NAMD
Molecule.h
Go to the documentation of this file.
1 
7 /*
8  This class is used to store all of the structural
9  information for a simulation. It reads in this information
10  from a .psf file, cross checks and obtains some information
11  from the Parameters object that is passed in, and then
12  stores all this information for later use.
13 */
14 
15 
16 #ifndef MOLECULE_H
17 
18 #define MOLECULE_H
19 
20 #include "parm.h"
21 #include "ReadAmberParm.h"
22 
23 #include "common.h"
24 #include "NamdTypes.h"
25 #include "structures.h"
26 #include "ConfigList.h"
27 #include "Vector.h"
28 #include "UniqueSet.h"
29 #include "Hydrogen.h"
30 #include "GromacsTopFile.h"
31 /* BEGIN gf */
32 #include "GridForceGrid.h"
33 #include "Tensor.h"
34 /* END gf */
35 
36 // Go -- JLai
37 #define MAX_GO_CHAINS 10
38 #define MAX_RESTRICTIONS 10
39 // End of Go
40 
41 #include "molfile_plugin.h"
42 
43 #include <vector>
44 
45 class SimParameters;
46 class Parameters;
47 class ConfigList;
48 class PDB;
49 class MIStream;
50 class MOStream;
51 
52 class ExclElem;
53 class BondElem;
54 class AngleElem;
55 class DihedralElem;
56 class ImproperElem;
57 class TholeElem; // Drude model
58 class AnisoElem; // Drude model
59 class CrosstermElem;
60 // JLai
61 class GromacsPairElem;
62 // End of JLai
63 class ResidueLookupElem;
64 
65 struct OutputAtomRecord;
66 
67 template<class Type> class ObjectArena;
68 
70 public:
72  char *flags;
73 
75  min=0;
76  max=-1;
77  flags = NULL;
78  }
79 private:
80  ExclusionCheck(const ExclusionCheck& chk){
81  }
82  ExclusionCheck &operator=(const ExclusionCheck& chk){
83  return *this;
84  }
85 };
86 #define EXCHCK_FULL 1
87 #define EXCHCK_MOD 2
88 
90 {
91 public:
92  char mySegid[11];
93  ResidueLookupElem *next; // stored as a linked list
94  int firstResid; // valid resid is >= firstResid
95  int lastResid; // valid resid is <= lastResid
96  ResizeArray<int> atomIndex; // 0-based index for first atom in residue
97 
98  ResidueLookupElem(void) { next = 0; firstResid = -1; lastResid = -1; }
99  ~ResidueLookupElem(void) { delete next; }
100  int lookup(const char *segid, int resid, int *begin, int *end) const;
101  ResidueLookupElem* append(const char *segid, int resid, int aid);
102 };
103 
104 // Ported by JLai -- JE
105 typedef struct go_val
106 {
107  Real epsilon; // Epsilon
108  int exp_a; // First exponent for attractive L-J term
109  int exp_b; // Second exponent for attractive L-J term
110  int exp_rep; // Exponent for repulsive L-J term
111  Real sigmaRep; // Sigma for repulsive term
112  Real epsilonRep; // Epsilon for replusive term
113  Real cutoff; // Cutoff distance for Go calculation
114  int restrictions[MAX_RESTRICTIONS]; // List of residue ID differences to be excluded from Go calculation
115 } GoValue;
116 
117 typedef struct go_pair
118 {
119  int goIndxA; // indexA
120  int goIndxB; // indexB
121  double A; // double A for the LJ pair
122  double B; // double B for the LJ pair
123 } GoPair;
124 // End of port - JL
125 
126 #define QMLSSMODEDIST 1
127 #define QMLSSMODECOM 2
128 
129 #define QMFormatORCA 1
130 #define QMFormatMOPAC 2
131 #define QMFormatUSR 3
132 
133 #define QMCHRGNONE 0
134 #define QMCHRGMULLIKEN 1
135 #define QMCHRGCHELPG 2
136 
137 #define QMSCHEMECS 1
138 #define QMSCHEMERCD 2
139 #define QMSCHEMEZ1 3
140 #define QMSCHEMEZ2 4
141 #define QMSCHEMEZ3 5
142 
143 //only used for compressing the molecule information
144 typedef struct seg_resid
145 {
146  char segname[11];
147  int resid;
149 
150 // List maintaining the global atom indicies sorted by helix groups.
151 class Molecule
152 {
153  private:
154 typedef struct constraint_params
155 {
156  Real k; // Force constant
157  Vector refPos; // Reference position for restraint
158 } ConstraintParams;
159 
160 
161 
162 /* BEGIN gf */
163 typedef struct gridfrc_params
164 {
165  Real k; // force multiplier
166  Charge q; // charge
167 } GridforceParams;
168 /* END gf */
169 
170 
171 typedef struct stir_params
172 {
173  Real startTheta;
174  Vector refPos; // Reference position for stirring
175 } StirParams;
176 
177 typedef struct movdrag_params
178 {
179  Vector v; // Linear velocity (A/step)
180 } MovDragParams;
181 
182 
183 typedef struct rotdrag_params
184 {
185  Real v; // Angular velocity (deg/step)
186  Vector a; // Rotation axis
187  Vector p; // Rotation pivot point
188 } RotDragParams;
189 
190 typedef struct constorque_params
191 {
192  Real v; // "Torque" value (Kcal/(mol*A^2))
193  Vector a; // Rotation axis
194  Vector p; // Rotation pivot point
195 } ConsTorqueParams;
196 
197 #ifdef MEM_OPT_VERSION
198 //indicate a range of atoms from aid1 to aid2
199 struct AtomSet{
200  AtomID aid1;
201  AtomID aid2;
202 
203  int operator < (const AtomSet &a) const{
204  return aid1 < a.aid1;
205  }
206 };
207 typedef ResizeArray<AtomSet> AtomSetList;
208 
209  void load_atom_set(StringList *setfile, const char *setname,
210  int *numAtomsInSet, Molecule::AtomSetList **atomsSet) const;
211 
212 #endif
213 
214 friend class ExclElem;
215 friend class BondElem;
216 friend class AngleElem;
217 friend class DihedralElem;
218 friend class ImproperElem;
219 friend class TholeElem; // Drude model
220 friend class AnisoElem; // Drude model
221 friend class CrosstermElem;
222 // JLai
223 friend class GromacsPairElem;
224 // End of JLai
225 friend class WorkDistrib;
226 
227 private:
228 
229 #ifndef MEM_OPT_VERSION
230  Atom *atoms; // Array of atom structures
231  ObjectArena<char> *nameArena;
232  AtomNameInfo *atomNames;// Array of atom name info. Only maintained on node 0 for VMD interface
233  //replaced by atom signatures
234  Bond *bonds; // Array of bond structures
235  Angle *angles; // Array of angle structures
236  Dihedral *dihedrals; // Array of dihedral structures
237  Improper *impropers; // Array of improper structures
238  Crossterm *crossterms; // Array of cross-term structures
239  GromacsPair *gromacsPair; // Array of gromacs-pair structures
240 
241  //These will be replaced by exclusion signatures
242  Exclusion *exclusions; // Array of exclusion structures
243  UniqueSet<Exclusion> exclusionSet; // Used for building
244 
245  int32 *cluster; // first atom of connected cluster
246 
247  ObjectArena<int32> *tmpArena;
248  int32 **bondsWithAtom; // List of bonds involving each atom
249  ObjectArena<int32> *arena;
250 
251  //function is replaced by atom signatures
252  int32 **bondsByAtom; // List of bonds owned by each atom
253  int32 **anglesByAtom; // List of angles owned by each atom
254  int32 **dihedralsByAtom; // List of dihedrals owned by each atom
255  int32 **impropersByAtom; // List of impropers owned by each atom
256  int32 **crosstermsByAtom; // List of crossterms owned by each atom
257 
258  int32 **exclusionsByAtom; // List of exclusions owned by each atom
259  int32 **fullExclusionsByAtom; // List of atoms excluded for each atom
260  int32 **modExclusionsByAtom; // List of atoms modified for each atom
261 // JLai
262  int32 **gromacsPairByAtom; // gromacsPair exclusion list which by definition should not have any exclusions (still not sure if it should be empty or zeroed out)
263 // End of JLai
264 
265  ObjectArena<char> *exclArena;
266  ExclusionCheck *all_exclusions;
267 
268  // DRUDE
269  int32 **tholesByAtom; // list of Thole correction terms owned by each atom
270  int32 **anisosByAtom; // list of anisotropic terms owned by each atom
271  // DRUDE
272 
273 #else
274  //Indexing to constant pools to save space
276  Index *eachAtomMass; //after initialization, this could be freed (possibly)
277  Index *eachAtomCharge; //after initialization, this could be freed (possibly)
278  AtomNameIdx *atomNames;
279  ObjectArena<char> *nameArena; //the space for names to be allocated
280 
281  //A generally true assumption: all atoms are arranged in the order of clusters. In other words,
282  //all atoms for a cluster must appear before/after any atoms in other clusters
283  //The first atom in the cluster (which has the lowest atom id) stores the cluster size
284  //other atoms in the cluster stores -1
285  int32 *clusterSigs;
286  int32 numClusters;
287 
288  AtomSigID *eachAtomSig;
289  ExclSigID *eachAtomExclSig;
290 
291  AtomSetList *fixedAtomsSet;
292  AtomSetList *constrainedAtomsSet;
293 #endif
294 
295  ResidueLookupElem *resLookup; // find residues by name
296 
297  AtomSegResInfo *atomSegResids; //only used for generating compressed molecule info
298 
299  Bond *donors; // Array of hydrogen bond donor structures
300  Bond *acceptors; // Array of hydrogen bond acceptor
301 
302  // DRUDE
303  DrudeConst *drudeConsts; // supplement Atom data (length of Atom array)
304  Thole *tholes; // Thole (screened Coulomb) interactions
305  Aniso *anisos; // anisotropic terms
306  Lphost *lphosts; // lone pair hosts
307  int32 *lphostIndexes; // index for each LP into lphosts array
308  // DRUDE
309 
310  int32 *consIndexes; // Constraint indexes for each atom
311  ConstraintParams *consParams;
312 
313 /* BEGIN gf */
314  int32 **gridfrcIndexes;
315  GridforceParams **gridfrcParams;
316  GridforceGrid **gridfrcGrid;
317 /* END gf */
318 
319  // Parameters for each atom constrained
320  int32 *stirIndexes; //Stirring indexes for each atoms
321  StirParams *stirParams;
322  // Paramters for each atoms stirred
323  int32 *movDragIndexes; // Moving drag indexes for each atom
324  MovDragParams *movDragParams;
325  // Parameters for each atom moving-dragged
326  int32 *rotDragIndexes; // Rotating drag indexes for each atom
327  RotDragParams *rotDragParams;
328  // Parameters for each atom rotation-dragged
329 
330  Real *langevinParams; // b values for langevin dynamics
331  int32 *fixedAtomFlags; // 1 for fixed, -1 for fixed group, else 0
332  int32 *exPressureAtomFlags; // 1 for excluded, -1 for excluded group.
333 
334  //In the memory optimized version: it will be NULL if the general
335  //true assumption mentioned above holds. If not, its size is numClusters.
336  //In the ordinary version: its size is numAtoms, and indicates the size
337  //of connected cluster or 0.
338  int32 *clusterSize;
339 
340  Real *rigidBondLengths; // if H, length to parent or 0. or
341  // if not H, length between children or 0.
342 //fepb
343  unsigned char *fepAtomFlags;
344 //fepe
345 
346 //soluteScaling
347  unsigned char *ssAtomFlags;
348  unsigned int num_ss;
349 //soluteScaling
350 
351  //occupancy and bfactor data from plugin-based IO implementation of loading structures
352  float *occupancy;
353  float *bfactor;
354 
355 
356  // added during the trasition from 1x to 2
358  Parameters *params;
359 
360 private:
361  void initialize(SimParameters *, Parameters *param);
362  // Sets most data to zero
363 
364  //LCPO
365  int *lcpoParamType;
366 
367 #ifndef MEM_OPT_VERSION
368  void read_psf_file(char *, Parameters *);
369  // Read in a .psf file given
370  // the filename and the parameter
371  // object to use
372 
373  void read_atoms(FILE *, Parameters *);
374  // Read in atom info from .psf
375  void read_bonds(FILE *);
376  // Read in bond info from .psf
377  void process_bonds(Parameters *);
378  // Remove fake bonds after read_lphosts() to deal with TIP4 water
379  void read_angles(FILE *, Parameters *);
380  // Read in angle info from .psf
381  void read_dihedrals(FILE *, Parameters *);
382  // Read in dihedral info from .psf
383  void read_impropers(FILE *, Parameters *);
384  // Read in improper info from .psf
385  void read_crossterms(FILE *, Parameters *);
386  // Read in cross-term info from .psf
387  void read_donors(FILE *);
388  // Read in hydrogen bond donors from .psf
389  void read_acceptors(FILE *);
390  // Read in hydrogen bond acceptors from .psf
391  void read_exclusions(FILE *);
392  // Read in exclusion info from .psf
393  // JLai August 16th, 2012 Modifications
394  void read_exclusions(int*, int*, int);
395  /* Read in exclusion array and sort entries */
396  static bool goPairCompare (GoPair, GoPair);
397  // End of JLai August 16th, 2012 Modifications
398 
399 
400  // DRUDE: PSF reading
401  void read_lphosts(FILE *);
402  // Read in lone pair hosts from Drude PSF
403  void read_anisos(FILE *);
404  // Read in anisotropic terms from Drude PSF
405  // DRUDE
406 
407  //LCPO
408  //input type is Charmm/Amber/other
409  //0 - Charmm/Xplor
410  //1 - Amber TODO
411  //2 - Plugin TODO
412  //3 - Gromacs TODO
413  void assignLCPOTypes(int inputType);
414 
415  //pluginIO-based loading atoms' structure
416  void plgLoadAtomBasics(molfile_atom_t *atomarray);
417  void plgLoadBonds(int *from, int *to); //atom index is 1-based in the parameters
418  void plgLoadAngles(int *plgAngles);
419  void plgLoadDihedrals(int *plgDihedrals);
420  void plgLoadImpropers(int *plgImpropers);
421  void plgLoadCrossterms(int *plgCterms);
422 
423  // List of all exclusions, including
424  // explicit exclusions and those calculated
425  // from the bonded structure based on the
426  // exclusion policy. Also includes 1-4's.
427  void build_lists_by_atom();
428  // Build the list of structures by atom
429 
430  void build12excl(void);
431  void build13excl(void);
432  void build14excl(int);
433 
434  // DRUDE: extend exclusions for Drude and LP
435  void build_inherited_excl(int);
436  // DRUDE
437  void stripFepExcl(void);
438 
439  void build_exclusions();
440  // analyze the atoms, and determine which are oxygen, hb donors, etc.
441  // this is called after a molecule is sent our (or received in)
442  void build_atom_status(void);
443 
444 #else
445  //the method to load the signatures of atoms etc. (i.e. reading the file in
446  //text fomrat of the compressed psf file)
447  void read_mol_signatures(char *fname, Parameters *params, ConfigList *cfgList=0);
448  void load_one_inputatom(int aid, OutputAtomRecord *one, InputAtom *fAtom);
449  void build_excl_check_signatures();
450 #endif
451 
452  void read_parm(const GromacsTopFile *);
453 
454 public:
455 
456  // for solute scaling
459  int *ss_index;
460 
461  // DRUDE
462  int is_drude_psf; // flag for reading Drude PSF
463  int is_lonepairs_psf; // flag for reading lone pairs from PSF
464  // DRUDE
465 
466  // data for TIP4P
469 
470  // data for tail corrections
475  void compute_LJcorrection();
476  BigReal getEnergyTailCorr(const BigReal, const int);
478 
479  int const * getLcpoParamType() {
480  return lcpoParamType;
481  }
482 
483  BigReal GetAtomAlpha(int i) const {
484  return drudeConsts[i].alpha;
485  }
486 
487 #ifdef MEM_OPT_VERSION
488  AtomCstInfo *getAtoms() const { return atoms; }
489  AtomNameIdx *getAtomNames() const { return atomNames; }
490 #else
491  Atom *getAtoms () const { return atoms; }
492  AtomNameInfo *getAtomNames() const { return atomNames; }
493 #endif
494 
495  AtomSegResInfo *getAtomSegResInfo() const { return atomSegResids; }
496 
497  // return number of fixed atoms, guarded by SimParameters
498  int num_fixed_atoms() const {
499  // local variables prefixed by s_
500  int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
501  return s_NumFixedAtoms; // value is "turned on" SimParameters
502  }
503 
504  int num_fixed_groups() const {
505  // local variables prefixed by s_
506  int s_NumFixedAtoms = num_fixed_atoms();
507  int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
508  return s_NumFixedGroups; // value is "turned on" SimParameters
509  }
510 
511  int64_t num_group_deg_freedom() const {
512  // local variables prefixed by s_
513  int64_t s_NumGroupDegFreedom = 3 * (int64_t) numHydrogenGroups;
514  int64_t s_NumFixedAtoms = num_fixed_atoms();
515  int s_NumFixedGroups = num_fixed_groups();
516  if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
517  if ( ! (s_NumFixedAtoms || numConstraints
518  || simParams->comMove || simParams->langevinOn) ) {
519  s_NumGroupDegFreedom -= 3;
520  }
521  return s_NumGroupDegFreedom;
522  }
523 
524  int64_t num_deg_freedom(int isInitialReport = 0) const {
525  // local variables prefixed by s_
526  int64_t s_NumDegFreedom = 3 * (int64_t) numAtoms;
527  int64_t s_NumFixedAtoms = num_fixed_atoms();
528  if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
529  if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
530  if ( ! (s_NumFixedAtoms || numConstraints
531  || simParams->comMove || simParams->langevinOn) ) {
532  s_NumDegFreedom -= 3;
533  }
534  if ( ! isInitialReport && simParams->pairInteractionOn) {
535  //
536  // DJH: a kludge? We want to initially report system degrees of freedom
537  //
538  // this doesn't attempt to deal with fixed atoms or constraints
539  s_NumDegFreedom = 3 * numFepInitial;
540  }
541  int s_NumFixedRigidBonds =
542  (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
543  if (simParams->watmodel == WAT_TIP4) {
544  // numLonepairs is subtracted here because all lonepairs have a rigid bond
545  // to oxygen, but all of the LP degrees of freedom are dealt with above
546  s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
547  }
548  else {
549  // Non-polarized systems don't have LPs.
550  // For Drude model, bonds that attach LPs are not counted as rigid;
551  // LPs have already been subtracted from degrees of freedom.
552  s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds);
553  }
554  return s_NumDegFreedom;
555  }
556 
557  int numAtoms; // Number of atoms
558 
559  int numRealBonds; // Number of bonds for exclusion determination
560  int numBonds; // Number of bonds calculated, including extras
561  int numAngles; // Number of angles
562  int numDihedrals; // Number of dihedrals
563  int suspiciousAlchBonds; // angles dropped due to crossing FEP partitions
564  int alchDroppedAngles; // angles dropped due to crossing FEP partitions
565  int alchDroppedDihedrals; // dihedrals dropped due to crossing FEP partitions
566  int alchDroppedImpropers; // impropers dropped due to crossing FEP partitions
567  int numImpropers; // Number of impropers
568  int numCrossterms; // Number of cross-terms
569  int numDonors; // Number of hydrogen bond donors
570  int numAcceptors; // Number of hydrogen bond acceptors
571  int numExclusions; // Number of exclusions
572  int64 numTotalExclusions; // Real Total Number of Exclusions // hack
573  int num_alch_unpert_Bonds; // These are
574  int num_alch_unpert_Angles; // Shobana's
575  int num_alch_unpert_Dihedrals; // unperturbed bond
576  Bond *alch_unpert_bonds; // angle, dihedral
577  Angle *alch_unpert_angles; // terms to remove dummy
578  Dihedral *alch_unpert_dihedrals; //atom influence
579 
580  // DRUDE
583  int numTholes;
584  int numAnisos;
587  // DRUDE
588 
589  int numConstraints; // Number of atoms constrained
590 /* BEGIN gf */
591  int numGridforceGrids;// Number of gridforce grids
592  int *numGridforces; // Number of atoms in gridforce file (array, one per grid)
593 /* END gf */
594  int numMovDrag; // Number of atoms moving-dragged
595  int numRotDrag; // Number of atoms rotating-dragged
596  int numConsTorque; // Number of atoms "constant"-torqued
597  int numFixedAtoms; // Number of fixed atoms
598  int numStirredAtoms; // Number of stirred atoms
599  int numExPressureAtoms; // Number of atoms excluded from pressure
600  int numHydrogenGroups; // Number of hydrogen groups
601  int maxHydrogenGroupSize; // Max atoms per hydrogen group
602  int numMigrationGroups; // Number of migration groups
603  int maxMigrationGroupSize; // Max atoms per migration group
604  int numFixedGroups; // Number of totally fixed hydrogen groups
605  int numRigidBonds; // Number of rigid bonds
606  int numFixedRigidBonds; // Number of rigid bonds between fixed atoms
607 //fepb
608  int numFepInitial; // no. of fep atoms with initial flag
609  int numFepFinal; // no. of fep atoms with final flag
610 //fepe
611 
612  int numConsForce; // Number of atoms that have constant force applied
613  int32 *consForceIndexes;// Constant force indexes for each atom
614  Vector *consForce; // Constant force array
615 
616  int32 *consTorqueIndexes; // "Constant" torque indexes for each atom
617  ConsTorqueParams *consTorqueParams;
618  // Parameters for each atom "constant"-torqued
619 
620  // The following are needed for error checking because we
621  // eliminate bonds, etc. which involve only fixed atoms
622  int numCalcBonds; // Number of bonds requiring calculation
623  int numCalcAngles; // Number of angles requiring calculation
624  int numCalcDihedrals; // Number of dihedrals requiring calculation
625  int numCalcImpropers; // Number of impropers requiring calculation
626  int numCalcCrossterms; // Number of cross-terms requiring calculation
627  int64 numCalcExclusions; // Number of exclusions requiring calculation
628  int64 numCalcFullExclusions; // Number of full exclusions requiring calculation
629 
630  // DRUDE
631  int numCalcTholes; // Number of Thole correction terms requiring calculation
632  int numCalcAnisos; // Number of anisotropic terms requiring calculation
633  // DRUDE
634 
635  // Number of dihedrals with multiple periodicity
637  // Number of impropers with multiple periodicity
639  // indexes of "atoms" sorted by hydrogen groups
641 
642  // Ported by JLai -- JE - Go
643  int numGoAtoms; // Number of atoms subject to Go forces -- ported by JLai/ Original by JE
644  int32 *atomChainTypes; // Go chain type for each atom; from 1 to MAX_GO_CHAINS
645  int32 *goSigmaIndices; // Indices into goSigmas
646  int32 *goResidIndices; // Indices into goSigmas
647  Real *goSigmas; // Sigma values for Go forces L-J type formula
648  bool *goWithinCutoff; // Whether the reference atom-atom distance is within the Go cutoff
649  Real *goCoordinates; // Coordinates (x,y,z) for Go atoms in the native structure
650  int *goResids; // Residue ID from PDB
651  PDB *goPDB; // Pointer to PDB object to use
652  // NAMD-Go2 calculation code
653  int goNumLJPair; // Integer storing the total number of explicit pairs (LJ)
654  int *goIndxLJA; // Pointer to the array of atom indices for LJ atom A
655  int *goIndxLJB; // Pointer to the array of atom indices for LJ atom B
656  double *goSigmaPairA; // Pointer to the array of A LJ parameters
657  double *goSigmaPairB; // Pointer to the array of B LJ parameters
658  int *pointerToGoBeg; // Array of pointers to array
659  int *pointerToGoEnd; // Array of pointers to array
660  // Gromacs LJ Pair list calculation code
661  int numPair; // Integer storing the total number of explicit pairs (LJ + Gaussian)
662  int numLJPair; // Integer storing the number of explicit LJ pairs
663  int numCalcLJPair; // Number of explicit LJ pairs requiring calculation
664  int *pointerToLJBeg; // Array of pointers to array
665  int *pointerToLJEnd; // Array of pointers to array B
666  int *indxLJA; // Pointer to the array of atom indices for LJ atom A
667  int *indxLJB; // Pointer to the array of atom indices for LJ atom B
668  Real *pairC6; // Pointer to the array of C6 LJ parameters
669  Real *pairC12; // Pointer to the array of C12 LJ parameters
671  // Gromacs Gauss Pair list calculation code
672  int *pointerToGaussBeg; // Array of pointers to array B
673  int *pointerToGaussEnd; // Array of pointers to array B
674  int numGaussPair; // Integer storing the number of explicit Gaussian pairs
675  int *indxGaussA; // Pointer to the array of atom indices for Gaussian atom A
676  int *indxGaussB; // Pointer to the array of atom indices for Gaussian atom B
677  Real *gA; // Pointer to the array of force constants to the Gaussian potential
678  Real *gMu1; // Pointer to the array of mu (shifts Gaussian)
679  Real *giSigma1; // Pointer to the array of sigma (controls spread of Gaussian)
680  Real *gMu2; // Pointer to the array of mu (shifts Gaussian 2)
681  Real *giSigma2; // Pointer to the array of sigma (controls spread of Gaussian 2)
682  Real *gRepulsive; // Pointer to the a LJ-12 repulsive parameter that adds to the Gaussian
683 
684  // GO ENERGY CALCULATION CODE
685  BigReal energyNative; // Holds the energy value of the native structure
686  BigReal energyNonnative; // Holds the energy value of the nonnative structure
687  // GO ENERGY CALCULATION CODE
688  // End of port - JL
689 
690 
691 private:
693  // Begin QM
695 
696  int qmDroppedBonds, qmDroppedAngles, qmDroppedDihedrals;
697  int qmDroppedImpropers, qmDroppedCrossterms;
698  ResizeArray<Bond> qmExtraBonds;
699 
700  Bool qmReplaceAll; // Indicates if all forces should be replaced.
701  int qmNumQMAtoms; // Number of QM atoms, from all groups.
702 
703  // Array of abbreviated element names for all atoms.
704  char **qmElementArray;
705  // Array of elements for dummy atoms.
706  char **qmDummyElement;
707 
708  // Number of QM atoms in each QM group
709  int *qmGrpSizes;
710 
711  // QM group for each atom of the system. 0 means MM atom.
712  Real *qmAtomGroup;
713  // Number of different QM regions
714  int qmNumGrps ;
715 
716  // QM Atom charges.
717  Real *qmAtmChrg ;
718  // global indices of all QM atoms.
719  int *qmAtmIndx ;
720 
721  // Number of QM-MM bonds.
722  int qmNumBonds ;
723  // IDs of each group, that is, the value in the qmColumn, per group.
724  Real *qmGrpID ;
725  // The total charge of each QM group.
726  Real *qmGrpChrg;
727  // The multiplicity of QM groups
728  Real *qmGrpMult;
729  // Number of QM-MM bonds in each group.
730  int *qmGrpNumBonds ;
731  // Sequential list of bonds between a MM atom and a QM atom.
732  // (with the bonded atoms ins this order: MM first, QM second).
733  int **qmMMBond ;
734  // List of bond indexes for each QM group.
735  int **qmGrpBonds ;
736  // List of atom indexes for MM atoms in QM-MM bonds, per group.
737  // This is used to check if a point charge is actually an MM atom
738  // that need to be ignored, and will be substituted by a dummy atom (for example).
739  int **qmMMBondedIndx ;
740  // List of indices for MM atoms which will receive fractions of charges from
741  // the MM atom of a QM-MM bond. This is used in the Charge Shift scheme.
742  int **qmMMChargeTarget;
743  // Number of target MM atoms per QM-MM bond. Targets will receive the partial
744  // charge of the MM atom in a QM-MM bond. (in Charge shift scheme)
745  int *qmMMNumTargs;
746  // List of distances from thr QM atom where the dummy atom will be placed.
747  BigReal *qmDummyBondVal;
748  // Indicate if point charges will be used in QM calculations.
749  Bool qmNoPC;
750 
752  // These variables are used in case mechanichal embedding is requested (NoPC = TRUE)
753  // AND there are QM-MM bonds in the system.
754 
755  // Indicates the number of items in the arrays for Mechanical embedding with QM-MM bonds.
756  int qmMeNumBonds;
757  // Indicates the indices of MM atoms which participate in QM-MM bonds.
758  int *qmMeMMindx;
759  // Indicates the QM group to which the QM-MM bonds belongs.
760  Real *qmMeQMGrp;
762 
763  // Indicates frequency of selection of point charges.
764  int qmPCFreq;
765  // Custom PC array;
766  int *qmCustomPCIdxs;
767  // Number of Indexes associated with each QM Group.
768  int *qmCustPCSizes;
769  // Total number of custom PC charges.
770  int qmTotCustPCs;
771  // Number of solvent molecules that will be selected and updated by NAMD, per group.
772  int *qmLSSSize;
773  // Number of atoms per solvent molecule. We need all molecules to have the same size.
774  int qmLSSResidueSize;
775  // IDs of all atoms belonging to QM solvent molecules, from all groups.
776  int *qmLSSIdxs;
777  // MAss of each atom in LSS solvent molecules.
778  Mass *qmLSSMass;
779  // Atom IDs of QM atoms which will be used to select solvent molecules by distance.
780  int *qmLSSRefIDs;
781  // Mass of each QM atom used as reference for solvent selection.
782  Mass *qmLSSRefMass ;
783  // Number of atom IDs/Mass per group.
784  int *qmLSSRefSize;
785  int qmLSSFreq;
786  int qmLSSTotalNumAtms;
787  // This will map each classical solvent atom with a global index of solvent residues,
788  // so we don't depend on segment names and repeated residue indices.
789  std::map<int,int> qmClassicSolv ;
790 
792  // Conditional SMD
793 
794  void read_qm_csdm_file(std::map<Real,int> &qmGrpIDMap) ;
795 
796  Bool qmcSMD;
797  // Total number of cSMD instances.
798  int cSMDnumInst;
799  // Num instances per QM group
800  int* cSMDindxLen;
801  // Index of Conditional SMD guides per QM group
802  int** cSMDindex;
803  // Atom indices for Origin and Target of cSMD
804  int** cSMDpairs;
805  // Spring constants for cSMD
806  Real* cSMDKs;
807  // Speed of movement of guide particles for cSMD.
808  Real* cSMDVels;
809  // Distance cutoff for guide particles for cSMD.
810  Real* cSMDcoffs;
811 
813  // end QM
815 
816 public:
817  // QM
818  void set_qm_replaceAll(Bool newReplaceAll) { qmReplaceAll = newReplaceAll; } ;
819 
820  const Real * get_qmAtomGroup() const {return qmAtomGroup; } ;
821  Real get_qmAtomGroup(int indx) const {return qmAtomGroup[indx]; } ;
822 
823  Real *get_qmAtmChrg() {return qmAtmChrg; } ;
824  const int *get_qmAtmIndx() {return qmAtmIndx; } ;
825 
826  int get_numQMAtoms() {return qmNumQMAtoms; } ;
827  const char *const * get_qmElements() {return qmElementArray;} ;
828  int get_qmNumGrps() const {return qmNumGrps; } ;
829  const int * get_qmGrpSizes() {return qmGrpSizes; } ;
830  Real * get_qmGrpID() { return qmGrpID; } ;
831  Real *get_qmGrpChrg() {return qmGrpChrg; } ;
832  Real *get_qmGrpMult() {return qmGrpMult; } ;
833 
834  int get_qmNumBonds() { return qmNumBonds; } ;
835  const BigReal * get_qmDummyBondVal() { return qmDummyBondVal; } ;
836  const int * get_qmGrpNumBonds() { return qmGrpNumBonds; } ;
837  const int *const * get_qmMMBond() { return qmMMBond; } ;
838  const int *const * get_qmGrpBonds() { return qmGrpBonds; } ;
839  const int *const * get_qmMMBondedIndx() { return qmMMBondedIndx; } ;
840  const char *const * get_qmDummyElement() { return qmDummyElement; } ;
841 
842  const int *const * get_qmMMChargeTarget() { return qmMMChargeTarget; } ;
843  const int * get_qmMMNumTargs() { return qmMMNumTargs; } ;
844 
845  int* get_qmLSSSize() { return qmLSSSize;} ;
846  int* get_qmLSSIdxs() { return qmLSSIdxs;} ;
847  Mass *get_qmLSSMass() { return qmLSSMass; } ;
848  int get_qmLSSFreq() { return qmLSSFreq; } ;
849  int get_qmLSSResSize() { return qmLSSResidueSize; } ;
850  int *get_qmLSSRefIDs() { return qmLSSRefIDs ; } ;
851  int *get_qmLSSRefSize() { return qmLSSRefSize ; } ;
852  Mass *get_qmLSSRefMass() {return qmLSSRefMass; } ;
853  std::map<int,int> &get_qmMMSolv() { return qmClassicSolv;} ;
854 
855  Bool get_qmReplaceAll() {return qmReplaceAll; } ;
856 
857  Bool get_noPC() { return qmNoPC; } ;
858  int get_qmMeNumBonds() { return qmMeNumBonds; } ;
859  int *get_qmMeMMindx() { return qmMeMMindx; } ;
860  Real *get_qmMeQMGrp() { return qmMeQMGrp; } ;
861 
862  int get_qmPCFreq() { return qmPCFreq; } ;
863 
864  int get_qmTotCustPCs() { return qmTotCustPCs; } ;
865  int *get_qmCustPCSizes() { return qmCustPCSizes; } ;
866  int *get_qmCustomPCIdxs() { return qmCustomPCIdxs; } ;
867 
868  Bool get_qmcSMD() { return qmcSMD;} ;
869  int get_cSMDnumInst() { return cSMDnumInst;} ;
870  int const * get_cSMDindxLen() { return cSMDindxLen;} ;
871  int const * const * get_cSMDindex() {return cSMDindex;} ;
872  int const * const * get_cSMDpairs() {return cSMDpairs;} ;
873  const Real* get_cSMDKs() {return cSMDKs;} ;
874  const Real* get_cSMDVels() {return cSMDVels;} ;
875  const Real* get_cSMDcoffs() {return cSMDcoffs;} ;
876 
877  void prepare_qm(const char *pdbFileName, Parameters *params, ConfigList *cfgList) ;
878  void delete_qm_bonded() ;
879  // end QM
880 
881 
882 
883  Molecule(SimParameters *, Parameters *param);
884  Molecule(SimParameters *, Parameters *param, char *filename, ConfigList *cfgList=NULL);
885  Molecule(SimParameters *simParams, Parameters *param, molfile_plugin_t *pIOHdl, void *pIOFileHdl, int natoms);
886 
888  void read_parm(Ambertoppar *);
889 
891  void read_parm(AmberParm7Reader::Ambertoppar *);
892 
894 
895  ~Molecule(); // Destructor
896 
897  void send_Molecule(MOStream *);
898  // send the molecular structure
899  // from the master to the clients
900 
901  void receive_Molecule(MIStream *);
902  // receive the molecular structure
903  // from the master on a client
904 
906  PDB *, char *);
907  // Build the set of harmonic constraint
908  // parameters
909 
910 /* BEGIN gf */
912  // Build the set of gridForce-style force pars
913 /* END gf */
914 
916  PDB *, char *);
917  // Build the set of moving drag pars
918 
921  PDB *, char *);
922  // Build the set of rotating drag pars
923 
926  PDB *, char *);
927  // Build the set of "constant" torque pars
928 
929 
930  void build_constant_forces(char *);
931  // Build the set of constant forces
932 
933  void build_langevin_params(BigReal coupling, BigReal drudeCoupling,
934  Bool doHydrogen);
935  void build_langevin_params(StringList *, StringList *, PDB *, char *);
936  // Build the set of langevin dynamics parameters
937 
938 #ifdef MEM_OPT_VERSION
939  void load_fixed_atoms(StringList *fixedFile);
940  void load_constrained_atoms(StringList *constrainedFile);
941 #endif
942 
943  void build_fixed_atoms(StringList *, StringList *, PDB *, char *);
944  // Determine which atoms are fixed (if any)
945 
946  void build_stirred_atoms(StringList *, StringList *, PDB *, char *);
947  // Determine which atoms are stirred (if any)
948 
949  void build_extra_bonds(Parameters *parameters, StringList *file);
950 
951 //fepb
952  void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *);
953  // selection of the mutant atoms
954  void delete_alch_bonded(void);
955 
956  void build_alch_unpert_bond_lists(char *);
957  void read_alch_unpert_bonds(FILE *);
958  void read_alch_unpert_angles(FILE *);
959  void read_alch_unpert_dihedrals(FILE *);
960 //fepe
961 
971  void build_ss_flags(
972  const StringList *ssfile,
974  const StringList *sscol,
976  PDB *initial_pdb,
977  const char *cwd
978  );
979 
980  void build_exPressure_atoms(StringList *, StringList *, PDB *, char *);
981  // Determine which atoms are excluded from
982  // pressure (if any)
983 
984  // Ported by JLai -- Original JE - Go -- Change the unsigned int to ints
985  void print_go_sigmas(); // Print out Go sigma parameters
986  void build_go_sigmas(StringList *, char *);
987  // Determine which atoms have Go forces applied
988  // calculate sigmas from distances between Go atom pairs
989  void build_go_sigmas2(StringList *, char *);
990  // Determine which atoms have Go forces applied
991  // calculate sigmas from distances between Go atom pairs
992  void build_go_arrays(StringList *, char *);
993  // Determine which atoms have Go forces applied
994  BigReal get_gro_force(BigReal, BigReal, BigReal, int, int) const;
995  BigReal get_gro_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const;
996  BigReal get_go_force(BigReal, int, int, BigReal *, BigReal *) const;
997  // Calculate the go force between a pair of atoms -- Modified to
998  // output Go energies
999  BigReal get_go_force_new(BigReal, int, int, BigReal *, BigReal *) const;
1000  // Calculate the go force between a pair of atoms
1001  BigReal get_go_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const;
1002  // Calculate the go force between a pair of atoms
1003  Bool atoms_1to4(unsigned int, unsigned int);
1004 // End of port -- JL
1005 
1006  void reloadCharges(float charge[], int n);
1007 
1008  Bool is_lp(int); // return true if atom is a lone pair
1009  Bool is_drude(int); // return true if atom is a Drude particle
1010  Bool is_hydrogen(int); // return true if atom is hydrogen
1011  Bool is_oxygen(int); // return true if atom is oxygen
1012  Bool is_hydrogenGroupParent(int); // return true if atom is group parent
1013  Bool is_water(int); // return true if atom is part of water
1014  int get_groupSize(int); // return # atoms in (hydrogen) group
1015  int get_mother_atom(int); // return mother atom of a hydrogen
1016 
1017  #ifdef MEM_OPT_VERSION
1018  //the way to get the cluster size if the atom ids of the cluster are
1019  //contiguous. The input parameter is the atom id that leads the cluster.
1020  int get_cluster_size_con(int aid) const { return clusterSigs[aid]; }
1021  //the way to get the cluster size if the atoms ids of the cluster are
1022  //not contiguous. The input parameter is the cluster index.
1023  int get_cluster_size_uncon(int cIdx) const { return clusterSize[cIdx]; }
1024  int get_cluster_idx(int aid) const { return clusterSigs[aid]; }
1025  int get_num_clusters() const { return numClusters; }
1026  #else
1027  int get_cluster(int anum) const { return cluster[anum]; }
1028  int get_clusterSize(int anum) const { return clusterSize[anum]; }
1029  #endif
1030 
1031 #ifndef MEM_OPT_VERSION
1032  const float *getOccupancyData() { return (const float *)occupancy; }
1033  void setOccupancyData(molfile_atom_t *atomarray);
1034  void freeOccupancyData() { delete [] occupancy; occupancy=NULL; }
1035 
1036  const float *getBFactorData() { return (const float *)bfactor; }
1037  void setBFactorData(molfile_atom_t *atomarray);
1038  void freeBFactorData() { delete [] bfactor; bfactor=NULL; }
1039 #endif
1040 
1041  // Get the mass of an atom
1042  Real atommass(int anum) const
1043  {
1044  #ifdef MEM_OPT_VERSION
1045  return atomMassPool[eachAtomMass[anum]];
1046  #else
1047  return(atoms[anum].mass);
1048  #endif
1049  }
1050 
1051  // Get the charge of an atom
1052  Real atomcharge(int anum) const
1053  {
1054  #ifdef MEM_OPT_VERSION
1055  return atomChargePool[eachAtomCharge[anum]];
1056  #else
1057  return(atoms[anum].charge);
1058  #endif
1059  }
1060 
1061  // Get the vdw type of an atom
1062  Index atomvdwtype(int anum) const
1063  {
1064  return(atoms[anum].vdw_type);
1065  }
1066 
1067  #ifndef MEM_OPT_VERSION
1068  // Retrieve a bond structure
1069  Bond *get_bond(int bnum) const {return (&(bonds[bnum]));}
1070 
1071  // Retrieve an angle structure
1072  Angle *get_angle(int anum) const {return (&(angles[anum]));}
1073 
1074  // Retrieve an improper strutcure
1075  Improper *get_improper(int inum) const {return (&(impropers[inum]));}
1076 
1077  // Retrieve a dihedral structure
1078  Dihedral *get_dihedral(int dnum) const {return (&(dihedrals[dnum]));}
1079 
1080  // Retrieve a cross-term strutcure
1081  Crossterm *get_crossterm(int inum) const {return (&(crossterms[inum]));}
1082  #endif
1083 
1084  // DRUDE: retrieve lphost structure
1085  Lphost *get_lphost(int atomid) const {
1086  // don't call unless simParams->drudeOn == TRUE
1087  // otherwise lphostIndexes array doesn't exist!
1088  int index = lphostIndexes[atomid];
1089  return (index != -1 ? &(lphosts[index]) : NULL);
1090  }
1091  // DRUDE
1092 
1093  #ifndef MEM_OPT_VERSION
1094  Bond *getAllBonds() const {return bonds;}
1095  Angle *getAllAngles() const {return angles;}
1096  Improper *getAllImpropers() const {return impropers;}
1097  Dihedral *getAllDihedrals() const {return dihedrals;}
1098  Crossterm *getAllCrossterms() const {return crossterms;}
1099  #endif
1100 
1101  // DRUDE: retrieve entire lphosts array
1102  Lphost *getAllLphosts() const { return lphosts; }
1103  // DRUDE
1104 
1105  // Retrieve a hydrogen bond donor structure
1106  Bond *get_donor(int dnum) const {return (&(donors[dnum]));}
1107 
1108  // Retrieve a hydrogen bond acceptor structure
1109  Bond *get_acceptor(int dnum) const {return (&(acceptors[dnum]));}
1110 
1111  Bond *getAllDonors() const {return donors;}
1112  Bond *getAllAcceptors() const {return acceptors;}
1113 
1114  // Retrieve an exclusion structure
1115  #ifndef MEM_OPT_VERSION
1116  Exclusion *get_exclusion(int ex) const {return (&(exclusions[ex]));}
1117  #endif
1118 
1119  // Retrieve an atom type
1120  const char *get_atomtype(int anum) const
1121  {
1122  if (atomNames == NULL)
1123  {
1124  NAMD_die("Tried to find atom type on node other than node 0");
1125  }
1126 
1127  #ifdef MEM_OPT_VERSION
1128  return atomTypePool[atomNames[anum].atomtypeIdx];
1129  #else
1130  return(atomNames[anum].atomtype);
1131  #endif
1132  }
1133 
1134  // Lookup atom id from segment, residue, and name
1135  int get_atom_from_name(const char *segid, int resid, const char *aname) const;
1136 
1137  // Lookup number of atoms in residue from segment and residue
1138  int get_residue_size(const char *segid, int resid) const;
1139 
1140  // Lookup atom id from segment, residue, and index in residue
1141  int get_atom_from_index_in_residue(const char *segid, int resid, int index) const;
1142 
1143 
1144  // The following routines are used to get the list of bonds
1145  // for a given atom. This is used when creating the bond lists
1146  // for the force objects
1147 
1148  #ifndef MEM_OPT_VERSION
1150  { return bondsByAtom[anum]; }
1152  { return anglesByAtom[anum]; }
1154  { return dihedralsByAtom[anum]; }
1156  { return impropersByAtom[anum]; }
1158  { return crosstermsByAtom[anum]; }
1160  { return exclusionsByAtom[anum]; }
1161  const int32 *get_full_exclusions_for_atom(int anum) const
1162  { return fullExclusionsByAtom[anum]; }
1163  const int32 *get_mod_exclusions_for_atom(int anum) const
1164  { return modExclusionsByAtom[anum]; }
1165  #endif
1166 
1167  // Check for exclusions, either explicit or bonded.
1168  // Returns 1 for full, 2 for 1-4 exclusions.
1169  #ifdef MEM_OPT_VERSION
1170  int checkExclByIdx(int idx1, int atom1, int atom2) const;
1171  const ExclusionCheck *get_excl_check_for_idx(int idx) const{
1172  return &exclChkSigPool[idx];
1173  }
1174  #else
1175  int checkexcl(int atom1, int atom2) const;
1176 
1177  const ExclusionCheck *get_excl_check_for_atom(int anum) const{
1178  return &all_exclusions[anum];
1179  }
1180  #endif
1181 
1182 /* BEGIN gf */
1183  // Return true or false based on whether or not the atom
1184  // is subject to grid force
1185  Bool is_atom_gridforced(int atomnum, int gridnum) const
1186  {
1187  if (numGridforceGrids)
1188  {
1189  return(gridfrcIndexes[gridnum][atomnum] != -1);
1190  }
1191  else
1192  {
1193  return(FALSE);
1194  }
1195  }
1196 /* END gf */
1197 
1198 #ifndef MEM_OPT_VERSION
1199  // Return true or false based on whether the specified atom
1200  // is constrained or not.
1201  Bool is_atom_constrained(int atomnum) const
1202  {
1203  if (numConstraints)
1204  {
1205  // Check the index to see if it is constrained
1206  return(consIndexes[atomnum] != -1);
1207  }
1208  else
1209  {
1210  // No constraints at all, so just return FALSE
1211  return(FALSE);
1212  }
1213  }
1214 #endif
1215 
1216  // Return true or false based on whether the specified atom
1217  // is moving-dragged or not.
1218  Bool is_atom_movdragged(int atomnum) const
1219  {
1220  if (numMovDrag)
1221  {
1222  // Check the index to see if it is constrained
1223  return(movDragIndexes[atomnum] != -1);
1224  }
1225  else
1226  {
1227  // No constraints at all, so just return FALSE
1228  return(FALSE);
1229  }
1230  }
1231 
1232  // Return true or false based on whether the specified atom
1233  // is rotating-dragged or not.
1234  Bool is_atom_rotdragged(int atomnum) const
1235  {
1236  if (numRotDrag)
1237  {
1238  // Check the index to see if it is constrained
1239  return(rotDragIndexes[atomnum] != -1);
1240  }
1241  else
1242  {
1243  // No constraints at all, so just return FALSE
1244  return(FALSE);
1245  }
1246  }
1247 
1248  // Return true or false based on whether the specified atom
1249  // is "constant"-torqued or not.
1250  Bool is_atom_constorqued(int atomnum) const
1251  {
1252  if (numConsTorque)
1253  {
1254  // Check the index to see if it is constrained
1255  return(consTorqueIndexes[atomnum] != -1);
1256  }
1257  else
1258  {
1259  // No constraints at all, so just return FALSE
1260  return(FALSE);
1261  }
1262  }
1263 
1264 #ifndef MEM_OPT_VERSION
1265  // Get the harmonic constraints for a specific atom
1266  void get_cons_params(Real &k, Vector &refPos, int atomnum) const
1267  {
1268  k = consParams[consIndexes[atomnum]].k;
1269  refPos = consParams[consIndexes[atomnum]].refPos;
1270  }
1271 #endif
1272 
1273 /* BEGIN gf */
1274  void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
1275  {
1276  k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
1277  q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
1278  }
1279 
1280  GridforceGrid* get_gridfrc_grid(int gridnum) const
1281  {
1282  GridforceGrid *result = NULL;
1283  if (gridnum >= 0 && gridnum < numGridforceGrids) {
1284  result = gridfrcGrid[gridnum];
1285  }
1286  return result;
1287  }
1288 
1289  int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
1290  {
1291  if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
1292  gridfrcGrid[gridnum] = grid;
1293  return 0;
1294  } else {
1295  return -1;
1296  }
1297  }
1298 /* END gf */
1299 
1300  Real langevin_param(int atomnum) const
1301  {
1302  return(langevinParams ? langevinParams[atomnum] : 0.);
1303  }
1304 
1305  // Get the stirring constraints for a specific atom
1306  void get_stir_refPos(Vector &refPos, int atomnum) const
1307  {
1308  refPos = stirParams[stirIndexes[atomnum]].refPos;
1309  }
1310 
1311 
1312  void put_stir_startTheta(Real theta, int atomnum) const
1313  {
1314  stirParams[stirIndexes[atomnum]].startTheta = theta;
1315  }
1316 
1317 
1318  Real get_stir_startTheta(int atomnum) const
1319  {
1320  return stirParams[stirIndexes[atomnum]].startTheta;
1321  }
1322 
1323 
1324  // Get the moving drag factor for a specific atom
1325  void get_movdrag_params(Vector &v, int atomnum) const
1326  {
1327  v = movDragParams[movDragIndexes[atomnum]].v;
1328  }
1329 
1330  // Get the rotating drag pars for a specific atom
1332  int atomnum) const
1333  {
1334  v = rotDragParams[rotDragIndexes[atomnum]].v;
1335  a = rotDragParams[rotDragIndexes[atomnum]].a;
1336  p = rotDragParams[rotDragIndexes[atomnum]].p;
1337  }
1338 
1339  // Get the "constant" torque pars for a specific atom
1341  int atomnum) const
1342  {
1343  v = consTorqueParams[consTorqueIndexes[atomnum]].v;
1344  a = consTorqueParams[consTorqueIndexes[atomnum]].a;
1345  p = consTorqueParams[consTorqueIndexes[atomnum]].p;
1346  }
1347 
1348 //fepb
1349  unsigned char get_fep_type(int anum) const
1350  {
1351  return(fepAtomFlags[anum]);
1352  }
1353 
1354 //soluteScaling
1355  unsigned char get_ss_type(int anum) const
1356  {
1357  return(ssAtomFlags[anum]);
1358  }
1359 //soluteScaling
1360 
1361  /* BKR - Get the FEP type (i.e. 0, 1, or 2) of a bonded _interaction_ based
1362  on the atom indices of the atoms involved (internally converted to FEP
1363  types) and the order of the bonded interaction (i.e. 2, 3, or 4). This
1364  automatically accounts for whether or not purely alchemical interactions
1365  are being scaled (e.g. bonds between two atoms of fep_type 1).
1366 
1367  The logic here is admittedly a bit opaque. When the fep_type's are back
1368  mapped to -1,0,1, we can use the sum of all of the types to determine the
1369  type of interaction for all bonded term types:
1370 
1371  0 - only non-alchemical atoms involved
1372  >0 - _atleast_ one appearing atom
1373  <0 - _atleast_ one disappearing atom
1374 
1375  If the magnitude of the sum is equal to the interaction order (i.e. 2, 3,
1376  or 4), then it is a _purely_ alchemical interaction and it may be
1377  desireable to retain it for sampling purposes (note that this adds a
1378  constant to the free energy that will almost always differ at the
1379  endpoints). In order to avoid unexpected instability these interactions
1380  are retained by default, but can be scaled along with everything else by
1381  setting "alchBondDecouple on".
1382 
1383  NB: All pure alchemical interactions beyond order 2 are ALWAYS discarded
1384  by alchemify. This is good, because higher order interactions would break
1385  the above logic. For example, if we had an angle term between atoms of
1386  types (1,1,-1) the sum would be 1, but this term should receive no scaling
1387  because it involves groups -1 and 1 but not 0.
1388  */
1389  int get_fep_bonded_type(const int *atomID, unsigned int order) const
1390  {
1391  int typeSum = 0;
1392  for ( int i=0; i < order; ++i ) {
1393  typeSum += (fepAtomFlags[atomID[i]] == 2 ? -1 : fepAtomFlags[atomID[i]]);
1394  }
1395  // Increase the cutoff if scaling purely alchemical bonds.
1396  // This really only applies when order = 2.
1397  if ( simParams->alchBondDecouple ) order++;
1398 
1399  // The majority of interactions are type 0, so catch those first.
1400  if ( typeSum == 0 || abs(typeSum) == order ) return 0;
1401  else if ( 0 < typeSum && typeSum < order ) return 1;
1402  else if ( -order < typeSum && typeSum < 0 ) return 2;
1403 
1404  // Alchemify should always keep this from bombing, but just in case...
1405  NAMD_die("Unexpected alchemical bonded interaction!");
1406  return 0;
1407  }
1408 //fepe
1409 
1410 #ifndef MEM_OPT_VERSION
1411  Bool is_atom_fixed(int atomnum) const
1412  {
1413  return (numFixedAtoms && fixedAtomFlags[atomnum]);
1414  }
1415 #else
1416  //Since binary search is more expensive than direct array access,
1417  //and this function is usually called for consecutive atoms in this context,
1418  //the *listIdx returns the index to the range of atoms [aid1, aid2]
1419  //that are fixed. If the atom aid is fixed, then aid1=<aid<=aid2;
1420  //If the atom aid is not fixed, then aid1 indicates the smallest fixed atom
1421  //id that is larger than aid; so the listIdx could be equal the size of
1422  //fixedAtomsSet. --Chao Mei
1423  Bool is_atom_in_set(AtomSetList *localAtomsSet, int aid, int *listIdx) const;
1424  inline Bool is_atom_fixed(int aid, int *listIdx=NULL) const {
1425  return is_atom_in_set(fixedAtomsSet,aid,listIdx);
1426  }
1427  inline Bool is_atom_constrained(int aid, int *listIdx=NULL) const {
1428  return is_atom_in_set(constrainedAtomsSet,aid,listIdx);
1429  }
1430 #endif
1431 
1432  Bool is_atom_stirred(int atomnum) const
1433  {
1434  if (numStirredAtoms)
1435  {
1436  // Check the index to see if it is constrained
1437  return(stirIndexes[atomnum] != -1);
1438  }
1439  else
1440  {
1441  // No constraints at all, so just return FALSE
1442  return(FALSE);
1443  }
1444  }
1445 
1446 
1447  Bool is_group_fixed(int atomnum) const
1448  {
1449  return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
1450  }
1451  Bool is_atom_exPressure(int atomnum) const
1452  {
1453  return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
1454  }
1455  // 0 if not rigid or length to parent, for parent refers to H-H length
1456  // < 0 implies MOLLY but not SHAKE, > 1 implies both if MOLLY is on
1457  Real rigid_bond_length(int atomnum) const
1458  {
1459  return(rigidBondLengths[atomnum]);
1460  }
1461 
1462  void print_atoms(Parameters *);
1463  // Print out list of atoms
1464  void print_bonds(Parameters *);
1465  // Print out list of bonds
1466  void print_exclusions();// Print out list of exclusions
1467 
1468 public:
1470 
1471 #ifdef MEM_OPT_VERSION
1472  //read the per-atom file for the memory optimized version where the file
1473  //name already exists the range of atoms to be read are
1474  //[fromAtomID, toAtomID].
1475  void read_binary_atom_info(int fromAtomID, int toAtomID, InputAtomList &inAtoms);
1476 
1477  int64 getNumCalcExclusions(){return numCalcExclusions;}
1478  void setNumCalcExclusions(int64 x){numCalcExclusions= x;}
1479 
1480  Index getEachAtomMass(int i){return eachAtomMass[i];}
1481  Index getEachAtomCharge(int i){return eachAtomCharge[i];}
1482 
1483  ExclSigID getAtomExclSigId(int aid) const {
1484  return eachAtomExclSig[aid];
1485  }
1486 
1487  Real *getAtomMassPool(){return atomMassPool;}
1488  Real *getAtomChargePool(){return atomChargePool;}
1489  AtomCstInfo *getAtoms(){return atoms;}
1490 
1491  int atomSigPoolSize;
1493 
1494  /* All the following are temporary variables for reading the compressed psf file */
1495  //declarations for atoms' constant information
1496  int segNamePoolSize; //Its value is usually less than 5
1497  char **segNamePool; //This seems not to be important, but it only occupied very little space.
1498 
1499  int resNamePoolSize;
1500  char **resNamePool;
1501 
1502  int atomNamePoolSize;
1503  char **atomNamePool;
1504 
1505  int atomTypePoolSize;
1506  char **atomTypePool;
1507 
1508  int chargePoolSize;
1509  Real *atomChargePool;
1510 
1511  int massPoolSize;
1512  Real *atomMassPool;
1513 
1514  AtomSigID getAtomSigId(int aid) {
1515  return eachAtomSig[aid];
1516  }
1517 
1518  //Indicates the size of both exclSigPool and exclChkSigPool
1519  int exclSigPoolSize;
1520  //this will be deleted after build_lists_by_atom
1521  ExclusionSignature *exclSigPool;
1522  //This is the final data structure we want to store
1523  ExclusionCheck *exclChkSigPool;
1524 
1525  void addNewExclSigPool(const std::vector<ExclusionSignature>&);
1526 
1527  void delEachAtomSigs(){
1528  //for NAMD-smp version, only one Molecule object is held
1529  //on each node, therefore, only one deletion operation should
1530  //be taken on a node, otherwise, there possibly would be some
1531  //wierd memory problems. The same reason applies to other deletion
1532  //operations inside the Molecule object.
1533  if(CmiMyRank()) return;
1534 
1535  delete [] eachAtomSig;
1536  delete [] eachAtomExclSig;
1537  eachAtomSig = NULL;
1538  eachAtomExclSig = NULL;
1539  }
1540 
1541  void delChargeSpace(){
1542  if(CmiMyRank()) return;
1543 
1544  delete [] atomChargePool;
1545  delete [] eachAtomCharge;
1546  atomChargePool = NULL;
1547  eachAtomCharge = NULL;
1548  }
1549 
1550  void delMassSpace(){
1551  if(CmiMyRank()) return;
1552 
1553  delete [] atomMassPool;
1554  delete [] eachAtomMass;
1555  atomMassPool = NULL;
1556  eachAtomMass = NULL;
1557  }
1558 
1559  void delClusterSigs() {
1560  if(CmiMyRank()) return;
1561 
1562  delete [] clusterSigs;
1563  clusterSigs = NULL;
1564  }
1565 
1566  void delAtomNames(){
1567  if(CmiMyRank()) return;
1568  delete [] atomNamePool;
1569  delete [] atomNames;
1570  atomNamePool = NULL;
1571  atomNames = NULL;
1572  }
1573 
1574  void delFixedAtoms(){
1575  if(CmiMyRank()) return;
1576  delete fixedAtomsSet;
1577  fixedAtomsSet = NULL;
1578  }
1579 
1580 private:
1581  Index insert_new_mass(Real newMass);
1582 
1583 #endif
1584 
1585 // Go stuff
1586 public:
1587 
1588 GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS]; // Array of Go params -- JLai
1589 int go_indices[MAX_GO_CHAINS+1]; // Indices from chainIDS to go array -- JLai
1590 int NumGoChains; // Number of Go chain types -- JLai
1591 
1592 // Declares and initializes Go variables
1593 void goInit();
1594 
1595 // Builds explicit Gromacs pairs
1596 void build_gro_pair();
1597 
1598 // Builds the initial Go parameters
1599 void build_go_params(StringList *);
1600 
1601 // Read Go parameter file
1602 void read_go_file(char *);
1603 
1604 // Get Go cutoff for a given chain type pair
1605 Real get_go_cutoff(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };
1606 
1607 // Get Go epsilonRep for a given chain type pair
1608 Real get_go_epsilonRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };
1609 
1610 // Get Go sigmaRep for a given chain type pair
1611 Real get_go_sigmaRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };
1612 
1613 // Get Go epsilon for a given chain type pair
1614 Real get_go_epsilon(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };
1615 
1616 // Get Go exp_a for a given chain type pair
1617 int get_go_exp_a(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };
1618 
1619 // Get Go exp_b for a given chain type pair
1620 int get_go_exp_b(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };
1621 
1622 // Get Go exp_rep for a given chain type pair
1623 int get_go_exp_rep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };
1624 
1625 // Whether residue IDs with this difference are restricted
1626 Bool go_restricted(int, int, int);
1627 
1628 // Prints Go Params
1629 void print_go_params();
1630 
1631 void initialize();
1632 
1633 void send_GoMolecule(MOStream *);
1634 // send the molecular structure
1635 // from the master to the clients
1636 
1638 // receive the molecular structure
1639 // from the master on a client
1640 };
1641 
1642 #endif
1643 
int32 * get_exclusions_for_atom(int anum)
Definition: Molecule.h:1159
BigReal get_gro_force(BigReal, BigReal, BigReal, int, int) const
void print_go_params()
Definition: GoMolecule.C:548
int get_atom_from_name(const char *segid, int resid, const char *aname) const
Definition: Molecule.C:121
int numFixedGroups
Definition: Molecule.h:604
int exp_b
Definition: Molecule.h:109
int get_residue_size(const char *segid, int resid) const
Definition: Molecule.C:144
void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *)
Definition: Molecule.C:6373
BigReal tail_corr_virial_2
Definition: Molecule.h:474
int suspiciousAlchBonds
Definition: Molecule.h:563
Bool get_noPC()
Definition: Molecule.h:857
int * get_qmLSSRefSize()
Definition: Molecule.h:851
int num_alch_unpert_Dihedrals
Definition: Molecule.h:575
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1617
Bond * getAllAcceptors() const
Definition: Molecule.h:1112
Real langevin_param(int atomnum) const
Definition: Molecule.h:1300
void get_stir_refPos(Vector &refPos, int atomnum) const
Definition: Molecule.h:1306
int * indxGaussA
Definition: Molecule.h:675
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1605
int32 * get_dihedrals_for_atom(int anum)
Definition: Molecule.h:1153
const int * get_qmMMNumTargs()
Definition: Molecule.h:843
Definition: PDB.h:36
int numCalcBonds
Definition: Molecule.h:622
Real * gMu2
Definition: Molecule.h:680
int alchDroppedDihedrals
Definition: Molecule.h:565
int32 * get_crossterms_for_atom(int anum)
Definition: Molecule.h:1157
int numCalcAnisos
Definition: Molecule.h:632
int numBonds
Definition: Molecule.h:560
double A
Definition: Molecule.h:121
Real * get_qmGrpMult()
Definition: Molecule.h:832
void print_bonds(Parameters *)
Definition: Molecule.C:5380
char segname[11]
Definition: Molecule.h:146
int get_qmNumGrps() const
Definition: Molecule.h:828
void send_GoMolecule(MOStream *)
Definition: GoMolecule.C:1635
int * pointerToGoBeg
Definition: Molecule.h:658
int numCalcLJPair
Definition: Molecule.h:663
Real * giSigma2
Definition: Molecule.h:681
struct go_pair GoPair
Bool is_atom_movdragged(int atomnum) const
Definition: Molecule.h:1218
PDB * goPDB
Definition: Molecule.h:651
short int32
Definition: dumpdcd.c:24
int AtomID
Definition: NamdTypes.h:29
const int * get_qmGrpNumBonds()
Definition: Molecule.h:836
BigReal get_go_force_new(BigReal, int, int, BigReal *, BigReal *) const
Definition: GoMolecule.C:1334
void build_extra_bonds(Parameters *parameters, StringList *file)
void setOccupancyData(molfile_atom_t *atomarray)
Definition: Molecule.C:3236
const int * get_qmAtmIndx()
Definition: Molecule.h:824
void print_exclusions()
Definition: Molecule.C:5417
Real epsilonRep
Definition: Molecule.h:112
BigReal get_gro_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const
Definition: GoMolecule.C:1173
Bool is_hydrogen(int)
Real * goCoordinates
Definition: Molecule.h:649
BigReal tail_corr_virial_1
Definition: Molecule.h:474
int numHydrogenGroups
Definition: Molecule.h:600
void receive_GoMolecule(MIStream *)
Definition: GoMolecule.C:1744
void read_alch_unpert_dihedrals(FILE *)
Definition: Molecule.C:1931
int numAnisos
Number of anisotropic terms.
Definition: Molecule.h:584
Bool is_hydrogenGroupParent(int)
#define MAX_RESTRICTIONS
Definition: Molecule.h:38
Angle * alch_unpert_angles
Definition: Molecule.h:577
int get_cSMDnumInst()
Definition: Molecule.h:869
void send_Molecule(MOStream *)
Definition: Molecule.C:5448
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1608
Definition: Vector.h:64
BigReal tail_corr_dUdl_1
Definition: Molecule.h:473
Real * pairC6
Definition: Molecule.h:668
const int32 * get_mod_exclusions_for_atom(int anum) const
Definition: Molecule.h:1163
int get_numQMAtoms()
Definition: Molecule.h:826
Improper * get_improper(int inum) const
Definition: Molecule.h:1075
static __thread unsigned int * exclusions
static __thread atom * atoms
Mass * get_qmLSSMass()
Definition: Molecule.h:847
int num_alch_unpert_Bonds
Definition: Molecule.h:573
int goIndxB
Definition: Molecule.h:120
Atom * getAtoms() const
Definition: Molecule.h:491
int alchDroppedImpropers
Definition: Molecule.h:566
struct go_val GoValue
char * flags
Definition: Molecule.h:72
float Real
Definition: common.h:109
const int *const * get_qmMMBondedIndx()
Definition: Molecule.h:839
Real get_stir_startTheta(int atomnum) const
Definition: Molecule.h:1318
double * goSigmaPairA
Definition: Molecule.h:656
#define FALSE
Definition: common.h:118
static __thread int2 * exclusionsByAtom
Real rigid_bond_length(int atomnum) const
Definition: Molecule.h:1457
int get_atom_from_index_in_residue(const char *segid, int resid, int index) const
Definition: Molecule.C:158
int * pointerToLJEnd
Definition: Molecule.h:665
int numGridforceGrids
Definition: Molecule.h:591
void setBFactorData(molfile_atom_t *atomarray)
Definition: Molecule.C:3243
int numRealBonds
Definition: Molecule.h:559
Bond * getAllDonors() const
Definition: Molecule.h:1111
Real get_qmAtomGroup(int indx) const
Definition: Molecule.h:821
int num_alch_unpert_Angles
Definition: Molecule.h:574
Crossterm * getAllCrossterms() const
Definition: Molecule.h:1098
int ExclSigID
Definition: NamdTypes.h:83
bool * goWithinCutoff
Definition: Molecule.h:648
int get_cluster(int anum) const
Definition: Molecule.h:1027
void freeOccupancyData()
Definition: Molecule.h:1034
void reloadCharges(float charge[], int n)
int get_fep_bonded_type(const int *atomID, unsigned int order) const
Definition: Molecule.h:1389
int const * get_cSMDindxLen()
Definition: Molecule.h:870
int numMovDrag
Definition: Molecule.h:594
Bool get_qmcSMD()
Definition: Molecule.h:868
int num_fixed_atoms() const
Definition: Molecule.h:498
int * get_qmLSSRefIDs()
Definition: Molecule.h:850
BigReal tail_corr_ener
Definition: Molecule.h:471
void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
Definition: Molecule.h:1274
struct seg_resid AtomSegResInfo
ResidueLookupElem * next
Definition: Molecule.h:93
int * get_qmLSSIdxs()
Definition: Molecule.h:846
std::map< int, int > & get_qmMMSolv()
Definition: Molecule.h:853
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:578
Real * gA
Definition: Molecule.h:677
#define MAX_GO_CHAINS
Definition: Molecule.h:37
const char *const * get_qmDummyElement()
Definition: Molecule.h:840
void read_go_file(char *)
Definition: GoMolecule.C:113
Bool is_oxygen(int)
Crossterm * get_crossterm(int inum) const
Definition: Molecule.h:1081
void build_go_arrays(StringList *, char *)
Definition: GoMolecule.C:950
int64_t num_deg_freedom(int isInitialReport=0) const
Definition: Molecule.h:524
int AtomSigID
Definition: NamdTypes.h:82
int exp_a
Definition: Molecule.h:108
int32 * get_angles_for_atom(int anum)
Definition: Molecule.h:1151
int get_qmTotCustPCs()
Definition: Molecule.h:864
int * indxLJB
Definition: Molecule.h:667
int numFepFinal
Definition: Molecule.h:609
Real * get_qmGrpChrg()
Definition: Molecule.h:831
Bond * get_donor(int dnum) const
Definition: Molecule.h:1106
const int *const * get_qmGrpBonds()
Definition: Molecule.h:838
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1614
int * pointerToGaussBeg
Definition: Molecule.h:672
int numGaussPair
Definition: Molecule.h:674
int32 * atomChainTypes
Definition: Molecule.h:644
int const *const * get_cSMDpairs()
Definition: Molecule.h:872
int numCalcCrossterms
Definition: Molecule.h:626
int isOccupancyValid
Definition: Molecule.h:1469
void get_constorque_params(BigReal &v, Vector &a, Vector &p, int atomnum) const
Definition: Molecule.h:1340
int numPair
Definition: Molecule.h:661
int32 * consTorqueIndexes
Definition: Molecule.h:616
HydrogenGroup hydrogenGroup
Definition: Molecule.h:640
void build_langevin_params(BigReal coupling, BigReal drudeCoupling, Bool doHydrogen)
int64 numTotalExclusions
Definition: Molecule.h:572
int Index
Definition: structures.h:26
Real * get_qmMeQMGrp()
Definition: Molecule.h:860
const Real * get_qmAtomGroup() const
Definition: Molecule.h:820
int get_qmMeNumBonds()
Definition: Molecule.h:858
ResidueLookupElem(void)
Definition: Molecule.h:98
const char * get_atomtype(int anum) const
Definition: Molecule.h:1120
Real r_ohc
Definition: Molecule.h:468
Real * gMu1
Definition: Molecule.h:678
Real * get_qmGrpID()
Definition: Molecule.h:830
#define order
Definition: PmeRealSpace.C:235
int numMultipleImpropers
Definition: Molecule.h:638
double B
Definition: Molecule.h:122
int * pointerToLJBeg
Definition: Molecule.h:664
Real * gRepulsive
Definition: Molecule.h:682
void goInit()
Definition: GoMolecule.C:54
Bool is_atom_rotdragged(int atomnum) const
Definition: Molecule.h:1234
int const * getLcpoParamType()
Definition: Molecule.h:479
Bool is_atom_stirred(int atomnum) const
Definition: Molecule.h:1432
int goIndxA
Definition: Molecule.h:119
int numMultipleDihedrals
Definition: Molecule.h:636
Bool is_atom_constorqued(int atomnum) const
Definition: Molecule.h:1250
BigReal getEnergyTailCorr(const BigReal, const int)
int numLonepairs
Number of lone pairs.
Definition: Molecule.h:581
int * pointerToGoEnd
Definition: Molecule.h:659
void build_gro_pair()
int * indxGaussB
Definition: Molecule.h:676
Lphost * get_lphost(int atomid) const
Definition: Molecule.h:1085
Bool is_drude(int)
int * get_qmMeMMindx()
Definition: Molecule.h:859
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1611
int64 numCalcFullExclusions
Definition: Molecule.h:628
BigReal get_go_force(BigReal, int, int, BigReal *, BigReal *) const
Definition: GoMolecule.C:1260
int * goIndxLJA
Definition: Molecule.h:654
Dihedral * get_dihedral(int dnum) const
Definition: Molecule.h:1078
~Molecule()
Definition: Molecule.C:558
int64_t num_group_deg_freedom() const
Definition: Molecule.h:511
int is_drude_psf
Definition: Molecule.h:462
const float * getBFactorData()
Definition: Molecule.h:1036
int goNumLJPair
Definition: Molecule.h:653
int checkexcl(int atom1, int atom2) const
int32 * get_impropers_for_atom(int anum)
Definition: Molecule.h:1155
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1623
int numFixedRigidBonds
Definition: Molecule.h:606
void build_constraint_params(StringList *, StringList *, StringList *, PDB *, char *)
int get_qmPCFreq()
Definition: Molecule.h:862
int32 * goResidIndices
Definition: Molecule.h:646
void build_constorque_params(StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1588
void read_alch_unpert_bonds(FILE *)
Definition: Molecule.C:1660
int numFepInitial
Definition: Molecule.h:608
int Bool
Definition: common.h:133
int * pointerToGaussEnd
Definition: Molecule.h:673
unsigned char get_ss_type(int anum) const
Definition: Molecule.h:1355
int numAcceptors
Definition: Molecule.h:570
int numTholes
Number of Thole terms.
Definition: Molecule.h:583
Real * get_qmAtmChrg()
Definition: Molecule.h:823
int32 * get_bonds_for_atom(int anum)
Definition: Molecule.h:1149
int get_qmNumBonds()
Definition: Molecule.h:834
const int *const * get_qmMMBond()
Definition: Molecule.h:837
int numCalcDihedrals
Definition: Molecule.h:624
int * goResids
Definition: Molecule.h:650
Real * goSigmas
Definition: Molecule.h:647
int get_qmLSSFreq()
Definition: Molecule.h:848
int numExPressureAtoms
Definition: Molecule.h:599
void set_qm_replaceAll(Bool newReplaceAll)
Definition: Molecule.h:818
int lookup(const char *segid, int resid, int *begin, int *end) const
Definition: Molecule.C:76
Bond * alch_unpert_bonds
Definition: Molecule.h:576
BigReal energyNonnative
Definition: Molecule.h:686
void delete_qm_bonded()
Definition: MoleculeQM.C:1547
int numFixedAtoms
Definition: Molecule.h:597
void prepare_qm(const char *pdbFileName, Parameters *params, ConfigList *cfgList)
Definition: MoleculeQM.C:109
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:525
Real cutoff
Definition: Molecule.h:113
Bond * get_bond(int bnum) const
Definition: Molecule.h:1069
int numCalcImpropers
Definition: Molecule.h:625
int numAngles
Definition: Molecule.h:561
void build_stirred_atoms(StringList *, StringList *, PDB *, char *)
const float * getOccupancyData()
Definition: Molecule.h:1032
Real * pairC12
Definition: Molecule.h:669
const Real * get_cSMDcoffs()
Definition: Molecule.h:875
Definition: parm.h:15
int numAtoms
Definition: Molecule.h:557
Real sigmaRep
Definition: Molecule.h:111
int * gromacsPair_type
Definition: Molecule.h:670
int numStirredAtoms
Definition: Molecule.h:598
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1280
int numCrossterms
Definition: Molecule.h:568
void NAMD_die(const char *err_msg)
Definition: common.C:85
Bool is_lp(int)
int numConsForce
Definition: Molecule.h:612
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309
BigReal getVirialTailCorr(const BigReal)
void build_ss_flags(const StringList *ssfile, const StringList *sscol, PDB *initial_pdb, const char *cwd)
void build_rotdrag_params(StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
HashPool< HashString > resNamePool
Definition: CompressPsf.C:308
bool operator<(const intpair &lhs, const intpair &rhs)
Definition: ComputeGlobal.h:29
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:617
AtomNameInfo * getAtomNames() const
Definition: Molecule.h:492
int get_groupSize(int)
int * ss_index
Definition: Molecule.h:459
int maxMigrationGroupSize
Definition: Molecule.h:603
char mySegid[11]
Definition: Molecule.h:92
void put_stir_startTheta(Real theta, int atomnum) const
Definition: Molecule.h:1312
int numDihedrals
Definition: Molecule.h:562
const int *const * get_qmMMChargeTarget()
Definition: Molecule.h:842
int * get_qmCustPCSizes()
Definition: Molecule.h:865
void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *)
unsigned char get_fep_type(int anum) const
Definition: Molecule.h:1349
int numImpropers
Definition: Molecule.h:567
const char *const * get_qmElements()
Definition: Molecule.h:827
int numConsTorque
Definition: Molecule.h:596
ResidueLookupElem * append(const char *segid, int resid, int aid)
Definition: Molecule.C:89
double * goSigmaPairB
Definition: Molecule.h:657
int numConstraints
Definition: Molecule.h:589
Bool is_group_fixed(int atomnum) const
Definition: Molecule.h:1447
void build_alch_unpert_bond_lists(char *)
int64 numCalcExclusions
Definition: Molecule.h:627
Bool is_atom_constrained(int atomnum) const
Definition: Molecule.h:1201
void build_fixed_atoms(StringList *, StringList *, PDB *, char *)
void get_cons_params(Real &k, Vector &refPos, int atomnum) const
Definition: Molecule.h:1266
BigReal tail_corr_dUdl_2
Definition: Molecule.h:473
const Real * get_cSMDKs()
Definition: Molecule.h:873
void compute_LJcorrection()
long long int64
Definition: common.h:34
int num_fixed_groups() const
Definition: Molecule.h:504
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1620
#define simParams
Definition: Output.C:127
Dihedral * getAllDihedrals() const
Definition: Molecule.h:1097
AtomSegResInfo * getAtomSegResInfo() const
Definition: Molecule.h:495
Exclusion * get_exclusion(int ex) const
Definition: Molecule.h:1116
Index atomvdwtype(int anum) const
Definition: Molecule.h:1062
int32 * consForceIndexes
Definition: Molecule.h:613
void print_atoms(Parameters *)
Definition: Molecule.C:5337
int maxHydrogenGroupSize
Definition: Molecule.h:601
BigReal get_go_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const
Definition: GoMolecule.C:1456
void get_movdrag_params(Vector &v, int atomnum) const
Definition: Molecule.h:1325
int numMigrationGroups
Definition: Molecule.h:602
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1589
void build_go_sigmas(StringList *, char *)
Definition: GoMolecule.C:577
void get_rotdrag_params(BigReal &v, Vector &a, Vector &p, int atomnum) const
Definition: Molecule.h:1331
Real * giSigma1
Definition: Molecule.h:679
Real atomcharge(int anum) const
Definition: Molecule.h:1052
HashPool< HashString > segNamePool
Definition: CompressPsf.C:307
void delete_alch_bonded(void)
HashPool< HashString > atomTypePool
Definition: CompressPsf.C:310
BigReal tail_corr_virial
Definition: Molecule.h:472
void build_exPressure_atoms(StringList *, StringList *, PDB *, char *)
int numZeroMassAtoms
Number of atoms with zero mass.
Definition: Molecule.h:586
const ExclusionCheck * get_excl_check_for_atom(int anum) const
Definition: Molecule.h:1177
void build_constant_forces(char *)
float Mass
Definition: ComputeGBIS.inl:20
k< npairi;++k){TABENERGY(const int numtypes=simParams->tableNumTypes;const float table_spacing=simParams->tableSpacing;const int npertype=(int)(namdnearbyint(simParams->tableMaxDist/simParams->tableSpacing)+1);) int table_i=(r2iilist[2 *k] >> 14)+r2_delta_expc;const int j=pairlisti[k];#define p_j BigReal diffa=r2list[k]-r2_table[table_i];#define table_four_i TABENERGY(register const int tabtype=-1-(lj_pars->A< 0?lj_pars->A:0);) BigReal kqq=kq_i *p_j-> charge
int * get_qmCustomPCIdxs()
Definition: Molecule.h:866
Angle * getAllAngles() const
Definition: Molecule.h:1095
Vector * consForce
Definition: Molecule.h:614
#define WAT_TIP4
Definition: common.h:191
int * indxLJA
Definition: Molecule.h:666
~ResidueLookupElem(void)
Definition: Molecule.h:99
int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
Definition: Molecule.h:1289
Real atommass(int anum) const
Definition: Molecule.h:1042
const Real * get_cSMDVels()
Definition: Molecule.h:874
BigReal energyNative
Definition: Molecule.h:685
void print_go_sigmas()
Definition: GoMolecule.C:1134
int * ss_vdw_type
Definition: Molecule.h:458
int * get_qmLSSSize()
Definition: Molecule.h:845
int * numGridforces
Definition: Molecule.h:592
int NumGoChains
Definition: Molecule.h:1590
int numDrudeAtoms
Number of Drude particles.
Definition: Molecule.h:582
Bool is_atom_exPressure(int atomnum) const
Definition: Molecule.h:1451
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:114
Real epsilon
Definition: Molecule.h:107
Bool atoms_1to4(unsigned int, unsigned int)
Definition: GoMolecule.C:1537
Bool is_atom_fixed(int atomnum) const
Definition: Molecule.h:1411
int is_lonepairs_psf
Definition: Molecule.h:463
int alchDroppedAngles
Definition: Molecule.h:564
int32 * goSigmaIndices
Definition: Molecule.h:645
int numCalcTholes
Definition: Molecule.h:631
BigReal GetAtomAlpha(int i) const
Definition: Molecule.h:483
gridSize x
void receive_Molecule(MIStream *)
Definition: Molecule.C:5806
void build_movdrag_params(StringList *, StringList *, StringList *, PDB *, char *)
int resid
Definition: Molecule.h:147
int numLphosts
Number of lone pair host records in PSF.
Definition: Molecule.h:585
Lphost * getAllLphosts() const
Definition: Molecule.h:1102
int * goIndxLJB
Definition: Molecule.h:655
Angle * get_angle(int anum) const
Definition: Molecule.h:1072
int numRigidBonds
Definition: Molecule.h:605
int const *const * get_cSMDindex()
Definition: Molecule.h:871
Mass * get_qmLSSRefMass()
Definition: Molecule.h:852
Bool is_water(int)
Bond * getAllBonds() const
Definition: Molecule.h:1094
void freeBFactorData()
Definition: Molecule.h:1038
const BigReal * get_qmDummyBondVal()
Definition: Molecule.h:835
int exp_rep
Definition: Molecule.h:110
int get_mother_atom(int)
void initialize()
int numDonors
Definition: Molecule.h:569
Bool get_qmReplaceAll()
Definition: Molecule.h:855
int numGoAtoms
Definition: Molecule.h:643
int isBFactorValid
Definition: Molecule.h:1469
int numCalcAngles
Definition: Molecule.h:623
float Charge
Definition: NamdTypes.h:32
const int32 * get_full_exclusions_for_atom(int anum) const
Definition: Molecule.h:1161
Improper * getAllImpropers() const
Definition: Molecule.h:1096
Real r_om
Definition: Molecule.h:467
int get_clusterSize(int anum) const
Definition: Molecule.h:1028
int ss_num_vdw_params
Definition: Molecule.h:457
int numRotDrag
Definition: Molecule.h:595
ResizeArray< int > atomIndex
Definition: Molecule.h:96
Molecule(SimParameters *, Parameters *param)
Definition: Molecule.C:429
double BigReal
Definition: common.h:114
int get_qmLSSResSize()
Definition: Molecule.h:849
Bool is_atom_gridforced(int atomnum, int gridnum) const
Definition: Molecule.h:1185
const int * get_qmGrpSizes()
Definition: Molecule.h:829
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313
Bond * get_acceptor(int dnum) const
Definition: Molecule.h:1109
int numLJPair
Definition: Molecule.h:662
void build_go_params(StringList *)
Definition: GoMolecule.C:79
void build_go_sigmas2(StringList *, char *)
Definition: GoMolecule.C:747
int numExclusions
Definition: Molecule.h:571
void read_alch_unpert_angles(FILE *)
Definition: Molecule.C:1783