Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AdunMolecularMechanicsForceField.h
1 /*
2  Project: Adun
3 
4  Copyright (C) 2007 Michael Johnston & Jordi Villą--Freixa
5 
6  Author: Michael Johnston
7 
8  This application is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This application is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU General Public
19  License along with this library; if not, write to the Free
20  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21 */
22 #ifndef ADUN_MMFORCEFIELD
23 #define ADUN_MMFORCEFIELD
24 
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <unistd.h>
28 #include <stdbool.h>
29 #include "Base/AdVector.h"
30 #include "Base/AdMatrix.h"
31 #include "Base/AdLinkedList.h"
32 #include "Base/AdForceFieldFunctions.h"
33 #include "AdunKernel/AdunForceField.h"
34 #include "AdunKernel/AdunNonbondedTerm.h"
35 #include "AdunKernel/AdunPureNonbondedTerm.h"
36 #include "AdunKernel/AdMatrixModification.h"
37 
38 //Define strings for energy units
44 extern NSString* KCalPerMol;
50 extern NSString* KJPerMol;
57 extern NSString* SimUnit;
58 
65 extern NSDictionary* conversionConstants;
66 
67 
79 - (NSArray*) potentials;
83 - (NSArray*) corePotentials;
87 - (double) valueForPotential: (NSString*) potential;
94 - (NSArray*) arrayOfValuesForPotentials: (NSArray*) array notFoundMarker: (id) anObject;
101 - (NSDictionary*) dictionaryOfValuesForPotentials: (NSArray*) array;
105 - (NSArray*) arrayOfCorePotentialValues;
110 - (NSDictionary*) dictionaryOfCorePotentialValues;
111 @end
112 
125 - (NSArray*) availableTerms;
132 - (NSArray*) coreTerms;
137 - (NSArray*) potentialsForTerm: (NSString*) aTerm;
142 - (NSArray*) potentialsForTerms: (NSArray*) array;
146 - (NSString*) termForPotential: (NSString*) aPotential;
147 
148 @end
149 
199 {
200  int no_of_atoms;
201  int updateInterval;
202  BOOL initialised;
203  BOOL harmonicBond;
204  BOOL harmonicAngle;
205  BOOL fourierTorsion;
206  BOOL improperTorsion;
207  BOOL nonbonded;
208  double bnd_pot;
209  double ang_pot;
210  double tor_pot;
211  double itor_pot;
212  double vdw_pot;
213  double est_pot;
214  double total_energy;
215  double cutoff;
216  double *reciprocalMasses;
217  AdMatrix *bonds;
218  AdMatrix *angles;
219  AdMatrix *torsions;
220  AdMatrix *improperTorsions;
221  AdMatrix* forceMatrix;
222  AdMatrix* accelerationMatrix;
223  NSLock *forcesLock;
224  NSLock *accelerationsLock;
225  AdListHandler* nonbondedHandler;
226  NSMutableDictionary* customTerms;
227  NSMutableArray* customTermNames;
228  NSMutableArray* availableTerms;
229  NSArray* coreTerms;
230  NSArray* corePotentials;
231  NSMutableDictionary* termPotentialMap;
232  NSMutableDictionary* state;
233  id system;
234  id nonbondedTerm;
235  id bondedInteractions;
236  id nonbondedInteractionTypes;
237  NSString* vdwInteractionType; //Identifies which vdw interaction is used.
238 
239 
240  AdMatrix* forceSaveMatrix;
241  AdMatrix* forceSaveTempMatrix;
242  AdMatrix* energySaveMatrix;
243  bool saveForces;
244  bool saveEnergies;
245  int saveAmount;
246  NSMutableArray* saveTerms;
247  int saveStep;
248 
249 }
261 - (id) initWithDictionary: (NSDictionary*) dictionary;
269 + (id) forceFieldForSystem: (AdSystem*) system;
273 - (id) init;
277 - (id) initWithSystem: (id) system;
281 - (id) initWithSystem: (id) system nonbondedTerm: (AdNonbondedTerm*) anObject;
297 - (id) initWithSystem: (id) system
298  nonbondedTerm: (AdNonbondedTerm*) anObject
299  customTerms: (NSDictionary*) aDict;
305 - (AdDataMatrix*) evaluateFiniteDifferenceForcesForTerm: (NSString*) aTerm;
309 - (void) evaluateFiniteDifferenceForces;
313 - (void) setSystem: (id) anObject;
320 - (void) setNonbondedTerm: (AdNonbondedTerm*) anObject;
324 - (AdNonbondedTerm*) nonbondedTerm;
328 - (NSString*) vdwInteractionType;
329 
330 @end
331 
335 @interface AdMolecularMechanicsForceField (PotentialMethods) <AdForceFieldPotentials>
336 @end
337 
342 @end
343 
348 @end
349 
353 @interface AdMolecularMechanicsForceField (CustomTerms) <AdForceFieldExtension>
354 @end
355 
356 @interface AdMolecularMechanicsForceField (DeprecatedMethods)
366 - (NSArray*) allTerms;
375 - (NSArray*) allEnergies;
376 
381 - (NSArray*) arrayOfEnergiesForTerms: (NSArray*) terms notFoundMarker: (id) anObject;
390 - (NSArray*) arrayOfCoreTermEnergies;
398 - (NSDictionary*) dictionaryOfCoreTermEnergies;
399 
400 
401 
402 @end
403 
404 
409 @interface AdMolecularMechanicsForceField (PrivateInternals)
413 - (void) _systemCleanUp;
417 - (void) _updateAccelerations;
423 - (void) _initialisationForSystem;
433 - (void) _handleSystemContentsChange: (NSNotification*) aNotification;
438 - (AdMatrix*) _internalDataStorageForGroups: (AdDataMatrix*) groups parameters: (AdDataMatrix*) parameters;
439 @end
440 
441 
442 @interface AdMolecularMechanicsForceField (CrashInformation)
446 - (void) logForceSaveMatrix: (NSString*) fileName;
450 - (void) _clearForceSaveMatrix;
454 - (void) _saveForcesForStep:(int) step forForce: (int) i;
458 - (bool) savesForces;
462 - (void) setOptions: (NSDictionary*) opt;
463 
464 
465 @end
466 
467 
468 
469 #endif