NAMD
Classes | Public Member Functions | Public Attributes | Friends | List of all members
Molecule Class Reference

Molecule stores the structural information for the system. More...

#include <Molecule.h>

Public Member Functions

void compute_LJcorrection ()
 
void compute_LJcorrection_alternative ()
 
BigReal getEnergyTailCorr (const BigReal, const int)
 
BigReal getVirialTailCorr (const BigReal)
 
int const * getLcpoParamType ()
 
BigReal GetAtomAlpha (int i) const
 
AtomgetAtoms () const
 
AtomNameInfogetAtomNames () const
 
AtomSegResInfogetAtomSegResInfo () const
 
int num_fixed_atoms () const
 
int num_fixed_groups () const
 
int64_t num_group_deg_freedom () const
 
int64_t num_deg_freedom (int isInitialReport=0) const
 
void updateAtomDcdSelection (int atomIdx, uint16 bits)
 
void set_qm_replaceAll (Bool newReplaceAll)
 
const Realget_qmAtomGroup () const
 
Real get_qmAtomGroup (int indx) const
 
Realget_qmAtmChrg ()
 
const int * get_qmAtmIndx ()
 
int get_numQMAtoms ()
 
const char *const * get_qmElements ()
 
int get_qmNumGrps () const
 
const int * get_qmGrpSizes ()
 
Realget_qmGrpID ()
 
Realget_qmGrpChrg ()
 
Realget_qmGrpMult ()
 
int get_qmNumBonds ()
 
const BigRealget_qmDummyBondVal ()
 
const int * get_qmGrpNumBonds ()
 
const int *const * get_qmMMBond ()
 
const int *const * get_qmGrpBonds ()
 
const int *const * get_qmMMBondedIndx ()
 
const char *const * get_qmDummyElement ()
 
const int *const * get_qmMMChargeTarget ()
 
const int * get_qmMMNumTargs ()
 
uint16 get_atom_dcd_status (const int index)
 
int get_atom_index_from_dcd_selection (const int index, const int atomIndex)
 
int get_dcd_selection_index_from_atom_id (const int index, const int atomIndex)
 
const int get_dcd_selection_size (const int index)
 
int * get_qmLSSSize ()
 
int * get_qmLSSIdxs ()
 
Massget_qmLSSMass ()
 
int get_qmLSSFreq ()
 
int get_qmLSSResSize ()
 
int * get_qmLSSRefIDs ()
 
int * get_qmLSSRefSize ()
 
Massget_qmLSSRefMass ()
 
std::map< int, int > & get_qmMMSolv ()
 
Bool get_qmReplaceAll ()
 
Bool get_noPC ()
 
int get_qmMeNumBonds ()
 
int * get_qmMeMMindx ()
 
Realget_qmMeQMGrp ()
 
int get_qmPCFreq ()
 
int get_qmTotCustPCs ()
 
int * get_qmCustPCSizes ()
 
int * get_qmCustomPCIdxs ()
 
Bool get_qmcSMD ()
 
int get_cSMDnumInst ()
 
int const * get_cSMDindxLen ()
 
int const *const * get_cSMDindex ()
 
int const *const * get_cSMDpairs ()
 
const Realget_cSMDKs ()
 
const Realget_cSMDVels ()
 
const Realget_cSMDcoffs ()
 
void prepare_qm (const char *pdbFileName, Parameters *params, ConfigList *cfgList)
 
void delete_qm_bonded ()
 
 Molecule (SimParameters *, Parameters *param)
 
 Molecule (SimParameters *, Parameters *param, char *filename, ConfigList *cfgList=NULL)
 
 Molecule (SimParameters *simParams, Parameters *param, molfile_plugin_t *pIOHdl, void *pIOFileHdl, int natoms)
 
 Molecule (SimParameters *, Parameters *, Ambertoppar *)
 
void read_parm (Ambertoppar *)
 
 Molecule (SimParameters *, Parameters *, AmberParm7Reader::Ambertoppar *)
 
void read_parm (AmberParm7Reader::Ambertoppar *)
 
 Molecule (SimParameters *, Parameters *, const GromacsTopFile *)
 
 ~Molecule ()
 
void send_Molecule (MOStream *)
 
void receive_Molecule (MIStream *)
 
void build_constraint_params (StringList *, StringList *, StringList *, PDB *, char *)
 
void build_gridforce_params (StringList *, StringList *, StringList *, StringList *, PDB *, char *)
 
void build_movdrag_params (StringList *, StringList *, StringList *, PDB *, char *)
 
void build_rotdrag_params (StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
 
void build_constorque_params (StringList *, StringList *, StringList *, StringList *, StringList *, StringList *, PDB *, char *)
 
void build_constant_forces (char *)
 
void build_langevin_params (BigReal coupling, BigReal drudeCoupling, Bool doHydrogen)
 
void build_langevin_params (StringList *, StringList *, PDB *, char *)
 
void build_fixed_atoms (StringList *, StringList *, PDB *, char *)
 
void build_stirred_atoms (StringList *, StringList *, PDB *, char *)
 
void build_extra_bonds (Parameters *parameters, StringList *file)
 
void build_dcd_selection_list_pdb (int dcdIndex, char *userDcdInputFile)
 
void add_dcd_selection_file (int dcdIndex, char *userDcdFile)
 
void add_dcd_selection_freq (int dcdIndex, int freq)
 
uint16_t find_dcd_selection_index (const char *keystr)
 
uint16_t find_or_create_dcd_selection_index (const char *keystr)
 
void build_molecule ()
 
void build_fep_flags (StringList *, StringList *, PDB *, char *, const char *)
 
void delete_alch_bonded (void)
 
void build_alch_unpert_bond_lists (char *)
 
void read_alch_unpert_bonds (FILE *)
 
void read_alch_unpert_angles (FILE *)
 
void read_alch_unpert_dihedrals (FILE *)
 
void build_ss_flags (const StringList *ssfile, const StringList *sscol, PDB *initial_pdb, const char *cwd)
 
void build_exPressure_atoms (StringList *, StringList *, PDB *, char *)
 
void parse_dcd_selection_params (ConfigList *configList)
 
void print_go_sigmas ()
 
void build_go_sigmas (StringList *, char *)
 
void build_go_sigmas2 (StringList *, char *)
 
void build_go_arrays (StringList *, char *)
 
BigReal get_gro_force (BigReal, BigReal, BigReal, int, int) const
 
BigReal get_gro_force2 (BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const
 
BigReal get_go_force (BigReal, int, int, BigReal *, BigReal *) const
 
BigReal get_go_force_new (BigReal, int, int, BigReal *, BigReal *) const
 
BigReal get_go_force2 (BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const
 
Bool atoms_1to4 (unsigned int, unsigned int)
 
void reloadCharges (float charge[], int n)
 
Bool is_lp (int)
 
Bool is_drude (int) const
 
Bool is_hydrogen (int)
 
Bool is_oxygen (int)
 
Bool is_hydrogenGroupParent (int)
 
Bool is_water (int)
 
int get_groupSize (int)
 
int get_mother_atom (int) const
 
int get_cluster (int anum) const
 
int get_clusterSize (int anum) const
 
const float * getOccupancyData ()
 
void setOccupancyData (molfile_atom_t *atomarray)
 
void freeOccupancyData ()
 
const float * getBFactorData ()
 
void setBFactorData (molfile_atom_t *atomarray)
 
void freeBFactorData ()
 
Real atommass (int anum) const
 
Real atomcharge (int anum) const
 
Index atomvdwtype (int anum) const
 
Bondget_bond (int bnum) const
 
Angleget_angle (int anum) const
 
Improperget_improper (int inum) const
 
Dihedralget_dihedral (int dnum) const
 
Crosstermget_crossterm (int inum) const
 
Lphostget_lphost (int atomid) const
 
BondgetAllBonds () const
 
AnglegetAllAngles () const
 
ImpropergetAllImpropers () const
 
DihedralgetAllDihedrals () const
 
CrosstermgetAllCrossterms () const
 
LphostgetAllLphosts () const
 
Bondget_donor (int dnum) const
 
Bondget_acceptor (int dnum) const
 
BondgetAllDonors () const
 
BondgetAllAcceptors () const
 
Exclusionget_exclusion (int ex) const
 
const char * get_atomtype (int anum) const
 
int get_atom_from_name (const char *segid, int resid, const char *aname) const
 
int get_residue_size (const char *segid, int resid) const
 
int get_atom_from_index_in_residue (const char *segid, int resid, int index) const
 
int32get_bonds_for_atom (int anum)
 
int32get_angles_for_atom (int anum)
 
int32get_dihedrals_for_atom (int anum)
 
int32get_impropers_for_atom (int anum)
 
int32get_crossterms_for_atom (int anum)
 
int32get_exclusions_for_atom (int anum)
 
const int32get_full_exclusions_for_atom (int anum) const
 
const int32get_mod_exclusions_for_atom (int anum) const
 
int checkexcl (int atom1, int atom2) const
 
const ExclusionCheckget_excl_check_for_atom (int anum) const
 
Bool is_atom_gridforced (int atomnum, int gridnum) const
 
Bool is_atom_constrained (int atomnum) const
 
Bool is_atom_movdragged (int atomnum) const
 
Bool is_atom_rotdragged (int atomnum) const
 
Bool is_atom_constorqued (int atomnum) const
 
Bool is_atom_dcd_selection (int atomnum, int tag) const
 
void get_cons_params (Real &k, Vector &refPos, int atomnum) const
 
void get_gridfrc_params (Real &k, Charge &q, int atomnum, int gridnum) const
 
GridforceGridget_gridfrc_grid (int gridnum) const
 
int set_gridfrc_grid (int gridnum, GridforceGrid *grid)
 
Real langevin_param (int atomnum) const
 
void get_stir_refPos (Vector &refPos, int atomnum) const
 
void put_stir_startTheta (Real theta, int atomnum) const
 
Real get_stir_startTheta (int atomnum) const
 
void get_movdrag_params (Vector &v, int atomnum) const
 
void get_rotdrag_params (BigReal &v, Vector &a, Vector &p, int atomnum) const
 
void get_constorque_params (BigReal &v, Vector &a, Vector &p, int atomnum) const
 
unsigned char get_fep_type (int anum) const
 
const unsigned char * getFepAtomFlags () const
 
unsigned char get_ss_type (int anum) const
 
int get_fep_bonded_type (const int *atomID, unsigned int order) const
 
Bool is_atom_fixed (int atomnum) const
 
Bool is_atom_stirred (int atomnum) const
 
Bool is_group_fixed (int atomnum) const
 
Bool is_atom_exPressure (int atomnum) const
 
Real rigid_bond_length (int atomnum) const
 
void print_atoms (Parameters *)
 
void print_bonds (Parameters *)
 
void print_exclusions ()
 
void goInit ()
 
void build_gro_pair ()
 
void build_go_params (StringList *)
 
void read_go_file (char *)
 
Real get_go_cutoff (int chain1, int chain2)
 
Real get_go_epsilonRep (int chain1, int chain2)
 
Real get_go_sigmaRep (int chain1, int chain2)
 
Real get_go_epsilon (int chain1, int chain2)
 
int get_go_exp_a (int chain1, int chain2)
 
int get_go_exp_b (int chain1, int chain2)
 
int get_go_exp_rep (int chain1, int chain2)
 
Bool go_restricted (int, int, int)
 
void print_go_params ()
 
void initialize ()
 
void send_GoMolecule (MOStream *)
 
void receive_GoMolecule (MIStream *)
 

Public Attributes

bool dcdSelectionAtoms
 
DCDParams dcdSelectionParams [16]
 
std::map< std::string, int > dcdSelectionKeyMap
 
int ss_num_vdw_params
 
int * ss_vdw_type
 
int * ss_index
 
int is_drude_psf
 
int is_lonepairs_psf
 
Real r_om
 
Real r_ohc
 
BigReal tail_corr_ener
 
BigReal tail_corr_virial
 
BigReal tail_corr_dUdl_1
 
BigReal tail_corr_dUdl_2
 
BigReal tail_corr_virial_1
 
BigReal tail_corr_virial_2
 
int numAtoms
 
int numRealBonds
 
int numBonds
 
int numAngles
 
int numDihedrals
 
int suspiciousAlchBonds
 
int alchDroppedAngles
 
int alchDroppedDihedrals
 
int alchDroppedImpropers
 
int numImpropers
 
int numCrossterms
 
int numDonors
 
int numAcceptors
 
int numExclusions
 
int64 numTotalExclusions
 
int num_alch_unpert_Bonds
 
int num_alch_unpert_Angles
 
int num_alch_unpert_Dihedrals
 
Bondalch_unpert_bonds
 
Anglealch_unpert_angles
 
Dihedralalch_unpert_dihedrals
 
int numLonepairs
 Number of lone pairs. More...
 
int numDrudeAtoms
 Number of Drude particles. More...
 
int numTholes
 Number of Thole terms. More...
 
int numAnisos
 Number of anisotropic terms. More...
 
int numLphosts
 Number of lone pair host records in PSF. More...
 
int numZeroMassAtoms
 Number of atoms with zero mass. More...
 
int numOneFourNbTholes
 
int numMolecules
 Number of 1-4 atom pairs with NBThole defined. More...
 
int numLargeMolecules
 Number of large molecules (compare to LARGEMOLTH) More...
 
int32moleculeStartIndex
 starting index of each molecule More...
 
int32moleculeAtom
 atom index for all molecules More...
 
int numConstraints
 
int numGridforceGrids
 
int * numGridforces
 
int numMovDrag
 
int numRotDrag
 
int numConsTorque
 
int numFixedAtoms
 
int numStirredAtoms
 
int numExPressureAtoms
 
int numHydrogenGroups
 
int maxHydrogenGroupSize
 
int numMigrationGroups
 
int maxMigrationGroupSize
 
int numFixedGroups
 
int numRigidBonds
 
int numFixedRigidBonds
 
int numFepInitial
 
int numFepFinal
 
int numConsForce
 
int32consForceIndexes
 
VectorconsForce
 
int32consTorqueIndexes
 
ConsTorqueParams * consTorqueParams
 
int numCalcBonds
 
int numCalcAngles
 
int numCalcDihedrals
 
int numCalcImpropers
 
int numCalcCrossterms
 
int64 numCalcExclusions
 
int64 numCalcFullExclusions
 
int numCalcTholes
 
int numCalcAnisos
 
int numCalcOneFourNbTholes
 
int numMultipleDihedrals
 
int numMultipleImpropers
 
HydrogenGroup hydrogenGroup
 
int numGoAtoms
 
int32atomChainTypes
 
int32goSigmaIndices
 
int32goResidIndices
 
RealgoSigmas
 
bool * goWithinCutoff
 
RealgoCoordinates
 
int * goResids
 
PDBgoPDB
 
int goNumLJPair
 
int * goIndxLJA
 
int * goIndxLJB
 
double * goSigmaPairA
 
double * goSigmaPairB
 
int * pointerToGoBeg
 
int * pointerToGoEnd
 
int numPair
 
int numLJPair
 
int numCalcLJPair
 
int * pointerToLJBeg
 
int * pointerToLJEnd
 
int * indxLJA
 
int * indxLJB
 
RealpairC6
 
RealpairC12
 
int * gromacsPair_type
 
int * pointerToGaussBeg
 
int * pointerToGaussEnd
 
int numGaussPair
 
int * indxGaussA
 
int * indxGaussB
 
RealgA
 
RealgMu1
 
RealgiSigma1
 
RealgMu2
 
RealgiSigma2
 
RealgRepulsive
 
BigReal energyNative
 
BigReal energyNonnative
 
int isOccupancyValid
 
int isBFactorValid
 
GoValue go_array [MAX_GO_CHAINS *MAX_GO_CHAINS]
 
int go_indices [MAX_GO_CHAINS+1]
 
int NumGoChains
 

Friends

class ExclElem
 
class BondElem
 
class AngleElem
 
class DihedralElem
 
class ImproperElem
 
class TholeElem
 
class AnisoElem
 
class OneFourNbTholeElem
 
class CrosstermElem
 
class GromacsPairElem
 
class WorkDistrib
 

Detailed Description

Molecule stores the structural information for the system.

This class is used to store all of the structural
information for a simulation. It reads in this information from a .psf file, cross checks and obtains some information from the Parameters object that is passed in, and then
stores all this information for later use.

One Molecule instance is kept on each PE (or node for SMP build), accessed by Node::Object()->molecule. There is an initial setup and file reading phase, after which there is a communication phase using the Communicate MIStream / MOStream to update all copies, all before simulation begins.

Keeps list maintaining the global atom indicies sorted by helix groups, and also bond connectivity and exclusion lists.

Reads PSF file, compressed PSF file (for memory optimized version), Gromacs topology file, and PDB files for various per atom constants and flags (Langevin, fixed atoms, FEP, Go residue IDs, grid force parameters, moving/rotating drag parameters, torque parameters, stirred atoms, pressure exclusions).

Definition at line 174 of file Molecule.h.

Constructor & Destructor Documentation

◆ Molecule() [1/6]

Molecule::Molecule ( SimParameters simParams,
Parameters param 
)

Definition at line 442 of file Molecule.C.

References simParams.

443 {
444  initialize(simParams,param);
445 }
void initialize()

◆ Molecule() [2/6]

Molecule::Molecule ( SimParameters simParams,
Parameters param,
char *  filename,
ConfigList cfgList = NULL 
)

Definition at line 455 of file Molecule.C.

References NAMD_EVENT_START, NAMD_EVENT_STOP, and simParams.

456 {
457  NAMD_EVENT_START(1, NamdProfileEvent::MOLECULE_CONSTRUCTOR);
458 
459  initialize(simParams,param);
460 
461 #ifdef MEM_OPT_VERSION
462  if(simParams->useCompressedPsf)
463  read_mol_signatures(filename, param, cfgList);
464 #else
465  read_psf_file(filename, param);
466  //LCPO
467  if (simParams->LCPOOn)
468  assignLCPOTypes( 0 );
469 #endif
470  NAMD_EVENT_STOP(1, NamdProfileEvent::MOLECULE_CONSTRUCTOR);
471  }
#define NAMD_EVENT_STOP(eon, id)
#define NAMD_EVENT_START(eon, id)
#define simParams
Definition: Output.C:131
void initialize()

◆ Molecule() [3/6]

Molecule::Molecule ( SimParameters simParams,
Parameters param,
molfile_plugin_t *  pIOHdl,
void *  pIOFileHdl,
int  natoms 
)

Definition at line 480 of file Molecule.C.

References NAMD_die(), and simParams.

481 {
482 #ifdef MEM_OPT_VERSION
483  NAMD_die("Sorry, plugin IO is not supported in the memory optimized version.");
484 #else
485  initialize(simParams, param);
486  numAtoms = natoms;
487  int optflags = MOLFILE_BADOPTIONS;
488  molfile_atom_t *atomarray = (molfile_atom_t *) malloc(natoms*sizeof(molfile_atom_t));
489  memset(atomarray, 0, natoms*sizeof(molfile_atom_t));
490 
491  //1a. read basic atoms information
492  int rc = pIOHdl->read_structure(pIOFileHdl, &optflags, atomarray);
493  if (rc != MOLFILE_SUCCESS && rc != MOLFILE_NOSTRUCTUREDATA) {
494  free(atomarray);
495  NAMD_die("ERROR: plugin failed reading structure data");
496  }
497  if(optflags == MOLFILE_BADOPTIONS) {
498  free(atomarray);
499  NAMD_die("ERROR: plugin didn't initialize optional data flags");
500  }
501  if(optflags & MOLFILE_OCCUPANCY) {
502  setOccupancyData(atomarray);
503  }
504  if(optflags & MOLFILE_BFACTOR) {
505  setBFactorData(atomarray);
506  }
507  //1b. load basic atoms information to the molecule object
508  plgLoadAtomBasics(atomarray);
509  free(atomarray);
510 
511  //2a. read bonds
512  //indices are one-based in read_bonds
513  int *from, *to;
514  float *bondorder;
515  int *bondtype, nbondtypes;
516  char **bondtypename;
517  if(pIOHdl->read_bonds!=NULL) {
518  if(pIOHdl->read_bonds(pIOFileHdl, &numBonds, &from, &to, &bondorder,
519  &bondtype, &nbondtypes, &bondtypename)){
520  NAMD_die("ERROR: failed reading bond information.");
521  }
522  }
523  //2b. load bonds information to the molecule object
524  if(numBonds!=0) {
525  plgLoadBonds(from,to);
526  }
527 
528  //3a. read other bonded structures
529  int *plgAngles, *plgDihedrals, *plgImpropers, *plgCterms;
530  int ctermcols, ctermrows;
531  int *angletypes, numangletypes, *dihedraltypes, numdihedraltypes;
532  int *impropertypes, numimpropertypes;
533  char **angletypenames, **dihedraltypenames, **impropertypenames;
534 
535  plgAngles=plgDihedrals=plgImpropers=plgCterms=NULL;
536  if(pIOHdl->read_angles!=NULL) {
537  if(pIOHdl->read_angles(pIOFileHdl,
538  &numAngles, &plgAngles,
539  &angletypes, &numangletypes, &angletypenames,
540  &numDihedrals, &plgDihedrals,
541  &dihedraltypes, &numdihedraltypes, &dihedraltypenames,
542  &numImpropers, &plgImpropers,
543  &impropertypes, &numimpropertypes, &impropertypenames,
544  &numCrossterms, &plgCterms, &ctermcols, &ctermrows)) {
545  NAMD_die("ERROR: failed reading angle information.");
546  }
547  }
548  //3b. load other bonded structures to the molecule object
549  if(numAngles!=0) plgLoadAngles(plgAngles);
550  if(numDihedrals!=0) plgLoadDihedrals(plgDihedrals);
551  if(numImpropers!=0) plgLoadImpropers(plgImpropers);
552  if(numCrossterms!=0) plgLoadCrossterms(plgCterms);
553 
555  build_atom_status();
556  //LCPO
557  if (simParams->LCPOOn)
558  assignLCPOTypes( 2 );
559 #endif
560 }
int numBonds
Definition: Molecule.h:589
void setOccupancyData(molfile_atom_t *atomarray)
Definition: Molecule.C:3282
void setBFactorData(molfile_atom_t *atomarray)
Definition: Molecule.C:3289
int numRealBonds
Definition: Molecule.h:588
int numAngles
Definition: Molecule.h:590
int numAtoms
Definition: Molecule.h:586
int numCrossterms
Definition: Molecule.h:597
void NAMD_die(const char *err_msg)
Definition: common.C:147
int numDihedrals
Definition: Molecule.h:591
int numImpropers
Definition: Molecule.h:596
#define simParams
Definition: Output.C:131
void initialize()

◆ Molecule() [4/6]

Molecule::Molecule ( SimParameters ,
Parameters ,
Ambertoppar  
)

◆ Molecule() [5/6]

Molecule::Molecule ( SimParameters ,
Parameters ,
AmberParm7Reader::Ambertoppar  
)

◆ Molecule() [6/6]

Molecule::Molecule ( SimParameters ,
Parameters ,
const GromacsTopFile  
)

◆ ~Molecule()

Molecule::~Molecule ( )

Definition at line 574 of file Molecule.C.

References atomSigPool.

575 {
576  /* Check to see if each array was ever allocated. If it was */
577  /* then free it */
578  if (atoms != NULL)
579  delete [] atoms;
580 
581  if (atomNames != NULL)
582  {
583  // subarrarys allocated from arena - automatically deleted
584  delete [] atomNames;
585  }
586  delete nameArena;
587 
588  if (resLookup != NULL)
589  delete resLookup;
590 
591  // DRUDE: free arrays read from PSF
592  if (drudeConsts != NULL) delete [] drudeConsts;
593  if (lphosts != NULL) delete [] lphosts;
594  if (anisos != NULL) delete [] anisos;
595  if (tholes != NULL) delete [] tholes;
596  if (oneFourNbTholes != NULL) delete[] oneFourNbTholes;
597  if (lphostIndexes != NULL) delete [] lphostIndexes;
598  // DRUDE
599 
600  //LCPO
601  if (lcpoParamType != NULL) delete [] lcpoParamType;
602 
603  #ifdef MEM_OPT_VERSION
604  if(eachAtomSig) delete [] eachAtomSig;
605  if(atomSigPool) delete [] atomSigPool;
606  #else
607  if (bonds != NULL)
608  delete [] bonds;
609 
610  if (angles != NULL)
611  delete [] angles;
612 
613  if (dihedrals != NULL)
614  delete [] dihedrals;
615 
616  if (impropers != NULL)
617  delete [] impropers;
618 
619  if (crossterms != NULL)
620  delete [] crossterms;
621 
622  if (exclusions != NULL)
623  delete [] exclusions;
624  #endif
625 
626  if (donors != NULL)
627  delete [] donors;
628 
629  if (acceptors != NULL)
630  delete [] acceptors;
631 
632  #ifdef MEM_OPT_VERSION
633  if(exclSigPool) delete [] exclSigPool;
634  if(exclChkSigPool) delete [] exclChkSigPool;
635  if(eachAtomExclSig) delete [] eachAtomExclSig;
636  if(fixedAtomsSet) delete fixedAtomsSet;
637  if(constrainedAtomsSet) delete constrainedAtomsSet;
638  #else
639  if (bondsByAtom != NULL)
640  delete [] bondsByAtom;
641 
642  if (anglesByAtom != NULL)
643  delete [] anglesByAtom;
644 
645  if (dihedralsByAtom != NULL)
646  delete [] dihedralsByAtom;
647 
648  if (impropersByAtom != NULL)
649  delete [] impropersByAtom;
650 
651  if (crosstermsByAtom != NULL)
652  delete [] crosstermsByAtom;
653 
654  if (exclusionsByAtom != NULL)
655  delete [] exclusionsByAtom;
656 
657  if (fullExclusionsByAtom != NULL)
658  delete [] fullExclusionsByAtom;
659 
660  if (modExclusionsByAtom != NULL)
661  delete [] modExclusionsByAtom;
662 
663  if (all_exclusions != NULL)
664  delete [] all_exclusions;
665 
666  // JLai
667  if (gromacsPairByAtom != NULL)
668  delete [] gromacsPairByAtom;
669  // End of JLai
670 
671  // DRUDE
672  if (tholesByAtom != NULL)
673  delete [] tholesByAtom;
674  if (anisosByAtom != NULL)
675  delete [] anisosByAtom;
676  if (oneFourNbTholesByAtom != NULL)
677  delete[] oneFourNbTholesByAtom;
678  // DRUDE
679  #endif
680 
681  //LCPO
682  if (lcpoParamType != NULL)
683  delete [] lcpoParamType;
684 
685  if (fixedAtomFlags != NULL)
686  delete [] fixedAtomFlags;
687 
688  if (stirIndexes != NULL)
689  delete [] stirIndexes;
690 
691 
692  #ifdef MEM_OPT_VERSION
693  if(clusterSigs != NULL){
694  delete [] clusterSigs;
695  }
696  #else
697  if (cluster != NULL)
698  delete [] cluster;
699  #endif
700  if (clusterSize != NULL)
701  delete [] clusterSize;
702 
703  if (exPressureAtomFlags != NULL)
704  delete [] exPressureAtomFlags;
705 
706  if (rigidBondLengths != NULL)
707  delete [] rigidBondLengths;
708 
709 //fepb
710  if (fepAtomFlags != NULL)
711  delete [] fepAtomFlags;
712  if (alch_unpert_bonds != NULL)
713  delete [] alch_unpert_bonds;
714  if (alch_unpert_angles != NULL)
715  delete [] alch_unpert_angles;
716  if (alch_unpert_dihedrals != NULL)
717  delete [] alch_unpert_dihedrals;
718 //fepe
719 
720 //soluteScaling
721  if (ssAtomFlags != NULL)
722  delete [] ssAtomFlags;
723  if (ss_vdw_type != NULL)
724  delete [] ss_vdw_type;
725  if (ss_index != NULL)
726  delete [] ss_index;
727 //soluteScaling
728 
729  if (qmAtomGroup != NULL)
730  delete [] qmAtomGroup;
731 
732  if (qmAtmIndx != NULL)
733  delete [] qmAtmIndx;
734 
735  if (qmAtmChrg != NULL)
736  delete [] qmAtmChrg;
737 
738 
739  if (qmGrpNumBonds != NULL)
740  delete [] qmGrpNumBonds;
741 
742  if (qmGrpSizes != NULL)
743  delete [] qmGrpSizes;
744 
745  if (qmDummyBondVal != NULL)
746  delete [] qmDummyBondVal;
747 
748  if (qmMMNumTargs != NULL)
749  delete [] qmMMNumTargs;
750 
751  if (qmGrpID != NULL)
752  delete [] qmGrpID;
753 
754  if (qmGrpChrg != NULL)
755  delete [] qmGrpChrg;
756 
757  if (qmGrpMult != NULL)
758  delete [] qmGrpMult;
759 
760  if (qmMeMMindx != NULL)
761  delete [] qmMeMMindx;
762 
763  if (qmMeQMGrp != NULL)
764  delete [] qmMeQMGrp;
765 
766  if (qmLSSSize != NULL)
767  delete [] qmLSSSize;
768 
769  if (qmLSSIdxs != NULL)
770  delete [] qmLSSIdxs;
771 
772  if (qmLSSMass != NULL)
773  delete [] qmLSSMass;
774 
775  if (qmLSSRefSize != NULL)
776  delete [] qmLSSRefSize;
777 
778  if (qmLSSRefIDs != NULL)
779  delete [] qmLSSRefIDs;
780 
781  if (qmLSSRefMass != NULL)
782  delete [] qmLSSRefMass;
783 
784  if (qmMMBond != NULL) {
785  for(int grpIndx = 0 ; grpIndx < qmNumBonds; grpIndx++) {
786  if (qmMMBond[grpIndx] != NULL)
787  delete [] qmMMBond[grpIndx];
788  }
789  delete [] qmMMBond;
790  }
791 
792  if (qmGrpBonds != NULL) {
793  for(int grpIndx = 0 ; grpIndx < qmNumGrps; grpIndx++) {
794  if (qmGrpBonds[grpIndx] != NULL)
795  delete [] qmGrpBonds[grpIndx];
796  }
797  delete [] qmGrpBonds;
798  }
799 
800  if (qmMMBondedIndx != NULL) {
801  for(int grpIndx = 0 ; grpIndx < qmNumGrps; grpIndx++) {
802  if (qmMMBondedIndx[grpIndx] != NULL)
803  delete [] qmMMBondedIndx[grpIndx];
804  }
805  delete [] qmMMBondedIndx;
806  }
807 
808  if (qmMMChargeTarget != NULL) {
809  for(int grpIndx = 0 ; grpIndx < qmNumBonds; grpIndx++) {
810  if (qmMMChargeTarget[grpIndx] != NULL)
811  delete [] qmMMChargeTarget[grpIndx];
812  }
813  delete [] qmMMChargeTarget;
814  }
815 
816  if (qmElementArray != NULL){
817  for(int atmInd = 0 ; atmInd < numAtoms; atmInd++) {
818  if (qmElementArray[atmInd] != NULL)
819  delete [] qmElementArray[atmInd];
820  }
821  delete [] qmElementArray;
822  }
823 
824  if (qmDummyElement != NULL){
825  for(int atmInd = 0 ; atmInd < numAtoms; atmInd++) {
826  if (qmDummyElement[atmInd] != NULL)
827  delete [] qmDummyElement[atmInd];
828  }
829  delete [] qmDummyElement;
830  }
831 
832  if (qmCustPCSizes != NULL){
833  delete [] qmCustPCSizes;
834  }
835 
836  if (qmCustomPCIdxs != NULL){
837  delete [] qmCustomPCIdxs;
838  }
839 
840  if (cSMDindex != NULL) {
841  for(int grpIndx = 0 ; grpIndx < qmNumGrps; grpIndx++) {
842  if (cSMDindex[grpIndx] != NULL)
843  delete [] cSMDindex[grpIndx];
844  }
845  delete [] cSMDindex;
846  }
847 
848  if (cSMDpairs != NULL) {
849  for(int instIndx = 0 ; instIndx < cSMDnumInst; instIndx++) {
850  if (cSMDpairs[instIndx] != NULL)
851  delete [] cSMDpairs[instIndx];
852  }
853  delete [] cSMDpairs;
854  }
855 
856  if (cSMDindxLen != NULL)
857  delete [] cSMDindxLen;
858  if (cSMDKs != NULL)
859  delete [] cSMDKs;
860  if (cSMDVels != NULL)
861  delete [] cSMDVels;
862  if (cSMDcoffs != NULL)
863  delete [] cSMDcoffs;
864 
865  #ifndef MEM_OPT_VERSION
866  delete arena;
867  delete exclArena;
868  #endif
869 }
Angle * alch_unpert_angles
Definition: Molecule.h:606
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:607
Bond * alch_unpert_bonds
Definition: Molecule.h:605
int numAtoms
Definition: Molecule.h:586
int * ss_index
Definition: Molecule.h:487
int * ss_vdw_type
Definition: Molecule.h:486
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313

Member Function Documentation

◆ add_dcd_selection_file()

void Molecule::add_dcd_selection_file ( int  dcdIndex,
char *  userDcdFile 
)

◆ add_dcd_selection_freq()

void Molecule::add_dcd_selection_freq ( int  dcdIndex,
int  freq 
)

◆ atomcharge()

Real Molecule::atomcharge ( int  anum) const
inline

Definition at line 1124 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), NamdState::loadStructure(), Sequencer::reloadCharges(), Sequencer::rescaleSoluteCharges(), colvarproxy_namd::update_atom_properties(), and colvarproxy_namd::update_group_properties().

1125  {
1126  #ifdef MEM_OPT_VERSION
1127  return atomChargePool[eachAtomCharge[anum]];
1128  #else
1129  return(atoms[anum].charge);
1130  #endif
1131  }

◆ atommass()

Real Molecule::atommass ( int  anum) const
inline

Definition at line 1114 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), GlobalMasterEasy::getMass(), GlobalMasterFreeEnergy::getMass(), NamdState::loadStructure(), Tcl_centerOfMass(), Tcl_radiusOfGyration(), colvarproxy_namd::update_atom_properties(), and colvarproxy_namd::update_group_properties().

1115  {
1116  #ifdef MEM_OPT_VERSION
1117  return atomMassPool[eachAtomMass[anum]];
1118  #else
1119  return(atoms[anum].mass);
1120  #endif
1121  }

◆ atoms_1to4()

Bool Molecule::atoms_1to4 ( unsigned int  atom1,
unsigned int  atom2 
)

Definition at line 1538 of file GoMolecule.C.

References bond::atom1, angle::atom1, dihedral::atom1, bond::atom2, angle::atom2, dihedral::atom2, angle::atom3, dihedral::atom3, dihedral::atom4, DebugM, FALSE, get_angle(), get_angles_for_atom(), get_bond(), get_bonds_for_atom(), get_dihedral(), get_dihedrals_for_atom(), and TRUE.

Referenced by build_go_arrays(), build_go_sigmas(), and build_go_sigmas2().

1540 {
1541  int bondNum; // Bonds in bonded list
1542  int angleNum; // Angles in angle list
1543  int dihedralNum; // Dihedrals in dihedral list
1544  int *bonds;
1545  int *angles;
1546  int *dihedrals;
1547  Bond *bond; // Temporary bond structure
1548  Angle *angle; // Temporary angle structure
1549  Dihedral *dihedral; // Temporary dihedral structure
1550 
1551  DebugM(2,"atoms_1to4(" << atom1 << "," << atom2 << ")" << std::endl);
1552 
1553  bonds = get_bonds_for_atom(atom1);
1554  bondNum = *bonds;
1555  while(bondNum != -1) {
1556  bond = get_bond(bondNum);
1557  DebugM(2,"bond atom1:" << bond->atom1 << ", atom2:" << bond->atom2 << std::endl);
1558  if (atom2 == bond->atom1 || atom2 == bond->atom2) {
1559  return TRUE;
1560  }
1561  bondNum = *(++bonds);
1562  }
1563 
1564  bonds = get_bonds_for_atom(atom2);
1565  bondNum = *bonds;
1566  while(bondNum != -1) {
1567  bond = get_bond(bondNum);
1568  DebugM(2,"bond atom1:" << bond->atom1 << ", atom2:" << bond->atom2 << std::endl);
1569  if (atom1 == bond->atom1 || atom1 == bond->atom2) {
1570  return TRUE;
1571  }
1572  bondNum = *(++bonds);
1573  }
1574 
1575  angles = get_angles_for_atom(atom1);
1576  angleNum = *angles;
1577  while(angleNum != -1) {
1578  angle = get_angle(angleNum);
1579  DebugM(2,"angle atom1:" << angle->atom1 << ", atom2:" << angle->atom2 << ", atom3:" << angle->atom3 << std::endl);
1580  if (atom2 == angle->atom1 || atom2 == angle->atom2 || atom2 == angle->atom3) {
1581  return TRUE;
1582  }
1583  angleNum = *(++angles);
1584  }
1585 
1586  angles = get_angles_for_atom(atom2);
1587  angleNum = *angles;
1588  while(angleNum != -1) {
1589  angle = get_angle(angleNum);
1590  DebugM(2,"angle atom1:" << angle->atom1 << ", atom2:" << angle->atom2 << ", atom3:" << angle->atom3 << std::endl);
1591  if (atom1 == angle->atom1 || atom1 == angle->atom2 || atom1 == angle->atom3) {
1592  return TRUE;
1593  }
1594  angleNum = *(++angles);
1595  }
1596 
1597  dihedrals = get_dihedrals_for_atom(atom1);
1598  dihedralNum = *dihedrals;
1599  while(dihedralNum != -1) {
1600  dihedral = get_dihedral(dihedralNum);
1601  DebugM(2,"dihedral atom1:" << dihedral->atom1 << ", atom2:" << dihedral->atom2 << ", atom3:" << dihedral->atom3 << ", atom4:" << dihedral->atom4 << std::endl);
1602  if (atom2 == dihedral->atom1 || atom2 == dihedral->atom2 \
1603  || atom2 == dihedral->atom3 || atom2 == dihedral->atom4) {
1604  return TRUE;
1605  }
1606  dihedralNum = *(++dihedrals);
1607  }
1608 
1609  dihedrals = get_dihedrals_for_atom(atom2);
1610  dihedralNum = *dihedrals;
1611  while(dihedralNum != -1) {
1612  dihedral = get_dihedral(dihedralNum);
1613  DebugM(2,"dihedral atom1:" << dihedral->atom1 << ", atom2:" << dihedral->atom2 << ", atom3:" << dihedral->atom3 << ", atom4:" << dihedral->atom4 << std::endl);
1614  if (atom1 == dihedral->atom1 || atom1 == dihedral->atom2 \
1615  || atom1 == dihedral->atom3 || atom1 == dihedral->atom4) {
1616  return TRUE;
1617  }
1618  dihedralNum = *(++dihedrals);
1619  }
1620 
1621  return FALSE;
1622 }
int32 * get_dihedrals_for_atom(int anum)
Definition: Molecule.h:1224
int32 atom3
Definition: structures.h:67
#define DebugM(x, y)
Definition: Debug.h:75
#define FALSE
Definition: common.h:127
Dihedral * get_dihedral(int dnum) const
Definition: Molecule.h:1150
int32 * get_angles_for_atom(int anum)
Definition: Molecule.h:1222
int32 atom4
Definition: structures.h:68
int32 atom1
Definition: structures.h:50
Angle * get_angle(int anum) const
Definition: Molecule.h:1144
int32 atom2
Definition: structures.h:58
int32 atom1
Definition: structures.h:57
int32 * get_bonds_for_atom(int anum)
Definition: Molecule.h:1220
int32 atom3
Definition: structures.h:59
int32 atom2
Definition: structures.h:66
Bond * get_bond(int bnum) const
Definition: Molecule.h:1141
#define TRUE
Definition: common.h:128
int32 atom1
Definition: structures.h:65
int32 atom2
Definition: structures.h:51

◆ atomvdwtype()

Index Molecule::atomvdwtype ( int  anum) const
inline

Definition at line 1134 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), and dumpbench().

1135  {
1136  return(atoms[anum].vdw_type);
1137  }

◆ build_alch_unpert_bond_lists()

void Molecule::build_alch_unpert_bond_lists ( char *  )

◆ build_constant_forces()

void Molecule::build_constant_forces ( char *  )

◆ build_constorque_params()

void Molecule::build_constorque_params ( StringList ,
StringList ,
StringList ,
StringList ,
StringList ,
StringList ,
PDB ,
char *   
)

◆ build_constraint_params()

void Molecule::build_constraint_params ( StringList ,
StringList ,
StringList ,
PDB ,
char *   
)

◆ build_dcd_selection_list_pdb()

void Molecule::build_dcd_selection_list_pdb ( int  dcdIndex,
char *  userDcdInputFile 
)

◆ build_exPressure_atoms()

void Molecule::build_exPressure_atoms ( StringList ,
StringList ,
PDB ,
char *   
)

◆ build_extra_bonds()

void Molecule::build_extra_bonds ( Parameters parameters,
StringList file 
)

◆ build_fep_flags()

void Molecule::build_fep_flags ( StringList ,
StringList ,
PDB ,
char *  ,
const char *   
)

◆ build_fixed_atoms()

void Molecule::build_fixed_atoms ( StringList ,
StringList ,
PDB ,
char *   
)

◆ build_go_arrays()

void Molecule::build_go_arrays ( StringList goCoordFile,
char *  cwd 
)

goSigmas = new Real[numGoAtoms*numGoAtoms]; goWithinCutoff = new bool[numGoAtoms*numGoAtoms]; for (i=0; i<numGoAtoms; i++) { for (j=0; j<numGoAtoms; j++) { goSigmas[i*numGoAtoms + j] = 0.0; goWithinCutoff[i*numGoAtoms + j] = false; } }

Definition at line 951 of file GoMolecule.C.

References PDB::atom(), atomChainTypes, atoms_1to4(), StringList::data, DebugM, endi(), energyNative, energyNonnative, get_go_cutoff(), go_restricted(), goCoordinates, goPDB, goResids, goSigmaIndices, iINFO(), iout, NAMD_die(), NAMD_FILENAME_BUFFER_SIZE, StringList::next, PDB::num_atoms(), numAtoms, numGoAtoms, PDBAtom::residueseq(), PDBAtom::xcoor(), PDBAtom::ycoor(), and PDBAtom::zcoor().

Referenced by NamdState::loadStructure().

953 {
954  DebugM(3,"->build_go_arrays" << std::endl);
955  //PDB *goPDB; // Pointer to PDB object to use
956  int bcol = 4; // Column that data is in
957  int32 chainType = 0; // b value from PDB file
958  int i; // Loop counter
959  int j; // Loop counter
960  BigReal atomAtomDist; // Distance between two atoms -- JLai put back
961  int resid1; // Residue ID for first atom
962  int resid2; // Residue ID for second atom
963  int residDiff; // Difference between resid1 and resid2
964  int goIndex; // Index into the goCoordinates array
965  int goIndx; // Index into the goCoordinates array
966  char filename[NAMD_FILENAME_BUFFER_SIZE]; // Filename
967 
968  //JLai
969  BigReal nativeEnergy, *native;
970  BigReal nonnativeEnergy, *nonnative;
971  nativeEnergy = 0;
972  nonnativeEnergy = 0;
973  native = &nativeEnergy;
974  nonnative = &nonnativeEnergy;
975 
976  long nativeContacts = 0;
977  long nonnativeContacts = 0;
978 
979  // Get the PDB object that contains the Go coordinates. If
980  // the user gave another file name, use it. Otherwise, just use
981  // the PDB file that has the initial coordinates.
982  if (goCoordFile == NULL)
983  {
984  //goPDB = initial_pdb;
985  NAMD_die("Error: goCoordFile is NULL - build_go_arrays");
986  }
987  else
988  {
989  if (goCoordFile->next != NULL)
990  {
991  NAMD_die("Multiple definitions of Go atoms PDB file in configuration file");
992  }
993 
994  if ( (cwd == NULL) || (goCoordFile->data[0] == '/') )
995  {
996  strcpy(filename, goCoordFile->data);
997  }
998  else
999  {
1000  strcpy(filename, cwd);
1001  strcat(filename, goCoordFile->data);
1002  }
1003 
1004  goPDB = new PDB(filename);
1005  if ( goPDB == NULL )
1006  {
1007  NAMD_die("goPDB memory allocation failed in Molecule::build_go_arrays");
1008  }
1009 
1010  if (goPDB->num_atoms() != numAtoms)
1011  {
1012  NAMD_die("Number of atoms in fixed atoms PDB doesn't match coordinate PDB");
1013  }
1014  }
1015 
1016  // Allocate the array to hold Go atom indices into the sigma array
1017  goSigmaIndices = new int32[numAtoms];
1018 
1019  if (goSigmaIndices == NULL) {
1020  NAMD_die("goSigmaIndices memory allocation failed in Molecule::build_go_arrays");
1021  }
1022 
1023  numGoAtoms = 0;
1024 
1025  // Loop through all the atoms and get the Go chain types
1026  for (i=0; i<numAtoms; i++) {
1027  chainType = (int32)(goPDB->atom(i))->occupancy();
1028  if ( chainType != 0 ) {
1029  DebugM(3,"build_go_arrays - atom:" << i << std::endl);
1031  numGoAtoms++;
1032  }
1033  else {
1034  goSigmaIndices[i] = -1;
1035  }
1036  }
1037 
1038  // Allocate the array to hold the sigma values for each Go atom pair
1050  // Allocate the array to hold the chain types
1052 
1053  if (atomChainTypes == NULL) {
1054  NAMD_die("atomChainTypes memory allocation failed in Molecule::build_go_arrays");
1055  }
1056 
1057  // Allocate the array to hold (x,y,z) coordinates for all of the Go atoms
1058  goCoordinates = new Real[numGoAtoms*3];
1059 
1060  if (goCoordinates == NULL) {
1061  NAMD_die("goCoordinates memory allocation failed in Molecule::build_go_arrays");
1062  }
1063 
1064  goResids = new int[numGoAtoms];
1065 
1066  // Allocate the array to hold PDB residu IDs for all of the Go atoms
1067  if (goResids == NULL) {
1068  NAMD_die("goResids memory allocation failed in Molecule::build_go_arrays");
1069  }
1070 
1071  for (i=0; i<numAtoms; i++) {
1072  goIndex = goSigmaIndices[i];
1073  if (goIndex != -1) {
1074  // Assign the chainType value!
1075  // Get the chainType from the occupancy field
1076  atomChainTypes[goIndex] = (int32)(goPDB->atom(i))->occupancy();
1077  goCoordinates[goIndex*3] = goPDB->atom(i)->xcoor();
1078  goCoordinates[goIndex*3 + 1] = goPDB->atom(i)->ycoor();
1079  goCoordinates[goIndex*3 + 2] = goPDB->atom(i)->zcoor();
1080  goResids[goIndex] = goPDB->atom(i)->residueseq();
1081  }
1082  }
1083  // JLai
1084  energyNative = 0;
1085  energyNonnative = 0;
1086  //printf("INIT ENERGY: (N) %f (NN) %f\n", energyNative, energyNonnative);
1087  for (i=0; i<numAtoms-1; i++) {
1088  goIndex = goSigmaIndices[i];
1089  if (goIndex != -1) {
1090  for (j=i+1; j<numAtoms;j++) {
1091  goIndx = goSigmaIndices[j];
1092  if (goIndx != -1) {
1093  resid1 = (goPDB->atom(i))->residueseq();
1094  resid2 = (goPDB->atom(j))->residueseq();
1095  residDiff = resid2 - resid1;
1096  if (residDiff < 0) residDiff = -residDiff;
1097  if (atomChainTypes[goIndex] && atomChainTypes[goIndx] &&
1098  !(this->go_restricted(atomChainTypes[goIndex],atomChainTypes[goIndx],residDiff)) &&
1099  !atoms_1to4(i,j)) {
1100  atomAtomDist = sqrt(pow((goPDB->atom(i))->xcoor() - (goPDB->atom(j))->xcoor(), 2.0) +
1101  pow((goPDB->atom(i))->ycoor() - (goPDB->atom(j))->ycoor(), 2.0) +
1102  pow((goPDB->atom(i))->zcoor() - (goPDB->atom(j))->zcoor(), 2.0));
1103  if (atomAtomDist <= this->get_go_cutoff(atomChainTypes[goIndex],atomChainTypes[goIndx]) ) {
1104  nativeContacts++;
1105  } else {
1106  nonnativeContacts++;
1107  }
1108  }
1109  }
1110  }
1111  }
1112  }
1113  iout << iINFO << "Number of UNIQUE native contacts: " << nativeContacts << "\n" << endi;
1114  iout << iINFO << "Number of UNIQUE nonnative contacts: " << nonnativeContacts << "\n" << endi;
1115 
1116  // If we had to create a PDB object, delete it now
1117  if (goCoordFile != NULL) {
1118  delete goPDB;
1119  }
1120 
1121  return;
1122 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
Definition: PDB.h:36
PDB * goPDB
Definition: Molecule.h:687
Real * goCoordinates
Definition: Molecule.h:685
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
BigReal zcoor(void)
Definition: PDBData.C:433
#define iout
Definition: InfoStream.h:51
#define NAMD_FILENAME_BUFFER_SIZE
Definition: common.h:45
int num_atoms(void)
Definition: PDB.C:323
int32 * atomChainTypes
Definition: Molecule.h:680
PDBAtom * atom(int place)
Definition: PDB.C:393
BigReal ycoor(void)
Definition: PDBData.C:429
int residueseq(void)
Definition: PDBData.C:411
int * goResids
Definition: Molecule.h:686
BigReal energyNonnative
Definition: Molecule.h:722
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
BigReal xcoor(void)
Definition: PDBData.C:425
StringList * next
Definition: ConfigList.h:49
char * data
Definition: ConfigList.h:48
BigReal energyNative
Definition: Molecule.h:721
Bool atoms_1to4(unsigned int, unsigned int)
Definition: GoMolecule.C:1538
int32 * goSigmaIndices
Definition: Molecule.h:681
int numGoAtoms
Definition: Molecule.h:679
double BigReal
Definition: common.h:123

◆ build_go_params()

void Molecule::build_go_params ( StringList g)

Definition at line 80 of file GoMolecule.C.

References StringList::data, endi(), iINFO(), iout, NAMD_die(), StringList::next, and read_go_file().

Referenced by NamdState::loadStructure().

80  {
81  iout << iINFO << "Building Go Parameters" << "\n" << endi;
82 #ifdef MEM_OPT_VERSION
83  NAMD_die("Go forces are not supported in memory-optimized builds.");
84 #else
85  build_lists_by_atom();
86 #endif
87  int iterator = 0;
88  do
89  {
90  iout << iINFO << "Reading Go File: " << iterator << "\n" << endi;
91  read_go_file(g->data);
92  g = g->next;
93  iterator++;
94  } while ( g != NULL && iterator < 100);
95 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
void read_go_file(char *)
Definition: GoMolecule.C:114
void NAMD_die(const char *err_msg)
Definition: common.C:147
StringList * next
Definition: ConfigList.h:49
char * data
Definition: ConfigList.h:48

◆ build_go_sigmas()

void Molecule::build_go_sigmas ( StringList goCoordFile,
char *  cwd 
)

Definition at line 578 of file GoMolecule.C.

References PDB::atom(), atomChainTypes, atoms_1to4(), StringList::data, DebugM, endi(), get_go_cutoff(), get_go_exp_a(), get_go_exp_b(), go_restricted(), goPDB, goSigmaIndices, goSigmas, goWithinCutoff, iINFO(), iout, NAMD_die(), NAMD_FILENAME_BUFFER_SIZE, StringList::next, PDB::num_atoms(), numAtoms, and numGoAtoms.

Referenced by NamdState::loadStructure().

580 {
581  DebugM(3,"->build_go_sigmas" << std::endl);
582  PDB *goPDB; // Pointer to PDB object to use
583  int bcol = 4; // Column that data is in
584  int32 chainType = 0; // b value from PDB file
585  int i; // Loop counter
586  int j; // Loop counter
587  int resid1; // Residue ID for first atom
588  int resid2; // Residue ID for second atom
589  int residDiff; // Difference between resid1 and resid2
590  Real sigma; // Sigma calculated for a Go atom pair
591  Real atomAtomDist; // Distance between two atoms
592  Real exp_a; // First exponent in L-J like formula
593  Real exp_b; // Second exponent in L-J like formula
594  char filename[NAMD_FILENAME_BUFFER_SIZE]; // Filename
595 
596  //JLai
597  BigReal nativeEnergy, *native;
598  BigReal nonnativeEnergy, *nonnative;
599  nativeEnergy = 0;
600  nonnativeEnergy = 0;
601  native = &nativeEnergy;
602  nonnative = &nonnativeEnergy;
603 
604  long nativeContacts = 0;
605  long nonnativeContacts = 0;
606 
607  // Get the PDB object that contains the Go coordinates. If
608  // the user gave another file name, use it. Otherwise, just use
609  // the PDB file that has the initial coordinates.
610  if (goCoordFile == NULL)
611  {
612  //goPDB = initial_pdb;
613  NAMD_die("Error: goCoordFile is NULL - build_go_sigmas");
614  }
615  else
616  {
617  if (goCoordFile->next != NULL)
618  {
619  NAMD_die("Multiple definitions of Go atoms PDB file in configuration file");
620  }
621 
622  if ( (cwd == NULL) || (goCoordFile->data[0] == '/') )
623  {
624  strcpy(filename, goCoordFile->data);
625  }
626  else
627  {
628  strcpy(filename, cwd);
629  strcat(filename, goCoordFile->data);
630  }
631 
632  goPDB = new PDB(filename);
633  if ( goPDB == NULL )
634  {
635  NAMD_die("Memory allocation failed in Molecule::build_go_sigmas");
636  }
637 
638  if (goPDB->num_atoms() != numAtoms)
639  {
640  NAMD_die("Number of atoms in fixed atoms PDB doesn't match coordinate PDB");
641  }
642  }
643  // Allocate the array to hold the chain types
645  // Allocate the array to hold Go atom indices into the sigma array
647 
648  if (atomChainTypes == NULL) {
649  NAMD_die("memory allocation failed in Molecule::build_go_sigmas");
650  }
651 
652  numGoAtoms = 0;
653 
654  // Loop through all the atoms and get the Go chain types
655  for (i=0; i<numAtoms; i++) {
656  // Get the chainType from the occupancy field
657  chainType = (int32)(goPDB->atom(i))->occupancy();
658  // Assign the chainType value
659  if ( chainType != 0 ) {
660  //DebugM(3,"build_go_sigmas - atom:" << i << ", chainType:" << chainType << std::endl);
661  atomChainTypes[i] = chainType;
663  numGoAtoms++;
664  }
665  else {
666  atomChainTypes[i] = 0;
667  goSigmaIndices[i] = -1;
668  }
669  //printf("CT: %d %d %d %d\n",i,numGoAtoms,atomChainTypes[i],goSigmaIndices[i]);
670  }
671 
672  // Allocate the array to hold the sigma values for each Go atom pair
675  for (i=0; i<numGoAtoms; i++) {
676  for (j=0; j<numGoAtoms; j++) {
677  goSigmas[i*numGoAtoms + j] = -1.0;
678  goWithinCutoff[i*numGoAtoms + j] = false;
679  }
680  }
681  // Loop through all atom pairs and calculate sigmas
682  DebugM(3," numAtoms=" << numAtoms << std::endl);
683  for (i=0; i<numAtoms; i++) {
684  //DebugM(3," i=" << i << std::endl);
685  resid1 = (goPDB->atom(i))->residueseq();
686  //DebugM(3," resid1=" << resid1 << std::endl);
687  //if ( goSigmaIndices[i] != -1) {
688  // goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[i]] = 0.0;
689  //}
690  for (j=i+1; j<numAtoms; j++) {
691  //DebugM(3," j=" << j << std::endl);
692  resid2 = (goPDB->atom(j))->residueseq();
693  //printf("GSIi %d %d %d\n",i,numAtoms,goSigmaIndices[i]);
694  //printf("SAN CHECK: %d\n",goSigmaIndices[37]);
695  //printf("GSIj %d %d %d\n",j,numAtoms,goSigmaIndices[j]);
696  //printf("ATOMS_1to4 %d\n",!atoms_1to4(i,j));
697  //DebugM(3," resid2=" << resid2 << std::endl);
698  // if goSigmaIndices aren't defined, don't set anything in goSigmas
699  if ( goSigmaIndices[i] != -1 && goSigmaIndices[j] != -1 && !atoms_1to4(i,j) ) {
700  //printf("TAKING DIFFERENCE\n");
701  residDiff = resid2 - resid1;
702  //printf("RESIDDIFF %d\n",residDiff);
703  if (residDiff < 0) residDiff = -residDiff;
704  //printf("RESIDDIFF2 %d\n",residDiff);
705  // if this is a Go atom pair that is not restricted
706  // calculate sigma
707  // sigmas are initially set to -1.0 if the atom pair fails go_restricted
708  //printf("CHECKING LOOPING\n");
709  if ( atomChainTypes[i] && atomChainTypes[j] &&
710  !(this->go_restricted(atomChainTypes[i],atomChainTypes[j],residDiff)) ) {
711  atomAtomDist = sqrt(pow((goPDB->atom(i))->xcoor() - (goPDB->atom(j))->xcoor(), 2.0) +
712  pow((goPDB->atom(i))->ycoor() - (goPDB->atom(j))->ycoor(), 2.0) +
713  pow((goPDB->atom(i))->zcoor() - (goPDB->atom(j))->zcoor(), 2.0));
714  if ( atomAtomDist <= this->get_go_cutoff(atomChainTypes[i],atomChainTypes[j]) ) {
715  exp_a = this->get_go_exp_a(atomChainTypes[i],atomChainTypes[j]);
716  exp_b = this->get_go_exp_b(atomChainTypes[i],atomChainTypes[j]);
717  sigma = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
722  nativeContacts++;
723  } else {
726  nonnativeContacts++;
727  }
728  } else {
731  }
732  }
733  }
734  }
735 
736  iout << iINFO << "Number of UNIQUE native contacts: " << nativeContacts << "\n" << endi;
737  iout << iINFO << "Number of UNIQUE nonnative contacts: " << nonnativeContacts << "\n" << endi;
738 
739  // If we had to create a PDB object, delete it now
740  if (goCoordFile != NULL) {
741  delete goPDB;
742  }
743 
744  return;
745 }
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1669
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
Definition: PDB.h:36
PDB * goPDB
Definition: Molecule.h:687
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
bool * goWithinCutoff
Definition: Molecule.h:684
#define iout
Definition: InfoStream.h:51
#define NAMD_FILENAME_BUFFER_SIZE
Definition: common.h:45
int num_atoms(void)
Definition: PDB.C:323
int32 * atomChainTypes
Definition: Molecule.h:680
PDBAtom * atom(int place)
Definition: PDB.C:393
Real * goSigmas
Definition: Molecule.h:683
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1672
StringList * next
Definition: ConfigList.h:49
char * data
Definition: ConfigList.h:48
Bool atoms_1to4(unsigned int, unsigned int)
Definition: GoMolecule.C:1538
int32 * goSigmaIndices
Definition: Molecule.h:681
int numGoAtoms
Definition: Molecule.h:679
double BigReal
Definition: common.h:123

◆ build_go_sigmas2()

void Molecule::build_go_sigmas2 ( StringList goCoordFile,
char *  cwd 
)

Definition at line 748 of file GoMolecule.C.

References go_pair::A, ResizeArray< Elem >::add(), PDB::atom(), atomChainTypes, atoms_1to4(), go_pair::B, ResizeArray< Elem >::begin(), StringList::data, DebugM, ResizeArray< Elem >::end(), endi(), get_go_cutoff(), get_go_exp_a(), get_go_exp_b(), go_restricted(), go_pair::goIndxA, go_pair::goIndxB, goIndxLJA, goIndxLJB, goNumLJPair, goPDB, goResidIndices, goSigmaIndices, goSigmaPairA, goSigmaPairB, iINFO(), iout, NAMD_die(), NAMD_FILENAME_BUFFER_SIZE, StringList::next, PDB::num_atoms(), numAtoms, numGoAtoms, numLJPair, pointerToGoBeg, and pointerToGoEnd.

Referenced by NamdState::loadStructure().

750 {
751  DebugM(3,"->build_go_sigmas2" << std::endl);
752  PDB *goPDB; // Pointer to PDB object to use
753  int bcol = 4; // Column that data is in
754  int32 chainType = 0; // b value from PDB file
755  int32 residType = 0; // resid value from PDB file
756  int i; // Loop counter
757  int j; // Loop counter
758  int resid1; // Residue ID for first atom
759  int resid2; // Residue ID for second atom
760  int residDiff; // Difference between resid1 and resid2
761  Real sigma; // Sigma calculated for a Go atom pair
762  Real atomAtomDist; // Distance between two atoms
763  Real exp_a; // First exponent in L-J like formula
764  Real exp_b; // Second exponent in L-J like formula
765  char filename[NAMD_FILENAME_BUFFER_SIZE]; // Filename
766 
767  //JLai
768  int numLJPair = 0;
769  long nativeContacts = 0;
770  long nonnativeContacts = 0;
771 
772  // Get the PDB object that contains the Go coordinates. If
773  // the user gave another file name, use it. Otherwise, just use
774  // the PDB file that has the initial coordinates.
775  if (goCoordFile == NULL)
776  {
777  //goPDB = initial_pdb;
778  NAMD_die("Error: goCoordFile is NULL - build_go_sigmas2");
779  }
780  else
781  {
782  if (goCoordFile->next != NULL)
783  {
784  NAMD_die("Multiple definitions of Go atoms PDB file in configuration file");
785  }
786 
787  if ( (cwd == NULL) || (goCoordFile->data[0] == '/') )
788  {
789  strcpy(filename, goCoordFile->data);
790  }
791  else
792  {
793  strcpy(filename, cwd);
794  strcat(filename, goCoordFile->data);
795  }
796 
797  goPDB = new PDB(filename);
798  if ( goPDB == NULL )
799  {
800  NAMD_die("Memory allocation failed in Molecule::build_go_sigmas2");
801  }
802 
803  if (goPDB->num_atoms() != numAtoms)
804  {
805  NAMD_die("Number of atoms in fixed atoms PDB doesn't match coordinate PDB");
806  }
807  }
808  // Allocate the array to hold the chain types
810  // Allocate the array to hold Go atom indices into the sigma array
812  // Allocate the array to hold resid
814 
815  if (atomChainTypes == NULL) {
816  NAMD_die("memory allocation failed in Molecule::build_go_sigmas2");
817  }
818 
819  numGoAtoms = 0;
820 
821  // Loop through all the atoms and get the Go chain types
822  for (i=0; i<numAtoms; i++) {
823  // Get the chainType from the occupancy field
824  chainType = (int32)(goPDB->atom(i))->occupancy();
825  // Get the resid from the resid field
826  residType = (int32)(goPDB->atom(i))->residueseq();
827  // Assign the chainType value
828  if ( chainType != 0 ) {
829  //DebugM(3,"build_go_sigmas2 - atom:" << i << ", chainType:" << chainType << std::endl);
830  atomChainTypes[i] = chainType;
832  goResidIndices[i] = residType;
833  numGoAtoms++;
834  }
835  else {
836  atomChainTypes[i] = 0;
837  goSigmaIndices[i] = -1;
838  goResidIndices[i] = -1;
839  }
840  }
841 
842  //Define:
843  ResizeArray<GoPair> tmpGoPair;
844 
845  // Loop through all atom pairs and calculate sigmas
846  // Store sigmas into sorted array
847  DebugM(3," numAtoms=" << numAtoms << std::endl);
848  for (i=0; i<numAtoms; i++) {
849  resid1 = (goPDB->atom(i))->residueseq();
850  for (j=i+1; j<numAtoms; j++) {
851  resid2 = (goPDB->atom(j))->residueseq();
852  if ( goSigmaIndices[i] != -1 && goSigmaIndices[j] != -1 && !atoms_1to4(i,j) ) {
853  residDiff = resid2 - resid1;
854  if (residDiff < 0) residDiff = -residDiff;
855  if ( atomChainTypes[i] && atomChainTypes[j] &&
856  !(this->go_restricted(atomChainTypes[i],atomChainTypes[j],residDiff)) ) {
857  atomAtomDist = sqrt(pow((goPDB->atom(i))->xcoor() - (goPDB->atom(j))->xcoor(), 2.0) +
858  pow((goPDB->atom(i))->ycoor() - (goPDB->atom(j))->ycoor(), 2.0) +
859  pow((goPDB->atom(i))->zcoor() - (goPDB->atom(j))->zcoor(), 2.0));
860  if ( atomAtomDist <= this->get_go_cutoff(atomChainTypes[i],atomChainTypes[j]) ) {
861  exp_a = this->get_go_exp_a(atomChainTypes[i],atomChainTypes[j]);
862  exp_b = this->get_go_exp_b(atomChainTypes[i],atomChainTypes[j]);
863  sigma = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
864  double tmpA = pow(sigma,exp_a);
865  double tmpB = pow(sigma,exp_b);
866  GoPair gp;
867  GoPair gp2;
868  gp.goIndxA = i;
869  gp.goIndxB = j;
870  gp.A = tmpA;
871  gp.B = tmpB;
872  tmpGoPair.add(gp);
873  gp2.goIndxA = j;
874  gp2.goIndxB = i;
875  gp2.A = tmpA;
876  gp2.B = tmpB;
877  tmpGoPair.add(gp2);
878  nativeContacts++;
879  } else {
880  nonnativeContacts++;
881  }
882  }
883  }
884  }
885  }
886 
887  iout << iINFO << "Number of UNIQUE native contacts: " << nativeContacts << "\n" << endi;
888  iout << iINFO << "Number of UNIQUE nonnative contacts: " << nonnativeContacts << "\n" << endi;
889 
890  // Copies the resizeArray into a block of continuous memory
891  std::sort(tmpGoPair.begin(),tmpGoPair.end(),goPairCompare);
892  goNumLJPair = 2*nativeContacts;
893  goIndxLJA = new int[goNumLJPair];
894  goIndxLJB = new int[goNumLJPair];
895  goSigmaPairA = new double[goNumLJPair];
896  goSigmaPairB = new double[goNumLJPair];
897  for(i=0; i< goNumLJPair; i++) {
898  goIndxLJA[i] = tmpGoPair[i].goIndxA;
899  goIndxLJB[i] = tmpGoPair[i].goIndxB;
900  goSigmaPairA[i] = tmpGoPair[i].A;
901  goSigmaPairB[i] = tmpGoPair[i].B;
902  }
903 
904  pointerToGoBeg = new int[numAtoms];
905  pointerToGoEnd = new int[numAtoms];
906  int oldIndex = -1;
907  for(i=0; i<numAtoms; i++) {
908  pointerToGoBeg[i] = -1;
909  pointerToGoEnd[i] = -2;
910  }
911  for(i=0; i < goNumLJPair; i++) {
912  if(pointerToGoBeg[goIndxLJA[i]] == -1) {
913  pointerToGoBeg[goIndxLJA[i]] = i;
914  oldIndex = goIndxLJA[i];
915  }
916  pointerToGoEnd[oldIndex] = i;
917  }
918 
919  // If we had to create a PDB object, delete it now
920  if (goCoordFile != NULL) {
921  delete goPDB;
922  }
923 
924  return;
925 }
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1669
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
Definition: PDB.h:36
double A
Definition: Molecule.h:120
int * pointerToGoBeg
Definition: Molecule.h:694
PDB * goPDB
Definition: Molecule.h:687
int goIndxB
Definition: Molecule.h:119
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
double * goSigmaPairA
Definition: Molecule.h:692
#define iout
Definition: InfoStream.h:51
#define NAMD_FILENAME_BUFFER_SIZE
Definition: common.h:45
int num_atoms(void)
Definition: PDB.C:323
int add(const Elem &elem)
Definition: ResizeArray.h:101
int32 * atomChainTypes
Definition: Molecule.h:680
double B
Definition: Molecule.h:121
int goIndxA
Definition: Molecule.h:118
int * pointerToGoEnd
Definition: Molecule.h:695
int * goIndxLJA
Definition: Molecule.h:690
PDBAtom * atom(int place)
Definition: PDB.C:393
int goNumLJPair
Definition: Molecule.h:689
int32 * goResidIndices
Definition: Molecule.h:682
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:693
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1672
StringList * next
Definition: ConfigList.h:49
iterator begin(void)
Definition: ResizeArray.h:36
char * data
Definition: ConfigList.h:48
iterator end(void)
Definition: ResizeArray.h:37
Bool atoms_1to4(unsigned int, unsigned int)
Definition: GoMolecule.C:1538
int32 * goSigmaIndices
Definition: Molecule.h:681
int * goIndxLJB
Definition: Molecule.h:691
int numGoAtoms
Definition: Molecule.h:679
int numLJPair
Definition: Molecule.h:698

◆ build_gridforce_params()

void Molecule::build_gridforce_params ( StringList gridfrcfile,
StringList gridfrccol,
StringList gridfrcchrgcol,
StringList potfile,
PDB initial_pdb,
char *  cwd 
)

Definition at line 6607 of file Molecule.C.

References PDB::atom(), DebugM, endi(), MGridforceParams::gridforceCol, MGridforceParams::gridforceFile, MGridforceParams::gridforceQcol, MGridforceParams::gridforceVfile, iout, iWARN(), NAMD_die(), NAMD_FILENAME_BUFFER_SIZE, GridforceGrid::new_grid(), MGridforceParams::next, PDB::num_atoms(), and simParams.

Referenced by NamdState::loadStructure().

6613 {
6614  PDB *kPDB;
6615  register int i; // Loop counters
6616  register int j;
6617  register int k;
6618 
6619  DebugM(3, "Entered build_gridforce_params multi...\n");
6620 // DebugM(3, "\tgridfrcfile = " << gridfrcfile->data << endi);
6621 // DebugM(3, "\tgridfrccol = " << gridfrccol->data << endi);
6622 
6623  MGridforceParams* mgridParams = simParams->mgridforcelist.get_first();
6624  numGridforceGrids = 0;
6625  while (mgridParams != NULL) {
6627  mgridParams = mgridParams->next;
6628  }
6629 
6630  DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
6631  gridfrcIndexes = new int32*[numGridforceGrids];
6632  gridfrcParams = new GridforceParams*[numGridforceGrids];
6633  gridfrcGrid = new GridforceGrid*[numGridforceGrids];
6634  numGridforces = new int[numGridforceGrids];
6635 
6636  int grandTotalGrids = 0; // including all subgrids
6637 
6638  mgridParams = simParams->mgridforcelist.get_first();
6639  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
6640  int current_index=0; // Index into values used
6641  int kcol = 5; // Column to look for force constant in
6642  int qcol = 0; // Column for charge (default 0: use electric charge)
6643  Real kval = 0; // Force constant value retreived
6644  char filename[NAMD_FILENAME_BUFFER_SIZE]; // PDB filename
6645  char potfilename[NAMD_FILENAME_BUFFER_SIZE]; // Potential file name
6646 
6647  if (mgridParams == NULL) {
6648  NAMD_die("Problem with mgridParams!");
6649  }
6650 
6651  // Now load values from mgridforcelist object
6652  if (mgridParams->gridforceFile == NULL)
6653  {
6654  if ( ! initial_pdb ) NAMD_die("Initial PDB file unavailable, gridforceFile required.");
6655  kPDB = initial_pdb;
6656  }
6657  else
6658  {
6659  DebugM(4, "mgridParams->gridforceFile = " << mgridParams->gridforceFile << "\n" << endi);
6660 
6661  if ( (cwd == NULL) || (mgridParams->gridforceFile[0] == '/') )
6662  {
6663  strcpy(filename, mgridParams->gridforceFile);
6664  }
6665  else
6666  {
6667  strcpy(filename, cwd);
6668  strcat(filename, mgridParams->gridforceFile);
6669  }
6670 
6671  kPDB = new PDB(filename);
6672  if ( kPDB == NULL )
6673  {
6674  NAMD_die("Memory allocation failed in Molecule::build_gridforce_params");
6675  }
6676 
6677  if (kPDB->num_atoms() != numAtoms)
6678  {
6679  NAMD_die("Number of atoms in grid force PDB doesn't match coordinate PDB");
6680  }
6681  }
6682 
6683  // Get the column that the force constant is going to be in. It
6684  // can be in any of the 5 floating point fields in the PDB, according
6685  // to what the user wants. The allowable fields are X, Y, Z, O, or
6686  // B which correspond to the 1st, 2nd, ... 5th floating point fields.
6687  // The default is the 5th field, which is beta (temperature factor)
6688  if (mgridParams->gridforceCol == NULL)
6689  {
6690  kcol = 5;
6691  }
6692  else
6693  {
6694  if (strcasecmp(mgridParams->gridforceCol, "X") == 0)
6695  {
6696  kcol=1;
6697  }
6698  else if (strcasecmp(mgridParams->gridforceCol, "Y") == 0)
6699  {
6700  kcol=2;
6701  }
6702  else if (strcasecmp(mgridParams->gridforceCol, "Z") == 0)
6703  {
6704  kcol=3;
6705  }
6706  else if (strcasecmp(mgridParams->gridforceCol, "O") == 0)
6707  {
6708  kcol=4;
6709  }
6710  else if (strcasecmp(mgridParams->gridforceCol, "B") == 0)
6711  {
6712  kcol=5;
6713  }
6714  else
6715  {
6716  NAMD_die("gridforcecol must have value of X, Y, Z, O, or B");
6717  }
6718  }
6719 
6720  // Get the column that the charge is going to be in.
6721  if (mgridParams->gridforceQcol == NULL)
6722  {
6723  qcol = 0; // Default: don't read charge from file, use electric charge
6724  }
6725  else
6726  {
6727  if (strcasecmp(mgridParams->gridforceQcol, "X") == 0)
6728  {
6729  qcol=1;
6730  }
6731  else if (strcasecmp(mgridParams->gridforceQcol, "Y") == 0)
6732  {
6733  qcol=2;
6734  }
6735  else if (strcasecmp(mgridParams->gridforceQcol, "Z") == 0)
6736  {
6737  qcol=3;
6738  }
6739  else if (strcasecmp(mgridParams->gridforceQcol, "O") == 0)
6740  {
6741  qcol=4;
6742  }
6743  else if (strcasecmp(mgridParams->gridforceQcol, "B") == 0)
6744  {
6745  qcol=5;
6746  }
6747  else
6748  {
6749  NAMD_die("gridforcechargecol must have value of X, Y, Z, O, or B");
6750  }
6751  }
6752 
6753  if (kcol == qcol) {
6754  NAMD_die("gridforcecol and gridforcechargecol cannot have same value");
6755  }
6756 
6757 
6758  // Allocate an array that will store an index into the constraint
6759  // parameters for each atom. If the atom is not constrained, its
6760  // value will be set to -1 in this array.
6761  gridfrcIndexes[gridnum] = new int32[numAtoms];
6762 
6763  if (gridfrcIndexes[gridnum] == NULL)
6764  {
6765  NAMD_die("memory allocation failed in Molecule::build_gridforce_params()");
6766  }
6767 
6768  // Loop through all the atoms and find out which ones are constrained
6769  for (i=0; i<numAtoms; i++)
6770  {
6771  // Get the k value based on where we were told to find it
6772  switch (kcol)
6773  {
6774  case 1:
6775  kval = (kPDB->atom(i))->xcoor();
6776  break;
6777  case 2:
6778  kval = (kPDB->atom(i))->ycoor();
6779  break;
6780  case 3:
6781  kval = (kPDB->atom(i))->zcoor();
6782  break;
6783  case 4:
6784  kval = (kPDB->atom(i))->occupancy();
6785  break;
6786  case 5:
6787  kval = (kPDB->atom(i))->temperaturefactor();
6788  break;
6789  }
6790 
6791  if (kval > 0.0)
6792  {
6793  // This atom is constrained
6794  gridfrcIndexes[gridnum][i] = current_index;
6795  current_index++;
6796  }
6797  else
6798  {
6799  // This atom is not constrained
6800  gridfrcIndexes[gridnum][i] = -1;
6801  }
6802  }
6803 
6804  if (current_index == 0)
6805  {
6806  // Constraints were turned on, but there weren't really any constrained
6807  iout << iWARN << "NO GRIDFORCE ATOMS WERE FOUND, BUT GRIDFORCE IS ON . . .\n" << endi;
6808  }
6809  else
6810  {
6811  // Allocate an array to hold the constraint parameters
6812  gridfrcParams[gridnum] = new GridforceParams[current_index];
6813  if (gridfrcParams[gridnum] == NULL)
6814  {
6815  NAMD_die("memory allocation failed in Molecule::build_gridforce_params");
6816  }
6817  }
6818 
6819  numGridforces[gridnum] = current_index;
6820 
6821  // Loop through all the atoms and assign the parameters for those
6822  // that are constrained
6823  for (i=0; i<numAtoms; i++)
6824  {
6825  if (gridfrcIndexes[gridnum][i] != -1)
6826  {
6827  // This atom has grid force, so get the k value again
6828  switch (kcol)
6829  {
6830  case 1:
6831  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->xcoor();
6832  break;
6833  case 2:
6834  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->ycoor();
6835  break;
6836  case 3:
6837  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->zcoor();
6838  break;
6839  case 4:
6840  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->occupancy();
6841  break;
6842  case 5:
6843  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->temperaturefactor();
6844  break;
6845  }
6846 
6847  // Also get charge column
6848  switch (qcol)
6849  {
6850  case 0:
6851 #ifdef MEM_OPT_VERSION
6852  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atomChargePool[eachAtomCharge[i]];
6853 #else
6854  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atoms[i].charge;
6855 #endif
6856  break;
6857  case 1:
6858  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->xcoor();
6859  break;
6860  case 2:
6861  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->ycoor();
6862  break;
6863  case 3:
6864  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->zcoor();
6865  break;
6866  case 4:
6867  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->occupancy();
6868  break;
6869  case 5:
6870  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->temperaturefactor();
6871  break;
6872  }
6873  }
6874  }
6875 
6876  // If we had to create new PDB objects, delete them now
6877  if (mgridParams->gridforceFile != NULL)
6878  {
6879  delete kPDB;
6880  }
6881 
6882  // Now we fill in our grid information
6883 
6884  // Open potential file
6885  if ( (cwd == NULL) || (mgridParams->gridforceVfile[0] == '/') )
6886  {
6887  strcpy(potfilename, mgridParams->gridforceVfile);
6888  }
6889  else
6890  {
6891  strcpy(potfilename, cwd);
6892  strcat(potfilename, mgridParams->gridforceVfile);
6893  }
6894 
6895 // iout << iINFO << "Allocating grid " << gridnum
6896 // << "\n" << endi;
6897 
6898  DebugM(3, "allocating GridforceGrid(" << gridnum << ")\n");
6899  gridfrcGrid[gridnum] = GridforceGrid::new_grid(gridnum, potfilename, simParams, mgridParams);
6900 
6901  grandTotalGrids++;
6902  DebugM(4, "grandTotalGrids = " << grandTotalGrids << "\n" << endi);
6903 
6904  // Finally, get next mgridParams pointer
6905  mgridParams = mgridParams->next;
6906  }
6907 }
Definition: PDB.h:36
static GridforceGrid * new_grid(int gridnum, char *potfilename, SimParameters *simParams, MGridforceParams *mgridParams)
Definition: GridForceGrid.C:34
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numGridforceGrids
Definition: Molecule.h:626
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
#define iout
Definition: InfoStream.h:51
#define NAMD_FILENAME_BUFFER_SIZE
Definition: common.h:45
int num_atoms(void)
Definition: PDB.C:323
MGridforceParams * get_first()
PDBAtom * atom(int place)
Definition: PDB.C:393
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
MGridforceParamsList mgridforcelist
MGridforceParams * next
int * numGridforces
Definition: Molecule.h:627

◆ build_gro_pair()

void Molecule::build_gro_pair ( )

◆ build_langevin_params() [1/2]

void Molecule::build_langevin_params ( BigReal  coupling,
BigReal  drudeCoupling,
Bool  doHydrogen 
)

◆ build_langevin_params() [2/2]

void Molecule::build_langevin_params ( StringList ,
StringList ,
PDB ,
char *   
)

◆ build_molecule()

void Molecule::build_molecule ( )

Definition at line 3303 of file Molecule.C.

References LARGEMOLTH, and sizeColumn().

Referenced by NamdState::loadStructure().

3304 {
3305  int i, j; // Loop counter
3306  //tmpArena = new ObjectArena<int32>;
3307  //atomsInMolecule = new int32 *[numAtoms];
3308 
3309  //store the atom index that are bonded with each atom
3310  vector<vector<int> > atomBonds(numAtoms);
3311  for (i = 0; i < numRealBonds; i++) {
3312  int a = bonds[i].atom1;
3313  int b = bonds[i].atom2;
3314  atomBonds[a].push_back(b);
3315  atomBonds[b].push_back(a);
3316  }
3317 
3318  vector<int> atomsInMolecules(numAtoms, -1);
3319  int molNumber = 0;
3320  for (i = 0; i < numAtoms; i++) {
3321  if (atomsInMolecules[i] == -1) {
3322  vector<int> atomList, neighborList;
3323  atomList.push_back(i);
3324  neighborList.push_back(0);
3325  int currentMolecule = molNumber++;
3326 
3327  while (atomList.size() > 0) {
3328  int particle = atomList.back();
3329  atomsInMolecules[particle] = currentMolecule;
3330  int& neighbor = neighborList.back();
3331  while (neighbor < atomBonds[particle].size() && atomsInMolecules[atomBonds[particle][neighbor]] != -1) {
3332  neighbor++;
3333  }
3334 
3335  if (neighbor < atomBonds[particle].size()) {
3336  atomList.push_back(atomBonds[particle][neighbor]);
3337  neighborList.push_back(0);
3338  } else {
3339  atomList.pop_back();
3340  neighborList.pop_back();
3341  }
3342  }
3343  }
3344  }
3345 
3346  numMolecules = molNumber;
3347  // Create a 2D vector to store the index of atoms in each molecule.
3348  vector<vector<int> > molecules(numMolecules);
3349  for (i = 0; i < numAtoms; i++) {
3350  molecules[atomsInMolecules[i]].push_back(i);
3351  }
3352 
3353  // sort the molecule in descending order, so molecules with larger
3354  // atom size come first.
3355  sort(molecules.begin(), molecules.end(), sizeColumn);
3356  // Need the number of large molecule for GPU work schedule
3357  // Determin the number of larg molecule with atom > LARGEMOLTH
3358  numLargeMolecules = 0;
3359  for (i = 0; i < numMolecules; i++){
3360  if(molecules[i].size() > LARGEMOLTH) {
3362  } else {
3363  // since we sorted the molecule based on their size, we can
3364  // break
3365  break;
3366  }
3367  }
3368 
3369  // store the atoms in molecule in two array.
3370  // moleculeAtom stores the atom index of all molecule, linearly
3371  // moleculeStartIndex stores the starting index of each molecule
3372  int index = 0;
3374  moleculeAtom = new int32[numAtoms];
3375 
3376  for (i = 0; i < numMolecules; i++) {
3377  moleculeStartIndex[i] = index;
3378  for (j = 0; j < molecules[i].size(); j++) {
3379  moleculeAtom[index++] = molecules[i][j];
3380  }
3381  }
3382  //store the last molecule index
3384 
3385 #if 0
3386  printf("Number of Molecule with atom greater than %5d: %5d \n: ", LARGEMOLTH, numLargeMolecules);
3387  for (i = 0; i < numMolecules; i++) {
3388  int startIdx = moleculeStartIndex[i];
3389  int endIdx = moleculeStartIndex[i+1];
3390  printf("Molecule Idx %5d: ", i);
3391  for (j = startIdx; j < endIdx; j++) {
3392  int atom = moleculeAtom[j];
3393  printf("%7d ", atom);
3394  }
3395  printf("\n");
3396  }
3397 #endif
3398 }
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:622
int32_t int32
Definition: common.h:38
int numRealBonds
Definition: Molecule.h:588
int32 atom1
Definition: structures.h:50
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:620
int numMolecules
Number of 1-4 atom pairs with NBThole defined.
Definition: Molecule.h:619
int numAtoms
Definition: Molecule.h:586
#define LARGEMOLTH
Definition: Molecule.h:142
int sizeColumn(const vector< int > &v1, const vector< int > &v2)
Definition: Molecule.C:3298
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:621
int32 atom2
Definition: structures.h:51

◆ build_movdrag_params()

void Molecule::build_movdrag_params ( StringList ,
StringList ,
StringList ,
PDB ,
char *   
)

◆ build_rotdrag_params()

void Molecule::build_rotdrag_params ( StringList ,
StringList ,
StringList ,
StringList ,
StringList ,
StringList ,
PDB ,
char *   
)

◆ build_ss_flags()

void Molecule::build_ss_flags ( const StringList ssfile,
const StringList sscol,
PDB initial_pdb,
const char *  cwd 
)

Build the flags needed for solute scaling.

A PDB file is read, indicating which atoms are to be scaled, and an array is maintained marking which are to be included. Each marked atom then has its corresponding van der Waals type number reassigned to enable extending the LJTable with scaled interaction values.

Parameters
ssfileconfig "soluteScalingFile = my.pdb" for PDB filename
sscolconfig "soluteScalingCol = O" for column of PDB ATOM records
initial_pdbthe initial PDB file
cwdcurrent working directory

Referenced by NamdState::loadStructure().

◆ build_stirred_atoms()

void Molecule::build_stirred_atoms ( StringList ,
StringList ,
PDB ,
char *   
)

◆ checkexcl()

int Molecule::checkexcl ( int  atom1,
int  atom2 
) const

◆ compute_LJcorrection()

void Molecule::compute_LJcorrection ( )

◆ compute_LJcorrection_alternative()

void Molecule::compute_LJcorrection_alternative ( )

◆ delete_alch_bonded()

void Molecule::delete_alch_bonded ( void  )

◆ delete_qm_bonded()

void Molecule::delete_qm_bonded ( void  )

Definition at line 1579 of file MoleculeQM.C.

References bond::atom1, angle::atom1, dihedral::atom1, improper::atom1, crossterm::atom1, DebugM, endi(), SimParameters::extraBondsOn, iERROR(), iINFO(), iout, NAMD_die(), numAngles, numBonds, numCrossterms, numDihedrals, numImpropers, and numRealBonds.

1579  {
1580 
1581 #ifdef MEM_OPT_VERSION
1582  NAMD_die("QMMM interface is not supported in memory optimized builds.");
1583 #else
1584 
1585  DebugM(3,"Cleaning QM bonds, angles, dihedrals, impropers and crossterms.\n")
1586 
1587  // Bonds
1588  Bond *nonQMBonds;
1589  nonQMBonds = new Bond[numBonds] ;
1590  int nonQMBondCount = 0;
1591  qmDroppedBonds = 0;
1592  for (int i = 0; i < numBonds; i++) {
1593 
1594  int part1 = qmAtomGroup[bonds[i].atom1];
1595  int part2 = qmAtomGroup[bonds[i].atom2];
1596  if (part1 > 0 && part2 > 0 ) {
1597 
1598  // If the user defined extra bonds, we check if the QM-QM bond is an "extra"
1599  // bond, and do not delete it.
1600  if (simParams->extraBondsOn) {
1601 // std::cout << "Checking Bond: " << bonds[i].atom1 << "," << bonds[i].atom2 << std::endl ;
1602 
1603  for (int ebi=0; ebi < qmExtraBonds.size() ; ebi++) {
1604 
1605  if( (qmExtraBonds[ebi].atom1 == bonds[i].atom1 ||
1606  qmExtraBonds[ebi].atom1 == bonds[i].atom2) &&
1607  (qmExtraBonds[ebi].atom2 == bonds[i].atom1 ||
1608  qmExtraBonds[ebi].atom2 == bonds[i].atom2) ) {
1609 // std::cout << "This is an extra bond! We will keep it." << std::endl;
1610  nonQMBonds[nonQMBondCount++] = bonds[i];
1611  break;
1612  }
1613  }
1614  }
1615 
1616  qmDroppedBonds++;
1617  } else {
1618  // Just a simple sanity check.
1619  // If there are no QM bonds defined by the user but we find a
1620  // bond between a QM and an MM atom, error out.
1621  if ((part1 > 0 || part2 > 0) && qmNumBonds == 0) {
1622  iout << iERROR << " Atoms " << bonds[i].atom1
1623  << " and " << bonds[i].atom2 << " form a QM-MM bond!\n" << endi ;
1624  NAMD_die("No QM-MM bonds were defined by the user, but one was found.");
1625  }
1626  nonQMBonds[nonQMBondCount++] = bonds[i];
1627  }
1628  }
1629  numBonds = nonQMBondCount;
1630  delete [] bonds;
1631  bonds = new Bond[numBonds];
1632  for (int i = 0; i < nonQMBondCount; i++) {
1633  bonds[i]=nonQMBonds[i];
1634  }
1635  delete [] nonQMBonds;
1637 
1638  // Angles
1639  Angle *nonQMAngles;
1640  nonQMAngles = new Angle[numAngles];
1641  int nonQMAngleCount = 0;
1642  qmDroppedAngles = 0;
1643  for (int i = 0; i < numAngles; i++) {
1644  int part1 = qmAtomGroup[angles[i].atom1];
1645  int part2 = qmAtomGroup[angles[i].atom2];
1646  int part3 = qmAtomGroup[angles[i].atom3];
1647  if (part1 > 0 && part2 > 0 && part3 > 0) {
1648  //CkPrintf("-----ANGLE ATOMS %i %i %i partitions %i %i %i\n",angles[i].atom1, angles[i].atom2, angles[i].atom3, part1, part2, part3);
1649  qmDroppedAngles++;
1650  }
1651  else {
1652  nonQMAngles[nonQMAngleCount++] = angles[i];
1653  }
1654  }
1655  numAngles = nonQMAngleCount;
1656  delete [] angles;
1657  angles = new Angle[numAngles];
1658  for (int i = 0; i < nonQMAngleCount; i++) {
1659  angles[i]=nonQMAngles[i];
1660  }
1661  delete [] nonQMAngles;
1662 
1663 
1664  // Dihedrals
1665  Dihedral *nonQMDihedrals;
1666  nonQMDihedrals = new Dihedral[numDihedrals];
1667  int nonQMDihedralCount = 0;
1668  qmDroppedDihedrals = 0;
1669  for (int i = 0; i < numDihedrals; i++) {
1670  int part1 = qmAtomGroup[dihedrals[i].atom1];
1671  int part2 = qmAtomGroup[dihedrals[i].atom2];
1672  int part3 = qmAtomGroup[dihedrals[i].atom3];
1673  int part4 = qmAtomGroup[dihedrals[i].atom4];
1674  if (part1 > 0 && part2 > 0 && part3 > 0 && part4 > 0) {
1675  //CkPrintf("-----i %i DIHEDRAL ATOMS %i %i %i %i partitions %i %i %i %i\n",i,dihedrals[i].atom1, dihedrals[i].atom2, dihedrals[i].atom3, dihedrals[i].atom4, part1, part2, part3,part4);
1676  qmDroppedDihedrals++;
1677  }
1678  else {
1679  nonQMDihedrals[nonQMDihedralCount++] = dihedrals[i];
1680  }
1681  }
1682  numDihedrals = nonQMDihedralCount;
1683  delete [] dihedrals;
1684  dihedrals = new Dihedral[numDihedrals];
1685  for (int i = 0; i < numDihedrals; i++) {
1686  dihedrals[i]=nonQMDihedrals[i];
1687  }
1688  delete [] nonQMDihedrals;
1689 
1690  // Impropers
1691  Improper *nonQMImpropers;
1692  nonQMImpropers = new Improper[numImpropers];
1693  int nonQMImproperCount = 0;
1694  qmDroppedImpropers = 0;
1695  for (int i = 0; i < numImpropers; i++) {
1696  int part1 = qmAtomGroup[impropers[i].atom1];
1697  int part2 = qmAtomGroup[impropers[i].atom2];
1698  int part3 = qmAtomGroup[impropers[i].atom3];
1699  int part4 = qmAtomGroup[impropers[i].atom4];
1700  if (part1 > 0 && part2 > 0 && part3 > 0 && part4 > 0) {
1701  //CkPrintf("-----i %i IMPROPER ATOMS %i %i %i %i partitions %i %i %i %i\n",i,impropers[i].atom1, impropers[i].atom2, impropers[i].atom3, impropers[i].atom4, part1, part2, part3,part4);
1702  qmDroppedImpropers++;
1703  }
1704  else {
1705  nonQMImpropers[nonQMImproperCount++] = impropers[i];
1706  }
1707  }
1708  numImpropers = nonQMImproperCount;
1709  delete [] impropers;
1710  impropers = new Improper[numImpropers];
1711  for (int i = 0; i < numImpropers; i++) {
1712  impropers[i]=nonQMImpropers[i];
1713  }
1714  delete [] nonQMImpropers;
1715 
1716  // Crossterms
1717  Crossterm *nonQMCrossterms;
1718  nonQMCrossterms = new Crossterm[numCrossterms];
1719  int nonQMCrosstermCount = 0;
1720  qmDroppedCrossterms = 0 ;
1721  for (int i = 0; i < numCrossterms; i++) {
1722  int part1 = qmAtomGroup[crossterms[i].atom1];
1723  int part2 = qmAtomGroup[crossterms[i].atom2];
1724  int part3 = qmAtomGroup[crossterms[i].atom3];
1725  int part4 = qmAtomGroup[crossterms[i].atom4];
1726  int part5 = qmAtomGroup[crossterms[i].atom5];
1727  int part6 = qmAtomGroup[crossterms[i].atom6];
1728  int part7 = qmAtomGroup[crossterms[i].atom7];
1729  int part8 = qmAtomGroup[crossterms[i].atom8];
1730  if (part1 > 0 && part2 > 0 && part3 > 0 && part4 > 0 &&
1731  part5 > 0 && part6 > 0 && part7 > 0 && part8 > 0) {
1732  //CkPrintf("-----i %i IMPROPER ATOMS %i %i %i %i partitions %i %i %i %i\n",i,impropers[i].atom1, impropers[i].atom2, impropers[i].atom3, impropers[i].atom4, part1, part2, part3,part4);
1733  qmDroppedCrossterms++;
1734  }
1735  else {
1736  nonQMCrossterms[nonQMCrosstermCount++] = crossterms[i];
1737  }
1738  }
1739  numCrossterms = nonQMCrosstermCount;
1740  delete [] crossterms;
1741  crossterms = new Crossterm[numCrossterms] ;
1742  for (int i=0; i < numCrossterms; i++){
1743  crossterms[i] = nonQMCrossterms[i] ;
1744  }
1745  delete [] nonQMCrossterms ;
1746 
1747  if (!CkMyPe()) {
1748  iout << iINFO << "The QM region will remove " << qmDroppedBonds << " bonds, " <<
1749  qmDroppedAngles << " angles, " << qmDroppedDihedrals << " dihedrals, "
1750  << qmDroppedImpropers << " impropers and " << qmDroppedCrossterms
1751  << " crossterms.\n" << endi ;
1752  }
1753 
1754 #endif
1755 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
int numBonds
Definition: Molecule.h:589
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numRealBonds
Definition: Molecule.h:588
int32 atom1
Definition: structures.h:83
#define iout
Definition: InfoStream.h:51
int32 atom1
Definition: structures.h:50
int32 atom1
Definition: structures.h:57
int numAngles
Definition: Molecule.h:590
int numCrossterms
Definition: Molecule.h:597
void NAMD_die(const char *err_msg)
Definition: common.C:147
int numDihedrals
Definition: Molecule.h:591
int numImpropers
Definition: Molecule.h:596
int32 atom1
Definition: structures.h:74
std::ostream & iERROR(std::ostream &s)
Definition: InfoStream.C:83
int32 atom1
Definition: structures.h:65
for(int i=0;i< n1;++i)

◆ find_dcd_selection_index()

uint16_t Molecule::find_dcd_selection_index ( const char *  keystr)

◆ find_or_create_dcd_selection_index()

uint16_t Molecule::find_or_create_dcd_selection_index ( const char *  keystr)

◆ freeBFactorData()

void Molecule::freeBFactorData ( )
inline

Definition at line 1110 of file Molecule.h.

Referenced by NamdState::loadStructure().

1110 { delete [] bfactor; bfactor=NULL; }

◆ freeOccupancyData()

void Molecule::freeOccupancyData ( )
inline

Definition at line 1106 of file Molecule.h.

Referenced by NamdState::loadStructure().

1106 { delete [] occupancy; occupancy=NULL; }

◆ get_acceptor()

Bond* Molecule::get_acceptor ( int  dnum) const
inline

Definition at line 1181 of file Molecule.h.

1181 {return (&(acceptors[dnum]));}

◆ get_angle()

Angle* Molecule::get_angle ( int  anum) const
inline

Definition at line 1144 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1144 {return (&(angles[anum]));}

◆ get_angles_for_atom()

int32* Molecule::get_angles_for_atom ( int  anum)
inline

Definition at line 1222 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1223  { return anglesByAtom[anum]; }

◆ get_atom_dcd_status()

uint16 Molecule::get_atom_dcd_status ( const int  index)
inline

Definition at line 883 of file Molecule.h.

References per_atom_flags::dcdSelection, and AtomCstInfo::flags.

883 {return atoms[index].flags.dcdSelection;}
PerAtomFlags flags
Definition: structures.h:41
uint16 dcdSelection
Definition: common.h:269

◆ get_atom_from_index_in_residue()

int Molecule::get_atom_from_index_in_residue ( const char *  segid,
int  resid,
int  index 
) const

Definition at line 163 of file Molecule.C.

References NAMD_die().

Referenced by GlobalMasterEasy::getAtomID(), and GlobalMasterFreeEnergy::getAtomID().

164  {
165 
166  if (atomNames == NULL || resLookup == NULL)
167  {
168  NAMD_die("Tried to find atom from name on node other than node 0");
169  }
170  int i = 0;
171  int end = 0;
172  if ( resLookup->lookup(segid,resid,&i,&end) ) return -1;
173  if ( index >= 0 && index < ( end - i ) ) return ( index + i );
174  return -1;
175 }
int lookup(const char *segid, int resid, int *begin, int *end) const
Definition: Molecule.C:81
void NAMD_die(const char *err_msg)
Definition: common.C:147

◆ get_atom_from_name()

int Molecule::get_atom_from_name ( const char *  segid,
int  resid,
const char *  aname 
) const

Definition at line 126 of file Molecule.C.

References atomNamePool, and NAMD_die().

Referenced by colvarproxy_namd::check_atom_id(), GlobalMasterEasy::getAtomID(), and GlobalMasterFreeEnergy::getAtomID().

127  {
128 
129  if (atomNames == NULL || resLookup == NULL)
130  {
131  NAMD_die("Tried to find atom from name on node other than node 0");
132  }
133 
134  int i = 0;
135  int end = 0;
136  if ( resLookup->lookup(segid,resid,&i,&end) ) return -1;
137  for ( ; i < end; ++i ) {
138  #ifdef MEM_OPT_VERSION
139  Index idx = atomNames[i].atomnameIdx;
140  if(!strcasecmp(aname, atomNamePool[idx])) return i;
141  #else
142  if ( ! strcasecmp(aname,atomNames[i].atomname) ) return i;
143  #endif
144  }
145  return -1;
146 }
int lookup(const char *segid, int resid, int *begin, int *end) const
Definition: Molecule.C:81
int Index
Definition: structures.h:26
void NAMD_die(const char *err_msg)
Definition: common.C:147
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309

◆ get_atom_index_from_dcd_selection()

int Molecule::get_atom_index_from_dcd_selection ( const int  index,
const int  atomIndex 
)
inline

Definition at line 884 of file Molecule.h.

References dcd_params::dcdSelectionIndex, and dcdSelectionParams.

Referenced by wrap_coor_int_dcd_selection().

884  {
885  return dcdSelectionParams[index].dcdSelectionIndex[atomIndex];
886  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:482
std::vector< int32 > dcdSelectionIndex
Definition: common.h:257

◆ get_atomtype()

const char* Molecule::get_atomtype ( int  anum) const
inline

Definition at line 1192 of file Molecule.h.

References AtomNameIdx::atomtypeIdx, atomTypePool, and NAMD_die().

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  }
void NAMD_die(const char *err_msg)
Definition: common.C:147
HashPool< HashString > atomTypePool
Definition: CompressPsf.C:310

◆ get_bond()

Bond* Molecule::get_bond ( int  bnum) const
inline

Definition at line 1141 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1141 {return (&(bonds[bnum]));}

◆ get_bonds_for_atom()

int32* Molecule::get_bonds_for_atom ( int  anum)
inline

Definition at line 1220 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1221  { return bondsByAtom[anum]; }

◆ get_cluster()

int Molecule::get_cluster ( int  anum) const
inline

Definition at line 1099 of file Molecule.h.

Referenced by wrap_coor_int(), and wrap_coor_int_dcd_selection().

1099 { return cluster[anum]; }

◆ get_clusterSize()

int Molecule::get_clusterSize ( int  anum) const
inline

Definition at line 1100 of file Molecule.h.

Referenced by wrap_coor_int(), and wrap_coor_int_dcd_selection().

1100 { return clusterSize[anum]; }

◆ get_cons_params()

void Molecule::get_cons_params ( Real k,
Vector refPos,
int  atomnum 
) const
inline

Definition at line 1354 of file Molecule.h.

Referenced by ComputeRestraints::doForce().

1355  {
1356  k = consParams[consIndexes[atomnum]].k;
1357  refPos = consParams[consIndexes[atomnum]].refPos;
1358  }

◆ get_constorque_params()

void Molecule::get_constorque_params ( BigReal v,
Vector a,
Vector p,
int  atomnum 
) const
inline

Definition at line 1428 of file Molecule.h.

References consTorqueIndexes, and consTorqueParams.

Referenced by ComputeConsTorque::doForce().

1430  {
1431  v = consTorqueParams[consTorqueIndexes[atomnum]].v;
1432  a = consTorqueParams[consTorqueIndexes[atomnum]].a;
1433  p = consTorqueParams[consTorqueIndexes[atomnum]].p;
1434  }
int32 * consTorqueIndexes
Definition: Molecule.h:651
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:652

◆ get_crossterm()

Crossterm* Molecule::get_crossterm ( int  inum) const
inline

Definition at line 1153 of file Molecule.h.

1153 {return (&(crossterms[inum]));}

◆ get_crossterms_for_atom()

int32* Molecule::get_crossterms_for_atom ( int  anum)
inline

Definition at line 1228 of file Molecule.h.

1229  { return crosstermsByAtom[anum]; }

◆ get_cSMDcoffs()

const Real* Molecule::get_cSMDcoffs ( )
inline

Definition at line 928 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

928 {return cSMDcoffs;} ;

◆ get_cSMDindex()

int const* const* Molecule::get_cSMDindex ( )
inline

Definition at line 924 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

924 {return cSMDindex;} ;

◆ get_cSMDindxLen()

int const* Molecule::get_cSMDindxLen ( )
inline

Definition at line 923 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

923 { return cSMDindxLen;} ;

◆ get_cSMDKs()

const Real* Molecule::get_cSMDKs ( )
inline

Definition at line 926 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

926 {return cSMDKs;} ;

◆ get_cSMDnumInst()

int Molecule::get_cSMDnumInst ( )
inline

Definition at line 922 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

922 { return cSMDnumInst;} ;

◆ get_cSMDpairs()

int const* const* Molecule::get_cSMDpairs ( )
inline

Definition at line 925 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

925 {return cSMDpairs;} ;

◆ get_cSMDVels()

const Real* Molecule::get_cSMDVels ( )
inline

Definition at line 927 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

927 {return cSMDVels;} ;

◆ get_dcd_selection_index_from_atom_id()

int Molecule::get_dcd_selection_index_from_atom_id ( const int  index,
const int  atomIndex 
)
inline

Definition at line 888 of file Molecule.h.

References dcd_params::dcdSelectionIndexReverse, and dcdSelectionParams.

Referenced by CollectionMaster::CollectVectorInstanceDcdSelection::append(), Output::coordinate(), and wrap_coor_int_dcd_selection().

888  {
889  return dcdSelectionParams[index].dcdSelectionIndexReverse[atomIndex];
890  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:482
std::vector< int32 > dcdSelectionIndexReverse
Definition: common.h:258

◆ get_dcd_selection_size()

const int Molecule::get_dcd_selection_size ( const int  index)
inline

Definition at line 893 of file Molecule.h.

References dcdSelectionParams, and dcd_params::size.

Referenced by Output::coordinate(), and wrap_coor_int_dcd_selection().

893  {
894  return dcdSelectionParams[index].size;
895  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:482
int size
Definition: common.h:259

◆ get_dihedral()

Dihedral* Molecule::get_dihedral ( int  dnum) const
inline

Definition at line 1150 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1150 {return (&(dihedrals[dnum]));}

◆ get_dihedrals_for_atom()

int32* Molecule::get_dihedrals_for_atom ( int  anum)
inline

Definition at line 1224 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1225  { return dihedralsByAtom[anum]; }

◆ get_donor()

Bond* Molecule::get_donor ( int  dnum) const
inline

Definition at line 1178 of file Molecule.h.

1178 {return (&(donors[dnum]));}

◆ get_excl_check_for_atom()

const ExclusionCheck* Molecule::get_excl_check_for_atom ( int  anum) const
inline

Definition at line 1248 of file Molecule.h.

Referenced by dumpbench().

1248  {
1249  return &all_exclusions[anum];
1250  }

◆ get_exclusion()

Exclusion* Molecule::get_exclusion ( int  ex) const
inline

Definition at line 1188 of file Molecule.h.

1188 {return (&(exclusions[ex]));}

◆ get_exclusions_for_atom()

int32* Molecule::get_exclusions_for_atom ( int  anum)
inline

Definition at line 1230 of file Molecule.h.

1231  { return exclusionsByAtom[anum]; }

◆ get_fep_bonded_type()

int Molecule::get_fep_bonded_type ( const int *  atomID,
unsigned int  order 
) const
inline

Definition at line 1482 of file Molecule.h.

References NAMD_die(), order, and simParams.

Referenced by AngleElem::computeForce(), ImproperElem::computeForce(), DihedralElem::computeForce(), AnisoElem::computeForce(), and BondElem::computeForce().

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  }
#define order
Definition: PmeRealSpace.C:235
void NAMD_die(const char *err_msg)
Definition: common.C:147

◆ get_fep_type()

unsigned char Molecule::get_fep_type ( int  anum) const
inline

Definition at line 1437 of file Molecule.h.

Referenced by CrosstermElem::computeForce(), TholeElem::computeForce(), WorkDistrib::createAtomLists(), and ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples().

1438  {
1439  return(fepAtomFlags[anum]);
1440  }

◆ get_full_exclusions_for_atom()

const int32* Molecule::get_full_exclusions_for_atom ( int  anum) const
inline

Definition at line 1232 of file Molecule.h.

1233  { return fullExclusionsByAtom[anum]; }

◆ get_go_cutoff()

Real Molecule::get_go_cutoff ( int  chain1,
int  chain2 
)
inline

Definition at line 1657 of file Molecule.h.

References go_val::cutoff, go_array, and MAX_GO_CHAINS.

Referenced by build_go_arrays(), build_go_sigmas(), build_go_sigmas2(), get_go_force(), get_go_force2(), and get_go_force_new().

1657 { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
Real cutoff
Definition: Molecule.h:112

◆ get_go_epsilon()

Real Molecule::get_go_epsilon ( int  chain1,
int  chain2 
)
inline

Definition at line 1666 of file Molecule.h.

References go_val::epsilon, go_array, and MAX_GO_CHAINS.

Referenced by get_go_force(), get_go_force2(), and get_go_force_new().

1666 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
Real epsilon
Definition: Molecule.h:106

◆ get_go_epsilonRep()

Real Molecule::get_go_epsilonRep ( int  chain1,
int  chain2 
)
inline

Definition at line 1660 of file Molecule.h.

References go_val::epsilonRep, go_array, and MAX_GO_CHAINS.

Referenced by get_go_force(), get_go_force2(), and get_go_force_new().

1660 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };
Real epsilonRep
Definition: Molecule.h:111
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640

◆ get_go_exp_a()

int Molecule::get_go_exp_a ( int  chain1,
int  chain2 
)
inline

Definition at line 1669 of file Molecule.h.

References go_val::exp_a, go_array, and MAX_GO_CHAINS.

Referenced by build_go_sigmas(), build_go_sigmas2(), get_go_force(), get_go_force2(), and get_go_force_new().

1669 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };
#define MAX_GO_CHAINS
Definition: Molecule.h:33
int exp_a
Definition: Molecule.h:107
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640

◆ get_go_exp_b()

int Molecule::get_go_exp_b ( int  chain1,
int  chain2 
)
inline

Definition at line 1672 of file Molecule.h.

References go_val::exp_b, go_array, and MAX_GO_CHAINS.

Referenced by build_go_sigmas(), build_go_sigmas2(), get_go_force(), get_go_force2(), and get_go_force_new().

1672 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };
int exp_b
Definition: Molecule.h:108
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640

◆ get_go_exp_rep()

int Molecule::get_go_exp_rep ( int  chain1,
int  chain2 
)
inline

Definition at line 1675 of file Molecule.h.

References go_val::exp_rep, go_array, and MAX_GO_CHAINS.

Referenced by get_go_force(), get_go_force2(), and get_go_force_new().

1675 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
int exp_rep
Definition: Molecule.h:109

◆ get_go_force()

BigReal Molecule::get_go_force ( BigReal  r,
int  atom1,
int  atom2,
BigReal goNative,
BigReal goNonnative 
) const

Definition at line 1261 of file GoMolecule.C.

References atomChainTypes, get_go_cutoff(), get_go_epsilon(), get_go_epsilonRep(), get_go_exp_a(), get_go_exp_b(), get_go_exp_rep(), get_go_sigmaRep(), goSigmaIndices, goSigmas, goWithinCutoff, and numGoAtoms.

1266 {
1267  BigReal goForce = 0.0;
1268  Real pow1;
1269  Real pow2;
1270  // determine which Go chain pair we are working with
1271  //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ")" << std::endl);
1272  int32 chain1 = atomChainTypes[atom1];
1273  int32 chain2 = atomChainTypes[atom2];
1274 
1275  //DebugM(3," chain1:" << chain1 << ", chain2:" << chain2 << std::endl);
1276  if (chain1 == 0 || chain2 == 0) return 0.0;
1277 
1278  // retrieve Go cutoff for this chain pair
1279  //TMP// JLai -- I'm going to replace this with a constant accessor. This is just a temporary thing
1280  Real goCutoff = const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2);
1281  //DebugM(3," goCutoff:" << goCutoff << std::endl);
1282  if (goCutoff == 0) return 0.0;
1283  // if repulsive then calculate repulsive
1284  // sigmas are initially set to -1.0 if the atom pair fails go_restricted
1285  if (goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]] != -1.0) {
1286  if (!goWithinCutoff[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]]) {
1287  Real epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1,chain2);
1288  Real sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1,chain2);
1289  int exp_rep = const_cast<Molecule*>(this)->get_go_exp_rep(chain1,chain2);
1290  pow1 = pow(sigmaRep/r,exp_rep);
1291  goForce = 4*((exp_rep/(r*r)) * epsilonRep * pow1);
1292  *goNative = 0.0;
1293  *goNonnative = (4 * epsilonRep * pow1 );
1294  //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", epsilonRep:" << epsilonRep << ", sigmaRep:" << sigmaRep << ", r:" << r << ", goForce:" << goForce << std::endl);
1295  }
1296  // if attractive then calculate attractive
1297  else {
1298  int goSigmaIndex1 = goSigmaIndices[atom1];
1299  int goSigmaIndex2 = goSigmaIndices[atom2];
1300  if (goSigmaIndex1 != -1 && goSigmaIndex2 != -1) {
1301  Real epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
1302  int exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
1303  int exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
1304  Real sigma_ij = goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]];
1305  // Positive gradient of potential, not negative gradient of potential
1306  pow1 = pow(sigma_ij/r,exp_a);
1307  pow2 = pow(sigma_ij/r,exp_b);
1308  goForce = ((4/(r*r)) * epsilon * (exp_a * pow1 - exp_b * pow2));
1309  //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", sigma_ij:" << sigma_ij << ", r:" << r << ", goForce:" << goForce << std::endl);
1310  *goNative = (4 * epsilon * ( pow1 - pow2 ) );
1311  *goNonnative = 0.0;
1312  }
1313  }
1314  }
1315  //DebugM(3,"goForce:" << goForce << std::endl);
1316  return goForce;
1317 }
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1669
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1660
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
bool * goWithinCutoff
Definition: Molecule.h:684
Molecule stores the structural information for the system.
Definition: Molecule.h:174
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1666
int32 * atomChainTypes
Definition: Molecule.h:680
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1663
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1675
Real * goSigmas
Definition: Molecule.h:683
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1672
int32 * goSigmaIndices
Definition: Molecule.h:681
int numGoAtoms
Definition: Molecule.h:679
double BigReal
Definition: common.h:123

◆ get_go_force2()

BigReal Molecule::get_go_force2 ( BigReal  x,
BigReal  y,
BigReal  z,
int  atom1,
int  atom2,
BigReal goNative,
BigReal goNonnative 
) const

Definition at line 1457 of file GoMolecule.C.

References atomChainTypes, get_go_cutoff(), get_go_epsilon(), get_go_epsilonRep(), get_go_exp_a(), get_go_exp_b(), get_go_exp_rep(), get_go_sigmaRep(), go_restricted(), goIndxLJB, goResidIndices, goSigmaPairA, goSigmaPairB, pointerToGoBeg, and pointerToGoEnd.

1464 {
1465 
1466  // Check to see if restricted. If so, escape function early
1467  int32 chain1 = atomChainTypes[atom1];
1468  int32 chain2 = atomChainTypes[atom2];
1469 
1470  if(chain1 == 0 || chain2 == 0) return 0.0;
1471  Molecule *mol = const_cast<Molecule*>(this);
1472  Real goCutoff = mol->get_go_cutoff(chain1,chain2);
1473  if(goCutoff == 0) return 0.0;
1474 
1475  int resid1 = goResidIndices[atom1];
1476  int resid2 = goResidIndices[atom2];
1477  int residDiff = abs(resid1 - resid2);
1478  if((mol->go_restricted(chain1,chain2,residDiff))) {
1479  return 0.0;
1480  }
1481 
1482  int LJIndex = -1;
1483  int LJbegin = pointerToGoBeg[atom1];
1484  int LJend = pointerToGoEnd[atom1];
1485  for(int i = LJbegin; i <= LJend; i++) {
1486  if(goIndxLJB[i] == atom2) {
1487  LJIndex = i;
1488  }
1489  }
1490 
1491  BigReal r2 = x*x + y*y + z*z;
1492  BigReal r = sqrt(r2);
1493 
1494  if (LJIndex == -1) {
1495  int exp_rep = const_cast<Molecule*>(this)->get_go_exp_rep(chain1,chain2);
1496  BigReal epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1, chain2);
1497  BigReal sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1, chain2);
1498  double sigmaRepPow = pow(sigmaRep,exp_rep);
1499  BigReal LJ = (4*epsilonRep*exp_rep*sigmaRepPow*pow(r,-(exp_rep+1)));
1500  *goNative = 0;
1501  *goNonnative = (4*epsilonRep*sigmaRepPow*pow(r,-exp_rep));
1502  //*goNonnative = (4*epsilonRep * pow(sigmaRep/r,exp_rep));
1503  return (LJ/r);
1504  } else {
1505  // Code to calculate distances because the pair was found in one of the lists
1506  int exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
1507  int exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
1508  // We want the force, so we have to take the n+1 derivative
1509  BigReal powA = pow(r,-(exp_a + 1));
1510  BigReal powB = pow(r,-(exp_b + 1));
1511  BigReal powaa = pow(r,-exp_a);
1512  BigReal powbb = pow(r,-exp_b);
1513  BigReal epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
1514  BigReal LJ = 4 * epsilon * (exp_a*goSigmaPairA[LJIndex]*powA - exp_b*goSigmaPairB[LJIndex]*powB);
1515  *goNative = 4 * epsilon * (goSigmaPairA[LJIndex]*powaa - goSigmaPairB[LJIndex]*powbb);
1516  *goNonnative = 0;
1517  return (LJ/r);
1518  }
1519  return 0;
1520 }
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1669
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
int * pointerToGoBeg
Definition: Molecule.h:694
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1660
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
double * goSigmaPairA
Definition: Molecule.h:692
Molecule stores the structural information for the system.
Definition: Molecule.h:174
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1666
int32 * atomChainTypes
Definition: Molecule.h:680
int * pointerToGoEnd
Definition: Molecule.h:695
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1663
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1675
int32 * goResidIndices
Definition: Molecule.h:682
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
double * goSigmaPairB
Definition: Molecule.h:693
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1672
int * goIndxLJB
Definition: Molecule.h:691
double BigReal
Definition: common.h:123

◆ get_go_force_new()

BigReal Molecule::get_go_force_new ( BigReal  r,
int  atom1,
int  atom2,
BigReal goNative,
BigReal goNonnative 
) const

Definition at line 1335 of file GoMolecule.C.

References atomChainTypes, DebugM, get_go_cutoff(), get_go_epsilon(), get_go_epsilonRep(), get_go_exp_a(), get_go_exp_b(), get_go_exp_rep(), get_go_sigmaRep(), go_restricted(), goCoordinates, goResids, and goSigmaIndices.

1340 {
1341  int resid1;
1342  int resid2;
1343  int residDiff;
1344  Real xcoorDiff;
1345  Real ycoorDiff;
1346  Real zcoorDiff;
1347  Real atomAtomDist;
1348  Real exp_a;
1349  Real exp_b;
1350  Real sigma_ij;
1351  Real epsilon;
1352  Real epsilonRep;
1353  Real sigmaRep;
1354  Real expRep;
1355  Real pow1;
1356  Real pow2;
1357 
1358  BigReal goForce = 0.0;
1359  *goNative = 0;
1360  *goNonnative = 0;
1361 
1362  // determine which Go chain pair we are working with
1363  DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ")" << std::endl);
1364  int goIndex1 = goSigmaIndices[atom1];
1365  int goIndex2 = goSigmaIndices[atom2];
1366 
1367  int32 chain1 = atomChainTypes[goIndex1];
1368  int32 chain2 = atomChainTypes[goIndex2];
1369 
1370  DebugM(3," chain1:" << chain1 << ", chain2:" << chain2 << std::endl);
1371  if (chain1 == 0 || chain2 == 0) return 0.0;
1372 
1373  // retrieve Go cutoff for this chain pair
1374  Real goCutoff = const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2);
1375  DebugM(3," goCutoff:" << goCutoff << std::endl);
1376  if (goCutoff == 0) return 0.0;
1377 
1378  // sigmas are initially set to -1.0 if the atom pair fails go_restricted
1379  // no goSigmas array anymore
1380  //Real sigma_ij = goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]];
1381 
1382  // XXX - used to be a condition for the following if
1383  //if the atoms are within 4 of each other
1384  //if ( !atoms_1to4(atom1,atom2) ) {
1385 
1386  // if goSigmaIndices aren't defined, don't calculate forces
1387  if ( goIndex1 != -1 && goIndex2 != -1 ) {
1388  resid1 = goResids[goIndex1];
1389  resid2 = goResids[goIndex2];
1390  residDiff = resid2 - resid1;
1391  if (residDiff < 0) residDiff = -residDiff;
1392  // if this is a Go atom pair that is not restricted
1393  if ( !(const_cast<Molecule*>(this)->go_restricted(chain1,chain2,residDiff)) ) {
1394  xcoorDiff = goCoordinates[goIndex1*3] - goCoordinates[goIndex2*3];
1395  ycoorDiff = goCoordinates[goIndex1*3 + 1] - goCoordinates[goIndex2*3 + 1];
1396  zcoorDiff = goCoordinates[goIndex1*3 + 2] - goCoordinates[goIndex2*3 + 2];
1397  atomAtomDist = sqrt(xcoorDiff*xcoorDiff + ycoorDiff*ycoorDiff + zcoorDiff*zcoorDiff);
1398 
1399  // if attractive then calculate attractive
1400  if ( atomAtomDist <= const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2) ) {
1401  exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
1402  exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
1403  sigma_ij = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
1404 
1405  // [JLai] print out atoms involved in native contacts
1406  // printf("ATOM1: %d C1: %d ATOM2: %d C2: %d\n", atom1,chain1,atom2,chain2);
1407 
1408  epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
1409  pow1 = pow(sigma_ij/r,static_cast<double>(exp_a));
1410  pow2 = pow(sigma_ij/r,static_cast<double>(exp_b));
1411  //goForce = ((4/r) * epsilon * (exp_a * pow(sigma_ij/r,exp_a) - exp_b * pow(sigma_ij/r,exp_b)));
1412  goForce = ((4/(r*r)) * epsilon * (exp_a * pow1 - exp_b * pow2));
1413  DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", exp_a:" << exp_a << ", exp_b:" << exp_b << ", sigma_ij:" << sigma_ij << ", r:" << r << ", goForce:" << goForce << std::endl);
1414  //goEnergy = (4 * epsilon * ( pow(sigma_ij/r,exp_a) - pow(sigma_ij/r,exp_b) ) ); // JLai I changed some of the expressions
1415  *goNative = (4 * epsilon * ( pow1 - pow2 ) );
1416  *goNonnative = 0;
1417  }
1418 
1419  // if repulsive then calculate repulsive
1420  else {
1421  epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1,chain2);
1422  sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1,chain2);
1423  expRep = const_cast<Molecule*>(this)->get_go_exp_rep(chain1,chain2);
1424  pow1 = pow(sigmaRep/r,(BigReal)expRep);
1425  //goForce = ((12.0/r) * epsilonRep * pow(sigmaRep/r,12.0));
1426  goForce = ((4/(r*r)) * expRep * epsilonRep * pow1);
1427  DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", epsilonRep:" << epsilonRep << ", sigmaRep:" << sigmaRep << ", r:" << r << ", goForce:" << goForce << std::endl);
1428  //goEnergy = (4 * epsilonRep * pow(sigmaRep/r,12.0)); // JLai I changed some of the expressions
1429  *goNonnative = (4 * epsilonRep * pow1);
1430  *goNative = 0;
1431  }
1432  }
1433  }
1434 
1435  //DebugM(3,"goForce:" << goForce << std::endl);
1436  return goForce;
1437 }
int get_go_exp_a(int chain1, int chain2)
Definition: Molecule.h:1669
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1657
Real * goCoordinates
Definition: Molecule.h:685
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1660
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
Molecule stores the structural information for the system.
Definition: Molecule.h:174
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1666
int32 * atomChainTypes
Definition: Molecule.h:680
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1663
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1675
int * goResids
Definition: Molecule.h:686
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1672
int32 * goSigmaIndices
Definition: Molecule.h:681
double BigReal
Definition: common.h:123

◆ get_go_sigmaRep()

Real Molecule::get_go_sigmaRep ( int  chain1,
int  chain2 
)
inline

Definition at line 1663 of file Molecule.h.

References go_array, MAX_GO_CHAINS, and go_val::sigmaRep.

Referenced by get_go_force(), get_go_force2(), and get_go_force_new().

1663 { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
Real sigmaRep
Definition: Molecule.h:110

◆ get_gridfrc_grid()

GridforceGrid* Molecule::get_gridfrc_grid ( int  gridnum) const
inline

Definition at line 1368 of file Molecule.h.

References numGridforceGrids.

Referenced by colvarproxy_namd::compute_volmap(), ComputeGridForce::doForce(), colvarproxy_namd::init_volmap_by_name(), Node::reloadGridforceGrid(), and Node::updateGridScale().

1369  {
1370  GridforceGrid *result = NULL;
1371  if (gridnum >= 0 && gridnum < numGridforceGrids) {
1372  result = gridfrcGrid[gridnum];
1373  }
1374  return result;
1375  }
int numGridforceGrids
Definition: Molecule.h:626

◆ get_gridfrc_params()

void Molecule::get_gridfrc_params ( Real k,
Charge q,
int  atomnum,
int  gridnum 
) const
inline

Definition at line 1362 of file Molecule.h.

Referenced by ComputeGridForce::do_calc().

1363  {
1364  k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
1365  q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
1366  }

◆ get_gro_force()

BigReal Molecule::get_gro_force ( BigReal  ,
BigReal  ,
BigReal  ,
int  ,
int   
) const

◆ get_gro_force2()

BigReal Molecule::get_gro_force2 ( BigReal  x,
BigReal  y,
BigReal  z,
int  atom1,
int  atom2,
BigReal pairLJEnergy,
BigReal pairGaussEnergy 
) const

Definition at line 1174 of file GoMolecule.C.

References gA, giSigma1, giSigma2, gMu1, gMu2, gRepulsive, indxGaussB, indxLJB, pairC12, pairC6, pointerToGaussBeg, pointerToGaussEnd, pointerToLJBeg, and pointerToLJEnd.

1181 {
1182  //Initialize return energies to zero
1183  *pairLJEnergy = 0.0;
1184  *pairGaussEnergy = 0.0;
1185 
1186  // Linear search for LJ data
1187  int LJIndex = -1;
1188  int LJbegin = pointerToLJBeg[atom1];
1189  int LJend = pointerToLJEnd[atom1];
1190  for(int i = LJbegin; i <= LJend; i++) {
1191  if(indxLJB[i] == atom2) {
1192  LJIndex = i;
1193  break;
1194  }
1195  }
1196 
1197  // Linear search for Gaussian data
1198  int GaussIndex = -1;
1199  int Gaussbegin = pointerToGaussBeg[atom1];
1200  int Gaussend = pointerToGaussEnd[atom1];
1201  for(int i = Gaussbegin; i <= Gaussend; i++) {
1202  if(indxGaussB[i] == atom2) {
1203  GaussIndex = i;
1204  break;
1205  }
1206  }
1207 
1208  if( LJIndex == -1 && GaussIndex == -1) {
1209  return 0;
1210  } else {
1211  // Code to calculate distances because the pair was found in one of the lists
1212  BigReal r2 = x*x + y*y + z*z;
1213  BigReal r = sqrt(r2);
1214  BigReal ri = 1/r;
1215  BigReal ri6 = (ri*ri*ri*ri*ri*ri);
1216  BigReal ri12 = ri6*ri6;
1217  BigReal ri13 = ri12*ri;
1218  BigReal LJ = 0;
1219  BigReal Gauss = 0;
1220  // Code to calculate LJ
1221  if (LJIndex != -1) {
1222  BigReal ri7 = ri6*ri;
1223  LJ = (12*(pairC12[LJIndex]*ri13) - 6*(pairC6[LJIndex]*ri7));
1224  *pairLJEnergy = (pairC12[LJIndex]*ri12 - pairC6[LJIndex]*ri6);
1225  //std::cout << pairC12[LJIndex] << " " << pairC6[LJIndex] << " " << ri13 << " " << ri7 << " " << LJ << " " << r << "\n";
1226  }
1227  // Code to calculate Gaussian
1228  if (GaussIndex != -1) {
1229  BigReal gr = 12*gRepulsive[GaussIndex]*ri13;
1230  BigReal r1prime = r - gMu1[GaussIndex];
1231  BigReal tmp1 = r1prime * r1prime;
1232  BigReal r2prime = r - gMu2[GaussIndex];
1233  BigReal tmp2 = r2prime * r2prime;
1234  BigReal tmp_gauss1 = 0;
1235  BigReal one_gauss1 = 1;
1236  BigReal tmp_gauss2 = 0;
1237  BigReal one_gauss2 = 1;
1238  if (giSigma1[GaussIndex] != 0) {
1239  tmp_gauss1 = exp(-tmp1*giSigma1[GaussIndex]);
1240  one_gauss1 = 1 - tmp_gauss1;
1241  }
1242  if (giSigma2[GaussIndex] != 0) {
1243  tmp_gauss2 = exp(-tmp2*giSigma2[GaussIndex]);
1244  one_gauss2 = 1 - tmp_gauss2;
1245  }
1246  BigReal A = gA[GaussIndex];
1247  Gauss = gr*one_gauss1*one_gauss2 - 2*A*tmp_gauss1*one_gauss2*r1prime*giSigma1[GaussIndex] \
1248  - 2*tmp_gauss1*one_gauss2*r1prime*giSigma1[GaussIndex]*gRepulsive[GaussIndex]*ri12 - 2*A*tmp_gauss2*one_gauss1*r2prime*giSigma2[GaussIndex] \
1249  - 2*tmp_gauss2*one_gauss1*r2prime*giSigma2[GaussIndex]*gRepulsive[GaussIndex]*ri12;
1250  *pairGaussEnergy = A*(-1+(one_gauss1)*(one_gauss2)*(1+gRepulsive[GaussIndex]*ri12/A));
1251  }
1252  //std::cout << "Net force: " << (LJ + Gauss) << " with ri " << (LJ + Gauss)*ri << "\n";
1253  return (LJ + Gauss)*ri;
1254  }
1255  return 0;
1256 }
Real * gMu2
Definition: Molecule.h:716
Real * giSigma2
Definition: Molecule.h:717
Real * pairC6
Definition: Molecule.h:704
int * pointerToLJEnd
Definition: Molecule.h:701
Real * gA
Definition: Molecule.h:713
int * indxLJB
Definition: Molecule.h:703
int * pointerToGaussBeg
Definition: Molecule.h:708
Real * gMu1
Definition: Molecule.h:714
int * pointerToLJBeg
Definition: Molecule.h:700
Real * gRepulsive
Definition: Molecule.h:718
int * indxGaussB
Definition: Molecule.h:712
int * pointerToGaussEnd
Definition: Molecule.h:709
Real * pairC12
Definition: Molecule.h:705
Real * giSigma1
Definition: Molecule.h:715
double BigReal
Definition: common.h:123

◆ get_groupSize()

int Molecule::get_groupSize ( int  )

◆ get_improper()

Improper* Molecule::get_improper ( int  inum) const
inline

Definition at line 1147 of file Molecule.h.

Referenced by dumpbench().

1147 {return (&(impropers[inum]));}

◆ get_impropers_for_atom()

int32* Molecule::get_impropers_for_atom ( int  anum)
inline

Definition at line 1226 of file Molecule.h.

Referenced by dumpbench().

1227  { return impropersByAtom[anum]; }

◆ get_lphost()

Lphost* Molecule::get_lphost ( int  atomid) const
inline

Definition at line 1157 of file Molecule.h.

Referenced by ComputeLonepairsCUDA::updateAtoms().

1157  {
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  }

◆ get_mod_exclusions_for_atom()

const int32* Molecule::get_mod_exclusions_for_atom ( int  anum) const
inline

Definition at line 1234 of file Molecule.h.

1235  { return modExclusionsByAtom[anum]; }

◆ get_mother_atom()

int Molecule::get_mother_atom ( int  ) const

◆ get_movdrag_params()

void Molecule::get_movdrag_params ( Vector v,
int  atomnum 
) const
inline

Definition at line 1413 of file Molecule.h.

Referenced by Sequencer::addMovDragToPosition().

1414  {
1415  v = movDragParams[movDragIndexes[atomnum]].v;
1416  }

◆ get_noPC()

Bool Molecule::get_noPC ( )
inline

Definition at line 910 of file Molecule.h.

Referenced by ComputeQM::initialize().

910 { return qmNoPC; } ;

◆ get_numQMAtoms()

int Molecule::get_numQMAtoms ( )
inline

◆ get_qmAtmChrg()

Real* Molecule::get_qmAtmChrg ( )
inline

◆ get_qmAtmIndx()

const int* Molecule::get_qmAtmIndx ( )
inline

◆ get_qmAtomGroup() [1/2]

const Real* Molecule::get_qmAtomGroup ( ) const
inline

◆ get_qmAtomGroup() [2/2]

Real Molecule::get_qmAtomGroup ( int  indx) const
inline

Definition at line 860 of file Molecule.h.

860 {return qmAtomGroup[indx]; } ;

◆ get_qmcSMD()

Bool Molecule::get_qmcSMD ( )
inline

Definition at line 921 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

921 { return qmcSMD;} ;

◆ get_qmCustomPCIdxs()

int* Molecule::get_qmCustomPCIdxs ( )
inline

Definition at line 919 of file Molecule.h.

Referenced by ComputeQM::initialize().

919 { return qmCustomPCIdxs; } ;

◆ get_qmCustPCSizes()

int* Molecule::get_qmCustPCSizes ( )
inline

Definition at line 918 of file Molecule.h.

Referenced by ComputeQM::initialize().

918 { return qmCustPCSizes; } ;

◆ get_qmDummyBondVal()

const BigReal* Molecule::get_qmDummyBondVal ( )
inline

Definition at line 874 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

874 { return qmDummyBondVal; } ;

◆ get_qmDummyElement()

const char* const* Molecule::get_qmDummyElement ( )
inline

Definition at line 879 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

879 { return qmDummyElement; } ;

◆ get_qmElements()

const char* const* Molecule::get_qmElements ( )
inline

Definition at line 866 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

866 {return qmElementArray;} ;

◆ get_qmGrpBonds()

const int* const* Molecule::get_qmGrpBonds ( )
inline

Definition at line 877 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

877 { return qmGrpBonds; } ;

◆ get_qmGrpChrg()

Real* Molecule::get_qmGrpChrg ( )
inline

Definition at line 870 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

870 {return qmGrpChrg; } ;

◆ get_qmGrpID()

Real* Molecule::get_qmGrpID ( )
inline

Definition at line 869 of file Molecule.h.

Referenced by ComputeQM::initialize(), and ComputeQMMgr::recvPartQM().

869 { return qmGrpID; } ;

◆ get_qmGrpMult()

Real* Molecule::get_qmGrpMult ( )
inline

Definition at line 871 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

871 {return qmGrpMult; } ;

◆ get_qmGrpNumBonds()

const int* Molecule::get_qmGrpNumBonds ( )
inline

Definition at line 875 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

875 { return qmGrpNumBonds; } ;

◆ get_qmGrpSizes()

const int* Molecule::get_qmGrpSizes ( )
inline

Definition at line 868 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

868 {return qmGrpSizes; } ;

◆ get_qmLSSFreq()

int Molecule::get_qmLSSFreq ( )
inline

Definition at line 901 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

901 { return qmLSSFreq; } ;

◆ get_qmLSSIdxs()

int* Molecule::get_qmLSSIdxs ( )
inline

Definition at line 899 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

899 { return qmLSSIdxs;} ;

◆ get_qmLSSMass()

Mass* Molecule::get_qmLSSMass ( )
inline

Definition at line 900 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

900 { return qmLSSMass; } ;

◆ get_qmLSSRefIDs()

int* Molecule::get_qmLSSRefIDs ( )
inline

Definition at line 903 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

903 { return qmLSSRefIDs ; } ;

◆ get_qmLSSRefMass()

Mass* Molecule::get_qmLSSRefMass ( )
inline

Definition at line 905 of file Molecule.h.

905 {return qmLSSRefMass; } ;

◆ get_qmLSSRefSize()

int* Molecule::get_qmLSSRefSize ( )
inline

Definition at line 904 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

904 { return qmLSSRefSize ; } ;

◆ get_qmLSSResSize()

int Molecule::get_qmLSSResSize ( )
inline

Definition at line 902 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

902 { return qmLSSResidueSize; } ;

◆ get_qmLSSSize()

int* Molecule::get_qmLSSSize ( )
inline

Definition at line 898 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

898 { return qmLSSSize;} ;

◆ get_qmMeMMindx()

int* Molecule::get_qmMeMMindx ( )
inline

Definition at line 912 of file Molecule.h.

Referenced by ComputeQM::initialize().

912 { return qmMeMMindx; } ;

◆ get_qmMeNumBonds()

int Molecule::get_qmMeNumBonds ( )
inline

Definition at line 911 of file Molecule.h.

Referenced by ComputeQM::initialize(), and ComputeQMMgr::recvPartQM().

911 { return qmMeNumBonds; } ;

◆ get_qmMeQMGrp()

Real* Molecule::get_qmMeQMGrp ( )
inline

Definition at line 913 of file Molecule.h.

Referenced by ComputeQM::initialize().

913 { return qmMeQMGrp; } ;

◆ get_qmMMBond()

const int* const* Molecule::get_qmMMBond ( )
inline

Definition at line 876 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

876 { return qmMMBond; } ;

◆ get_qmMMBondedIndx()

const int* const* Molecule::get_qmMMBondedIndx ( )
inline

Definition at line 878 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

878 { return qmMMBondedIndx; } ;

◆ get_qmMMChargeTarget()

const int* const* Molecule::get_qmMMChargeTarget ( )
inline

Definition at line 881 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

881 { return qmMMChargeTarget; } ;

◆ get_qmMMNumTargs()

const int* Molecule::get_qmMMNumTargs ( )
inline

Definition at line 882 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

882 { return qmMMNumTargs; } ;

◆ get_qmMMSolv()

std::map<int,int>& Molecule::get_qmMMSolv ( )
inline

Definition at line 906 of file Molecule.h.

906 { return qmClassicSolv;} ;

◆ get_qmNumBonds()

int Molecule::get_qmNumBonds ( )
inline

Definition at line 873 of file Molecule.h.

873 { return qmNumBonds; } ;

◆ get_qmNumGrps()

int Molecule::get_qmNumGrps ( ) const
inline

Definition at line 867 of file Molecule.h.

Referenced by ComputeQM::initialize(), ComputeQMMgr::recvPartQM(), and ComputeQM::saveResults().

867 {return qmNumGrps; } ;

◆ get_qmPCFreq()

int Molecule::get_qmPCFreq ( )
inline

Definition at line 915 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

915 { return qmPCFreq; } ;

◆ get_qmReplaceAll()

Bool Molecule::get_qmReplaceAll ( )
inline

Definition at line 908 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

908 {return qmReplaceAll; } ;

◆ get_qmTotCustPCs()

int Molecule::get_qmTotCustPCs ( )
inline

Definition at line 917 of file Molecule.h.

Referenced by ComputeQM::initialize().

917 { return qmTotCustPCs; } ;

◆ get_residue_size()

int Molecule::get_residue_size ( const char *  segid,
int  resid 
) const

Definition at line 149 of file Molecule.C.

References NAMD_die().

Referenced by GlobalMasterEasy::getNumAtoms(), GlobalMasterFreeEnergy::getNumAtoms(), and prepare_qm().

150  {
151 
152  if (atomNames == NULL || resLookup == NULL)
153  {
154  NAMD_die("Tried to find atom from name on node other than node 0");
155  }
156  int i = 0;
157  int end = 0;
158  if ( resLookup->lookup(segid,resid,&i,&end) ) return 0;
159  return ( end - i );
160 }
int lookup(const char *segid, int resid, int *begin, int *end) const
Definition: Molecule.C:81
void NAMD_die(const char *err_msg)
Definition: common.C:147

◆ get_rotdrag_params()

void Molecule::get_rotdrag_params ( BigReal v,
Vector a,
Vector p,
int  atomnum 
) const
inline

Definition at line 1419 of file Molecule.h.

Referenced by Sequencer::addRotDragToPosition().

1421  {
1422  v = rotDragParams[rotDragIndexes[atomnum]].v;
1423  a = rotDragParams[rotDragIndexes[atomnum]].a;
1424  p = rotDragParams[rotDragIndexes[atomnum]].p;
1425  }

◆ get_ss_type()

unsigned char Molecule::get_ss_type ( int  anum) const
inline

Definition at line 1448 of file Molecule.h.

Referenced by ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples(), and Sequencer::rescaleSoluteCharges().

1449  {
1450  return(ssAtomFlags[anum]);
1451  }

◆ get_stir_refPos()

void Molecule::get_stir_refPos ( Vector refPos,
int  atomnum 
) const
inline

Definition at line 1394 of file Molecule.h.

1395  {
1396  refPos = stirParams[stirIndexes[atomnum]].refPos;
1397  }

◆ get_stir_startTheta()

Real Molecule::get_stir_startTheta ( int  atomnum) const
inline

Definition at line 1406 of file Molecule.h.

Referenced by ComputeStir::doForce().

1407  {
1408  return stirParams[stirIndexes[atomnum]].startTheta;
1409  }

◆ getAllAcceptors()

Bond* Molecule::getAllAcceptors ( ) const
inline

Definition at line 1184 of file Molecule.h.

1184 {return acceptors;}

◆ getAllAngles()

Angle* Molecule::getAllAngles ( ) const
inline

Definition at line 1167 of file Molecule.h.

Referenced by buildAngleData().

1167 {return angles;}

◆ getAllBonds()

Bond* Molecule::getAllBonds ( ) const
inline

Definition at line 1166 of file Molecule.h.

Referenced by buildBondData().

1166 {return bonds;}

◆ getAllCrossterms()

Crossterm* Molecule::getAllCrossterms ( ) const
inline

Definition at line 1170 of file Molecule.h.

Referenced by buildCrosstermData().

1170 {return crossterms;}

◆ getAllDihedrals()

Dihedral* Molecule::getAllDihedrals ( ) const
inline

Definition at line 1169 of file Molecule.h.

Referenced by buildDihedralData().

1169 {return dihedrals;}

◆ getAllDonors()

Bond* Molecule::getAllDonors ( ) const
inline

Definition at line 1183 of file Molecule.h.

1183 {return donors;}

◆ getAllImpropers()

Improper* Molecule::getAllImpropers ( ) const
inline

Definition at line 1168 of file Molecule.h.

Referenced by buildImproperData().

1168 {return impropers;}

◆ getAllLphosts()

Lphost* Molecule::getAllLphosts ( ) const
inline

Definition at line 1174 of file Molecule.h.

1174 { return lphosts; }

◆ GetAtomAlpha()

BigReal Molecule::GetAtomAlpha ( int  i) const
inline

Definition at line 512 of file Molecule.h.

References drude_constants::alpha.

512  {
513  return drudeConsts[i].alpha;
514  }

◆ getAtomNames()

AtomNameInfo* Molecule::getAtomNames ( ) const
inline

Definition at line 521 of file Molecule.h.

Referenced by buildAtomData().

521 { return atomNames; }

◆ getAtoms()

Atom* Molecule::getAtoms ( ) const
inline

Definition at line 520 of file Molecule.h.

Referenced by buildAtomData(), WorkDistrib::createAtomLists(), and outputCompressedFile().

520 { return atoms; }

◆ getAtomSegResInfo()

AtomSegResInfo* Molecule::getAtomSegResInfo ( ) const
inline

Definition at line 524 of file Molecule.h.

Referenced by buildAtomData().

524 { return atomSegResids; }

◆ getBFactorData()

const float* Molecule::getBFactorData ( )
inline

Definition at line 1108 of file Molecule.h.

Referenced by NamdState::loadStructure(), and outputCompressedFile().

1108 { return (const float *)bfactor; }

◆ getEnergyTailCorr()

BigReal Molecule::getEnergyTailCorr ( const BigReal  ,
const int   
)

◆ getFepAtomFlags()

const unsigned char* Molecule::getFepAtomFlags ( ) const
inline

Definition at line 1443 of file Molecule.h.

1443  {
1444  return fepAtomFlags;
1445  }

◆ getLcpoParamType()

int const* Molecule::getLcpoParamType ( )
inline

Definition at line 508 of file Molecule.h.

Referenced by HomePatch::setLcpoType().

508  {
509  return lcpoParamType;
510  }

◆ getOccupancyData()

const float* Molecule::getOccupancyData ( )
inline

Definition at line 1104 of file Molecule.h.

Referenced by NamdState::loadStructure(), and outputCompressedFile().

1104 { return (const float *)occupancy; }

◆ getVirialTailCorr()

BigReal Molecule::getVirialTailCorr ( const BigReal  )

◆ go_restricted()

Bool Molecule::go_restricted ( int  chain1,
int  chain2,
int  rDiff 
)

Definition at line 526 of file GoMolecule.C.

References FALSE, go_array, MAX_GO_CHAINS, MAX_RESTRICTIONS, and TRUE.

Referenced by build_go_arrays(), build_go_sigmas(), build_go_sigmas2(), get_go_force2(), and get_go_force_new().

527 {
528  int i; // Loop counter
529  for(i=0; i<MAX_RESTRICTIONS; i++) {
530  if (go_array[(MAX_GO_CHAINS*chain1) + chain2].restrictions[i] == rDiff) {
531  return TRUE;
532  } else if (go_array[(MAX_GO_CHAINS*chain1) + chain2].restrictions[i] == -1) {
533  return FALSE;
534  }
535  }
536  return FALSE;
537 }
#define MAX_RESTRICTIONS
Definition: Molecule.h:34
#define FALSE
Definition: common.h:127
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
#define TRUE
Definition: common.h:128

◆ goInit()

void Molecule::goInit ( )

Definition at line 55 of file GoMolecule.C.

References atomChainTypes, energyNative, energyNonnative, goCoordinates, goPDB, goResids, goSigmaIndices, goSigmas, goWithinCutoff, and numGoAtoms.

55  {
56  numGoAtoms=0;
57  energyNative=0;
59  atomChainTypes=NULL;
60  goSigmaIndices=NULL;
61  goSigmas=NULL;
62  goWithinCutoff=NULL;
63  goCoordinates=NULL;
64  goResids=NULL;
65  goPDB=NULL;
66 }
PDB * goPDB
Definition: Molecule.h:687
Real * goCoordinates
Definition: Molecule.h:685
bool * goWithinCutoff
Definition: Molecule.h:684
int32 * atomChainTypes
Definition: Molecule.h:680
int * goResids
Definition: Molecule.h:686
Real * goSigmas
Definition: Molecule.h:683
BigReal energyNonnative
Definition: Molecule.h:722
BigReal energyNative
Definition: Molecule.h:721
int32 * goSigmaIndices
Definition: Molecule.h:681
int numGoAtoms
Definition: Molecule.h:679

◆ initialize()

void Molecule::initialize ( )

◆ is_atom_constorqued()

Bool Molecule::is_atom_constorqued ( int  atomnum) const
inline

Definition at line 1321 of file Molecule.h.

References consTorqueIndexes, FALSE, and numConsTorque.

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  }
#define FALSE
Definition: common.h:127
int32 * consTorqueIndexes
Definition: Molecule.h:651
int numConsTorque
Definition: Molecule.h:631

◆ is_atom_constrained()

Bool Molecule::is_atom_constrained ( int  atomnum) const
inline

Definition at line 1272 of file Molecule.h.

References FALSE, and numConstraints.

Referenced by ComputeRestraints::doForce().

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  }
#define FALSE
Definition: common.h:127
int numConstraints
Definition: Molecule.h:624

◆ is_atom_dcd_selection()

Bool Molecule::is_atom_dcd_selection ( int  atomnum,
int  tag 
) const
inline

Definition at line 1337 of file Molecule.h.

References dcdSelectionAtoms, and FALSE.

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  }
#define FALSE
Definition: common.h:127
bool dcdSelectionAtoms
Definition: Molecule.h:481

◆ is_atom_exPressure()

Bool Molecule::is_atom_exPressure ( int  atomnum) const
inline

Definition at line 1544 of file Molecule.h.

References numExPressureAtoms.

Referenced by Sequencer::langevinPiston().

1545  {
1546  return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
1547  }
int numExPressureAtoms
Definition: Molecule.h:634

◆ is_atom_fixed()

Bool Molecule::is_atom_fixed ( int  atomnum) const
inline

Definition at line 1504 of file Molecule.h.

References numFixedAtoms.

Referenced by WorkDistrib::createAtomLists().

1505  {
1506  return (numFixedAtoms && fixedAtomFlags[atomnum]);
1507  }
int numFixedAtoms
Definition: Molecule.h:632

◆ is_atom_gridforced()

Bool Molecule::is_atom_gridforced ( int  atomnum,
int  gridnum 
) const
inline

Definition at line 1256 of file Molecule.h.

References FALSE, and numGridforceGrids.

Referenced by ComputeGridForce::checkGridForceRatio(), ComputeGridForce::createGridForcedIdxList(), and ComputeGridForce::do_calc().

1257  {
1258  if (numGridforceGrids)
1259  {
1260  return(gridfrcIndexes[gridnum][atomnum] != -1);
1261  }
1262  else
1263  {
1264  return(FALSE);
1265  }
1266  }
#define FALSE
Definition: common.h:127
int numGridforceGrids
Definition: Molecule.h:626

◆ is_atom_movdragged()

Bool Molecule::is_atom_movdragged ( int  atomnum) const
inline

Definition at line 1289 of file Molecule.h.

References FALSE, and numMovDrag.

Referenced by Sequencer::addMovDragToPosition().

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  }
#define FALSE
Definition: common.h:127
int numMovDrag
Definition: Molecule.h:629

◆ is_atom_rotdragged()

Bool Molecule::is_atom_rotdragged ( int  atomnum) const
inline

Definition at line 1305 of file Molecule.h.

References FALSE, and numRotDrag.

Referenced by Sequencer::addRotDragToPosition().

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  }
#define FALSE
Definition: common.h:127
int numRotDrag
Definition: Molecule.h:630

◆ is_atom_stirred()

Bool Molecule::is_atom_stirred ( int  atomnum) const
inline

Definition at line 1525 of file Molecule.h.

References FALSE, and numStirredAtoms.

Referenced by ComputeStir::doForce().

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  }
#define FALSE
Definition: common.h:127
int numStirredAtoms
Definition: Molecule.h:633

◆ is_drude()

Bool Molecule::is_drude ( int  ) const

◆ is_group_fixed()

Bool Molecule::is_group_fixed ( int  atomnum) const
inline

Definition at line 1540 of file Molecule.h.

References numFixedAtoms.

1541  {
1542  return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
1543  }
int numFixedAtoms
Definition: Molecule.h:632

◆ is_hydrogen()

Bool Molecule::is_hydrogen ( int  )

◆ is_hydrogenGroupParent()

Bool Molecule::is_hydrogenGroupParent ( int  )

◆ is_lp()

Bool Molecule::is_lp ( int  )

◆ is_oxygen()

Bool Molecule::is_oxygen ( int  )

◆ is_water()

Bool Molecule::is_water ( int  )

◆ langevin_param()

Real Molecule::langevin_param ( int  atomnum) const
inline

Definition at line 1388 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists().

1389  {
1390  return(langevinParams ? langevinParams[atomnum] : 0.);
1391  }

◆ num_deg_freedom()

int64_t Molecule::num_deg_freedom ( int  isInitialReport = 0) const
inline

Definition at line 553 of file Molecule.h.

References num_fixed_atoms(), numAtoms, numConstraints, numFepInitial, numFixedRigidBonds, numLonepairs, numRigidBonds, simParams, and TIP4.

Referenced by Controller::Controller(), NamdState::loadStructure(), and Controller::receivePressure().

553  {
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  }
Bool pairInteractionOn
WaterModel watmodel
int numLonepairs
Number of lone pairs.
Definition: Molecule.h:610
int numFixedRigidBonds
Definition: Molecule.h:641
int numFepInitial
Definition: Molecule.h:643
int num_fixed_atoms() const
Definition: Molecule.h:527
int numAtoms
Definition: Molecule.h:586
int numConstraints
Definition: Molecule.h:624
int numRigidBonds
Definition: Molecule.h:640

◆ num_fixed_atoms()

int Molecule::num_fixed_atoms ( ) const
inline

Definition at line 527 of file Molecule.h.

References numFixedAtoms, and simParams.

Referenced by num_deg_freedom(), num_fixed_groups(), num_group_deg_freedom(), and Controller::receivePressure().

527  {
528  // local variables prefixed by s_
529  int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
530  return s_NumFixedAtoms; // value is "turned on" SimParameters
531  }
int numFixedAtoms
Definition: Molecule.h:632

◆ num_fixed_groups()

int Molecule::num_fixed_groups ( ) const
inline

Definition at line 533 of file Molecule.h.

References num_fixed_atoms(), and numFixedGroups.

Referenced by num_group_deg_freedom(), and Controller::receivePressure().

533  {
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  }
int numFixedGroups
Definition: Molecule.h:639
int num_fixed_atoms() const
Definition: Molecule.h:527

◆ num_group_deg_freedom()

int64_t Molecule::num_group_deg_freedom ( ) const
inline

Definition at line 540 of file Molecule.h.

References num_fixed_atoms(), num_fixed_groups(), numConstraints, numHydrogenGroups, and simParams.

Referenced by Controller::receivePressure().

540  {
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  }
int numHydrogenGroups
Definition: Molecule.h:635
int num_fixed_atoms() const
Definition: Molecule.h:527
int numConstraints
Definition: Molecule.h:624
int num_fixed_groups() const
Definition: Molecule.h:533

◆ parse_dcd_selection_params()

void Molecule::parse_dcd_selection_params ( ConfigList configList)

◆ prepare_qm()

void Molecule::prepare_qm ( const char *  pdbFileName,
Parameters params,
ConfigList cfgList 
)

Prepares Live Solvent Selection

Data gathering from PDB to find QM atom and bond info

Multiplicity of each QM group

Charge of each QM group

Populate arrays that are used throughout the the calculations.

Overides Link Atom element with user selection.

Bond Schemes. Prepares for treatment of QM-MM bonds in ComputeQM.C

Live Solvent Selection

Custom Point Charge selection

Topology preparation

Definition at line 110 of file MoleculeQM.C.

References Parameters::assign_vdw_index(), qmSolvData::atmIDs, PDB::atom(), bond::atom1, bond::atom2, ResizeArray< Elem >::begin(), bond::bond_type, atom_constants::charge, StringList::data, DebugM, PDBAtom::element(), ResizeArray< Elem >::end(), endi(), SimParameters::extraBondsOn, SortedArray< Elem >::find(), ConfigList::find(), SimParameters::fixedAtomsOn, get_residue_size(), ObjectArena< Type >::getNewArray(), iERROR(), iINFO(), SortedArray< Elem >::insert(), iout, iWARN(), ResidueLookupElem::lookup(), atom_constants::mass, NAMD_blank_string(), NAMD_die(), NAMD_read_line(), StringList::next, PDB::num_atoms(), numAtoms, numBonds, numRealBonds, PDBAtom::occupancy(), SimParameters::PMEOn, SimParameters::qmBondColumnDefined, SimParameters::qmBondDist, SimParameters::qmBondGuess, SimParameters::qmBondOn, SimParameters::qmBondScheme, SimParameters::qmChrgFromPSF, SimParameters::qmColumn, SimParameters::qmCSMD, SimParameters::qmCustomPCSel, SimParameters::qmElecEmbed, SimParameters::qmFormat, QMFormatMOPAC, QMFormatORCA, SimParameters::qmLSSFreq, SimParameters::qmLSSMode, QMLSSMODECOM, QMLSSMODEDIST, SimParameters::qmLSSOn, SimParameters::qmLSSResname, SimParameters::qmMOPACAddConfigChrg, SimParameters::qmNoPC, SimParameters::qmPCSelFreq, QMSCHEMECS, QMSCHEMERCD, QMSCHEMEZ1, QMSCHEMEZ2, QMSCHEMEZ3, SimParameters::qmVDW, PDBAtom::residuename(), PDBAtom::residueseq(), PDBAtom::segmentname(), qmSolvData::size, ResizeArray< Elem >::size(), split(), SimParameters::stepsPerCycle, and PDBAtom::temperaturefactor().

Referenced by NamdState::loadStructure().

111  {
112 #ifdef MEM_OPT_VERSION
113  NAMD_die("QMMM interface is not supported in memory optimized builds.");
114 #else
115 
116  PDB *pdbP; // Pointer to PDB object to use
117 
118  qmNumQMAtoms = 0;
119 
120  qmNumGrps = 0 ;
121 
122  iout << iINFO << "Using the following PDB file for QM parameters: " <<
123  pdbFileName << "\n" << endi;
124  if (pdbFileName)
125  pdbP = new PDB(pdbFileName);
126  else
127  iout << "pdbFile name not defined!\n\n" << endi ;
128 
129  if (pdbP->num_atoms() != numAtoms)
130  {
131  NAMD_die("Number of atoms in QM parameter PDB file doesn't match coordinate PDB");
132  }
133 
134  qmElementArray = new char*[numAtoms] ;
135 
136  qmAtomGroup = new Real[numAtoms] ;
137 
138  BigReal bondVal;
139  Real atmGrp;
140 
141  std::set<Real> atmGrpSet;
142 
143  std::vector<Real> grpChrgVec;
144 
145  // Value in the bond column fro QM-MM bonds.
146  std::vector<BigReal> qmBondValVec;
147  // Identifiers of different QM regions
148  std::vector<Real> qmGroupIDsVec;
149  // This maps the qm group ID with the serail index of this group in
150  // various arrays.
151  std::map<Real,int> qmGrpIDMap ;
152 
153  std::vector<int> qmAtmIndxVec, qmGrpSizeVec;
154 
155  // Used to parse user selection in different places.
156  std::vector<std::string> strVec;
157 
158  qmNoPC = simParams->qmNoPC;
159 
160  // We set to zero by default, So there is no need for extra processing.
161  qmPCFreq = 0;
162  if (simParams->qmPCSelFreq > 1)
163  qmPCFreq = simParams->qmPCSelFreq;
164 
165 
168 
169 
170  qmLSSTotalNumAtms = 0;
171  SortedArray< qmSolvData> lssGrpRes;
172  std::map<Real,std::vector<int> > lssGrpRefIDs;
173  refSelStrMap lssRefUsrSel;
174  int totalNumRefAtms = 0;
175  int lssClassicResIndx = 0 ;
176  int lssCurrClassResID = -1 ;
177  char lssCurrClassResSegID[5];
178  if (simParams->qmLSSOn) {
179  DebugM(4, "LSS is ON! Processing QM solvent.\n") ;
180 
181  if (resLookup == NULL)
182  NAMD_die("We need residue data to conduct LSS.");
183 
184  if (simParams->qmLSSMode == QMLSSMODECOM) {
185 
186  StringList *current = cfgList->find("QMLSSRef");
187  for ( ; current; current = current->next ) {
188 
189  strVec = split( std::string(current->data) , " ");
190 
191  if (strVec.size() != 3 ) {
192  iout << iERROR << "Format error in QM LSS size: "
193  << current->data
194  << "\n" << endi;
195  NAMD_die("Error processing QM information.");
196  }
197 
198  std::stringstream storConv ;
199 
200  storConv << strVec[0] ;
201  Real grpID ;
202  storConv >> grpID;
203  if (storConv.fail()) {
204  iout << iERROR << "Error parsing QMLSSRef selection: "
205  << current->data
206  << "\n" << endi;
207  NAMD_die("Error processing QM information.");
208  }
209 
210  std::string segName = strVec[1].substr(0,4);
211 
212  storConv.clear() ;
213  storConv << strVec[2];
214  int resID ;
215  storConv >> resID;
216  if (storConv.fail()) {
217  iout << iERROR << "Error parsing QMLSSRef selection: "
218  << current->data
219  << "\n" << endi;
220  NAMD_die("Error processing QM information.");
221  }
222 
223  auto it = lssRefUsrSel.find(grpID) ;
224  if (it == lssRefUsrSel.end())
225  lssRefUsrSel.insert(refSelStrPair(grpID,refSelStrVec()));
226 
227  lssRefUsrSel[grpID].push_back(refSelStr(segName, resID));
228  }
229 
230  for (auto it=lssRefUsrSel.begin(); it!=lssRefUsrSel.end(); it++) {
231  iout << iINFO << "LSS user selection for COM composition of group "
232  << it->first << ":\n" << endi ;
233  for (int i=0; i<it->second.size();i++) {
234  iout << iINFO << "Segment " << it->second[i].segid
235  << " ; residue " << it->second[i].resid << "\n" << endi ;
236  }
237  }
238  }
239  }
240 
241 
242 
245 
246 
247  for (int atmInd = 0 ; atmInd < numAtoms; atmInd++) {
248 
249  // If we are looking for QM-MM bonds, then we need to store extra info.
250  // We only store extra information if the QM bond column was defined in
251  // the configuration file. If not, we are using QM bond guessing.
252  if (simParams->qmBondOn and (simParams->qmBondColumnDefined)) {
253 
254  // We store both the qm group and the bond value
255  if ( strcmp(simParams->qmColumn,"beta") == 0 ){
256  atmGrp = pdbP->atom(atmInd)->temperaturefactor() ;
257 
258  bondVal = pdbP->atom(atmInd)->occupancy() ;
259  }
260  else {
261  atmGrp = pdbP->atom(atmInd)->occupancy() ;
262 
263  bondVal = pdbP->atom(atmInd)->temperaturefactor() ;
264  }
265 
266  qmBondValVec.push_back(bondVal);
267  }
268  else {
269 
270  if ( strcmp(simParams->qmColumn,"beta") == 0 ){
271  atmGrp = pdbP->atom(atmInd)->temperaturefactor() ;
272  }
273  else {
274  atmGrp = pdbP->atom(atmInd)->occupancy() ;
275  }
276  }
277 
278  // We store all atom QM Group IDs in an array for
279  // future transport to all PEs.
280  qmAtomGroup[atmInd] = atmGrp;
281 
282  // We store all atom's elements for quick access in the QM code.
283  // Elements are used to tell the QM code the atom type.
284  qmElementArray[atmInd] = new char[3];
285  strncpy(qmElementArray[atmInd],pdbP->atom(atmInd)->element(),3);
286 
287  // For QM atoms, we keep global atom indices and parse different QM Group
288  // IDs, keeping track of each groups size
289  if (atmGrp > 0){
290 
291  if (simParams->fixedAtomsOn) {
292  if ( fixedAtomFlags[atmInd] == 1 ) {
293  iout << iERROR << "QM atom cannot be fixed in space!\n"
294  << endi;
295  NAMD_die("Error processing QM information.");
296  }
297  }
298 
299  // Changes the VdW type of QM atoms.
300  // This is may be used to counter balance the overpolarization
301  // that QM atoms sufer.
302  if (simParams->qmVDW) {
303  // Creating a new type string
304  std::string qmType(qmElementArray[atmInd]) ;
305  // Erases empty spaces
306  qmType.erase(
307  std::remove_if(qmType.begin(), qmType.end(), isspace ),
308  qmType.end());
309  // pre-pends a "q" to the element name.
310  qmType = std::string("q") + qmType;
311 
312 // iout << "QM VdW type: " << atoms[atmInd].vdw_type
313 // << " atom type: " << atomNames[atmInd].atomtype
314 // << " new type "<< qmType << "\n" << endi;
315 
316  /* Look up the vdw constants for this atom */
317  // I am casting a non-const here because the function doesn't actually
318  // change the string value, but it doesn't ask for a const char* as
319  // an argument.
320  params->assign_vdw_index(const_cast<char*>( qmType.c_str()),
321  &(atoms[atmInd]));
322 
323 // iout << "----> new VdW type: " << atoms[atmInd].vdw_type << "\n" << endi;
324  }
325 
326  // Indexes all global indices of QM atoms.
327  qmAtmIndxVec.push_back(atmInd);
328 
329  auto retVal = atmGrpSet.insert(atmGrp);
330 
331  // If a new QM group is found, store the reverse reference in a map
332  // and increase the total count.
333  if (retVal.second) {
334  // This mak makes the reverse identification from the group ID
335  // to the sequential order in which each group was first found.
336  qmGrpIDMap.insert(std::pair<BigReal,int>(atmGrp, qmNumGrps));
337 
338  // This vector keeps track of the group ID for each group
339  qmGroupIDsVec.push_back(atmGrp);
340 
341  // This counter is used to keep track of the sequential order in
342  // which QM groups were first seen in the reference PDB file.
343  qmNumGrps++ ;
344 
345  // If this is a new QM group, initialize a new variable in the
346  // vector to keep track of the number of atoms in this group.
347  qmGrpSizeVec.push_back(1);
348 
349  // For each new QM group, a new entry in the total charge
350  // vector is created
351  grpChrgVec.push_back( atoms[atmInd].charge );
352  }
353  else {
354  // If the QM group has already been seen, increase the count
355  // of atoms in that group.
356  qmGrpSizeVec[ qmGrpIDMap[atmGrp] ]++ ;
357 
358  // If the QM group exists, adds current atom charge to total charge.
359  grpChrgVec[ qmGrpIDMap[atmGrp] ] += atoms[atmInd].charge;
360  }
361 
362  // In case we are using live solvent selection
363  if(simParams->qmLSSOn) {
364 
365  int resID = pdbP->atom(atmInd)->residueseq();
366  char segName[5];
367  strncpy(segName, pdbP->atom(atmInd)->segmentname(),5);
368 
369  int resSize = get_residue_size(segName,resID);
370 
371  int i =-1, end =-1;
372 
373  resLookup->lookup(segName,resID,&i, &end);
374 
375  if ( strncasecmp(pdbP->atom(atmInd)->residuename(),
376  simParams->qmLSSResname, 4) == 0) {
377 
378  // We try to insert every residue from every atom
379  qmSolvData *resP = lssGrpRes.find(qmSolvData(resID, i, resSize));
380 
381  if (resP != NULL) {
382  resP->atmIDs.push_back(atmInd) ;
383 // DebugM(3, "Existing residue " << resP->resID
384 // << " from segID " << resP->segName
385 // << " received atom "
386 // << atmInd << "\n" );
387  }
388  else {
389  lssGrpRes.insert(qmSolvData(resID, i, resSize, segName, atmGrp));
390 // DebugM(3, lssGrpRes.size() << ") Inserted new residue: "
391 // << resID << " from segID " << segName
392 // << " with atom "
393 // << i << "\n" ) ;
394  }
395  }
396  else {
397  // We store the QM atoms, per group, which are NOT part of
398  // solvent molecules.
399 
400  // Checks if we have a vector for this QM group.
401  auto itNewGrp = lssGrpRefIDs.find(atmGrp) ;
402  if (itNewGrp == lssGrpRefIDs.end()) {
403  lssGrpRefIDs.insert(std::pair<Real, std::vector<int> >(
404  atmGrp, std::vector<int>() ) );
405  }
406 
407  switch (simParams->qmLSSMode)
408  {
409 
410  case QMLSSMODECOM:
411  {
412  // If we are using COM selection, checks if the atom
413  // is part of the user selected residues
414  for(int i=0; i<lssRefUsrSel[atmGrp].size(); i++) {
415  if (lssRefUsrSel[atmGrp][i].resid == resID &&
416  strncmp(lssRefUsrSel[atmGrp][i].segid.c_str(),
417  segName,5) == 0 ) {
418 
419  lssGrpRefIDs[atmGrp].push_back(atmInd);
420  totalNumRefAtms++;
421  }
422  }
423 
424  } break;
425 
426  case QMLSSMODEDIST:
427  {
428 
429  lssGrpRefIDs[atmGrp].push_back(atmInd);
430  totalNumRefAtms++;
431 
432  } break;
433 
434  }
435  }
436 
437  }
438 
439  }
440  else if (atmGrp == 0) {
441 
442  if(simParams->qmLSSOn) {
443 
444  if ( strncasecmp(pdbP->atom(atmInd)->residuename(),
445  simParams->qmLSSResname, 4) == 0) {
446 
447  int resID = pdbP->atom(atmInd)->residueseq();
448  char segName[5];
449  strncpy(segName, pdbP->atom(atmInd)->segmentname(),5);
450 
451  if (lssCurrClassResID < 0) {
452  lssCurrClassResID = resID ;
453  strncpy(lssCurrClassResSegID, segName,5);
454  lssClassicResIndx = 0;
455  }
456  else if (lssCurrClassResID != resID ||
457  strcmp(lssCurrClassResSegID, segName) != 0 ) {
458  lssCurrClassResID = resID ;
459  strncpy(lssCurrClassResSegID, segName,5);
460  lssClassicResIndx++;
461  }
462 
463  qmClassicSolv.insert(std::pair<int,int>(atmInd,lssClassicResIndx));
464 
465  }
466  }
467  }
468  else if(atmGrp < 0) {
469  iout << iERROR << "QM group ID cannot be less than zero!\n" << endi;
470  NAMD_die("Error processing QM information.");
471  }
472  }
473 
474  // Sanity check
475  if (simParams->qmLSSOn) {
476  if (lssGrpRes.size() == 0)
477  NAMD_die("LSS was activated but there are no QM solvent molecules!\n");
478 
479  for (auto it=lssRefUsrSel.begin(); it!=lssRefUsrSel.end(); it++) {
480  auto itTarget = qmGrpIDMap.find(it->first);
481  if (itTarget == qmGrpIDMap.end()) {
482  iout << iERROR << "QM group ID for LSS could not be found in input!"
483  << " QM group ID: " << it->first << "\n" << endi;
484  NAMD_die("Error processing QM information.");
485  }
486  }
487 
488  DebugM(3,"We found " << lssClassicResIndx << " classical solvent molecules totalling "
489  << qmClassicSolv.size() << " atoms.\n" );
490 
491  }
492 
493  qmNumQMAtoms = qmAtmIndxVec.size();
494 
495  if (qmNumQMAtoms == 0)
496  NAMD_die("No QM atoms were found in this QM simulation!") ;
497 
498  iout << iINFO << "Number of QM atoms (excluding Dummy atoms): " <<
499  qmNumQMAtoms << "\n" << endi;
500 
501  qmAtmChrg = new Real[qmNumQMAtoms] ;
502  qmAtmIndx = new int[qmNumQMAtoms] ;
503  for (int i=0; i<qmNumQMAtoms; i++) {
504  // qmAtmChrg gets initialized with the PSF charges at the end of this
505  // function, but values may change as QM steps are taken.
506  qmAtmChrg[i] = 0;
507  qmAtmIndx[i] = qmAtmIndxVec[i] ;
508  }
509 
510  // This map relates the QM group index with a vector of pairs
511  // of bonded MM-QM atoms (with the bonded atoms ins this order:
512  // MM first, QM second).
513  std::map<int, std::vector<std::pair<int,int> > > qmGrpIDBonds ;
514  int bondCounter = 0;
515  if (simParams->qmBondOn) {
516 
517  iout << iINFO << "Storing QM-MM bonds.\n" << endi;
518 
519  // Checks all bonds for QM-MM pairs.
520  // Makes sanity checks against QM-QM pairs and MM-MM pairs that
521  // are flagged by the user to be bonds between QM and MM regions.
522  // QM-QM bonds will be removed in another function.
523  for (int bndIt = 0; bndIt < numBonds; bndIt++) {
524 
525  bond curr = bonds[bndIt] ;
526 
527  bool storeBond = false ;
528 
529 
530 
531  if (simParams->qmBondGuess) {
532  // In case we are using QM region definitions and topology to
533  // determine QM-MM bonds.
534  if ((qmAtomGroup[curr.atom1] == 0 || qmAtomGroup[curr.atom2] == 0) &&
535  (qmAtomGroup[curr.atom1] != qmAtomGroup[curr.atom2]))
536  {
537  storeBond = true;
538  }
539 
540  }
541  else
542  {
543  // In case we are using the user-provided QM bond column values
544  // to determine QM-MM bonds.
545 
546  // In case BOTH atoms have a non-zero bond column value
547  if (qmBondValVec[curr.atom1] != 0 &&
548  qmBondValVec[curr.atom2] != 0 ) {
549 
550  storeBond = true;
551 
552  // Sanity checks (1 of 2)
553  if (qmAtomGroup[curr.atom1] != 0 &&
554  qmAtomGroup[curr.atom2] != 0) {
555  iout << iINFO << "Skipping Bond! Atoms " << curr.atom1
556  << " and " << curr.atom2 <<
557  " are assigned as QM atoms.\n" << endi;
558  storeBond = false;
559  }
560 
561  // Sanity checks (2 of 2)
562  if (qmAtomGroup[curr.atom1] == 0 &&
563  qmAtomGroup[curr.atom2] == 0) {
564  iout << iINFO << "Skipping Bond! Atoms " << curr.atom1
565  << " and " << curr.atom2 <<
566  " are assigned as MM atoms.\n" << endi;
567  storeBond = false;
568  }
569  }
570 
571  }
572 
573  if (storeBond) {
574  int currGrpID = 0;
575  std::pair<int,int> newPair(0,0);
576 
577  // We create a QM-MM pair with the MM atom first
578  if (qmAtomGroup[curr.atom1] != 0) {
579  newPair = std::pair<int,int>(curr.atom2, curr.atom1) ;
580  currGrpID = qmAtomGroup[curr.atom1];
581  } else {
582  newPair = std::pair<int,int>(curr.atom1, curr.atom2) ;
583  currGrpID = qmAtomGroup[curr.atom2];
584  }
585 
586  int grpIndx = qmGrpIDMap[currGrpID] ;
587 
588  // Stores bonds in vectors key-ed by the QM group ID of the QM atom.
589  auto retIter = qmGrpIDBonds.find(grpIndx) ;
590  // In case thi QM-MM bonds belong to a QM group we have not seen
591  // yet, stores a new vector in the map.
592  if (retIter == qmGrpIDBonds.end()) {
593  qmGrpIDBonds.insert(std::pair<BigReal,std::vector<std::pair<int,int> > >(
594  grpIndx, std::vector<std::pair<int,int> >() ) );
595  }
596 
597  qmGrpIDBonds[grpIndx].push_back( newPair );
598 
599  bondCounter++ ;
600  }
601 
602 
603  }
604 
605 // iout << "Finished processing QM-MM bonds.\n" << endi ;
606 
607  if (bondCounter == 0)
608  iout << iWARN << "We found " << bondCounter << " QM-MM bonds.\n" << endi ;
609  else
610  iout << iINFO << "We found " << bondCounter << " QM-MM bonds.\n" << endi ;
611 
612  }
613 
614  // Initializes several arrays used to setup the QM simulation.
615  qmNumBonds = bondCounter ;
616 
617  qmMMBond = new int*[qmNumBonds];
618 
619  qmDummyBondVal = new BigReal[qmNumBonds];
620 
621  qmMMChargeTarget = new int*[qmNumBonds] ;
622  qmMMNumTargs = new int[qmNumBonds] ;
623 
624  qmDummyElement = new char*[qmNumBonds] ;
625 
626 
627  qmNumGrps = atmGrpSet.size();
628 
629  qmGrpSizes = new int[qmNumGrps];
630 
631  qmGrpID = new Real[qmNumGrps];
632 
633  qmGrpChrg = new Real[qmNumGrps];
634 
635  qmGrpMult = new Real[qmNumGrps] ;
636 
637  qmGrpNumBonds = new int[qmNumGrps];
638 
639  qmGrpBonds = new int*[qmNumGrps];
640  qmMMBondedIndx = new int*[qmNumGrps];
641 
642 
645 
646 
647  // We first initialize the multiplicity vector with
648  // default values, then populate it with user defined values.
649  for (int grpIter = 0; grpIter < qmNumGrps; grpIter++) {
650  qmGrpMult[grpIter] = 0;
651  }
652 
653  int multCount = 0;
654  StringList *current = cfgList->find("QMMult");
655  for ( ; current; current = current->next ) {
656 
657  auto strVec = split( std::string(current->data) , " ");
658 
659  if (strVec.size() != 2 ) {
660  iout << iERROR << "Format error in QM Multiplicity string: "
661  << current->data
662  << "\n" << endi;
663  NAMD_die("Error processing QM information.");
664  }
665 
666  std::stringstream storConv ;
667 
668  storConv << strVec[0] ;
669  Real grpID ;
670  storConv >> grpID;
671  if (storConv.fail()) {
672  iout << iERROR << "Error parsing QMMult selection: "
673  << current->data
674  << "\n" << endi;
675  NAMD_die("Error processing QM information.");
676  }
677 
678  storConv.clear() ;
679  storConv << strVec[1];
680  Real multiplicity ;
681  storConv >> multiplicity;
682  if (storConv.fail()) {
683  iout << iERROR << "Error parsing QMMult selection: "
684  << current->data
685  << "\n" << endi;
686  NAMD_die("Error processing QM information.");
687  }
688 
689  auto it = qmGrpIDMap.find(grpID);
690 
691  if (it == qmGrpIDMap.end()) {
692  iout << iERROR << "Error parsing QMMult selection. Could not find QM group ID: "
693  << grpID
694  << "\n" << endi;
695  NAMD_die("Error processing QM information.");
696  }
697  else {
698  iout << iINFO << "Applying user defined multiplicity "
699  << multiplicity << " to QM group ID " << grpID << "\n" << endi;
700  qmGrpMult[it->second] = multiplicity;
701  }
702 
703  multCount++;
704  }
705 
706  if (multCount != qmNumGrps && simParams->qmFormat == QMFormatORCA) {
707  NAMD_die("ORCA neds multiplicity values for all QM regions.");
708  }
709 
710 
713 
714 
715  for (size_t grpIndx = 0; grpIndx < qmGrpSizeVec.size(); grpIndx++) {
716 
717  bool nonInteger = true;
718  if ((fabsf(roundf(grpChrgVec[grpIndx]) - grpChrgVec[grpIndx]) <= 0.001f) ) {
719  grpChrgVec[grpIndx] = roundf(grpChrgVec[grpIndx]) ;
720  nonInteger = false;
721  }
722 
723  iout << iINFO << grpIndx + 1 << ") Group ID: " << qmGroupIDsVec[grpIndx]
724  << " ; Group size: " << qmGrpSizeVec[grpIndx] << " atoms"
725  << " ; Total PSF charge: " << grpChrgVec[grpIndx] << "\n" << endi ;
726 
727  if (nonInteger && simParams->PMEOn)
728  NAMD_die("QM atoms do not add up to a whole charge, which is needed for PME.") ;
729  }
730 
731  int chrgCount = 0;
732  current = cfgList->find("QMCharge");
733  for ( ; current; current = current->next ) {
734 
735  auto strVec = split( std::string(current->data) , " ");
736 
737  if (strVec.size() != 2 ) {
738  iout << iERROR << "Format error in QM Charge string: "
739  << current->data
740  << "\n" << endi;
741  NAMD_die("Error processing QM information.");
742  }
743 
744  std::stringstream storConv ;
745 
746  storConv << strVec[0] ;
747  Real grpID ;
748  storConv >> grpID;
749  if (storConv.fail()) {
750  iout << iERROR << "Error parsing QMCharge selection: "
751  << current->data
752  << "\n" << endi;
753  NAMD_die("Error processing QM information.");
754  }
755 
756  storConv.clear() ;
757  storConv << strVec[1];
758  Real charge ;
759  storConv >> charge;
760  if (storConv.fail()) {
761  iout << iERROR << "Error parsing QMCharge selection: "
762  << current->data
763  << "\n" << endi;
764  NAMD_die("Error processing QM information.");
765  }
766 
767  auto it = qmGrpIDMap.find(grpID);
768 
769  if (it == qmGrpIDMap.end()) {
770  iout << iERROR << "Error parsing QMCharge selection. Could not find QM group ID: "
771  << grpID
772  << "\n" << endi;
773  NAMD_die("Error processing QM information.");
774  }
775  else {
776  iout << iINFO << "Found user defined charge "
777  << charge << " for QM group ID " << grpID << ". Will ignore PSF charge.\n" << endi;
778  grpChrgVec[it->second] = charge;
779  }
780 
781  chrgCount++;
782  }
783 
784  simParams->qmMOPACAddConfigChrg = false;
785  // Checks if QM group charges can be defined for MOPAC.
786  // Since charge can be defined in QMConfigLine, we need extra logic.
787  if (simParams->qmFormat == QMFormatMOPAC) {
788 
789  // Checks if group charge was supplied in config line for MOPAC.
790  std::string::size_type chrgLoc = std::string::npos ;
791 
792  // This will hold a sting with the first user supplied configuration line for MOPAC.
793  std::string configLine(cfgList->find("QMConfigLine")->data) ;
794  chrgLoc = configLine.find("CHARGE") ;
795 
796  if ( chrgLoc != std::string::npos ) {
797  iout << iINFO << "Found user defined charge in command line. This \
798 will be used for all QM regions and will take precedence over all other charge \
799 definitions.\n" << endi;
800  }
801  else if ( chrgLoc == std::string::npos && (simParams->qmChrgFromPSF || chrgCount == qmNumGrps) ) {
802  // If no charge was defined in the configuration line, gets from PSF and/or
803  // from user defined charges (through the QMCharge keyword).
804  simParams->qmMOPACAddConfigChrg = true;
805  }
806  else
807  {
808  // If we could nont find a charge definition in the config line AND
809  // no specific charge was selected for each QM region through QMCharge AND
810  // the QMChargeFromPSF was not turned ON, the we stop NAMD and scream at the user.
811 // if ( chrgLoc == std::string::npos && (chrgCount != qmNumGrps ) && !simParams->qmChrgFromPSF)
812  iout << iERROR << "Could not find charge for all QM groups. For MOPAC, \
813 charges can be defined through QMConfigLine, QMCharge or QMChargeFromPSF keywords.\n" << endi;
814  NAMD_die("Error processing QM information.");
815  }
816 
817  }
818 
819  if (simParams->qmFormat == QMFormatORCA ) {
820  if ((chrgCount != qmNumGrps ) && !simParams->qmChrgFromPSF) {
821  // If we are not supposed to get charges from the PSF, and not
822  // enough charges were set to cover all QM regions,
823  // we stop NAMD and scream at the user.
824  iout << iERROR << "Could not find charge for all QM groups. For ORCA, \
825 charges can be defined through QMCharge or QMChargeFromPSF keywords.\n" << endi;
826  NAMD_die("Error processing QM information.");
827  }
828  }
829 
830  // If mechanichal embedding was requested but we have QM-MM bonds, we need
831  // to send extra info to ComputeQM to preserve calculation speed.
832  if (qmNumBonds > 0 && qmNoPC) {
833  qmMeNumBonds = qmNumBonds;
834  qmMeMMindx = new int[qmMeNumBonds] ;
835  qmMeQMGrp = new Real[qmMeNumBonds] ;
836  }
837  else {
838  qmMeNumBonds = 0 ;
839  qmMeMMindx = NULL;
840  qmMeQMGrp = NULL;
841  }
842 
843 
846 
847 
848  bondCounter = 0;
849  for (int grpIter = 0; grpIter < qmNumGrps; grpIter++) {
850 
851  qmGrpID[grpIter] = qmGroupIDsVec[grpIter] ;
852 
853  qmGrpSizes[grpIter] = qmGrpSizeVec[grpIter] ;
854 
855  qmGrpChrg[grpIter] = grpChrgVec[grpIter];
856 
857 // iout << "Loaded " << qmGrpSizes[grpIter] << " atoms to this group.\n" << endi;
858 
859  int currNumbBonds = qmGrpIDBonds[grpIter].size() ;
860 
861  // Assigns the number of bonds that the current QM group has.
862  qmGrpNumBonds[grpIter] = currNumbBonds;
863 
864  if (currNumbBonds > 0) {
865 
866  qmGrpBonds[grpIter] = new int[currNumbBonds];
867  qmMMBondedIndx[grpIter] = new int[currNumbBonds];
868 
869  for (int bndIter = 0; bndIter<currNumbBonds; bndIter++) {
870 
871  // Adds the bonds to the overall sequential list.
872  qmMMBond[bondCounter] = new int[2] ;
873  qmMMBond[bondCounter][0] = qmGrpIDBonds[grpIter][bndIter].first ;
874  qmMMBond[bondCounter][1] = qmGrpIDBonds[grpIter][bndIter].second ;
875 
876  // For the current QM group, and the current bond, gets the bond index.
877  qmGrpBonds[grpIter][bndIter] = bondCounter;
878 
879  // For the current QM group, and the current bond, gets the MM atom.
880  qmMMBondedIndx[grpIter][bndIter] = qmGrpIDBonds[grpIter][bndIter].first ;
881 
882  // Assign the default value of dummy element
883  qmDummyElement[bondCounter] = new char[3];
884  strcpy(qmDummyElement[bondCounter],"H\0");
885 
886  // Determines the distance that will separate the new Dummy atom
887  // and the Qm atom to which it will be bound.
888  bondVal = 0;
889  if (simParams->qmBondDist) {
890  if (qmBondValVec[qmMMBond[bondCounter][0]] !=
891  qmBondValVec[qmMMBond[bondCounter][1]]
892  ) {
893  iout << iERROR << "qmBondDist is ON but the values in the bond column are different for atom "
894  << qmMMBond[bondCounter][0] << " and " << qmMMBond[bondCounter][1]
895  << ".\n" << endi ;
896  NAMD_die("Error in QM-MM bond processing.");
897  }
898 
899  bondVal = qmBondValVec[qmMMBond[bondCounter][0]] ;
900  }
901  else {
902 
903  if (strcmp(qmElementArray[qmMMBond[bondCounter][1]],"C") == 0 ) {
904  bondVal = 1.09 ;
905  }
906  else if (strcmp(qmElementArray[qmMMBond[bondCounter][1]],"O") == 0 ) {
907  bondVal = 0.98 ;
908  }
909  else if (strcmp(qmElementArray[qmMMBond[bondCounter][1]],"N") == 0 ) {
910  bondVal = 0.99 ;
911  }
912  else {
913  iout << iERROR << "qmBondDist is OFF but the QM atom has no default distance value. Atom "
914  << qmMMBond[bondCounter][1] << ", with element: "
915  << qmElementArray[qmMMBond[bondCounter][1]]
916  << ".\n" << endi ;
917  NAMD_die("Error in QM-MM bond processing.");
918  }
919 
920  }
921 
922  iout << iINFO << "MM-QM pair: " << qmMMBond[bondCounter][0] << ":"
923  << qmMMBond[bondCounter][1]
924  << " -> Value (distance or ratio): " << bondVal
925  << " (QM Group " << grpIter << " ID " << qmGrpID[grpIter] << ")"
926  << "\n" << endi ;
927 
928  qmDummyBondVal[bondCounter] = bondVal;
929 
930  // In case we are preparing for a mechanical embedding simulation
931  // with no point charges, populate the following vectors
932  if (qmMeNumBonds > 0) {
933  qmMeMMindx[bondCounter] = qmMMBond[bondCounter][0];
934  qmMeQMGrp[bondCounter] = qmGrpID[grpIter];
935  }
936 
937  bondCounter++ ;
938  }
939  }
940 
941  }
942 
943 
946 
947  current = NULL;
948  if (qmNumBonds > 0)
949  current = cfgList->find("QMLinkElement");
950 
951  int numParsedLinkElem = 0;
952  for ( ; current != NULL; current = current->next ) {
953 
954  DebugM(3,"Parsing link atom element: " << current->data << "\n" );
955 
956  strVec = split( std::string(current->data) , " ");
957 
958  // We need the two atoms that compose the QM-MM bonds and
959  // then the element.
960  if (strVec.size() != 3 && qmNumBonds > 1) {
961  iout << iERROR << "Format error in QM link atom element selection: "
962  << current->data
963  << "\n" << endi;
964  NAMD_die("Error processing QM information.");
965  }
966 
967  // If there is only one QM-MM bond, we can accept the element only.
968  if (strVec.size() != 1 && strVec.size() != 3 && qmNumBonds == 1) {
969  iout << iERROR << "Format error in QM link atom element selection: "
970  << current->data
971  << "\n" << endi;
972  NAMD_die("Error processing QM information.");
973  }
974 
975  std::stringstream storConv ;
976  int bondAtom1, bondAtom2;
977  std::string linkElement ;
978 
979  if (strVec.size() == 1) {
980  linkElement = strVec[0].substr(0,2);
981  }
982  else if (strVec.size() == 3) {
983 
984  storConv << strVec[0] ;
985  storConv >> bondAtom1;
986  if (storConv.fail()) {
987  iout << iERROR << "Error parsing link atom element selection: "
988  << current->data
989  << "\n" << endi;
990  NAMD_die("Error processing QM information.");
991  }
992 
993  storConv.clear() ;
994  storConv << strVec[1];
995  storConv >> bondAtom2;
996  if (storConv.fail()) {
997  iout << iERROR << "Error parsing link atom element selection: "
998  << current->data
999  << "\n" << endi;
1000  NAMD_die("Error processing QM information.");
1001  }
1002 
1003  linkElement = strVec[2].substr(0,2);
1004  }
1005 
1006  numParsedLinkElem++;
1007 
1008  if (numParsedLinkElem>qmNumBonds) {
1009  iout << iERROR << "More link atom elements were set than there"
1010  " are QM-MM bonds.\n" << endi;
1011  NAMD_die("Error processing QM information.");
1012  }
1013 
1014  int bondIter;
1015 
1016  if (strVec.size() == 1) {
1017  bondIter = 0;
1018  }
1019  else if (strVec.size() == 3) {
1020 
1021  Bool foundBond = false;
1022 
1023  for (bondIter=0; bondIter<qmNumBonds; bondIter++) {
1024 
1025  if ( (qmMMBond[bondIter][0] == bondAtom1 &&
1026  qmMMBond[bondIter][1] == bondAtom2 ) ||
1027  (qmMMBond[bondIter][0] == bondAtom2 &&
1028  qmMMBond[bondIter][1] == bondAtom1 ) ) {
1029 
1030  foundBond = true;
1031  break;
1032  }
1033  }
1034 
1035  if (! foundBond) {
1036  iout << iERROR << "Error parsing link atom element selection: "
1037  << current->data
1038  << "\n" << endi;
1039  iout << iERROR << "Atom pair was not found to be a QM-MM bond.\n"
1040  << endi;
1041  NAMD_die("Error processing QM information.");
1042  }
1043  }
1044 
1045  strcpy(qmDummyElement[bondIter],linkElement.c_str());
1046  qmDummyElement[bondIter][2] = '\0';
1047 
1048  iout << iINFO << "Applying user defined link atom element "
1049  << qmDummyElement[bondIter] << " to QM-MM bond "
1050  << bondIter << ": " << qmMMBond[bondIter][0]
1051  << " - " << qmMMBond[bondIter][1]
1052  << "\n" << endi;
1053  }
1054 
1055 
1056 
1059 
1060 
1061  int32 **bondsWithAtomLocal = NULL ;
1062  int32 *byAtomSizeLocal = NULL;
1063  ObjectArena <int32 >* tmpArenaLocal = NULL;
1064  if (qmNumBonds > 0) {
1065 
1066  bondsWithAtomLocal = new int32 *[numAtoms];
1067  byAtomSizeLocal = new int32[numAtoms];
1068  tmpArenaLocal = new ObjectArena<int32>;
1069 
1070  // Build the bond lists
1071  for (int i=0; i<numAtoms; i++)
1072  {
1073  byAtomSizeLocal[i] = 0;
1074  }
1075  for (int i=0; i<numRealBonds; i++)
1076  {
1077  byAtomSizeLocal[bonds[i].atom1]++;
1078  byAtomSizeLocal[bonds[i].atom2]++;
1079  }
1080  for (int i=0; i<numAtoms; i++)
1081  {
1082  bondsWithAtomLocal[i] = tmpArenaLocal->getNewArray(byAtomSizeLocal[i]+1);
1083  bondsWithAtomLocal[i][byAtomSizeLocal[i]] = -1;
1084  byAtomSizeLocal[i] = 0;
1085  }
1086  for (int i=0; i<numRealBonds; i++)
1087  {
1088  int a1 = bonds[i].atom1;
1089  int a2 = bonds[i].atom2;
1090  bondsWithAtomLocal[a1][byAtomSizeLocal[a1]++] = i;
1091  bondsWithAtomLocal[a2][byAtomSizeLocal[a2]++] = i;
1092  }
1093  }
1094 
1095  // In this loops we try to find other bonds in which the MM atoms from
1096  // QM-MM bonds may be involved. The other MM atoms (which we will call M2 and M3)
1097  // will be involved in charge manipulation. See ComputeQM.C for details.
1098  for (int qmBndIt = 0; qmBndIt < qmNumBonds; qmBndIt++) {
1099 
1100  // The charge targets are accumulated in a temporary vector and then
1101  // transfered to an array that will be transmited to the ComputeQMMgr object.
1102  std::vector<int> chrgTrgt ;
1103 
1104  int MM1 = qmMMBond[qmBndIt][0], MM2, MM2BondIndx, MM3, MM3BondIndx;
1105 
1106  switch (simParams->qmBondScheme) {
1107 
1108  case QMSCHEMERCD:
1109 
1110  case QMSCHEMECS:
1111  {
1112  // Selects ALL MM2 atoms.
1113  for (int i=0; i<byAtomSizeLocal[MM1]; i++) {
1114  MM2BondIndx = bondsWithAtomLocal[MM1][i] ;
1115 
1116  // Checks which of the atoms in the bond structure is the
1117  // MM2 atom.
1118  if (bonds[MM2BondIndx].atom1 == MM1)
1119  MM2 = bonds[MM2BondIndx].atom2;
1120  else
1121  MM2 = bonds[MM2BondIndx].atom1;
1122 
1123  // In case the bonded atom is a QM atom,
1124  // skips the index.
1125  if (qmAtomGroup[MM2] > 0)
1126  continue;
1127 
1128  chrgTrgt.push_back(MM2);
1129  }
1130 
1131  } break;
1132 
1133  case QMSCHEMEZ3:
1134  {
1135  // Selects all MM3 atoms
1136  for (int i=0; i<byAtomSizeLocal[MM1]; i++) {
1137  MM2BondIndx = bondsWithAtomLocal[MM1][i] ;
1138 
1139  // Checks which of the atoms in the bond structure is the
1140  // MM2 atom.
1141  if (bonds[MM2BondIndx].atom1 == MM1)
1142  MM2 = bonds[MM2BondIndx].atom2;
1143  else
1144  MM2 = bonds[MM2BondIndx].atom1;
1145 
1146  // In case the bonded atom is a QM atom,
1147  // skips the index.
1148  if (qmAtomGroup[MM2] > 0)
1149  continue;
1150 
1151  for (int i=0; i<byAtomSizeLocal[MM2]; i++) {
1152  MM3BondIndx = bondsWithAtomLocal[MM2][i] ;
1153 
1154  // Checks which of the atoms in the bond structure is the
1155  // MM3 atom.
1156  if (bonds[MM3BondIndx].atom1 == MM2)
1157  MM3 = bonds[MM3BondIndx].atom2;
1158  else
1159  MM3 = bonds[MM3BondIndx].atom1;
1160 
1161  // In case the bonded atom is a QM atom,
1162  // skips the index.
1163  // We also keep the search from going back to MM1.
1164  if (qmAtomGroup[MM3] > 0 || MM3 == MM1)
1165  continue;
1166 
1167  chrgTrgt.push_back(MM3);
1168  }
1169 
1170  }
1171 
1172  };
1173 
1174  case QMSCHEMEZ2:
1175  {
1176  // Selects all MM2 atoms
1177  for (int i=0; i<byAtomSizeLocal[MM1]; i++) {
1178  MM2BondIndx = bondsWithAtomLocal[MM1][i] ;
1179 
1180  // Checks which of the atoms in the bond structure is the
1181  // MM2 atom.
1182  if (bonds[MM2BondIndx].atom1 == MM1)
1183  MM2 = bonds[MM2BondIndx].atom2;
1184  else
1185  MM2 = bonds[MM2BondIndx].atom1;
1186 
1187  // In case the bonded atom is a QM atom,
1188  // skips the index.
1189  if (qmAtomGroup[MM2] > 0)
1190  continue;
1191 
1192  chrgTrgt.push_back(MM2);
1193  }
1194 
1195  };
1196 
1197  case QMSCHEMEZ1:
1198  {
1199  // Selects all MM1 atoms
1200  chrgTrgt.push_back(MM1);
1201  } break;
1202  }
1203 
1204 
1205  qmMMChargeTarget[qmBndIt] = new int[chrgTrgt.size()] ;
1206  qmMMNumTargs[qmBndIt] = chrgTrgt.size();
1207 
1208  DebugM(3, "MM-QM bond " << qmBndIt << "; MM atom "
1209  << qmMMBond[qmBndIt][0] << " conections: \n" );
1210 
1211  for (size_t i=0; i < chrgTrgt.size(); i++) {
1212  qmMMChargeTarget[qmBndIt][i] = chrgTrgt[i];
1213  DebugM(3,"MM Bonded to: " << chrgTrgt[i] << "\n" );
1214  }
1215 
1216  chrgTrgt.clear();
1217  }
1218 
1219  if (bondsWithAtomLocal != NULL)
1220  delete [] bondsWithAtomLocal; bondsWithAtomLocal = 0;
1221  if (byAtomSizeLocal != NULL)
1222  delete [] byAtomSizeLocal; byAtomSizeLocal = 0;
1223  if (tmpArenaLocal != NULL)
1224  delete tmpArenaLocal; tmpArenaLocal = 0;
1225 
1226 
1229 
1230 
1231  if(simParams->qmLSSOn) {
1232 
1233  std::map<Real,int> grpLSSSize ;
1234  std::map<Real,int>::iterator itGrpSize;
1235 
1236  qmLSSTotalNumAtms = 0;
1237  qmLSSResidueSize = 0;
1238 
1239  if (simParams->qmLSSFreq == 0)
1240  qmLSSFreq = simParams->stepsPerCycle ;
1241  else
1242  qmLSSFreq = simParams->qmLSSFreq;
1243 
1244  #ifdef DEBUG_QM
1245  int resSize = -1;
1246  #endif
1247 
1248  std::map<Real, int> grpNumLSSRes;
1249  std::map<Real, int>::iterator itGrpNumRes;
1250 
1251  for( auto it = lssGrpRes.begin(); it != lssGrpRes.end();it++ ) {
1252 
1253  if (it->atmIDs.size() != it->size) {
1254  iout << iERROR << "The number of atoms loaded for residue "
1255  << it->resID << " does not match the expected for this residue type.\n"
1256  << endi;
1257  NAMD_die("Error parsing data for LSS.");
1258  }
1259 
1260  qmLSSTotalNumAtms += it->size;
1261 
1262  #ifdef DEBUG_QM
1263  if (resSize < 0) resSize = it->size ;
1264  if (resSize > 0 and resSize != it->size) {
1265  iout << iERROR << "The number of atoms loaded for residue "
1266  << it->resID << " does not match previously loaded residues.\n"
1267  << endi;
1268  NAMD_die("Error parsing data for LSS.");
1269  }
1270 
1271 // DebugM(3,"Residue " << it->resID << ": " << it->segName
1272 // << " - from " << it->begAtmID << " with size "
1273 // << it->size << " (QM ID: " << it->qmGrpID
1274 // << ") has " << it->atmIDs.size() << " atoms: \n" ) ;
1275 // for (int i=0; i<it->atmIDs.size(); i++)
1276 // DebugM(3, it->atmIDs[i] << "\n" );
1277  #endif
1278 
1279  // Calculating total number of atoms per group
1280  itGrpSize = grpLSSSize.find(it->qmGrpID) ;
1281  if (itGrpSize != grpLSSSize.end())
1282  itGrpSize->second += it->size;
1283  else
1284  grpLSSSize.insert(std::pair<Real,int>(it->qmGrpID, it->size));
1285 
1286  // Calculating total number of solvent residues per group
1287  itGrpNumRes = grpNumLSSRes.find(it->qmGrpID) ;
1288  if (itGrpNumRes != grpNumLSSRes.end())
1289  itGrpNumRes->second += 1;
1290  else
1291  grpNumLSSRes.insert(std::pair<Real,int>(it->qmGrpID, 1));
1292  }
1293 
1294  qmLSSResidueSize = lssGrpRes.begin()->size ;
1295 
1296  qmLSSSize = new int[qmNumGrps];
1297 
1298  qmLSSIdxs = new int[qmLSSTotalNumAtms];
1299  int lssAtmIndx = 0;
1300 
1301  switch (simParams->qmLSSMode) {
1302 
1303  case QMLSSMODECOM:
1304  {
1305 
1306  qmLSSRefSize = new int[qmNumGrps];
1307 
1308  qmLSSMass = new Mass[qmLSSTotalNumAtms];
1309 
1310  qmLSSRefIDs = new int[totalNumRefAtms];
1311  qmLSSRefMass = new Mass[totalNumRefAtms];
1312  int lssRefIndx = 0;
1313 
1314  for (int grpIndx=0; grpIndx<qmNumGrps; grpIndx++) {
1315 
1316  itGrpSize = grpNumLSSRes.find(qmGrpID[grpIndx]) ;
1317 
1318  if (itGrpSize != grpNumLSSRes.end())
1319  qmLSSSize[grpIndx] = itGrpSize->second;
1320  else
1321  qmLSSSize[grpIndx] = 0;
1322 
1323  for( auto it = lssGrpRes.begin(); it != lssGrpRes.end();it++ ) {
1324 
1325  if (it->qmGrpID == qmGrpID[grpIndx]) {
1326  for (int i=0; i<it->atmIDs.size(); i++) {
1327  qmLSSIdxs[lssAtmIndx] = it->atmIDs[i];
1328  qmLSSMass[lssAtmIndx] = atoms[it->atmIDs[i]].mass;
1329  lssAtmIndx++;
1330  }
1331  }
1332  }
1333 
1334  DebugM(4, "QM group " << qmGrpID[grpIndx]
1335  << " has " << qmLSSSize[grpIndx] << " solvent molecules, "
1336  << "totalling " << grpLSSSize[qmGrpID[grpIndx]]
1337  << " atoms (check " << lssAtmIndx << ").\n" );
1338 
1339  qmLSSRefSize[grpIndx] = lssGrpRefIDs[qmGrpID[grpIndx]].size();
1340  for(int i=0; i < qmLSSRefSize[grpIndx]; i++) {
1341  qmLSSRefIDs[lssRefIndx] = lssGrpRefIDs[qmGrpID[grpIndx]][i];
1342  qmLSSRefMass[lssRefIndx] = atoms[qmLSSRefIDs[lssRefIndx]].mass;
1343  lssRefIndx++;
1344  }
1345 
1346  DebugM(4, "QM group " << qmGrpID[grpIndx]
1347  << " has " << qmLSSRefSize[grpIndx] << " non-solvent atoms for LSS.\n" );
1348  }
1349 
1350  } break ;
1351 
1352  case QMLSSMODEDIST:
1353  {
1354  for (int grpIndx=0; grpIndx<qmNumGrps; grpIndx++) {
1355 
1356  itGrpSize = grpNumLSSRes.find(qmGrpID[grpIndx]) ;
1357 
1358  if (itGrpSize != grpNumLSSRes.end())
1359  qmLSSSize[grpIndx] = itGrpSize->second;
1360  else
1361  qmLSSSize[grpIndx] = 0;
1362 
1363  for( auto it = lssGrpRes.begin(); it != lssGrpRes.end();it++ ) {
1364 
1365  if (it->qmGrpID == qmGrpID[grpIndx]) {
1366  for (int i=0; i<it->atmIDs.size(); i++) {
1367  qmLSSIdxs[lssAtmIndx] = it->atmIDs[i];
1368  lssAtmIndx++;
1369  }
1370  }
1371  }
1372 
1373  DebugM(4, "QM group " << qmGrpID[grpIndx]
1374  << " has " << qmLSSSize[grpIndx] << " solvent molecules, "
1375  << "totalling " << grpLSSSize[qmGrpID[grpIndx]]
1376  << " atoms (check " << lssAtmIndx << ").\n" );
1377  }
1378 
1379  } break ;
1380 
1381  }
1382  }
1383 
1384 
1387 
1388 
1389  PDB *customPCPDB;
1390 
1391  // In case we have a custom and fixed set of point charges for each QM group,
1392  // we process the files containing information.
1393  current = NULL;
1394  if (simParams->qmCustomPCSel) {
1395  current = cfgList->find("QMCustomPCFile");
1396  }
1397 
1398  std::map<Real,std::vector<int> > qmPCVecMap ;
1399 
1400  int numParsedPBDs = 0;
1401  for ( ; current != NULL; current = current->next ) {
1402 
1403  iout << iINFO << "Parsing QM Custom PC file " << current->data << "\n" << endi;
1404  customPCPDB = new PDB(current->data);
1405 
1406  if (customPCPDB->num_atoms() != numAtoms)
1407  NAMD_die("Number of atoms in QM Custom PC PDB file doesn't match coordinate PDB");
1408 
1409  std::vector< int > currPCSel ;
1410  Real currQMID = 0 ;
1411  int currGrpSize = 0 ;
1412 
1413  for (int atmInd = 0 ; atmInd < numAtoms; atmInd++) {
1414 
1415  BigReal beta = customPCPDB->atom(atmInd)->temperaturefactor() ;
1416  BigReal occ = customPCPDB->atom(atmInd)->occupancy() ;
1417 
1418  if ( beta != 0 && occ != 0)
1419  NAMD_die("An atom cannot be marked as QM and poitn charge simultaneously!");
1420 
1421  // If this is not a QM atom and
1422  if (occ != 0) {
1423  currPCSel.push_back(atmInd) ;
1424  }
1425 
1426  if (beta != 0) {
1427  if (pdbP->atom(atmInd)->temperaturefactor() != beta)
1428  NAMD_die("QM Group selection is different in reference PDB and Custom-PC PDB!");
1429 
1430  if (currQMID == 0) {
1431  // If this is the first QM atom we find, keep the QM Group ID.
1432  currQMID = beta;
1433  }
1434  else {
1435  // For all other atoms, check if it is the same group. It must be!!
1436  if (currQMID != beta)
1437  NAMD_die("Found two different QM group IDs in this file!");
1438  }
1439 
1440  currGrpSize++;
1441  }
1442 
1443  }
1444 
1445  if (currGrpSize != qmGrpSizeVec[ qmGrpIDMap[currQMID] ])
1446  NAMD_die("Reference PDB and Custom-PC PDB have different QM group sizes!") ;
1447 
1448  qmPCVecMap.insert(std::pair<Real,std::vector<int> >(
1449  currQMID, currPCSel ));
1450 
1451  numParsedPBDs++;
1452  delete customPCPDB;
1453  }
1454 
1455  delete pdbP;
1456 
1457  if (numParsedPBDs != qmNumGrps && simParams->qmCustomPCSel) {
1458  iout << iWARN << "The number of files provided for custom point "
1459  "charges is not equal to the number of QM groups!\n" << endi;
1460  }
1461 
1462  // Initializes an array with the number of Custom Point Charges per
1463  // QM group.
1464  qmCustPCSizes = new int[qmNumGrps];
1465  for (int i=0; i<qmNumGrps; i++)
1466  qmCustPCSizes[i] = 0;
1467 
1468  qmTotCustPCs = 0;
1469 
1470  // Stores the size of each Custom PC vector in the array.
1471  // We may not have PCs for all QM groups.
1472  for (auto it = qmPCVecMap.begin(); it != qmPCVecMap.end(); it++) {
1473  qmTotCustPCs += (*it).second.size();
1474  int qmIndx = qmGrpIDMap[(*it).first];
1475  qmCustPCSizes[qmIndx] = (*it).second.size();
1476  }
1477 
1478  qmCustomPCIdxs = new int[qmTotCustPCs];
1479 
1480  if (simParams->qmCustomPCSel) {
1481 
1482  int auxIter = 0;
1483  for (int grpIndx=0; grpIndx<qmNumGrps; grpIndx++) {
1484 
1485  Real currQMID = qmGrpID[grpIndx];
1486 
1487  iout << iINFO << "Loading " << qmPCVecMap[currQMID].size()
1488  << " custom point charges to QM Group " << grpIndx
1489  << " (ID: " << currQMID << ")\n" << endi;
1490 
1491  for (int pcIndx=0; pcIndx<qmPCVecMap[currQMID].size(); pcIndx++) {
1492  qmCustomPCIdxs[auxIter] = qmPCVecMap[currQMID][pcIndx] ;
1493  auxIter++;
1494  }
1495  }
1496  }
1497 
1498  // Conditional SMD option
1499  qmcSMD = simParams->qmCSMD;
1500  if (qmcSMD) {
1501  read_qm_csdm_file(qmGrpIDMap);
1502  }
1503 
1506 
1507  if (simParams->qmElecEmbed) {
1508  // Modifies Atom charges for Electrostatic Embedding.
1509  // QM atoms cannot have charges in the standard location, to keep
1510  // NAMD from calculating electrostatic interactions between QM and MM atoms.
1511  // We handle electrostatics ourselves in ComputeQM.C and in special
1512  // modifications for PME.
1513  for (int i=0; i<qmNumQMAtoms; i++) {
1514  qmAtmChrg[i] = atoms[qmAtmIndx[i]].charge;
1515  atoms[qmAtmIndx[i]].charge = 0;
1516  }
1517  }
1518 
1519 
1520  if ( simParams->extraBondsOn) {
1521  // Lifted from Molecule::build_extra_bonds
1522 
1523  StringList *file = cfgList->find("extraBondsFile");
1524 
1525  char err_msg[512];
1526  int a1,a2; float k, ref;
1527 
1528  for ( ; file; file = file->next ) { // loop over files
1529  FILE *f = fopen(file->data,"r");
1530 // if ( ! f ) {
1531 // sprintf(err_msg, "UNABLE TO OPEN EXTRA BONDS FILE %s", file->data);
1532 // NAMD_err(err_msg);
1533 // } else {
1534 // iout << iINFO << "READING EXTRA BONDS FILE " << file->data <<"\n"<<endi;
1535 // }
1536 
1537  while ( 1 ) {
1538  char buffer[512];
1539  int ret_code;
1540  do {
1541  ret_code = NAMD_read_line(f, buffer);
1542  } while ( (ret_code==0) && (NAMD_blank_string(buffer)) );
1543  if (ret_code!=0) break;
1544 
1545  char type[512];
1546  sscanf(buffer,"%s",type);
1547 
1548  int badline = 0;
1549  if ( ! strncasecmp(type,"bond",4) ) {
1550  if ( sscanf(buffer, "%s %d %d %f %f %s",
1551  type, &a1, &a2, &k, &ref, err_msg) != 5 ) badline = 1;
1552 
1553  // If an extra bond is defined between QM atoms, we make
1554  // note so that it wont be deleted when we delete bonded
1555  // interactions between QM atoms.
1556  if( qmAtomGroup[a1] > 0 && qmAtomGroup[a2]) {
1557  Bond tmp;
1558  tmp.bond_type = 0;
1559  tmp.atom1 = a1; tmp.atom2 = a2;
1560  qmExtraBonds.add(tmp);
1561  }
1562 
1563 
1564  }else if ( ! strncasecmp(type,"#",1) ) {
1565  continue; // comment
1566  }
1567 
1568  }
1569  fclose(f);
1570  }
1571  }
1572 
1573  return;
1574 
1575 #endif // MEM_OPT_VERSION
1576 }
char qmLSSResname[5]
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Type * getNewArray(int n)
Definition: ObjectArena.h:49
std::map< Real, refSelStrVec > refSelStrMap
Definition: MoleculeQM.C:107
#define QMLSSMODECOM
Definition: Molecule.h:126
Definition: PDB.h:36
int size(void) const
Definition: ResizeArray.h:131
int numBonds
Definition: Molecule.h:589
#define QMSCHEMEZ2
Definition: Molecule.h:139
int NAMD_read_line(FILE *fd, char *buf, int bufsize)
Definition: strlib.C:38
void assign_vdw_index(const char *, Atom *)
Definition: Parameters.C:4399
std::vector< int > atmIDs
Definition: MoleculeQM.C:51
#define QMSCHEMERCD
Definition: Molecule.h:137
int get_residue_size(const char *segid, int resid) const
Definition: Molecule.C:149
BigReal temperaturefactor(void)
Definition: PDBData.C:450
int lookup(const char *segid, int resid, int *begin, int *end) const
Definition: Molecule.C:81
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
int numRealBonds
Definition: Molecule.h:588
#define QMFormatMOPAC
Definition: Molecule.h:129
#define iout
Definition: InfoStream.h:51
int num_atoms(void)
Definition: PDB.C:323
#define QMFormatORCA
Definition: Molecule.h:128
#define QMSCHEMEZ3
Definition: Molecule.h:140
int32 atom1
Definition: structures.h:50
#define QMSCHEMEZ1
Definition: Molecule.h:138
#define QMSCHEMECS
Definition: Molecule.h:136
const char * residuename(void)
Definition: PDBData.C:399
int insert(const Elem &elem)
Definition: SortedArray.h:81
PDBAtom * atom(int place)
Definition: PDB.C:393
int NAMD_blank_string(char *str)
Definition: strlib.C:222
int Bool
Definition: common.h:142
int residueseq(void)
Definition: PDBData.C:411
std::pair< Real, refSelStrVec > refSelStrPair
Definition: MoleculeQM.C:108
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
std::vector< std::string > split(const std::string &text, std::string delimiter)
Definition: MoleculeQM.C:74
Bool qmMOPACAddConfigChrg
std::vector< refSelStr > refSelStrVec
Definition: MoleculeQM.C:106
StringList * next
Definition: ConfigList.h:49
iterator begin(void)
Definition: ResizeArray.h:36
char * data
Definition: ConfigList.h:48
Bool qmBondColumnDefined
Elem * find(const Elem &elem)
Definition: SortedArray.h:94
iterator end(void)
Definition: ResizeArray.h:37
float Mass
Definition: ComputeGBIS.inl:20
BigReal occupancy(void)
Definition: PDBData.C:444
std::ostream & iERROR(std::ostream &s)
Definition: InfoStream.C:83
#define QMLSSMODEDIST
Definition: Molecule.h:125
Index bond_type
Definition: structures.h:52
StringList * find(const char *name) const
Definition: ConfigList.C:341
const char * element(void)
Definition: PDBData.C:470
int32 atom2
Definition: structures.h:51
double BigReal
Definition: common.h:123
char qmColumn[16]
const char * segmentname(void)
Definition: PDBData.C:464

◆ print_atoms()

void Molecule::print_atoms ( Parameters params)

Definition at line 5548 of file Molecule.C.

References DebugM, endi(), Parameters::get_num_vdw_params(), Parameters::get_vdw_params(), and simParams.

Referenced by NamdState::loadStructure().

5549 {
5550 #ifdef MEM_OPT_VERSION
5551  DebugM(3, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5552 #else
5553  register int i;
5554  Real sigma;
5555  Real epsilon;
5556  Real sigma14;
5557  Real epsilon14;
5558 
5559  DebugM(3,"ATOM LIST\n" \
5560  << "******************************************\n" \
5561  << "NUM NAME TYPE RES MASS CHARGE CHARGE FEP-CHARGE" \
5562  << "SIGMA EPSILON SIGMA14 EPSILON14\n" \
5563  << endi);
5564 
5565  const int LJtypecount = params->get_num_vdw_params();
5566  for (i=0; i<numAtoms; i++)
5567  {
5568  const int vdw_type = simParams->soluteScalingOn ?
5569  ((atoms[i].vdw_type >= LJtypecount) ?
5570  ss_vdw_type[atoms[i].vdw_type-LJtypecount] : atoms[i].vdw_type) : atoms[i].vdw_type;
5571  params->get_vdw_params(&sigma, &epsilon, &sigma14, &epsilon14, vdw_type);
5572 
5573  DebugM(3,i+1 << " " << atomNames[i].atomname \
5574  << " " << atomNames[i].atomtype << " " \
5575  << atomNames[i].resname << " " << atoms[i].mass \
5576  << " " << atoms[i].charge << " " << sigma \
5577  << " " << epsilon << " " << sigma14 \
5578  << " " << epsilon14 << "\n" \
5579  << endi);
5580  }
5581 #endif
5582 }
float Real
Definition: common.h:118
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numAtoms
Definition: Molecule.h:586
int get_num_vdw_params(void)
Definition: Parameters.h:602
Index vdw_type
Definition: structures.h:39
int * ss_vdw_type
Definition: Molecule.h:486
void get_vdw_params(Real *sigma, Real *epsilon, Real *sigma14, Real *epsilon14, Index index)
Definition: Parameters.h:568

◆ print_bonds()

void Molecule::print_bonds ( Parameters params)

Definition at line 5594 of file Molecule.C.

References DebugM, endi(), and Parameters::get_bond_params().

Referenced by NamdState::loadStructure().

5595 {
5596 #ifdef MEM_OPT_VERSION
5597  DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5598 #else
5599  register int i;
5600  Real k;
5601  Real x0;
5602 
5603  DebugM(2,"BOND LIST\n" << "********************************\n" \
5604  << "ATOM1 ATOM2 TYPE1 TYPE2 k x0" \
5605  << endi);
5606 
5607  for (i=0; i<numBonds; i++)
5608  {
5609  params->get_bond_params(&k, &x0, bonds[i].bond_type);
5610 
5611  DebugM(2,bonds[i].atom1+1 << " " \
5612  << bonds[i].atom2+1 << " " \
5613  << atomNames[bonds[i].atom1].atomtype << " " \
5614  << atomNames[bonds[i].atom2].atomtype << " " << k \
5615  << " " << x0 << endi);
5616  }
5617 
5618 #endif
5619 }
int numBonds
Definition: Molecule.h:589
float Real
Definition: common.h:118
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
void get_bond_params(Real *k, Real *x0, Index index)
Definition: Parameters.h:517

◆ print_exclusions()

void Molecule::print_exclusions ( )

Definition at line 5631 of file Molecule.C.

References DebugM, and endi().

Referenced by NamdState::loadStructure().

5632 {
5633 #ifdef MEM_OPT_VERSION
5634  DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5635 #else
5636  register int i;
5637 
5638  DebugM(2,"EXPLICIT EXCLUSION LIST\n" \
5639  << "********************************\n" \
5640  << "ATOM1 ATOM2 " \
5641  << endi);
5642 
5643  for (i=0; i<numExclusions; i++)
5644  {
5645  DebugM(2,exclusions[i].atom1+1 << " " \
5646  << exclusions[i].atom2+1 << endi);
5647  }
5648 #endif
5649 }
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numExclusions
Definition: Molecule.h:600

◆ print_go_params()

void Molecule::print_go_params ( )

Definition at line 549 of file GoMolecule.C.

References DebugM, go_array, MAX_GO_CHAINS, and NumGoChains.

550 {
551  int i;
552  int j;
553  int index;
554 
555  DebugM(3,NumGoChains << " Go PARAMETERS 3\n" \
556  << "*****************************************" << std::endl);
557 
558  for (i=0; i<NumGoChains; i++) {
559  for (j=0; j<NumGoChains; j++) {
560  index = (i * MAX_GO_CHAINS) + j;
561  // Real epsilon; // Epsilon
562  // Real exp_a; // First exponent for attractive L-J term
563  // Real exp_b; // Second exponent for attractive L-J term
564  // Real sigmaRep; // Sigma for repulsive term
565  // Real epsilonRep; // Epsilon for replusive term
566  DebugM(3,"Go index=(" << i << "," << j << ") epsilon=" << go_array[index].epsilon \
567  << " exp_a=" << go_array[index].exp_a << " exp_b=" << go_array[index].exp_b \
568  << " exp_rep=" << go_array[index].exp_rep << " sigmaRep=" \
569  << go_array[index].sigmaRep << " epsilonRep=" << go_array[index].epsilonRep \
570  << " cutoff=" << go_array[index].cutoff << std::endl);
571  }
572  }
573 
574 }
#define DebugM(x, y)
Definition: Debug.h:75
#define MAX_GO_CHAINS
Definition: Molecule.h:33
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
int NumGoChains
Definition: Molecule.h:1642

◆ print_go_sigmas()

void Molecule::print_go_sigmas ( )

Definition at line 1135 of file GoMolecule.C.

References DebugM, goSigmaIndices, goSigmas, numAtoms, and numGoAtoms.

1136 {
1137  int i; // Counter
1138  int j; // Counter
1139  Real sigma;
1140 
1141  DebugM(3,"GO SIGMA ARRAY\n" \
1142  << "***************************" << std::endl);
1143  DebugM(3, "numGoAtoms: " << numGoAtoms << std::endl);
1144 
1145  if (goSigmaIndices == NULL) {
1146  DebugM(3, "GO SIGMAS HAVE NOT BEEN BUILT" << std::endl);
1147  return;
1148  }
1149 
1150  for (i=0; i<numAtoms; i++) {
1151  for (j=0; j<numAtoms; j++) {
1152  if ( goSigmaIndices[i] != -1 && goSigmaIndices[j] != -1 ) {
1153  //DebugM(3, "i: " << i << ", j: " << j << std::endl);
1155  if (sigma > 0.0) {
1156  DebugM(3, "(" << i << "," << j << ") - +" << sigma << " ");
1157  }
1158  else {
1159  DebugM(3, "(" << i << "," << j << ") - " << sigma << " ");
1160  }
1161  } else {
1162  //DebugM(3, "0 ");
1163  }
1164  }
1165  if ( goSigmaIndices[i] != -1 ) {
1166  DebugM(3, "-----------" << std::endl);
1167  }
1168  }
1169  return;
1170 }
float Real
Definition: common.h:118
#define DebugM(x, y)
Definition: Debug.h:75
Real * goSigmas
Definition: Molecule.h:683
int numAtoms
Definition: Molecule.h:586
int32 * goSigmaIndices
Definition: Molecule.h:681
int numGoAtoms
Definition: Molecule.h:679

◆ put_stir_startTheta()

void Molecule::put_stir_startTheta ( Real  theta,
int  atomnum 
) const
inline

Definition at line 1400 of file Molecule.h.

1401  {
1402  stirParams[stirIndexes[atomnum]].startTheta = theta;
1403  }

◆ read_alch_unpert_angles()

void Molecule::read_alch_unpert_angles ( FILE *  fd)

Definition at line 1824 of file Molecule.C.

References NAMD_die(), and NAMD_read_int().

1824  {
1825  int atom_nums[3]; // Atom numbers for the three atoms
1826  register int j; // Loop counter
1827  int num_read=0; // Number of angles read so far
1828 
1830 
1831  if (alch_unpert_angles == NULL) {
1832  NAMD_die("memory allocation failed in Molecule::read_alch_unpert_angles");
1833  }
1834 
1835  while (num_read < num_alch_unpert_Angles) {
1836  for (j=0; j<3; j++) {
1837  atom_nums[j]=NAMD_read_int(fd, "ANGLES")-1;
1838 
1839  if (atom_nums[j] >= numAtoms) {
1840  char err_msg[128];
1841  sprintf(err_msg, "ANGLES INDEX %d GREATER THAN NATOM %d IN ANGLES # %d IN ALCH UNPERT PSF FILE", atom_nums[j]+1, numAtoms, num_read+1);
1842  NAMD_die(err_msg);
1843  }
1844  }
1845 
1846  alch_unpert_angles[num_read].atom1=atom_nums[0];
1847  alch_unpert_angles[num_read].atom2=atom_nums[1];
1848  alch_unpert_angles[num_read].atom3=atom_nums[2];
1849 
1850  ++num_read;
1851  }
1852  return;
1853 }
Angle * alch_unpert_angles
Definition: Molecule.h:606
int num_alch_unpert_Angles
Definition: Molecule.h:603
int32 atom2
Definition: structures.h:58
int32 atom1
Definition: structures.h:57
int32 atom3
Definition: structures.h:59
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
int NAMD_read_int(FILE *fd, const char *msg)
Definition: strlib.C:302

◆ read_alch_unpert_bonds()

void Molecule::read_alch_unpert_bonds ( FILE *  fd)

Definition at line 1701 of file Molecule.C.

References bond::atom1, bond::atom2, NAMD_die(), and NAMD_read_int().

1701  {
1702  int atom_nums[2]; // Atom indexes for the bonded atoms
1703  register int j; // Loop counter
1704  int num_read=0; // Number of bonds read so far
1705 
1707 
1708  if (alch_unpert_bonds == NULL) {
1709  NAMD_die("memory allocations failed in Molecule::read_alch_unpert_bonds");
1710  }
1711 
1712  while (num_read < num_alch_unpert_Bonds) {
1713  for (j=0; j<2; j++) {
1714  atom_nums[j]=NAMD_read_int(fd, "BONDS")-1;
1715 
1716  if (atom_nums[j] >= numAtoms) {
1717  char err_msg[128];
1718 
1719  sprintf(err_msg, "BOND INDEX %d GREATER THAN NATOM %d IN BOND # %d IN ALCH PSF FILE", atom_nums[j]+1, numAtoms, num_read+1);
1720  NAMD_die(err_msg);
1721  }
1722  }
1723 
1724  Bond *b = &(alch_unpert_bonds[num_read]);
1725  b->atom1=atom_nums[0];
1726  b->atom2=atom_nums[1];
1727 
1728  ++num_read;
1729  }
1730  return;
1731 }
int num_alch_unpert_Bonds
Definition: Molecule.h:602
int32 atom1
Definition: structures.h:50
Bond * alch_unpert_bonds
Definition: Molecule.h:605
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
int NAMD_read_int(FILE *fd, const char *msg)
Definition: strlib.C:302
int32 atom2
Definition: structures.h:51

◆ read_alch_unpert_dihedrals()

void Molecule::read_alch_unpert_dihedrals ( FILE *  fd)

Definition at line 1972 of file Molecule.C.

References NAMD_die(), and NAMD_read_int().

1972  {
1973  int atom_nums[4]; // The 4 atom indexes
1974  int num_read=0; // number of dihedrals read so far
1975  register int j; // loop counter
1976 
1978 
1979  if (alch_unpert_dihedrals == NULL) {
1980  NAMD_die("memory allocation failed in Molecule::read_alch_unpert_dihedrals");
1981  }
1982 
1983  while (num_read < num_alch_unpert_Dihedrals) {
1984  for (j=0; j<4; j++) {
1985  atom_nums[j]=NAMD_read_int(fd, "DIHEDRALS")-1;
1986 
1987  if (atom_nums[j] >= numAtoms) {
1988  char err_msg[128];
1989 
1990  sprintf(err_msg, "DIHEDRALS INDEX %d GREATER THAN NATOM %d IN DIHEDRALS # %d IN ALCH UNPERT PSF FILE", atom_nums[j]+1, numAtoms, num_read+1);
1991  NAMD_die(err_msg);
1992  }
1993  }
1994 
1995  alch_unpert_dihedrals[num_read].atom1=atom_nums[0];
1996  alch_unpert_dihedrals[num_read].atom2=atom_nums[1];
1997  alch_unpert_dihedrals[num_read].atom3=atom_nums[2];
1998  alch_unpert_dihedrals[num_read].atom4=atom_nums[3];
1999 
2000  num_read++;
2001  }
2002  return;
2003 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:604
int32 atom3
Definition: structures.h:67
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:607
int32 atom4
Definition: structures.h:68
int numAtoms
Definition: Molecule.h:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
int32 atom2
Definition: structures.h:66
int NAMD_read_int(FILE *fd, const char *msg)
Definition: strlib.C:302
int32 atom1
Definition: structures.h:65

◆ read_go_file()

void Molecule::read_go_file ( char *  fname)

Definition at line 114 of file GoMolecule.C.

References go_val::cutoff, DebugM, endi(), go_val::epsilon, go_val::epsilonRep, go_val::exp_a, go_val::exp_b, go_val::exp_rep, FALSE, go_array, go_indices, iout, iWARN(), MAX_GO_CHAINS, MAX_RESTRICTIONS, NAMD_blank_string(), NAMD_die(), NAMD_find_first_word(), NAMD_read_line(), NumGoChains, go_val::restrictions, go_val::sigmaRep, and TRUE.

Referenced by build_go_params().

116 {
117 
118  int i; // Counter
119  int j; // Counter
120  int par_type=0; // What type of parameter are we currently
121  // dealing with? (vide infra)
122  // JLai -- uncommented
123  int skipline; // skip this line?
124  int skipall = 0; // skip rest of file;
125  char buffer[512]; // Buffer to store each line of the file
126  char first_word[512]; // First word of the current line
127  int read_count = 0; // Count of input parameters on a given line
128  int chain1 = 0; // First chain type for pair interaction
129  int chain2 = 0; // Second chain type for pair interaction
130  int int1; // First parameter int
131  int int2; // Second parameter int
132  Real r1; // Parameter Real
133  char in2[512]; // Second parameter word
134  GoValue *goValue1 = NULL; // current GoValue for loading parameters
135  GoValue *goValue2 = NULL; // other current GoValue for loading parameters
136  Bool sameGoChain = FALSE; // whether the current GoValue is within a chain or between chains
137  int restrictionCount = 0; // number of Go restrictions set for a given chain pair
138  FILE *pfile; // File descriptor for the parameter file
139 
140  /* Check to make sure that we haven't previously been told */
141  /* that all the files were read */
142  /*if (AllFilesRead)
143  {
144  NAMD_die("Tried to read another parameter file after being told that all files were read!");
145  }*/
146 
147  /* Initialize go_indices */
148  for (i=0; i<MAX_GO_CHAINS+1; i++) {
149  go_indices[i] = -1;
150  }
151 
152  /* Initialize go_array */
153  for (i=0; i<MAX_GO_CHAINS*MAX_GO_CHAINS; i++) {
154  go_array[i].epsilon = 1.25;
155  go_array[i].exp_a = 12;
156  go_array[i].exp_b = 6;
157  go_array[i].exp_rep = 12;
158  go_array[i].sigmaRep = 2.25;
159  go_array[i].epsilonRep = 0.03;
160  go_array[i].cutoff = 4.0;
161  for (j=0; j<MAX_RESTRICTIONS; j++) {
162  go_array[i].restrictions[j] = -1;
163  }
164  }
165 
166  /* Try and open the file */
167  if ( (pfile = fopen(fname, "r")) == NULL)
168  {
169  char err_msg[256];
170 
171  sprintf(err_msg, "UNABLE TO OPEN GO PARAMETER FILE %s\n", fname);
172  NAMD_die(err_msg);
173  }
174 
175  /* Keep reading in lines until we hit the EOF */
176  while (NAMD_read_line(pfile, buffer) != -1)
177  {
178  /* Get the first word of the line */
179  NAMD_find_first_word(buffer, first_word);
180  skipline=0;
181 
182  /* First, screen out things that we ignore. */
183  /* blank lines, lines that start with '!' or '*', lines that */
184  /* start with "END". */
185  if (!NAMD_blank_string(buffer) &&
186  (strncmp(first_word, "!", 1) != 0) &&
187  (strncmp(first_word, "*", 1) != 0) &&
188  (strncasecmp(first_word, "END", 3) != 0))
189  {
190  if ( skipall ) {
191  iout << iWARN << "SKIPPING PART OF GO PARAMETER FILE AFTER RETURN STATEMENT\n" << endi;
192  break;
193  }
194  /* Now, determine the apropriate parameter type. */
195  if (strncasecmp(first_word, "chaintypes", 10)==0)
196  {
197  read_count=sscanf(buffer, "%s %d %d\n", first_word, &int1, &int2);
198  if (read_count != 3) {
199  char err_msg[512];
200  sprintf(err_msg, "UNKNOWN PARAMETER IN GO PARAMETER FILE %s\nLINE=*%s*\nread_count=%d, int1=%d, int2=%d", fname, buffer, read_count, int1, int2);
201  NAMD_die(err_msg);
202  }
203  chain1 = int1;
204  chain2 = int2;
205  if (chain1 < 1 || chain1 > MAX_GO_CHAINS ||
206  chain2 < 1 || chain2 > MAX_GO_CHAINS) {
207  char err_msg[512];
208  sprintf(err_msg, "GO PARAMETER FILE: CHAIN INDEX MUST BE [1-%d] %s\nLINE=*%s*\nread_count=%d, int1=%d, int2=%d", MAX_GO_CHAINS, fname, buffer, read_count, int1, int2);
209  NAMD_die(err_msg);
210  }
211  if (go_indices[chain1] == -1) {
212  go_indices[chain1] = NumGoChains;
213  NumGoChains++;
214  }
215  if (go_indices[chain2] == -1) {
216  go_indices[chain2] = NumGoChains;
217  NumGoChains++;
218  }
219  if (chain1 == chain2) {
220  sameGoChain = TRUE;
221  } else {
222  sameGoChain = FALSE;
223  }
224  //goValue = &go_array[(chain1 * MAX_GO_CHAINS) + chain2];
225  goValue1 = &go_array[(chain1*MAX_GO_CHAINS) + chain2];
226  goValue2 = &go_array[(chain2*MAX_GO_CHAINS) + chain1];
227 #if CODE_REDUNDANT
228  goValue1 = &go_array[(go_indices[chain1]*MAX_GO_CHAINS) + go_indices[chain2]];
229  goValue2 = &go_array[(go_indices[chain2]*MAX_GO_CHAINS) + go_indices[chain1]];
230 #endif
231  restrictionCount = 0; // restrictionCount applies to each chain pair separately
232  }
233  else if (strncasecmp(first_word, "epsilonRep", 10)==0)
234  {
235  read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
236  if (read_count != 2) {}
237  goValue1->epsilonRep = r1;
238  if (!sameGoChain) {
239  goValue2->epsilonRep = r1;
240  }
241  }
242  else if (strncasecmp(first_word, "epsilon", 7)==0)
243  {
244  // Read in epsilon
245  read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
246  if (read_count != 2) {}
247  goValue1->epsilon = r1;
248  if (!sameGoChain) {
249  goValue2->epsilon = r1;
250  }
251  }
252  else if (strncasecmp(first_word, "exp_a", 5)==0)
253  {
254  read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
255  if (read_count != 2) {}
256  goValue1->exp_a = int1;
257  if (!sameGoChain) {
258  goValue2->exp_a = int1;
259  }
260  }
261  else if (strncasecmp(first_word, "exp_b", 5)==0)
262  {
263  read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
264  if (read_count != 2) {}
265  goValue1->exp_b = int1;
266  if (!sameGoChain) {
267  goValue2->exp_b = int1;
268  }
269  }
270  else if (strncasecmp(first_word, "exp_rep", 5)==0)
271  {
272  read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
273  if (read_count != 2) {}
274  goValue1->exp_rep = int1;
275  if (!sameGoChain) {
276  goValue2->exp_rep = int1;
277  }
278  }
279  else if (strncasecmp(first_word, "exp_Rep", 5)==0)
280  {
281  read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
282  if (read_count != 2) {}
283  goValue1->exp_rep = int1;
284  if (!sameGoChain) {
285  goValue2->exp_rep = int1;
286  }
287  }
288  else if (strncasecmp(first_word, "sigmaRep", 8)==0)
289  {
290  read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
291  if (read_count != 2) {}
292  goValue1->sigmaRep = r1;
293  if (!sameGoChain) {
294  goValue2->sigmaRep = r1;
295  }
296  }
297  else if (strncasecmp(first_word, "cutoff", 6)==0)
298  {
299  read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
300  if (read_count != 2) {}
301  goValue1->cutoff = r1;
302  if (!sameGoChain) {
303  goValue2->cutoff = r1;
304  }
305  }
306  else if (strncasecmp(first_word, "restriction", 10)==0)
307  {
308  read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
309  if (read_count != 2) {}
310  if (int1 < 0) {
311  DebugM(3, "ERROR: residue restriction value must be nonnegative. int1=" << int1 << "\n");
312  }
313  if (!sameGoChain) {
314  //goValue2->restrictions[restrictionCount] = int1;
315  DebugM(3, "ERROR: residue restrictions should not be defined between two separate chains. chain1=" << chain1 << ", chain2=" << chain2 << "\n");
316  }
317  else {
318  goValue1->restrictions[restrictionCount] = int1;
319  }
320  restrictionCount++;
321  }
322  else if (strncasecmp(first_word, "return", 4)==0)
323  {
324  skipall=8;
325  skipline=1;
326  }
327  else // if (par_type == 0)
328  {
329  /* This is an unknown paramter. */
330  /* This is BAD */
331  char err_msg[512];
332 
333  sprintf(err_msg, "UNKNOWN PARAMETER IN GO PARAMETER FILE %s\nLINE=*%s*",fname, buffer);
334  NAMD_die(err_msg);
335  }
336  }
337  else
338  {
339  skipline=1;
340  }
341  }
342 
343  /* Close the file */
344  fclose(pfile);
345 
346  return;
347 }
int exp_b
Definition: Molecule.h:108
int NAMD_read_line(FILE *fd, char *buf, int bufsize)
Definition: strlib.C:38
Real epsilonRep
Definition: Molecule.h:111
#define MAX_RESTRICTIONS
Definition: Molecule.h:34
float Real
Definition: common.h:118
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define FALSE
Definition: common.h:127
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:82
#define iout
Definition: InfoStream.h:51
void NAMD_find_first_word(char *source, char *word)
Definition: strlib.C:258
#define MAX_GO_CHAINS
Definition: Molecule.h:33
int exp_a
Definition: Molecule.h:107
int NAMD_blank_string(char *str)
Definition: strlib.C:222
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
int Bool
Definition: common.h:142
Real cutoff
Definition: Molecule.h:112
Real sigmaRep
Definition: Molecule.h:110
void NAMD_die(const char *err_msg)
Definition: common.C:147
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1641
int NumGoChains
Definition: Molecule.h:1642
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:113
Real epsilon
Definition: Molecule.h:106
#define TRUE
Definition: common.h:128
int exp_rep
Definition: Molecule.h:109

◆ read_parm() [1/2]

void Molecule::read_parm ( Ambertoppar )

◆ read_parm() [2/2]

void Molecule::read_parm ( AmberParm7Reader::Ambertoppar )

◆ receive_GoMolecule()

void Molecule::receive_GoMolecule ( MIStream msg)

Definition at line 1745 of file GoMolecule.C.

References atomChainTypes, go_val::cutoff, go_val::epsilon, go_val::epsilonRep, go_val::exp_a, go_val::exp_b, go_val::exp_rep, MIStream::get(), go_array, go_indices, goCoordinates, SimParameters::goForcesOn, goIndxLJA, goIndxLJB, SimParameters::goMethod, goNumLJPair, goResidIndices, goResids, goSigmaIndices, goSigmaPairA, goSigmaPairB, goSigmas, goWithinCutoff, MAX_GO_CHAINS, MAX_RESTRICTIONS, NAMD_die(), numAtoms, numGoAtoms, NumGoChains, pointerToGoBeg, pointerToGoEnd, go_val::restrictions, and go_val::sigmaRep.

1745  {
1746  // Ported by JLai -- Original by JE
1747  // JE - receive Go info
1748  Real *a1, *a2, *a3, *a4;
1749  int *i1, *i2, *i3, *i4;
1750  int maxGoChainsSqr = MAX_GO_CHAINS*MAX_GO_CHAINS; // JE JLai Go code
1751  msg->get(NumGoChains);
1752 
1753  if (NumGoChains) {
1754  //go_indices = new int[MAX_GO_CHAINS+1];
1755  //go_array = new GoValue[MAX_GO_CHAINS*MAX_GO_CHAINS];
1756 
1757  // int go_indices[MAX_GO_CHAINS+1]; // Indices from chainIDs to go_array
1758  // GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS]; // Array of Go params
1759  msg->get(MAX_GO_CHAINS+1,go_indices);
1760 
1761  a1 = new Real[maxGoChainsSqr];
1762  a2 = new Real[maxGoChainsSqr];
1763  a3 = new Real[maxGoChainsSqr];
1764  a4 = new Real[maxGoChainsSqr];
1765  i1 = new int[maxGoChainsSqr];
1766  i2 = new int[maxGoChainsSqr];
1767  i3 = new int[maxGoChainsSqr];
1768  i4 = new int[maxGoChainsSqr*MAX_RESTRICTIONS];
1769 
1770  if ( (a1 == NULL) || (a2 == NULL) || (a3 == NULL) || (a4 == NULL) ||
1771  (i1 == NULL) || (i2 == NULL) || (i3 == NULL) || (i4 == NULL) )
1772  {
1773  NAMD_die("memory allocation failed in Molecule::send_Molecule");
1774  }
1775 
1776  msg->get(maxGoChainsSqr, a1);
1777  msg->get(maxGoChainsSqr, a2);
1778  msg->get(maxGoChainsSqr, a3);
1779  msg->get(maxGoChainsSqr, a4);
1780  msg->get(maxGoChainsSqr, i1);
1781  msg->get(maxGoChainsSqr, i2);
1782  msg->get(maxGoChainsSqr, i3);
1783  msg->get(maxGoChainsSqr*MAX_RESTRICTIONS, i4);
1784 
1785  for (int i=0; i<maxGoChainsSqr; i++) {
1786  go_array[i].epsilon = a1[i];
1787  go_array[i].sigmaRep = a2[i];
1788  go_array[i].epsilonRep = a3[i];
1789  go_array[i].cutoff = a4[i];
1790  go_array[i].exp_a = i1[i];
1791  go_array[i].exp_b = i2[i];
1792  go_array[i].exp_rep = i3[i];
1793  for (int j=0; j<MAX_RESTRICTIONS; j++) {
1794  go_array[i].restrictions[j] = i4[i*MAX_RESTRICTIONS + j];
1795  }
1796  }
1797 
1798  delete [] a1;
1799  delete [] a2;
1800  delete [] a3;
1801  delete [] a4;
1802  delete [] i1;
1803  delete [] i2;
1804  delete [] i3;
1805  delete [] i4;
1806 
1807  //msg->get(MAX_GO_CHAINS*MAX_GO_CHAINS, (char*)go_array);
1808 
1809  /*DebugM(3,"NumGoChains:" << NumGoChains << std::endl);
1810  for (int ii=0; ii<MAX_GO_CHAINS; ii++) {
1811  for (int jj=0; jj<MAX_GO_CHAINS; jj++) {
1812  DebugM(3,"go_array[" << ii << "][" << jj << "]:" << go_array[ii][jj] << std::endl);
1813  }
1814  }
1815  for (int ii=0; ii<MAX_GO_CHAINS+1; ii++) {
1816  DebugM(3,"go_indices[" << ii << "]:" << go_indices[ii] << std::endl);
1817  }*/
1818  }
1819 
1820  if (simParams->goForcesOn) {
1821  switch(simParams->goMethod) {
1822  case 1:
1823  msg->get(numGoAtoms);
1824  //printf("Deleting goSigmaIndiciesA\n");
1825  delete [] goSigmaIndices;
1826  goSigmaIndices = new int32[numAtoms];
1827  //printf("Deleting atomChainTypesA\n");
1828  delete [] atomChainTypes;
1830  //printf("Deleting goSigmasA\n");
1831  delete [] goSigmas;
1833  //printf("Deleting goWithinCutoffA\n");
1834  delete [] goWithinCutoff;
1835  goWithinCutoff = new bool[numGoAtoms*numGoAtoms];
1836  msg->get(numAtoms, goSigmaIndices);
1837  msg->get(numGoAtoms, atomChainTypes);
1839  msg->get(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
1840  break;
1841  case 2: //GSR
1842  msg->get(numGoAtoms);
1843  delete [] pointerToGoBeg;
1844  pointerToGoBeg = new int[numAtoms];
1845  msg->get(numAtoms,pointerToGoBeg);
1846  delete [] pointerToGoEnd;
1847  pointerToGoEnd = new int[numAtoms];
1848  msg->get(numAtoms,pointerToGoEnd);
1849  delete [] goSigmaIndices;
1850  goSigmaIndices = new int32[numAtoms];
1851  msg->get(numAtoms,goSigmaIndices);
1852  delete [] goResidIndices;
1853  goResidIndices = new int32[numAtoms];
1854  msg->get(numAtoms,goResidIndices);
1855  delete [] atomChainTypes;
1858  msg->get(goNumLJPair);
1859  delete [] goIndxLJA;
1860  goIndxLJA = new int[goNumLJPair];
1861  msg->get(goNumLJPair,goIndxLJA);
1862  delete [] goIndxLJB;
1863  goIndxLJB = new int[goNumLJPair];
1864  msg->get(goNumLJPair,goIndxLJB);
1865  delete [] goSigmaPairA;
1866  goSigmaPairA = new double[goNumLJPair];
1868  delete [] goSigmaPairB;
1869  goSigmaPairB = new double[goNumLJPair];
1870  msg->get(goNumLJPair,goSigmaPairB);
1871  break;
1872  case 3:
1873  msg->get(numGoAtoms);
1874  //printf("Deleting goSigmaIndiciesB\n");
1875  delete [] goSigmaIndices;
1876  goSigmaIndices = new int32[numAtoms];
1877  //printf("Deleting atomChainTypesB\n");
1878  delete [] atomChainTypes;
1880  //delete [] goSigmas;
1881  //goSigmas = new Real[numGoAtoms*numGoAtoms];
1882  //delete [] goWithinCutoff;
1883  //goWithinCutoff = new bool[numGoAtoms*numGoAtoms];
1884  //printf("Deleting goCoordinatesB\n");
1885  delete [] goCoordinates;
1886  goCoordinates = new Real[numGoAtoms*3];
1887  //printf("Deleting goResidsB\n");
1888  delete [] goResids;
1889  goResids = new int[numGoAtoms];
1890  msg->get(numAtoms, goSigmaIndices);
1891  msg->get(numGoAtoms, atomChainTypes);
1892  //msg->get(numGoAtoms*numGoAtoms, goSigmas);
1893  //msg->get(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
1894  msg->get(numGoAtoms*3, goCoordinates);
1895  msg->get(numGoAtoms, goResids);
1896  break;
1897  }
1898  }
1899 
1900  delete msg;
1901 
1902 }
int exp_b
Definition: Molecule.h:108
int * pointerToGoBeg
Definition: Molecule.h:694
Real epsilonRep
Definition: Molecule.h:111
Real * goCoordinates
Definition: Molecule.h:685
#define MAX_RESTRICTIONS
Definition: Molecule.h:34
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
double * goSigmaPairA
Definition: Molecule.h:692
MIStream * get(char &data)
Definition: MStream.h:29
bool * goWithinCutoff
Definition: Molecule.h:684
#define MAX_GO_CHAINS
Definition: Molecule.h:33
int exp_a
Definition: Molecule.h:107
int32 * atomChainTypes
Definition: Molecule.h:680
int * pointerToGoEnd
Definition: Molecule.h:695
int * goIndxLJA
Definition: Molecule.h:690
int goNumLJPair
Definition: Molecule.h:689
int32 * goResidIndices
Definition: Molecule.h:682
GoChoices goMethod
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
int * goResids
Definition: Molecule.h:686
Real * goSigmas
Definition: Molecule.h:683
Real cutoff
Definition: Molecule.h:112
int numAtoms
Definition: Molecule.h:586
Real sigmaRep
Definition: Molecule.h:110
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:693
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1641
int NumGoChains
Definition: Molecule.h:1642
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:113
Real epsilon
Definition: Molecule.h:106
int32 * goSigmaIndices
Definition: Molecule.h:681
int * goIndxLJB
Definition: Molecule.h:691
int exp_rep
Definition: Molecule.h:109
int numGoAtoms
Definition: Molecule.h:679

◆ receive_Molecule()

void Molecule::receive_Molecule ( MIStream msg)

Definition at line 6028 of file Molecule.C.

References gromacsPair::atom1, gromacsPair::atom2, atomNamePool, atomSigPool, DebugM, MIStream::get(), Parameters::get_num_vdw_params(), gromacsPair::gromacsPair_type, numGaussPair, numLJPair, gromacsPair::pairC12, gromacsPair::pairC6, simParams, and GridforceGrid::unpack_grid().

Referenced by Node::resendMolecule().

6028  {
6029  // Get the atom information
6030  msg->get(numAtoms);
6031 
6032 #ifdef MEM_OPT_VERSION
6033 //in the memory optimized version, only the atom signatures are recved
6034 //from the master Node. --Chao Mei
6035 
6036  msg->get(massPoolSize);
6037  if(atomMassPool) delete [] atomMassPool;
6038  atomMassPool = new Real[massPoolSize];
6039  msg->get(massPoolSize, atomMassPool);
6040 
6041  msg->get(chargePoolSize);
6042  if(atomChargePool) delete [] atomChargePool;
6043  atomChargePool = new Real[chargePoolSize];
6044  msg->get(chargePoolSize, atomChargePool);
6045 
6046  //get atoms' signatures
6047  msg->get(atomSigPoolSize);
6048  if(atomSigPool) delete [] atomSigPool;
6049  atomSigPool = new AtomSignature[atomSigPoolSize];
6050  for(int i=0; i<atomSigPoolSize; i++)
6051  atomSigPool[i].unpack(msg);
6052 
6053  //get exclusions' signatures
6054  msg->get(exclSigPoolSize);
6055  if(exclSigPool) delete [] exclSigPool;
6056  exclSigPool = new ExclusionSignature[exclSigPoolSize];
6057  for(int i=0; i<exclSigPoolSize; i++)
6058  exclSigPool[i].unpack(msg);
6059 
6060  msg->get(numHydrogenGroups);
6061  msg->get(maxHydrogenGroupSize);
6062  msg->get(numMigrationGroups);
6063  msg->get(maxMigrationGroupSize);
6064  msg->get(isOccupancyValid);
6065  msg->get(isBFactorValid);
6066 
6067  //get names for atoms
6068  msg->get(atomNamePoolSize);
6069  atomNamePool = new char *[atomNamePoolSize];
6070  for(int i=0; i<atomNamePoolSize;i++) {
6071  int len;
6072  msg->get(len);
6073  atomNamePool[i] = nameArena->getNewArray(len+1);
6074  msg->get(len, atomNamePool[i]);
6075  }
6076 
6077  if(simParams->fixedAtomsOn){
6078  int numFixedAtomsSet;
6079  msg->get(numFixedAtoms);
6080  msg->get(numFixedAtomsSet);
6081  fixedAtomsSet = new AtomSetList(numFixedAtomsSet);
6082  msg->get(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
6083  }
6084 
6085  if(simParams->constraintsOn){
6086  int numConstrainedAtomsSet;
6087  msg->get(numConstraints);
6088  msg->get(numConstrainedAtomsSet);
6089  constrainedAtomsSet = new AtomSetList(numConstrainedAtomsSet);
6090  msg->get(numConstrainedAtomsSet*sizeof(AtomSet), (char *)(constrainedAtomsSet->begin()));
6091  }
6092 
6093 #else
6094  delete [] atoms;
6095  atoms= new Atom[numAtoms];
6096  msg->get(numAtoms*sizeof(Atom), (char*)atoms);
6097 
6098  // Get the bond information
6099  msg->get(numRealBonds);
6100  msg->get(numBonds);
6101  if (numBonds)
6102  {
6103  delete [] bonds;
6104  bonds=new Bond[numBonds];
6105  msg->get(numBonds*sizeof(Bond), (char*)bonds);
6106  }
6107 
6108  // Get the angle information
6109  msg->get(numAngles);
6110  if (numAngles)
6111  {
6112  delete [] angles;
6113  angles=new Angle[numAngles];
6114  msg->get(numAngles*sizeof(Angle), (char*)angles);
6115  }
6116 
6117  // Get the dihedral information
6118  msg->get(numDihedrals);
6119  if (numDihedrals)
6120  {
6121  delete [] dihedrals;
6122  dihedrals=new Dihedral[numDihedrals];
6123  msg->get(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
6124  }
6125 
6126  if (simParams->sdScaling) {
6127  msg->get(num_alch_unpert_Bonds);
6129  msg->get(num_alch_unpert_Bonds*sizeof(Bond), (char*)alch_unpert_bonds);
6130 
6133  msg->get(num_alch_unpert_Angles*sizeof(Angle), (char*)alch_unpert_angles);
6134 
6138  }
6139 
6140  // Get the improper information
6141  msg->get(numImpropers);
6142  if (numImpropers)
6143  {
6144  delete [] impropers;
6145  impropers=new Improper[numImpropers];
6146  msg->get(numImpropers*sizeof(Improper), (char*)impropers);
6147  }
6148 
6149  // Get the crossterm information
6150  msg->get(numCrossterms);
6151  if (numCrossterms)
6152  {
6153  delete [] crossterms;
6154  crossterms=new Crossterm[numCrossterms];
6155  msg->get(numCrossterms*sizeof(Crossterm), (char*)crossterms);
6156  }
6157 
6158  // Get the hydrogen bond donors
6159  msg->get(numDonors);
6160  if (numDonors)
6161  {
6162  delete [] donors;
6163  donors=new Bond[numDonors];
6164  msg->get(numDonors*sizeof(Bond), (char*)donors);
6165  }
6166 
6167  // Get the hydrogen bond acceptors
6168  msg->get(numAcceptors);
6169  if (numAcceptors)
6170  {
6171  delete [] acceptors;
6172  acceptors=new Bond[numAcceptors];
6173  msg->get(numAcceptors*sizeof(Bond), (char*)acceptors);
6174  }
6175 
6176  // Get the exclusion information
6177  msg->get(numExclusions);
6178  if (numExclusions)
6179  {
6180  delete [] exclusions;
6181  exclusions=new Exclusion[numExclusions];
6182  msg->get(numExclusions*sizeof(Exclusion), (char*)exclusions);
6183  }
6184 
6185  // Get the constraint information, if they are active
6186  if (simParams->constraintsOn)
6187  {
6188  msg->get(numConstraints);
6189 
6190  delete [] consIndexes;
6191  consIndexes = new int32[numAtoms];
6192 
6193  msg->get(numAtoms, consIndexes);
6194 
6195  if (numConstraints)
6196  {
6197  delete [] consParams;
6198  consParams = new ConstraintParams[numConstraints];
6199 
6200  msg->get(numConstraints*sizeof(ConstraintParams), (char*)consParams);
6201  }
6202  }
6203 #endif
6204 
6205  /* BEGIN gf */
6206  if (simParams->mgridforceOn)
6207  {
6208  DebugM(3, "Receiving gridforce info\n");
6209 
6210  msg->get(numGridforceGrids);
6211 
6212  DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
6213 
6214  delete [] numGridforces;
6215  numGridforces = new int[numGridforceGrids];
6216 
6217  delete [] gridfrcIndexes; // Should I be deleting elements of these first?
6218  delete [] gridfrcParams;
6219  delete [] gridfrcGrid;
6220  gridfrcIndexes = new int32*[numGridforceGrids];
6221  gridfrcParams = new GridforceParams*[numGridforceGrids];
6222  gridfrcGrid = new GridforceGrid*[numGridforceGrids];
6223 
6224  int grandTotalGrids = 0;
6225  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
6226  msg->get(numGridforces[gridnum]);
6227 
6228  gridfrcIndexes[gridnum] = new int32[numAtoms];
6229  msg->get(numAtoms, gridfrcIndexes[gridnum]);
6230 
6231  if (numGridforces[gridnum])
6232  {
6233  gridfrcParams[gridnum] = new GridforceParams[numGridforces[gridnum]];
6234  msg->get(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
6235  }
6236 
6237  gridfrcGrid[gridnum] = GridforceGrid::unpack_grid(gridnum, msg);
6238 
6239  grandTotalGrids++;
6240  }
6241  }
6242  /* END gf */
6243 
6244  // Get the stirring information, if stirring is active
6245  if (simParams->stirOn)
6246  {
6247  msg->get(numStirredAtoms);
6248 
6249  delete [] stirIndexes;
6250  stirIndexes = new int32[numAtoms];
6251 
6252  msg->get(numAtoms, stirIndexes);
6253 
6254  if (numStirredAtoms)
6255  {
6256  delete [] stirParams;
6257  stirParams = new StirParams[numStirredAtoms];
6258 
6259  msg->get(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
6260  }
6261  }
6262 
6263  // Get the moving drag information, if it is active
6264  if (simParams->movDragOn) {
6265  msg->get(numMovDrag);
6266  delete [] movDragIndexes;
6267  movDragIndexes = new int32[numAtoms];
6268  msg->get(numAtoms, movDragIndexes);
6269  if (numMovDrag)
6270  {
6271  delete [] movDragParams;
6272  movDragParams = new MovDragParams[numMovDrag];
6273  msg->get(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
6274  }
6275  }
6276 
6277  // Get the rotating drag information, if it is active
6278  if (simParams->rotDragOn) {
6279  msg->get(numRotDrag);
6280  delete [] rotDragIndexes;
6281  rotDragIndexes = new int32[numAtoms];
6282  msg->get(numAtoms, rotDragIndexes);
6283  if (numRotDrag)
6284  {
6285  delete [] rotDragParams;
6286  rotDragParams = new RotDragParams[numRotDrag];
6287  msg->get(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
6288  }
6289  }
6290 
6291  // Get the "constant" torque information, if it is active
6292  if (simParams->consTorqueOn) {
6293  msg->get(numConsTorque);
6294  delete [] consTorqueIndexes;
6297  if (numConsTorque)
6298  {
6299  delete [] consTorqueParams;
6300  consTorqueParams = new ConsTorqueParams[numConsTorque];
6301  msg->get(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
6302  }
6303  }
6304 
6305  // Get the constant force information, if it's active
6306  if (simParams->consForceOn)
6307  { msg->get(numConsForce);
6308  delete [] consForceIndexes;
6310  msg->get(numAtoms, consForceIndexes);
6311  if (numConsForce)
6312  { delete [] consForce;
6313  consForce = new Vector[numConsForce];
6314  msg->get(numConsForce*sizeof(Vector), (char*)consForce);
6315  }
6316  }
6317 
6318  // Get molecule information for MC barostat
6319  if (simParams->monteCarloPressureOn) {
6320  msg->get(numMolecules);
6321  msg->get(numLargeMolecules);
6322  delete [] moleculeAtom;
6323  delete [] moleculeStartIndex;
6324  moleculeAtom = new int32[numAtoms];
6326  msg->get(numAtoms, moleculeAtom);
6328  }
6329 
6330  if (simParams->excludeFromPressure) {
6331  exPressureAtomFlags = new int32[numAtoms];
6332  msg->get(numExPressureAtoms);
6333  msg->get(numAtoms, exPressureAtomFlags);
6334  }
6335 
6336 #ifndef MEM_OPT_VERSION
6337  // Get the langevin parameters, if they are active
6338  if (simParams->langevinOn || simParams->tCoupleOn)
6339  {
6340  delete [] langevinParams;
6341  langevinParams = new Real[numAtoms];
6342 
6343  msg->get(numAtoms, langevinParams);
6344  }
6345 
6346  // Get the fixed atoms, if they are active
6347  if (simParams->fixedAtomsOn)
6348  {
6349  delete [] fixedAtomFlags;
6350  fixedAtomFlags = new int32[numAtoms];
6351 
6352  msg->get(numFixedAtoms);
6353  msg->get(numAtoms, fixedAtomFlags);
6354  msg->get(numFixedRigidBonds);
6355  }
6356 
6357  if (simParams->qmForcesOn)
6358  {
6359  if( qmAtomGroup != 0)
6360  delete [] qmAtomGroup;
6361  qmAtomGroup = new Real[numAtoms];
6362 
6363  msg->get(numAtoms, qmAtomGroup);
6364 
6365  msg->get(qmNumQMAtoms);
6366 
6367  if( qmAtmChrg != 0)
6368  delete [] qmAtmChrg;
6369  qmAtmChrg = new Real[qmNumQMAtoms];
6370 
6371  msg->get(qmNumQMAtoms, qmAtmChrg);
6372 
6373  if( qmAtmIndx != 0)
6374  delete [] qmAtmIndx;
6375  qmAtmIndx = new int[qmNumQMAtoms];
6376 
6377  msg->get(qmNumQMAtoms, qmAtmIndx);
6378 
6379  msg->get(qmNoPC);
6380 
6381  msg->get(qmNumBonds);
6382 
6383  msg->get(qmMeNumBonds);
6384 
6385  if( qmMeMMindx != 0)
6386  delete [] qmMeMMindx;
6387  qmMeMMindx = new int[qmMeNumBonds];
6388 
6389  msg->get(qmMeNumBonds, qmMeMMindx);
6390 
6391  if( qmMeQMGrp != 0)
6392  delete [] qmMeQMGrp;
6393  qmMeQMGrp = new Real[qmMeNumBonds];
6394 
6395  msg->get(qmMeNumBonds, qmMeQMGrp);
6396 
6397  msg->get(qmPCFreq);
6398 
6399  msg->get(qmNumGrps);
6400 
6401  if( qmGrpID != 0)
6402  delete [] qmGrpID;
6403  qmGrpID = new Real[qmNumGrps];
6404  msg->get(qmNumGrps, qmGrpID);
6405 
6406  if( qmCustPCSizes != 0)
6407  delete [] qmCustPCSizes;
6408  qmCustPCSizes = new int[qmNumGrps];
6409  msg->get(qmNumGrps, qmCustPCSizes);
6410 
6411  msg->get(qmTotCustPCs);
6412 
6413  if( qmCustomPCIdxs != 0)
6414  delete [] qmCustomPCIdxs;
6415  qmCustomPCIdxs = new int[qmTotCustPCs];
6416  msg->get(qmTotCustPCs, qmCustomPCIdxs);
6417  }
6418 
6419 //fepb
6420  //receive fep atom info
6421  if (simParams->alchOn || simParams->lesOn || simParams->pairInteractionOn) {
6422  delete [] fepAtomFlags;
6423  fepAtomFlags = new unsigned char[numAtoms];
6424 
6425  msg->get(numFepInitial);
6426  msg->get(numFepFinal);
6427  msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
6428  }
6429 //fepe
6430 
6431 //soluteScaling
6432  if (simParams->soluteScalingOn) {
6433  delete [] ssAtomFlags;
6434  delete [] ss_vdw_type;
6435  delete [] ss_index;
6436  ssAtomFlags = new unsigned char[numAtoms];
6437  ss_vdw_type = new int [params->get_num_vdw_params()];
6438  ss_index = new int [numAtoms];
6439  msg->get(numAtoms*sizeof(unsigned char), (char*)ssAtomFlags);
6440  msg->get(ss_num_vdw_params);
6441  msg->get(params->get_num_vdw_params()*sizeof(int), (char*)ss_vdw_type);
6442  msg->get(numAtoms*sizeof(int), (char*)ss_index);
6443  }
6444 //soluteScaling
6445 #ifdef OPENATOM_VERSION
6446  // This needs to be refactored into its own version
6447  if (simParams->openatomOn) {
6448  delete [] fepAtomFlags;
6449  fepAtomFlags = new unsigned char[numAtoms];
6450 
6451  msg->get(numFepInitial);
6452  msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
6453 #endif //OPENATOM_VERSION
6454 
6455  // DRUDE: receive data read from PSF
6456  msg->get(is_lonepairs_psf);
6457  if (is_lonepairs_psf) {
6458  msg->get(numLphosts);
6459  delete[] lphosts;
6460  lphosts = new Lphost[numLphosts];
6461  msg->get(numLphosts*sizeof(Lphost), (char*)lphosts);
6462  }
6463  msg->get(is_drude_psf);
6464  if (is_drude_psf) {
6465  delete[] drudeConsts;
6466  drudeConsts = new DrudeConst[numAtoms];
6467  msg->get(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
6468  msg->get(numTholes);
6469  delete[] tholes;
6470  tholes = new Thole[numTholes];
6471  msg->get(numTholes*sizeof(Thole), (char*)tholes);
6472  msg->get(numAnisos);
6473  delete[] anisos;
6474  anisos = new Aniso[numAnisos];
6475  msg->get(numAnisos*sizeof(Aniso), (char*)anisos);
6476  }
6477  msg->get(numZeroMassAtoms);
6478  // DRUDE
6479 
6480  //LCPO
6481  if (simParams->LCPOOn) {
6482  delete [] lcpoParamType;
6483  lcpoParamType = new int[numAtoms];
6484  msg->get(numAtoms, (int*)lcpoParamType);
6485  }
6486 
6487  //Receive GromacsPairStuff -- JLai
6488 
6489  if (simParams->goGroPair) {
6490  msg->get(numLJPair);
6491  delete [] indxLJA;
6492  indxLJA = new int[numLJPair];
6493  msg->get(numLJPair,indxLJA);
6494  delete [] indxLJB;
6495  indxLJB = new int[numLJPair];
6496  msg->get(numLJPair,indxLJB);
6497  delete [] pairC6;
6498  pairC6 = new Real[numLJPair];
6499  msg->get(numLJPair,pairC6);
6500  delete [] pairC12;
6501  pairC12 = new Real[numLJPair];
6502  msg->get(numLJPair,pairC12);
6503  delete [] gromacsPair_type;
6504  gromacsPair_type = new int[numLJPair];
6506  delete [] pointerToLJBeg;
6507  pointerToLJBeg = new int[numAtoms];
6508  msg->get((numAtoms),pointerToLJBeg);
6509  delete [] pointerToLJEnd;
6510  pointerToLJEnd = new int[numAtoms];
6511  msg->get((numAtoms),pointerToLJEnd);
6512  // JLai
6513  delete [] gromacsPair;
6515  for(int i=0; i < numLJPair; i++) {
6516  gromacsPair[i].atom1 = indxLJA[i];
6517  gromacsPair[i].atom2 = indxLJB[i];
6518  gromacsPair[i].pairC6 = pairC6[i];
6519  gromacsPair[i].pairC12 = pairC12[i];
6521  }
6522  //
6523  msg->get(numGaussPair);
6524  delete [] indxGaussA;
6525  indxGaussA = new int[numGaussPair];
6526  msg->get(numGaussPair,indxGaussA);
6527  delete [] indxGaussB;
6528  indxGaussB = new int[numGaussPair];
6529  msg->get(numGaussPair,indxGaussB);
6530  delete [] gA;
6531  gA = new Real[numGaussPair];
6532  msg->get(numGaussPair,gA);
6533  delete [] gMu1;
6534  gMu1 = new Real[numGaussPair];
6535  msg->get(numGaussPair,gMu1);
6536  delete [] giSigma1;
6537  giSigma1 = new Real[numGaussPair];
6538  msg->get(numGaussPair,giSigma1);
6539  delete [] gMu2;
6540  gMu2 = new Real[numGaussPair];
6541  msg->get(numGaussPair,gMu2);
6542  delete [] giSigma2;
6543  giSigma2 = new Real[numGaussPair];
6544  msg->get(numGaussPair,giSigma2);
6545  delete [] gRepulsive;
6546  gRepulsive = new Real[numGaussPair];
6547  msg->get(numGaussPair,gRepulsive);
6548  delete [] pointerToGaussBeg;
6549  pointerToGaussBeg = new int[numAtoms];
6550  msg->get((numAtoms),pointerToGaussBeg);
6551  delete [] pointerToGaussEnd;
6552  pointerToGaussEnd = new int[numAtoms];
6553  msg->get((numAtoms),pointerToGaussEnd);
6554  //
6555  }
6556 #endif
6557 
6558  // Now free the message
6559  delete msg;
6560 
6561 #ifdef MEM_OPT_VERSION
6562 
6563  build_excl_check_signatures();
6564 
6565  //set num{Calc}Tuples(Bonds,...,Impropers) to 0
6566  numBonds = numCalcBonds = 0;
6567  numAngles = numCalcAngles = 0;
6572  // JLai
6573  numLJPair = numCalcLJPair = 0;
6574  // End of JLai
6575 
6576 #else
6577 
6578  // analyze the data and find the status of each atom
6579  build_atom_status();
6580  build_lists_by_atom();
6581 
6582 
6583 #endif
6584 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:604
int * indxGaussA
Definition: Molecule.h:711
Type * getNewArray(int n)
Definition: ObjectArena.h:49
int numCalcBonds
Definition: Molecule.h:657
Real * gMu2
Definition: Molecule.h:716
int numBonds
Definition: Molecule.h:589
int numCalcLJPair
Definition: Molecule.h:699
Bool monteCarloPressureOn
Real * giSigma2
Definition: Molecule.h:717
int numHydrogenGroups
Definition: Molecule.h:635
int numAnisos
Number of anisotropic terms.
Definition: Molecule.h:613
Angle * alch_unpert_angles
Definition: Molecule.h:606
Definition: Vector.h:72
Real * pairC6
Definition: Molecule.h:704
Real pairC6
Definition: structures.h:99
Bool excludeFromPressure
int num_alch_unpert_Bonds
Definition: Molecule.h:602
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:622
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
#define DebugM(x, y)
Definition: Debug.h:75
int * pointerToLJEnd
Definition: Molecule.h:701
int numGridforceGrids
Definition: Molecule.h:626
int numRealBonds
Definition: Molecule.h:588
MIStream * get(char &data)
Definition: MStream.h:29
int num_alch_unpert_Angles
Definition: Molecule.h:603
int numMovDrag
Definition: Molecule.h:629
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:607
Real * gA
Definition: Molecule.h:713
Bool pairInteractionOn
Real pairC12
Definition: structures.h:98
int * indxLJB
Definition: Molecule.h:703
int numFepFinal
Definition: Molecule.h:644
int * pointerToGaussBeg
Definition: Molecule.h:708
int numGaussPair
Definition: Molecule.h:710
int32 atom2
Definition: structures.h:97
int numCalcCrossterms
Definition: Molecule.h:661
int isOccupancyValid
Definition: Molecule.h:1562
int32 * consTorqueIndexes
Definition: Molecule.h:651
int64 numTotalExclusions
Definition: Molecule.h:601
Real * gMu1
Definition: Molecule.h:714
int * pointerToLJBeg
Definition: Molecule.h:700
Real * gRepulsive
Definition: Molecule.h:718
int * indxGaussB
Definition: Molecule.h:712
int64 numCalcFullExclusions
Definition: Molecule.h:663
int is_drude_psf
Definition: Molecule.h:490
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:620
int numFixedRigidBonds
Definition: Molecule.h:641
int numFepInitial
Definition: Molecule.h:643
int numMolecules
Number of 1-4 atom pairs with NBThole defined.
Definition: Molecule.h:619
int * pointerToGaussEnd
Definition: Molecule.h:709
int numAcceptors
Definition: Molecule.h:599
int numTholes
Number of Thole terms.
Definition: Molecule.h:612
int numCalcDihedrals
Definition: Molecule.h:659
int numExPressureAtoms
Definition: Molecule.h:634
Bond * alch_unpert_bonds
Definition: Molecule.h:605
int numFixedAtoms
Definition: Molecule.h:632
int numCalcImpropers
Definition: Molecule.h:660
int numAngles
Definition: Molecule.h:590
Real * pairC12
Definition: Molecule.h:705
int numAtoms
Definition: Molecule.h:586
int * gromacsPair_type
Definition: Molecule.h:706
int numStirredAtoms
Definition: Molecule.h:633
int numCrossterms
Definition: Molecule.h:597
int numConsForce
Definition: Molecule.h:647
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:652
int get_num_vdw_params(void)
Definition: Parameters.h:602
int * ss_index
Definition: Molecule.h:487
int maxMigrationGroupSize
Definition: Molecule.h:638
int numDihedrals
Definition: Molecule.h:591
int numImpropers
Definition: Molecule.h:596
int numConsTorque
Definition: Molecule.h:631
int numConstraints
Definition: Molecule.h:624
int64 numCalcExclusions
Definition: Molecule.h:662
int32 * consForceIndexes
Definition: Molecule.h:648
static GridforceGrid * unpack_grid(int gridnum, MIStream *msg)
Definition: GridForceGrid.C:60
int maxHydrogenGroupSize
Definition: Molecule.h:636
int numMigrationGroups
Definition: Molecule.h:637
Real * giSigma1
Definition: Molecule.h:715
int numZeroMassAtoms
Number of atoms with zero mass.
Definition: Molecule.h:615
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:621
Vector * consForce
Definition: Molecule.h:649
int * indxLJA
Definition: Molecule.h:702
int * ss_vdw_type
Definition: Molecule.h:486
int * numGridforces
Definition: Molecule.h:627
Index gromacsPair_type
Definition: structures.h:100
int is_lonepairs_psf
Definition: Molecule.h:491
int numLphosts
Number of lone pair host records in PSF.
Definition: Molecule.h:614
int numDonors
Definition: Molecule.h:598
int isBFactorValid
Definition: Molecule.h:1562
int numCalcAngles
Definition: Molecule.h:658
int ss_num_vdw_params
Definition: Molecule.h:485
int numRotDrag
Definition: Molecule.h:630
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313
int32 atom1
Definition: structures.h:96
int numLJPair
Definition: Molecule.h:698
int numExclusions
Definition: Molecule.h:600

◆ reloadCharges()

void Molecule::reloadCharges ( float  charge[],
int  n 
)

Referenced by Node::reloadCharges().

◆ rigid_bond_length()

Real Molecule::rigid_bond_length ( int  atomnum) const
inline

Definition at line 1550 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), and outputCompressedFile().

1551  {
1552  return(rigidBondLengths[atomnum]);
1553  }

◆ send_GoMolecule()

void Molecule::send_GoMolecule ( MOStream msg)

Definition at line 1636 of file GoMolecule.C.

References atomChainTypes, go_val::cutoff, MOStream::end(), go_val::epsilon, go_val::epsilonRep, go_val::exp_a, go_val::exp_b, go_val::exp_rep, go_array, go_indices, goCoordinates, SimParameters::goForcesOn, goIndxLJA, goIndxLJB, SimParameters::goMethod, goNumLJPair, goResidIndices, goResids, goSigmaIndices, goSigmaPairA, goSigmaPairB, goSigmas, goWithinCutoff, MAX_GO_CHAINS, MAX_RESTRICTIONS, NAMD_die(), numAtoms, numGoAtoms, NumGoChains, pointerToGoBeg, pointerToGoEnd, MOStream::put(), go_val::restrictions, and go_val::sigmaRep.

1636  {
1637  Real *a1, *a2, *a3, *a4;
1638  int *i1, *i2, *i3, *i4;
1639  int maxGoChainsSqr = MAX_GO_CHAINS*MAX_GO_CHAINS; // JE JLai Go code
1640  msg->put(NumGoChains);
1641 
1642  if (NumGoChains) {
1643  // int go_indices[MAX_GO_CHAINS+1]; // Indices from chainIDs to go_array
1644  // GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS]; // Array of Go params
1645  msg->put(MAX_GO_CHAINS+1,go_indices);
1646 
1647  a1 = new Real[maxGoChainsSqr];
1648  a2 = new Real[maxGoChainsSqr];
1649  a3 = new Real[maxGoChainsSqr];
1650  a4 = new Real[maxGoChainsSqr];
1651  i1 = new int[maxGoChainsSqr];
1652  i2 = new int[maxGoChainsSqr];
1653  i3 = new int[maxGoChainsSqr];
1654  i4 = new int[maxGoChainsSqr*MAX_RESTRICTIONS];
1655 
1656  if ( (a1 == NULL) || (a2 == NULL) || (a3 == NULL) || (a4 == NULL) ||
1657  (i1 == NULL) || (i2 == NULL) || (i3 == NULL) || (i4 == NULL) )
1658  {
1659  NAMD_die("memory allocation failed in Molecules::send_Molecules");
1660  }
1661 
1662  for (int i=0; i<maxGoChainsSqr; i++) {
1663  a1[i] = go_array[i].epsilon;
1664  a2[i] = go_array[i].sigmaRep;
1665  a3[i] = go_array[i].epsilonRep;
1666  a4[i] = go_array[i].cutoff;
1667  i1[i] = go_array[i].exp_a;
1668  i2[i] = go_array[i].exp_b;
1669  i3[i] = go_array[i].exp_rep;
1670  for (int j=0; j<MAX_RESTRICTIONS; j++) {
1671  i4[i*MAX_RESTRICTIONS + j] = go_array[i].restrictions[j];
1672  }
1673  }
1674 
1675  msg->put(maxGoChainsSqr, a1);
1676  msg->put(maxGoChainsSqr, a2);
1677  msg->put(maxGoChainsSqr, a3);
1678  msg->put(maxGoChainsSqr, a4);
1679  msg->put(maxGoChainsSqr, i1);
1680  msg->put(maxGoChainsSqr, i2);
1681  msg->put(maxGoChainsSqr, i3);
1682  msg->put(maxGoChainsSqr*MAX_RESTRICTIONS, i4);
1683 
1684  delete [] a1;
1685  delete [] a2;
1686  delete [] a3;
1687  delete [] a4;
1688  delete [] i1;
1689  delete [] i2;
1690  delete [] i3;
1691  delete [] i4;
1692  }
1693 
1694  //Ported JLai
1695  if (simParams->goForcesOn) {
1696  switch(simParams->goMethod) {
1697  case 1:
1698  msg->put(numGoAtoms);
1699  msg->put(numAtoms, goSigmaIndices);
1700  msg->put(numGoAtoms, atomChainTypes);
1702  msg->put(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
1703  // printf("Molecule.C sending atomChainTypes %d %d \n", numGoAtoms, atomChainTypes);
1704  break;
1705  case 2: //GSS
1706  msg->put(numGoAtoms);
1707  msg->put(numAtoms,pointerToGoBeg);
1708  msg->put(numAtoms,pointerToGoEnd);
1709  msg->put(numAtoms,goSigmaIndices);
1710  msg->put(numAtoms,goResidIndices);
1712  msg->put(goNumLJPair);
1713  msg->put(goNumLJPair,goIndxLJA);
1714  msg->put(goNumLJPair,goIndxLJB);
1717  break;
1718  case 3:
1719  msg->put(numGoAtoms);
1720  msg->put(numAtoms, goSigmaIndices);
1721  msg->put(numGoAtoms, atomChainTypes);
1722  //msg->put(numGoAtoms*numGoAtoms, goSigmas);
1723  //msg->put(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
1724  msg->put(numGoAtoms*3, goCoordinates);
1725  msg->put(numGoAtoms, goResids);
1726  break;
1727  }
1728  }
1729 
1730  msg->end();
1731  delete msg;
1732 }
int exp_b
Definition: Molecule.h:108
void end(void)
Definition: MStream.C:176
int * pointerToGoBeg
Definition: Molecule.h:694
Real epsilonRep
Definition: Molecule.h:111
Real * goCoordinates
Definition: Molecule.h:685
#define MAX_RESTRICTIONS
Definition: Molecule.h:34
float Real
Definition: common.h:118
double * goSigmaPairA
Definition: Molecule.h:692
bool * goWithinCutoff
Definition: Molecule.h:684
#define MAX_GO_CHAINS
Definition: Molecule.h:33
int exp_a
Definition: Molecule.h:107
int32 * atomChainTypes
Definition: Molecule.h:680
int * pointerToGoEnd
Definition: Molecule.h:695
int * goIndxLJA
Definition: Molecule.h:690
int goNumLJPair
Definition: Molecule.h:689
int32 * goResidIndices
Definition: Molecule.h:682
GoChoices goMethod
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1640
int * goResids
Definition: Molecule.h:686
Real * goSigmas
Definition: Molecule.h:683
Real cutoff
Definition: Molecule.h:112
int numAtoms
Definition: Molecule.h:586
Real sigmaRep
Definition: Molecule.h:110
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:693
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1641
MOStream * put(char data)
Definition: MStream.h:112
int NumGoChains
Definition: Molecule.h:1642
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:113
Real epsilon
Definition: Molecule.h:106
int32 * goSigmaIndices
Definition: Molecule.h:681
int * goIndxLJB
Definition: Molecule.h:691
int exp_rep
Definition: Molecule.h:109
int numGoAtoms
Definition: Molecule.h:679

◆ send_Molecule()

void Molecule::send_Molecule ( MOStream msg)

Definition at line 5662 of file Molecule.C.

References atomNamePool, atomSigPool, DebugM, MOStream::end(), endi(), Parameters::get_num_vdw_params(), numGaussPair, numLJPair, GridforceGrid::pack_grid(), MOStream::put(), and simParams.

Referenced by Node::resendMolecule().

5662  {
5663 #ifdef MEM_OPT_VERSION
5664 //in the memory optimized version, only the atom signatures are broadcast
5665 //to other Nodes. --Chao Mei
5666 
5667  msg->put(numAtoms);
5668 
5669  msg->put(massPoolSize);
5670  msg->put(massPoolSize, atomMassPool);
5671 
5672  msg->put(chargePoolSize);
5673  msg->put(chargePoolSize, atomChargePool);
5674 
5675  //put atoms' signatures
5676  msg->put(atomSigPoolSize);
5677  for(int i=0; i<atomSigPoolSize; i++)
5678  atomSigPool[i].pack(msg);
5679 
5680  //put atom's exclusion signatures
5681  msg->put(exclSigPoolSize);
5682  for(int i=0; i<exclSigPoolSize; i++)
5683  exclSigPool[i].pack(msg);
5684 
5685  msg->put(numHydrogenGroups);
5686  msg->put(maxHydrogenGroupSize);
5687  msg->put(numMigrationGroups);
5688  msg->put(maxMigrationGroupSize);
5689  msg->put(isOccupancyValid);
5690  msg->put(isBFactorValid);
5691 
5692  //put names for atoms
5693  msg->put(atomNamePoolSize);
5694  for(int i=0; i<atomNamePoolSize;i++) {
5695  int len = strlen(atomNamePool[i]);
5696  msg->put(len);
5697  msg->put(len*sizeof(char), atomNamePool[i]);
5698  }
5699 
5700  if(simParams->fixedAtomsOn){
5701  int numFixedAtomsSet = fixedAtomsSet->size();
5702  msg->put(numFixedAtoms);
5703  msg->put(numFixedAtomsSet);
5704  msg->put(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
5705  }
5706 
5707  if (simParams->constraintsOn) {
5708  int numConstrainedAtomsSet = constrainedAtomsSet->size();
5709  msg->put(numConstraints);
5710  msg->put(numConstrainedAtomsSet);
5711  msg->put(numConstrainedAtomsSet*sizeof(AtomSet), (char *)(constrainedAtomsSet->begin()));
5712  }
5713 
5714 #else
5715  msg->put(numAtoms);
5716  msg->put(numAtoms*sizeof(Atom), (char*)atoms);
5717 
5718  // Send the bond information
5719  msg->put(numRealBonds);
5720  msg->put(numBonds);
5721 
5722  if (numBonds)
5723  {
5724  msg->put(numBonds*sizeof(Bond), (char*)bonds);
5725  }
5726 
5727  // Send the angle information
5728  msg->put(numAngles);
5729  if (numAngles)
5730  {
5731  msg->put(numAngles*sizeof(Angle), (char*)angles);
5732  }
5733 
5734  // Send the dihedral information
5735  msg->put(numDihedrals);
5736  if (numDihedrals)
5737  {
5738  msg->put(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
5739  }
5740 
5741  if (simParams->sdScaling) {
5742  msg->put(num_alch_unpert_Bonds);
5743  msg->put(num_alch_unpert_Bonds*sizeof(Bond), (char*)alch_unpert_bonds);
5744 
5746  msg->put(num_alch_unpert_Angles*sizeof(Angle), (char*)alch_unpert_angles);
5747 
5750  }
5751 
5752  // Send the improper information
5753  msg->put(numImpropers);
5754  if (numImpropers)
5755  {
5756  msg->put(numImpropers*sizeof(Improper), (char*)impropers);
5757  }
5758 
5759  // Send the crossterm information
5760  msg->put(numCrossterms);
5761  if (numCrossterms)
5762  {
5763  msg->put(numCrossterms*sizeof(Crossterm), (char*)crossterms);
5764  }
5765 
5766  // send the hydrogen bond donor information
5767  msg->put(numDonors);
5768  if(numDonors)
5769  {
5770  msg->put(numDonors*sizeof(Bond), (char*)donors);
5771  }
5772 
5773  // send the hydrogen bond acceptor information
5774  msg->put(numAcceptors);
5775  if(numAcceptors)
5776  {
5777  msg->put(numAcceptors*sizeof(Bond), (char*)acceptors);
5778  }
5779 
5780  // Send the exclusion information
5781  msg->put(numExclusions);
5782  if (numExclusions)
5783  {
5784  msg->put(numExclusions*sizeof(Exclusion), (char*)exclusions);
5785  }
5786  // Send the constraint information, if used
5787  if (simParams->constraintsOn)
5788  {
5789  msg->put(numConstraints);
5790 
5791  msg->put(numAtoms, consIndexes);
5792 
5793  if (numConstraints)
5794  {
5795  msg->put(numConstraints*sizeof(ConstraintParams), (char*)consParams);
5796  }
5797  }
5798 #endif
5799 
5800  /* BEGIN gf */
5801  // Send the gridforce information, if used
5802  if (simParams->mgridforceOn)
5803  {
5804  DebugM(3, "Sending gridforce info\n" << endi);
5805  msg->put(numGridforceGrids);
5806 
5807  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
5808  msg->put(numGridforces[gridnum]);
5809  msg->put(numAtoms, gridfrcIndexes[gridnum]);
5810  if (numGridforces[gridnum])
5811  {
5812  msg->put(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
5813  }
5814  GridforceGrid::pack_grid(gridfrcGrid[gridnum], msg);
5815  }
5816  }
5817  /* END gf */
5818 
5819  // Send the stirring information, if used
5820  if (simParams->stirOn)
5821  {
5822  //CkPrintf ("DEBUG: putting numStirredAtoms..\n");
5823  msg->put(numStirredAtoms);
5824  //CkPrintf ("DEBUG: putting numAtoms,stirIndexes.. numAtoms=%d\n",numStirredAtoms);
5825  msg->put(numAtoms, stirIndexes);
5826  //CkPrintf ("DEBUG: if numStirredAtoms..\n");
5827  if (numStirredAtoms)
5828  {
5829  //CkPrintf ("DEBUG: big put, with (char*)stirParams\n");
5830  msg->put(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
5831  }
5832  }
5833 
5834 
5835  // Send the moving drag information, if used
5836  if (simParams->movDragOn) {
5837  msg->put(numMovDrag);
5838  msg->put(numAtoms, movDragIndexes);
5839  if (numMovDrag)
5840  {
5841  msg->put(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
5842  }
5843  }
5844 
5845  // Send the rotating drag information, if used
5846  if (simParams->rotDragOn) {
5847  msg->put(numRotDrag);
5848  msg->put(numAtoms, rotDragIndexes);
5849  if (numRotDrag)
5850  {
5851  msg->put(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
5852  }
5853  }
5854 
5855  // Send the "constant" torque information, if used
5856  if (simParams->consTorqueOn) {
5857  msg->put(numConsTorque);
5859  if (numConsTorque)
5860  {
5861  msg->put(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
5862  }
5863  }
5864 
5865  // Send the constant force information, if used
5866  if (simParams->consForceOn)
5867  { msg->put(numConsForce);
5868  msg->put(numAtoms, consForceIndexes);
5869  if (numConsForce)
5870  msg->put(numConsForce*sizeof(Vector), (char*)consForce);
5871  }
5872 
5873  // Send molecule information for MC barostat
5874  if (simParams->monteCarloPressureOn) {
5875  msg->put(numMolecules);
5876  msg->put(numLargeMolecules);
5877  msg->put(numAtoms, moleculeAtom);
5879  }
5880 
5881  if (simParams->excludeFromPressure) {
5882  msg->put(numExPressureAtoms);
5883  msg->put(numAtoms, exPressureAtomFlags);
5884  }
5885 
5886 #ifndef MEM_OPT_VERSION
5887  // Send the langevin parameters, if active
5888  if (simParams->langevinOn || simParams->tCoupleOn)
5889  {
5890  msg->put(numAtoms, langevinParams);
5891  }
5892 
5893  // Send fixed atoms, if active
5894  if (simParams->fixedAtomsOn)
5895  {
5896  msg->put(numFixedAtoms);
5897  msg->put(numAtoms, fixedAtomFlags);
5898  msg->put(numFixedRigidBonds);
5899  }
5900 
5901  if (simParams->qmForcesOn)
5902  {
5903  msg->put(numAtoms, qmAtomGroup);
5904  msg->put(qmNumQMAtoms);
5905  msg->put(qmNumQMAtoms, qmAtmChrg);
5906  msg->put(qmNumQMAtoms, qmAtmIndx);
5907  msg->put(qmNoPC);
5908  msg->put(qmNumBonds);
5909  msg->put(qmMeNumBonds);
5910  msg->put(qmMeNumBonds, qmMeMMindx);
5911  msg->put(qmMeNumBonds, qmMeQMGrp);
5912  msg->put(qmPCFreq);
5913  msg->put(qmNumGrps);
5914  msg->put(qmNumGrps, qmGrpID);
5915  msg->put(qmNumGrps, qmCustPCSizes);
5916  msg->put(qmTotCustPCs);
5917  msg->put(qmTotCustPCs, qmCustomPCIdxs);
5918  }
5919 
5920  //fepb
5921  // send fep atom info
5922  if (simParams->alchOn || simParams->lesOn || simParams->pairInteractionOn) {
5923  msg->put(numFepInitial);
5924  msg->put(numFepFinal);
5925  msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
5926  }
5927  //fepe
5928 
5929  if (simParams->soluteScalingOn) {
5930  msg->put(numAtoms*sizeof(char), (char*)ssAtomFlags);
5931  msg->put(ss_num_vdw_params);
5932  msg->put(params->get_num_vdw_params()*sizeof(int), (char*)ss_vdw_type);
5933  msg->put(numAtoms*sizeof(int), (char*)ss_index);
5934  }
5935 
5936  #ifdef OPENATOM_VERSION
5937  // needs to be refactored into its own openatom version
5938  if (simParams->openatomOn ) {
5939  msg->put(numFepInitial);
5940  msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
5941  }
5942  #endif //OPENATOM_VERSION
5943 
5944  // DRUDE: send data read from PSF
5945  msg->put(is_lonepairs_psf);
5946  if (is_lonepairs_psf) {
5947  msg->put(numLphosts);
5948  msg->put(numLphosts*sizeof(Lphost), (char*)lphosts);
5949  }
5950  msg->put(is_drude_psf);
5951  if (is_drude_psf) {
5952  msg->put(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
5953  msg->put(numTholes);
5954  msg->put(numTholes*sizeof(Thole), (char*)tholes);
5955  msg->put(numAnisos);
5956  msg->put(numAnisos*sizeof(Aniso), (char*)anisos);
5957  }
5958  msg->put(numZeroMassAtoms);
5959  // DRUDE
5960 
5961  //LCPO
5962  if (simParams->LCPOOn) {
5963  msg->put(numAtoms, (int*)lcpoParamType);
5964  }
5965 
5966  //Send GromacsPairStuff -- JLai
5967  if (simParams->goGroPair) {
5968  msg->put(numLJPair);
5969  msg->put(numLJPair,indxLJA);
5970  msg->put(numLJPair,indxLJB);
5971  msg->put(numLJPair,pairC6);
5972  msg->put(numLJPair,pairC12);
5974  msg->put((numAtoms),pointerToLJBeg);
5975  msg->put((numAtoms),pointerToLJEnd);
5976  msg->put(numGaussPair);
5977  msg->put(numGaussPair,indxGaussA);
5978  msg->put(numGaussPair,indxGaussB);
5979  msg->put(numGaussPair,gA);
5980  msg->put(numGaussPair,gMu1);
5981  msg->put(numGaussPair,giSigma1);
5982  msg->put(numGaussPair,gMu2);
5983  msg->put(numGaussPair,giSigma2);
5984  msg->put(numGaussPair,gRepulsive);
5985  msg->put((numAtoms),pointerToGaussBeg);
5986  msg->put((numAtoms),pointerToGaussEnd);
5987  }
5988 #endif
5989 
5990  // Broadcast the message to the other nodes
5991  msg->end();
5992  delete msg;
5993 
5994 #ifdef MEM_OPT_VERSION
5995 
5996  build_excl_check_signatures();
5997 
5998  //set num{Calc}Tuples(Bonds,...,Impropers) to 0
5999  numBonds = numCalcBonds = 0;
6000  numAngles = numCalcAngles = 0;
6005  // JLai
6006  numLJPair = numCalcLJPair = 0;
6007  // End of JLai
6008 
6009 #else
6010 
6011  // Now build arrays of indexes into these arrays by atom
6012  build_lists_by_atom();
6013 
6014 #endif
6015 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:604
int * indxGaussA
Definition: Molecule.h:711
void end(void)
Definition: MStream.C:176
int numCalcBonds
Definition: Molecule.h:657
Real * gMu2
Definition: Molecule.h:716
int numBonds
Definition: Molecule.h:589
int numCalcLJPair
Definition: Molecule.h:699
Bool monteCarloPressureOn
Real * giSigma2
Definition: Molecule.h:717
int numHydrogenGroups
Definition: Molecule.h:635
int numAnisos
Number of anisotropic terms.
Definition: Molecule.h:613
Angle * alch_unpert_angles
Definition: Molecule.h:606
Definition: Vector.h:72
Real * pairC6
Definition: Molecule.h:704
Bool excludeFromPressure
int num_alch_unpert_Bonds
Definition: Molecule.h:602
static void pack_grid(GridforceGrid *grid, MOStream *msg)
Definition: GridForceGrid.C:50
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:622
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int * pointerToLJEnd
Definition: Molecule.h:701
int numGridforceGrids
Definition: Molecule.h:626
int numRealBonds
Definition: Molecule.h:588
int num_alch_unpert_Angles
Definition: Molecule.h:603
int numMovDrag
Definition: Molecule.h:629
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:607
Real * gA
Definition: Molecule.h:713
Bool pairInteractionOn
int * indxLJB
Definition: Molecule.h:703
int numFepFinal
Definition: Molecule.h:644
int * pointerToGaussBeg
Definition: Molecule.h:708
int numGaussPair
Definition: Molecule.h:710
int numCalcCrossterms
Definition: Molecule.h:661
int isOccupancyValid
Definition: Molecule.h:1562
int32 * consTorqueIndexes
Definition: Molecule.h:651
int64 numTotalExclusions
Definition: Molecule.h:601
Real * gMu1
Definition: Molecule.h:714
int * pointerToLJBeg
Definition: Molecule.h:700
Real * gRepulsive
Definition: Molecule.h:718
int * indxGaussB
Definition: Molecule.h:712
int64 numCalcFullExclusions
Definition: Molecule.h:663
int is_drude_psf
Definition: Molecule.h:490
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:620
int numFixedRigidBonds
Definition: Molecule.h:641
int numFepInitial
Definition: Molecule.h:643
int numMolecules
Number of 1-4 atom pairs with NBThole defined.
Definition: Molecule.h:619
int * pointerToGaussEnd
Definition: Molecule.h:709
int numAcceptors
Definition: Molecule.h:599
int numTholes
Number of Thole terms.
Definition: Molecule.h:612
int numCalcDihedrals
Definition: Molecule.h:659
int numExPressureAtoms
Definition: Molecule.h:634
Bond * alch_unpert_bonds
Definition: Molecule.h:605
int numFixedAtoms
Definition: Molecule.h:632
int numCalcImpropers
Definition: Molecule.h:660
int numAngles
Definition: Molecule.h:590
Real * pairC12
Definition: Molecule.h:705
int numAtoms
Definition: Molecule.h:586
int * gromacsPair_type
Definition: Molecule.h:706
int numStirredAtoms
Definition: Molecule.h:633
int numCrossterms
Definition: Molecule.h:597
int numConsForce
Definition: Molecule.h:647
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:652
int get_num_vdw_params(void)
Definition: Parameters.h:602
int * ss_index
Definition: Molecule.h:487
int maxMigrationGroupSize
Definition: Molecule.h:638
int numDihedrals
Definition: Molecule.h:591
int numImpropers
Definition: Molecule.h:596
int numConsTorque
Definition: Molecule.h:631
int numConstraints
Definition: Molecule.h:624
int64 numCalcExclusions
Definition: Molecule.h:662
int32 * consForceIndexes
Definition: Molecule.h:648
int maxHydrogenGroupSize
Definition: Molecule.h:636
int numMigrationGroups
Definition: Molecule.h:637
Real * giSigma1
Definition: Molecule.h:715
int numZeroMassAtoms
Number of atoms with zero mass.
Definition: Molecule.h:615
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:621
Vector * consForce
Definition: Molecule.h:649
int * indxLJA
Definition: Molecule.h:702
MOStream * put(char data)
Definition: MStream.h:112
int * ss_vdw_type
Definition: Molecule.h:486
int * numGridforces
Definition: Molecule.h:627
int is_lonepairs_psf
Definition: Molecule.h:491
int numLphosts
Number of lone pair host records in PSF.
Definition: Molecule.h:614
int numDonors
Definition: Molecule.h:598
int isBFactorValid
Definition: Molecule.h:1562
int numCalcAngles
Definition: Molecule.h:658
int ss_num_vdw_params
Definition: Molecule.h:485
int numRotDrag
Definition: Molecule.h:630
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313
int numLJPair
Definition: Molecule.h:698
int numExclusions
Definition: Molecule.h:600

◆ set_gridfrc_grid()

int Molecule::set_gridfrc_grid ( int  gridnum,
GridforceGrid grid 
)
inline

Definition at line 1377 of file Molecule.h.

References numGridforceGrids.

Referenced by Node::reloadGridforceGrid().

1378  {
1379  if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
1380  gridfrcGrid[gridnum] = grid;
1381  return 0;
1382  } else {
1383  return -1;
1384  }
1385  }
int numGridforceGrids
Definition: Molecule.h:626

◆ set_qm_replaceAll()

void Molecule::set_qm_replaceAll ( Bool  newReplaceAll)
inline

Definition at line 857 of file Molecule.h.

Referenced by NamdState::loadStructure().

857 { qmReplaceAll = newReplaceAll; } ;

◆ setBFactorData()

void Molecule::setBFactorData ( molfile_atom_t *  atomarray)

Definition at line 3289 of file Molecule.C.

3289  {
3290  bfactor = new float[numAtoms];
3291  for(int i=0; i<numAtoms; i++) {
3292  bfactor[i] = atomarray[i].bfactor;
3293  }
3294 }
int numAtoms
Definition: Molecule.h:586

◆ setOccupancyData()

void Molecule::setOccupancyData ( molfile_atom_t *  atomarray)

Definition at line 3282 of file Molecule.C.

3282  {
3283  occupancy = new float[numAtoms];
3284  for(int i=0; i<numAtoms; i++) {
3285  occupancy[i] = atomarray[i].occupancy;
3286  }
3287 }
int numAtoms
Definition: Molecule.h:586

◆ updateAtomDcdSelection()

void Molecule::updateAtomDcdSelection ( int  atomIdx,
uint16  bits 
)
inline

Definition at line 726 of file Molecule.h.

References per_atom_flags::dcdSelection, and AtomCstInfo::flags.

727 {
728  atoms[atomIdx].flags.dcdSelection |= bits;
729 }
PerAtomFlags flags
Definition: structures.h:41
uint16 dcdSelection
Definition: common.h:269

Friends And Related Function Documentation

◆ AngleElem

friend class AngleElem
friend

Definition at line 239 of file Molecule.h.

◆ AnisoElem

friend class AnisoElem
friend

Definition at line 243 of file Molecule.h.

◆ BondElem

friend class BondElem
friend

Definition at line 238 of file Molecule.h.

◆ CrosstermElem

friend class CrosstermElem
friend

Definition at line 245 of file Molecule.h.

◆ DihedralElem

friend class DihedralElem
friend

Definition at line 240 of file Molecule.h.

◆ ExclElem

friend class ExclElem
friend

Definition at line 237 of file Molecule.h.

◆ GromacsPairElem

friend class GromacsPairElem
friend

Definition at line 247 of file Molecule.h.

◆ ImproperElem

friend class ImproperElem
friend

Definition at line 241 of file Molecule.h.

◆ OneFourNbTholeElem

friend class OneFourNbTholeElem
friend

Definition at line 244 of file Molecule.h.

◆ TholeElem

friend class TholeElem
friend

Definition at line 242 of file Molecule.h.

◆ WorkDistrib

friend class WorkDistrib
friend

Definition at line 249 of file Molecule.h.

Member Data Documentation

◆ alch_unpert_angles

Angle* Molecule::alch_unpert_angles

◆ alch_unpert_bonds

Bond* Molecule::alch_unpert_bonds

◆ alch_unpert_dihedrals

Dihedral* Molecule::alch_unpert_dihedrals

◆ alchDroppedAngles

int Molecule::alchDroppedAngles

Definition at line 593 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ alchDroppedDihedrals

int Molecule::alchDroppedDihedrals

Definition at line 594 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ alchDroppedImpropers

int Molecule::alchDroppedImpropers

Definition at line 595 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ atomChainTypes

int32* Molecule::atomChainTypes

◆ consForce

Vector* Molecule::consForce

Definition at line 649 of file Molecule.h.

Referenced by ComputeConsForce::doForce(), and ComputeMgr::recvComputeConsForceMsg().

◆ consForceIndexes

int32* Molecule::consForceIndexes

Definition at line 648 of file Molecule.h.

Referenced by ComputeConsForce::doForce(), and ComputeMgr::recvComputeConsForceMsg().

◆ consTorqueIndexes

int32* Molecule::consTorqueIndexes

◆ consTorqueParams

ConsTorqueParams* Molecule::consTorqueParams

Definition at line 652 of file Molecule.h.

Referenced by get_constorque_params().

◆ dcdSelectionAtoms

bool Molecule::dcdSelectionAtoms

◆ dcdSelectionKeyMap

std::map<std::string, int> Molecule::dcdSelectionKeyMap

Definition at line 483 of file Molecule.h.

◆ dcdSelectionParams

DCDParams Molecule::dcdSelectionParams[16]

◆ energyNative

BigReal Molecule::energyNative

Definition at line 721 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

◆ energyNonnative

BigReal Molecule::energyNonnative

Definition at line 722 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

◆ gA

Real* Molecule::gA

Definition at line 713 of file Molecule.h.

Referenced by get_gro_force2().

◆ giSigma1

Real* Molecule::giSigma1

Definition at line 715 of file Molecule.h.

Referenced by get_gro_force2().

◆ giSigma2

Real* Molecule::giSigma2

Definition at line 717 of file Molecule.h.

Referenced by get_gro_force2().

◆ gMu1

Real* Molecule::gMu1

Definition at line 714 of file Molecule.h.

Referenced by get_gro_force2().

◆ gMu2

Real* Molecule::gMu2

Definition at line 716 of file Molecule.h.

Referenced by get_gro_force2().

◆ go_array

GoValue Molecule::go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]

◆ go_indices

int Molecule::go_indices[MAX_GO_CHAINS+1]

Definition at line 1641 of file Molecule.h.

Referenced by read_go_file(), receive_GoMolecule(), and send_GoMolecule().

◆ goCoordinates

Real* Molecule::goCoordinates

◆ goIndxLJA

int* Molecule::goIndxLJA

Definition at line 690 of file Molecule.h.

Referenced by build_go_sigmas2(), receive_GoMolecule(), and send_GoMolecule().

◆ goIndxLJB

int* Molecule::goIndxLJB

Definition at line 691 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ goNumLJPair

int Molecule::goNumLJPair

Definition at line 689 of file Molecule.h.

Referenced by build_go_sigmas2(), receive_GoMolecule(), and send_GoMolecule().

◆ goPDB

PDB* Molecule::goPDB

Definition at line 687 of file Molecule.h.

Referenced by build_go_arrays(), build_go_sigmas(), build_go_sigmas2(), and goInit().

◆ goResidIndices

int32* Molecule::goResidIndices

Definition at line 682 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ goResids

int* Molecule::goResids

◆ goSigmaIndices

int32* Molecule::goSigmaIndices

◆ goSigmaPairA

double* Molecule::goSigmaPairA

Definition at line 692 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ goSigmaPairB

double* Molecule::goSigmaPairB

Definition at line 693 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ goSigmas

Real* Molecule::goSigmas

◆ goWithinCutoff

bool* Molecule::goWithinCutoff

◆ gRepulsive

Real* Molecule::gRepulsive

Definition at line 718 of file Molecule.h.

Referenced by get_gro_force2().

◆ gromacsPair_type

int* Molecule::gromacsPair_type

Definition at line 706 of file Molecule.h.

◆ hydrogenGroup

HydrogenGroup Molecule::hydrogenGroup

Definition at line 676 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), and outputCompressedFile().

◆ indxGaussA

int* Molecule::indxGaussA

Definition at line 711 of file Molecule.h.

◆ indxGaussB

int* Molecule::indxGaussB

Definition at line 712 of file Molecule.h.

Referenced by get_gro_force2().

◆ indxLJA

int* Molecule::indxLJA

Definition at line 702 of file Molecule.h.

◆ indxLJB

int* Molecule::indxLJB

Definition at line 703 of file Molecule.h.

Referenced by get_gro_force2().

◆ is_drude_psf

int Molecule::is_drude_psf

Definition at line 490 of file Molecule.h.

◆ is_lonepairs_psf

int Molecule::is_lonepairs_psf

Definition at line 491 of file Molecule.h.

◆ isBFactorValid

int Molecule::isBFactorValid

Definition at line 1562 of file Molecule.h.

◆ isOccupancyValid

int Molecule::isOccupancyValid

Definition at line 1562 of file Molecule.h.

◆ maxHydrogenGroupSize

int Molecule::maxHydrogenGroupSize

Definition at line 636 of file Molecule.h.

Referenced by NamdState::loadStructure(), and outputCompressedFile().

◆ maxMigrationGroupSize

int Molecule::maxMigrationGroupSize

Definition at line 638 of file Molecule.h.

Referenced by NamdState::loadStructure(), and outputCompressedFile().

◆ moleculeAtom

int32* Molecule::moleculeAtom

atom index for all molecules

Definition at line 622 of file Molecule.h.

◆ moleculeStartIndex

int32* Molecule::moleculeStartIndex

starting index of each molecule

Definition at line 621 of file Molecule.h.

◆ num_alch_unpert_Angles

int Molecule::num_alch_unpert_Angles

◆ num_alch_unpert_Bonds

int Molecule::num_alch_unpert_Bonds

◆ num_alch_unpert_Dihedrals

int Molecule::num_alch_unpert_Dihedrals

◆ numAcceptors

int Molecule::numAcceptors

Definition at line 599 of file Molecule.h.

◆ numAngles

int Molecule::numAngles

◆ numAnisos

int Molecule::numAnisos

Number of anisotropic terms.

Definition at line 613 of file Molecule.h.

Referenced by AnisoElem::getMoleculePointers().

◆ numAtoms

int Molecule::numAtoms

◆ numBonds

int Molecule::numBonds

◆ numCalcAngles

int Molecule::numCalcAngles

Definition at line 658 of file Molecule.h.

Referenced by Controller::compareChecksums(), and dumpbench().

◆ numCalcAnisos

int Molecule::numCalcAnisos

Definition at line 667 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcBonds

int Molecule::numCalcBonds

Definition at line 657 of file Molecule.h.

Referenced by Controller::compareChecksums(), and dumpbench().

◆ numCalcCrossterms

int Molecule::numCalcCrossterms

Definition at line 661 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcDihedrals

int Molecule::numCalcDihedrals

Definition at line 659 of file Molecule.h.

Referenced by Controller::compareChecksums(), and dumpbench().

◆ numCalcExclusions

int64 Molecule::numCalcExclusions

Definition at line 662 of file Molecule.h.

Referenced by Controller::compareChecksums(), and dumpbench().

◆ numCalcFullExclusions

int64 Molecule::numCalcFullExclusions

Definition at line 663 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcImpropers

int Molecule::numCalcImpropers

Definition at line 660 of file Molecule.h.

Referenced by Controller::compareChecksums(), and dumpbench().

◆ numCalcLJPair

int Molecule::numCalcLJPair

Definition at line 699 of file Molecule.h.

◆ numCalcOneFourNbTholes

int Molecule::numCalcOneFourNbTholes

Definition at line 668 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcTholes

int Molecule::numCalcTholes

Definition at line 666 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numConsForce

int Molecule::numConsForce

Definition at line 647 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numConsTorque

int Molecule::numConsTorque

Definition at line 631 of file Molecule.h.

Referenced by is_atom_constorqued().

◆ numConstraints

int Molecule::numConstraints

◆ numCrossterms

int Molecule::numCrossterms

◆ numDihedrals

int Molecule::numDihedrals

◆ numDonors

int Molecule::numDonors

Definition at line 598 of file Molecule.h.

◆ numDrudeAtoms

int Molecule::numDrudeAtoms

Number of Drude particles.

Definition at line 611 of file Molecule.h.

Referenced by NamdState::loadStructure(), and Controller::receivePressure().

◆ numExclusions

int Molecule::numExclusions

Definition at line 600 of file Molecule.h.

Referenced by ExclElem::getMoleculePointers(), and NamdState::loadStructure().

◆ numExPressureAtoms

int Molecule::numExPressureAtoms

Definition at line 634 of file Molecule.h.

Referenced by is_atom_exPressure().

◆ numFepFinal

int Molecule::numFepFinal

Definition at line 644 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numFepInitial

int Molecule::numFepInitial

◆ numFixedAtoms

int Molecule::numFixedAtoms

◆ numFixedGroups

int Molecule::numFixedGroups

◆ numFixedRigidBonds

int Molecule::numFixedRigidBonds

◆ numGaussPair

int Molecule::numGaussPair

Definition at line 710 of file Molecule.h.

◆ numGoAtoms

int Molecule::numGoAtoms

◆ NumGoChains

int Molecule::NumGoChains

Definition at line 1642 of file Molecule.h.

Referenced by print_go_params(), read_go_file(), receive_GoMolecule(), and send_GoMolecule().

◆ numGridforceGrids

int Molecule::numGridforceGrids

◆ numGridforces

int* Molecule::numGridforces

Definition at line 627 of file Molecule.h.

◆ numHydrogenGroups

int Molecule::numHydrogenGroups

◆ numImpropers

int Molecule::numImpropers

◆ numLargeMolecules

int Molecule::numLargeMolecules

Number of large molecules (compare to LARGEMOLTH)

Definition at line 620 of file Molecule.h.

◆ numLJPair

int Molecule::numLJPair

Definition at line 698 of file Molecule.h.

Referenced by build_go_sigmas2(), and GromacsPairElem::getMoleculePointers().

◆ numLonepairs

int Molecule::numLonepairs

Number of lone pairs.

Definition at line 610 of file Molecule.h.

Referenced by NamdState::loadStructure(), num_deg_freedom(), and Controller::receivePressure().

◆ numLphosts

int Molecule::numLphosts

Number of lone pair host records in PSF.

Definition at line 614 of file Molecule.h.

◆ numMigrationGroups

int Molecule::numMigrationGroups

Definition at line 637 of file Molecule.h.

Referenced by NamdState::loadStructure(), and outputCompressedFile().

◆ numMolecules

int Molecule::numMolecules

Number of 1-4 atom pairs with NBThole defined.

Number of molecules

Definition at line 619 of file Molecule.h.

Referenced by Controller::monteCarloPressure_accept().

◆ numMovDrag

int Molecule::numMovDrag

Definition at line 629 of file Molecule.h.

Referenced by is_atom_movdragged().

◆ numMultipleDihedrals

int Molecule::numMultipleDihedrals

Definition at line 672 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numMultipleImpropers

int Molecule::numMultipleImpropers

Definition at line 674 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numOneFourNbTholes

int Molecule::numOneFourNbTholes

Definition at line 616 of file Molecule.h.

Referenced by OneFourNbTholeElem::getMoleculePointers().

◆ numPair

int Molecule::numPair

Definition at line 697 of file Molecule.h.

◆ numRealBonds

int Molecule::numRealBonds

Definition at line 588 of file Molecule.h.

Referenced by buildBondData(), delete_qm_bonded(), and prepare_qm().

◆ numRigidBonds

int Molecule::numRigidBonds

◆ numRotDrag

int Molecule::numRotDrag

Definition at line 630 of file Molecule.h.

Referenced by is_atom_rotdragged().

◆ numStirredAtoms

int Molecule::numStirredAtoms

Definition at line 633 of file Molecule.h.

Referenced by is_atom_stirred(), and NamdState::loadStructure().

◆ numTholes

int Molecule::numTholes

Number of Thole terms.

Definition at line 612 of file Molecule.h.

Referenced by TholeElem::getMoleculePointers().

◆ numTotalExclusions

int64 Molecule::numTotalExclusions

Definition at line 601 of file Molecule.h.

◆ numZeroMassAtoms

int Molecule::numZeroMassAtoms

Number of atoms with zero mass.

Definition at line 615 of file Molecule.h.

◆ pairC12

Real* Molecule::pairC12

Definition at line 705 of file Molecule.h.

Referenced by get_gro_force2().

◆ pairC6

Real* Molecule::pairC6

Definition at line 704 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGaussBeg

int* Molecule::pointerToGaussBeg

Definition at line 708 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGaussEnd

int* Molecule::pointerToGaussEnd

Definition at line 709 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGoBeg

int* Molecule::pointerToGoBeg

Definition at line 694 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ pointerToGoEnd

int* Molecule::pointerToGoEnd

Definition at line 695 of file Molecule.h.

Referenced by build_go_sigmas2(), get_go_force2(), receive_GoMolecule(), and send_GoMolecule().

◆ pointerToLJBeg

int* Molecule::pointerToLJBeg

Definition at line 700 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToLJEnd

int* Molecule::pointerToLJEnd

Definition at line 701 of file Molecule.h.

Referenced by get_gro_force2().

◆ r_ohc

Real Molecule::r_ohc

Definition at line 496 of file Molecule.h.

◆ r_om

Real Molecule::r_om

Definition at line 495 of file Molecule.h.

◆ ss_index

int* Molecule::ss_index

Definition at line 487 of file Molecule.h.

◆ ss_num_vdw_params

int Molecule::ss_num_vdw_params

Definition at line 485 of file Molecule.h.

Referenced by ComputeLjPmeSerialMgr::getLJparameters(), and LJTable::LJTable().

◆ ss_vdw_type

int* Molecule::ss_vdw_type

Definition at line 486 of file Molecule.h.

Referenced by ComputeLjPmeSerialMgr::getLJparameters().

◆ suspiciousAlchBonds

int Molecule::suspiciousAlchBonds

Definition at line 592 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ tail_corr_dUdl_1

BigReal Molecule::tail_corr_dUdl_1

Definition at line 501 of file Molecule.h.

◆ tail_corr_dUdl_2

BigReal Molecule::tail_corr_dUdl_2

Definition at line 501 of file Molecule.h.

◆ tail_corr_ener

BigReal Molecule::tail_corr_ener

Definition at line 499 of file Molecule.h.

Referenced by Controller::rescaleaccelMD().

◆ tail_corr_virial

BigReal Molecule::tail_corr_virial

Definition at line 500 of file Molecule.h.

◆ tail_corr_virial_1

BigReal Molecule::tail_corr_virial_1

Definition at line 502 of file Molecule.h.

◆ tail_corr_virial_2

BigReal Molecule::tail_corr_virial_2

Definition at line 502 of file Molecule.h.


The documentation for this class was generated from the following files: