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