Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AdunSmoothedGBTerm.h
1 /*
2  Project: AdunKernel
3 
4  Copyright (C) 2008 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 ADSMOOTHED_GBTERM
23 #define ADSMOOTHED_GBTERM
24 
25 #include "Base/AdMatrix.h"
26 #include "Base/AdVector.h"
27 #include "Base/AdLinkedList.h"
28 #include "Base/AdGeneralizedBornFunctions.h"
29 #include "Base/AdVolumeFunctions.h"
30 #include "Base/AdQuadratureFunctions.h"
31 #include "AdunKernel/AdunMoleculeCavity.h"
32 #include "AdunKernel/AdunGrid.h"
33 #include "AdunKernel/AdForceFieldTerm.h"
35 #include "AdunKernel/AdunNonbondedTerm.h"
36 #include "AdunKernel/AdunSystem.h"
37 #include "AdunKernel/AdunDataMatrix.h"
38 #include "AdunKernel/AdunNonbondedTerm.h"
39 #include "AdunKernel/AdunMemoryManager.h"
40 #include "AdunKernel/AdunListHandler.h"
41 #include "AdunKernel/AdunCellListHandler.h"
42 #include "AdunKernel/AdunCuboidBox.h"
43 #include "AdunKernel/AdunThreadManager.h"
44 
58 @interface AdSmoothedGBTerm: NSObject
59 - (id) initWithSystem: (id) aSystem
60  nonbondedTerm: (id) aTerm
61  smoothingLength: (double) length
62  solventPermittivity: (double) epsilonSol
63  tensionCoefficient: (double) gamma
64  updateInterval: (unsigned int) interval;
65 @end
66 
76 @interface AdSmoothedGBTermSerial: NSObject
77 {
80  double coefficentOne;
81  double coefficentTwo;
82  double smoothingLength;
84  double solventPermittivity;
85  double solutePermittivity;
86  double tensionCoefficient;
87  double cutBuffer;
88  double meshSize;
89  double cutoff;
91  id system;
92  AdMemoryManager* memoryManager;
93 
94  //Energy and force variables
98  double totalSasa;
100 
101  //Born Radius
102  int radialEnd;
103  double* charges;
104  double* pbRadii;
105  double* bornRadii;
106  double* atomSasas;
108 
109  //Born Radius Derivatives
110  //Do not access outside of relevant methods
112 
113  //SoluteGrid
114  //The grid cutoff point is the distance from each atom at which there are
115  //no more grid points and hence no more atoms - there is no need to integrate beyond this point
121  uint_fast8_t *overlapBuffer;
122  int (*getIndex)(id,SEL,Vector3D*);
123  SEL gridSelector;
124  NSZone* lookupZone;
125 
126  //Integration Points
127  int numberRadialPoints;
128  int numberAngularPoints;
129  AdMatrix* radialInfo; //The radial distances of each integration ''shell'' and the integration weight
130  AdMatrix* angularInfo; //The angles of the points in each shell and their integration weights
132 
133  //Precomputed Constants
136  float tau;
137  float piFactor;
138 }
143 - (id) initWithDictionary: (NSDictionary*) dict;
153 - (id) initWithSystem: (id) system
154  nonbondedTerm: (id) term
155  smoothingLength: (double) length
156  solventPermittivity: (double) epsilonSol
157  tensionCoefficient: (double) gamma
158  updateInterval: (unsigned int) interval;
164 - (void) calculateBornRadii;
171 - (void) setAutoUpdateBornRadii: (BOOL) value;
176 - (BOOL) autoUpdateBornRadii;
180 - (double) screeningEnergy;
184 - (double) selfEnergy;
193 - (AdDataMatrix*) selfEnergyData;
197 - (double) nonPolarEnergy;
202 - (void) setSolventPermittivity: (double) value;
207 - (void) setSolutePermittivity: (double) value;
211 - (double) solutePermittivity;
215 - (double) solventPermittivity;
216 
217 @end
218 
219 @interface AdSmoothedGBTermSerial (AdForceFieldTermMethods) <AdForceFieldTerm>
220 @end
221 
222 /*
223  * Categories
224  */
225 
229 @interface AdSmoothedGBTermSerial (IntegrationMethods)
230 - (void) _initIntegrationVariables;
231 - (void) _cleanUpIntegrationVariables;
232 @end
233 
237 @interface AdSmoothedGBTermSerial (LookupTableMethods)
241 - (BOOL) _createLookupTable;
242 - (void) _createGrid;
243 - (void) _initLookupTableVariables;
244 - (void) updateLookupTable;
245 - (void) _cleanUpLookupTableVariables;
246 - (void) _freeNeighbourTable;
247 @end
248 
253 @interface AdSmoothedGBTermSerial (BornRadiusMethods)
254 - (void) _initBornRadiiVariables;
255 - (void) _cleanUpBornRadiiVariables;
256 - (void) _calculateBornRadiusAndCFATermsForAtom: (int) atomIndex;
257 - (void) _calculateBornRadiiAndCFATermsForAtomsInRange: (NSRange) range;
258 - (void) _calculateBornRadiiAndCFATerms;
259 @end
260 
267 @interface AdSmoothedGBTermSerial (BornNonPolarMethods)
268 - (double) _calculateSASAForAtom: (int) atomIndex;
269 - (void) _calculateSASAForAtomsInRange: (NSRange) range;
270 - (void) _calculateSASA;
271 @end
272 
277 @interface AdSmoothedGBTermSerial (BornRadiusDerivative)
316  - (BOOL) _calculateDerivativesOfBornRadiusOfAtom:(int) mainAtom
317  contributingAtoms: (NSMutableIndexSet*) indexSet
318  radiusGradients: (AdMatrix*) radiusGradients;
324 @end
325 
326 //Contains optimised atomic radii from Nina et al.
327 extern NSDictionary* generalizedBornRadiiDict;
328 
336 {
337  //Thread variables
338  ListElement** listPositions;
339  AdThreadManager* threadManager;
340  NSLock* threadLock;
341  NSMutableIndexSet* atomQueue;
342  NSMutableArray* threadForces;
343  NSMutableArray* threadRanges;
344  NSMutableArray* energyInvocations;
345  NSMutableArray* pairForceInvocations;
346  NSMutableArray* selfForceInvocations;
347  NSMutableArray* sasaInvocations;
348  NSMutableArray* bornRadiiInvocations;
353 }
354 - (void) _threadedEnergyEvaluation: (unsigned int) threadNumber;
355 - (void) _threadedPairForceEvaluation: (unsigned int) threadNumber;
356 - (void) _threadedSelfForceEvaluation: (unsigned int) threadNumber;
357 - (void) _threadedBornRadiiCalculation: (unsigned int) threadNumber;
358 - (void) _threadedSASACalculation: (unsigned int) threadNumber;
359 @end
360 
361 #endif
362