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