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 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 ()
 
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)
 
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)
 
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

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 numMolecules
 Number of molecules. 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 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 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 175 of file Molecule.h.

Constructor & Destructor Documentation

◆ Molecule() [1/6]

Molecule::Molecule ( SimParameters simParams,
Parameters param 
)

Definition at line 438 of file Molecule.C.

References simParams.

439 {
440  initialize(simParams,param);
441 }
void initialize()

◆ Molecule() [2/6]

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

Definition at line 451 of file Molecule.C.

References NAMD_EVENT_START, NAMD_EVENT_STOP, and simParams.

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

◆ Molecule() [3/6]

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

Definition at line 476 of file Molecule.C.

References NAMD_die(), and simParams.

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

References atomSigPool.

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

1118  {
1119  #ifdef MEM_OPT_VERSION
1120  return atomChargePool[eachAtomCharge[anum]];
1121  #else
1122  return(atoms[anum].charge);
1123  #endif
1124  }

◆ atommass()

Real Molecule::atommass ( int  anum) const
inline

Definition at line 1107 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().

1108  {
1109  #ifdef MEM_OPT_VERSION
1110  return atomMassPool[eachAtomMass[anum]];
1111  #else
1112  return(atoms[anum].mass);
1113  #endif
1114  }

◆ 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:1217
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:1143
int32 * get_angles_for_atom(int anum)
Definition: Molecule.h:1215
int32 atom4
Definition: structures.h:68
int32 atom1
Definition: structures.h:50
Angle * get_angle(int anum) const
Definition: Molecule.h:1137
int32 atom2
Definition: structures.h:58
int32 atom1
Definition: structures.h:57
int32 * get_bonds_for_atom(int anum)
Definition: Molecule.h:1213
int32 atom3
Definition: structures.h:59
int32 atom2
Definition: structures.h:66
Bond * get_bond(int bnum) const
Definition: Molecule.h:1134
#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 1127 of file Molecule.h.

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

1128  {
1129  return(atoms[anum].vdw_type);
1130  }

◆ 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:1652
Definition: PDB.h:36
PDB * goPDB
Definition: Molecule.h:684
Real * goCoordinates
Definition: Molecule.h:682
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:677
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:683
BigReal energyNonnative
Definition: Molecule.h:719
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:585
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:718
Bool atoms_1to4(unsigned int, unsigned int)
Definition: GoMolecule.C:1538
int32 * goSigmaIndices
Definition: Molecule.h:678
int numGoAtoms
Definition: Molecule.h:676
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:1664
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1652
Definition: PDB.h:36
PDB * goPDB
Definition: Molecule.h:684
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:681
#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:677
PDBAtom * atom(int place)
Definition: PDB.C:393
Real * goSigmas
Definition: Molecule.h:680
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:585
void NAMD_die(const char *err_msg)
Definition: common.C:147
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1667
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:678
int numGoAtoms
Definition: Molecule.h:676
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:1664
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1652
Definition: PDB.h:36
double A
Definition: Molecule.h:121
int * pointerToGoBeg
Definition: Molecule.h:691
PDB * goPDB
Definition: Molecule.h:684
int goIndxB
Definition: Molecule.h:120
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:689
#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:677
double B
Definition: Molecule.h:122
int goIndxA
Definition: Molecule.h:119
int * pointerToGoEnd
Definition: Molecule.h:692
int * goIndxLJA
Definition: Molecule.h:687
PDBAtom * atom(int place)
Definition: PDB.C:393
int goNumLJPair
Definition: Molecule.h:686
int32 * goResidIndices
Definition: Molecule.h:679
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int numAtoms
Definition: Molecule.h:585
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:690
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1667
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:678
int * goIndxLJB
Definition: Molecule.h:688
int numGoAtoms
Definition: Molecule.h:676
int numLJPair
Definition: Molecule.h:695

◆ build_gridforce_params()

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

Definition at line 6534 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().

6540 {
6541  PDB *kPDB;
6542  register int i; // Loop counters
6543  register int j;
6544  register int k;
6545 
6546  DebugM(3, "Entered build_gridforce_params multi...\n");
6547 // DebugM(3, "\tgridfrcfile = " << gridfrcfile->data << endi);
6548 // DebugM(3, "\tgridfrccol = " << gridfrccol->data << endi);
6549 
6550  MGridforceParams* mgridParams = simParams->mgridforcelist.get_first();
6551  numGridforceGrids = 0;
6552  while (mgridParams != NULL) {
6554  mgridParams = mgridParams->next;
6555  }
6556 
6557  DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
6558  gridfrcIndexes = new int32*[numGridforceGrids];
6559  gridfrcParams = new GridforceParams*[numGridforceGrids];
6560  gridfrcGrid = new GridforceGrid*[numGridforceGrids];
6561  numGridforces = new int[numGridforceGrids];
6562 
6563  int grandTotalGrids = 0; // including all subgrids
6564 
6565  mgridParams = simParams->mgridforcelist.get_first();
6566  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
6567  int current_index=0; // Index into values used
6568  int kcol = 5; // Column to look for force constant in
6569  int qcol = 0; // Column for charge (default 0: use electric charge)
6570  Real kval = 0; // Force constant value retreived
6571  char filename[NAMD_FILENAME_BUFFER_SIZE]; // PDB filename
6572  char potfilename[NAMD_FILENAME_BUFFER_SIZE]; // Potential file name
6573 
6574  if (mgridParams == NULL) {
6575  NAMD_die("Problem with mgridParams!");
6576  }
6577 
6578  // Now load values from mgridforcelist object
6579  if (mgridParams->gridforceFile == NULL)
6580  {
6581  if ( ! initial_pdb ) NAMD_die("Initial PDB file unavailable, gridforceFile required.");
6582  kPDB = initial_pdb;
6583  }
6584  else
6585  {
6586  DebugM(4, "mgridParams->gridforceFile = " << mgridParams->gridforceFile << "\n" << endi);
6587 
6588  if ( (cwd == NULL) || (mgridParams->gridforceFile[0] == '/') )
6589  {
6590  strcpy(filename, mgridParams->gridforceFile);
6591  }
6592  else
6593  {
6594  strcpy(filename, cwd);
6595  strcat(filename, mgridParams->gridforceFile);
6596  }
6597 
6598  kPDB = new PDB(filename);
6599  if ( kPDB == NULL )
6600  {
6601  NAMD_die("Memory allocation failed in Molecule::build_gridforce_params");
6602  }
6603 
6604  if (kPDB->num_atoms() != numAtoms)
6605  {
6606  NAMD_die("Number of atoms in grid force PDB doesn't match coordinate PDB");
6607  }
6608  }
6609 
6610  // Get the column that the force constant is going to be in. It
6611  // can be in any of the 5 floating point fields in the PDB, according
6612  // to what the user wants. The allowable fields are X, Y, Z, O, or
6613  // B which correspond to the 1st, 2nd, ... 5th floating point fields.
6614  // The default is the 5th field, which is beta (temperature factor)
6615  if (mgridParams->gridforceCol == NULL)
6616  {
6617  kcol = 5;
6618  }
6619  else
6620  {
6621  if (strcasecmp(mgridParams->gridforceCol, "X") == 0)
6622  {
6623  kcol=1;
6624  }
6625  else if (strcasecmp(mgridParams->gridforceCol, "Y") == 0)
6626  {
6627  kcol=2;
6628  }
6629  else if (strcasecmp(mgridParams->gridforceCol, "Z") == 0)
6630  {
6631  kcol=3;
6632  }
6633  else if (strcasecmp(mgridParams->gridforceCol, "O") == 0)
6634  {
6635  kcol=4;
6636  }
6637  else if (strcasecmp(mgridParams->gridforceCol, "B") == 0)
6638  {
6639  kcol=5;
6640  }
6641  else
6642  {
6643  NAMD_die("gridforcecol must have value of X, Y, Z, O, or B");
6644  }
6645  }
6646 
6647  // Get the column that the charge is going to be in.
6648  if (mgridParams->gridforceQcol == NULL)
6649  {
6650  qcol = 0; // Default: don't read charge from file, use electric charge
6651  }
6652  else
6653  {
6654  if (strcasecmp(mgridParams->gridforceQcol, "X") == 0)
6655  {
6656  qcol=1;
6657  }
6658  else if (strcasecmp(mgridParams->gridforceQcol, "Y") == 0)
6659  {
6660  qcol=2;
6661  }
6662  else if (strcasecmp(mgridParams->gridforceQcol, "Z") == 0)
6663  {
6664  qcol=3;
6665  }
6666  else if (strcasecmp(mgridParams->gridforceQcol, "O") == 0)
6667  {
6668  qcol=4;
6669  }
6670  else if (strcasecmp(mgridParams->gridforceQcol, "B") == 0)
6671  {
6672  qcol=5;
6673  }
6674  else
6675  {
6676  NAMD_die("gridforcechargecol must have value of X, Y, Z, O, or B");
6677  }
6678  }
6679 
6680  if (kcol == qcol) {
6681  NAMD_die("gridforcecol and gridforcechargecol cannot have same value");
6682  }
6683 
6684 
6685  // Allocate an array that will store an index into the constraint
6686  // parameters for each atom. If the atom is not constrained, its
6687  // value will be set to -1 in this array.
6688  gridfrcIndexes[gridnum] = new int32[numAtoms];
6689 
6690  if (gridfrcIndexes[gridnum] == NULL)
6691  {
6692  NAMD_die("memory allocation failed in Molecule::build_gridforce_params()");
6693  }
6694 
6695  // Loop through all the atoms and find out which ones are constrained
6696  for (i=0; i<numAtoms; i++)
6697  {
6698  // Get the k value based on where we were told to find it
6699  switch (kcol)
6700  {
6701  case 1:
6702  kval = (kPDB->atom(i))->xcoor();
6703  break;
6704  case 2:
6705  kval = (kPDB->atom(i))->ycoor();
6706  break;
6707  case 3:
6708  kval = (kPDB->atom(i))->zcoor();
6709  break;
6710  case 4:
6711  kval = (kPDB->atom(i))->occupancy();
6712  break;
6713  case 5:
6714  kval = (kPDB->atom(i))->temperaturefactor();
6715  break;
6716  }
6717 
6718  if (kval > 0.0)
6719  {
6720  // This atom is constrained
6721  gridfrcIndexes[gridnum][i] = current_index;
6722  current_index++;
6723  }
6724  else
6725  {
6726  // This atom is not constrained
6727  gridfrcIndexes[gridnum][i] = -1;
6728  }
6729  }
6730 
6731  if (current_index == 0)
6732  {
6733  // Constraints were turned on, but there weren't really any constrained
6734  iout << iWARN << "NO GRIDFORCE ATOMS WERE FOUND, BUT GRIDFORCE IS ON . . .\n" << endi;
6735  }
6736  else
6737  {
6738  // Allocate an array to hold the constraint parameters
6739  gridfrcParams[gridnum] = new GridforceParams[current_index];
6740  if (gridfrcParams[gridnum] == NULL)
6741  {
6742  NAMD_die("memory allocation failed in Molecule::build_gridforce_params");
6743  }
6744  }
6745 
6746  numGridforces[gridnum] = current_index;
6747 
6748  // Loop through all the atoms and assign the parameters for those
6749  // that are constrained
6750  for (i=0; i<numAtoms; i++)
6751  {
6752  if (gridfrcIndexes[gridnum][i] != -1)
6753  {
6754  // This atom has grid force, so get the k value again
6755  switch (kcol)
6756  {
6757  case 1:
6758  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->xcoor();
6759  break;
6760  case 2:
6761  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->ycoor();
6762  break;
6763  case 3:
6764  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->zcoor();
6765  break;
6766  case 4:
6767  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->occupancy();
6768  break;
6769  case 5:
6770  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->temperaturefactor();
6771  break;
6772  }
6773 
6774  // Also get charge column
6775  switch (qcol)
6776  {
6777  case 0:
6778 #ifdef MEM_OPT_VERSION
6779  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atomChargePool[eachAtomCharge[i]];
6780 #else
6781  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atoms[i].charge;
6782 #endif
6783  break;
6784  case 1:
6785  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->xcoor();
6786  break;
6787  case 2:
6788  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->ycoor();
6789  break;
6790  case 3:
6791  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->zcoor();
6792  break;
6793  case 4:
6794  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->occupancy();
6795  break;
6796  case 5:
6797  gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->temperaturefactor();
6798  break;
6799  }
6800  }
6801  }
6802 
6803  // If we had to create new PDB objects, delete them now
6804  if (mgridParams->gridforceFile != NULL)
6805  {
6806  delete kPDB;
6807  }
6808 
6809  // Now we fill in our grid information
6810 
6811  // Open potential file
6812  if ( (cwd == NULL) || (mgridParams->gridforceVfile[0] == '/') )
6813  {
6814  strcpy(potfilename, mgridParams->gridforceVfile);
6815  }
6816  else
6817  {
6818  strcpy(potfilename, cwd);
6819  strcat(potfilename, mgridParams->gridforceVfile);
6820  }
6821 
6822 // iout << iINFO << "Allocating grid " << gridnum
6823 // << "\n" << endi;
6824 
6825  DebugM(3, "allocating GridforceGrid(" << gridnum << ")\n");
6826  gridfrcGrid[gridnum] = GridforceGrid::new_grid(gridnum, potfilename, simParams, mgridParams);
6827 
6828  grandTotalGrids++;
6829  DebugM(4, "grandTotalGrids = " << grandTotalGrids << "\n" << endi);
6830 
6831  // Finally, get next mgridParams pointer
6832  mgridParams = mgridParams->next;
6833  }
6834 }
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:624
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:585
void NAMD_die(const char *err_msg)
Definition: common.C:147
MGridforceParamsList mgridforcelist
MGridforceParams * next
int * numGridforces
Definition: Molecule.h:625

◆ 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 3291 of file Molecule.C.

References LARGEMOLTH, and sizeColumn().

Referenced by NamdState::loadStructure().

3292 {
3293  int i, j; // Loop counter
3294  //tmpArena = new ObjectArena<int32>;
3295  //atomsInMolecule = new int32 *[numAtoms];
3296 
3297  //store the atom index that are bonded with each atom
3298  vector<vector<int> > atomBonds(numAtoms);
3299  for (i = 0; i < numRealBonds; i++) {
3300  int a = bonds[i].atom1;
3301  int b = bonds[i].atom2;
3302  atomBonds[a].push_back(b);
3303  atomBonds[b].push_back(a);
3304  }
3305 
3306  vector<int> atomsInMolecules(numAtoms, -1);
3307  int molNumber = 0;
3308  for (i = 0; i < numAtoms; i++) {
3309  if (atomsInMolecules[i] == -1) {
3310  vector<int> atomList, neighborList;
3311  atomList.push_back(i);
3312  neighborList.push_back(0);
3313  int currentMolecule = molNumber++;
3314 
3315  while (atomList.size() > 0) {
3316  int particle = atomList.back();
3317  atomsInMolecules[particle] = currentMolecule;
3318  int& neighbor = neighborList.back();
3319  while (neighbor < atomBonds[particle].size() && atomsInMolecules[atomBonds[particle][neighbor]] != -1) {
3320  neighbor++;
3321  }
3322 
3323  if (neighbor < atomBonds[particle].size()) {
3324  atomList.push_back(atomBonds[particle][neighbor]);
3325  neighborList.push_back(0);
3326  } else {
3327  atomList.pop_back();
3328  neighborList.pop_back();
3329  }
3330  }
3331  }
3332  }
3333 
3334  numMolecules = molNumber;
3335  // Create a 2D vector to store the index of atoms in each molecule.
3336  vector<vector<int> > molecules(numMolecules);
3337  for (i = 0; i < numAtoms; i++) {
3338  molecules[atomsInMolecules[i]].push_back(i);
3339  }
3340 
3341  // sort the molecule in descending order, so molecules with larger
3342  // atom size come first.
3343  sort(molecules.begin(), molecules.end(), sizeColumn);
3344  // Need the number of large molecule for GPU work schedule
3345  // Determin the number of larg molecule with atom > LARGEMOLTH
3346  numLargeMolecules = 0;
3347  for (i = 0; i < numMolecules; i++){
3348  if(molecules[i].size() > LARGEMOLTH) {
3350  } else {
3351  // since we sorted the molecule based on their size, we can
3352  // break
3353  break;
3354  }
3355  }
3356 
3357  // store the atoms in molecule in two array.
3358  // moleculeAtom stores the atom index of all molecule, linearly
3359  // moleculeStartIndex stores the starting index of each molecule
3360  int index = 0;
3362  moleculeAtom = new int32[numAtoms];
3363 
3364  for (i = 0; i < numMolecules; i++) {
3365  moleculeStartIndex[i] = index;
3366  for (j = 0; j < molecules[i].size(); j++) {
3367  moleculeAtom[index++] = molecules[i][j];
3368  }
3369  }
3370  //store the last molecule index
3372 
3373 #if 0
3374  printf("Number of Molecule with atom greater than %5d: %5d \n: ", LARGEMOLTH, numLargeMolecules);
3375  for (i = 0; i < numMolecules; i++) {
3376  int startIdx = moleculeStartIndex[i];
3377  int endIdx = moleculeStartIndex[i+1];
3378  printf("Molecule Idx %5d: ", i);
3379  for (j = startIdx; j < endIdx; j++) {
3380  int atom = moleculeAtom[j];
3381  printf("%7d ", atom);
3382  }
3383  printf("\n");
3384  }
3385 #endif
3386 }
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:620
int32_t int32
Definition: common.h:38
int numRealBonds
Definition: Molecule.h:587
int32 atom1
Definition: structures.h:50
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:618
int numMolecules
Number of molecules.
Definition: Molecule.h:617
int numAtoms
Definition: Molecule.h:585
#define LARGEMOLTH
Definition: Molecule.h:143
int sizeColumn(const vector< int > &v1, const vector< int > &v2)
Definition: Molecule.C:3286
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:619
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:588
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numRealBonds
Definition: Molecule.h:587
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:589
int numCrossterms
Definition: Molecule.h:596
void NAMD_die(const char *err_msg)
Definition: common.C:147
int numDihedrals
Definition: Molecule.h:590
int numImpropers
Definition: Molecule.h:595
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 1103 of file Molecule.h.

Referenced by NamdState::loadStructure().

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

◆ freeOccupancyData()

void Molecule::freeOccupancyData ( )
inline

Definition at line 1099 of file Molecule.h.

Referenced by NamdState::loadStructure().

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

◆ get_acceptor()

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

Definition at line 1174 of file Molecule.h.

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

◆ get_angle()

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

Definition at line 1137 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

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

◆ get_angles_for_atom()

int32* Molecule::get_angles_for_atom ( int  anum)
inline

Definition at line 1215 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1216  { return anglesByAtom[anum]; }

◆ 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 877 of file Molecule.h.

References dcd_params::dcdSelectionIndex, and dcdSelectionParams.

Referenced by wrap_coor_int_dcd_selection().

877  {
878  return dcdSelectionParams[index].dcdSelectionIndex[atomIndex];
879  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
std::vector< int32 > dcdSelectionIndex
Definition: common.h:264

◆ get_atomtype()

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

Definition at line 1185 of file Molecule.h.

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

1186  {
1187  if (atomNames == NULL)
1188  {
1189  NAMD_die("Tried to find atom type on node other than node 0");
1190  }
1191 
1192  #ifdef MEM_OPT_VERSION
1193  return atomTypePool[atomNames[anum].atomtypeIdx];
1194  #else
1195  return(atomNames[anum].atomtype);
1196  #endif
1197  }
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 1134 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

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

◆ get_bonds_for_atom()

int32* Molecule::get_bonds_for_atom ( int  anum)
inline

Definition at line 1213 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1214  { return bondsByAtom[anum]; }

◆ get_cluster()

int Molecule::get_cluster ( int  anum) const
inline

Definition at line 1092 of file Molecule.h.

Referenced by wrap_coor_int(), and wrap_coor_int_dcd_selection().

1092 { return cluster[anum]; }

◆ get_clusterSize()

int Molecule::get_clusterSize ( int  anum) const
inline

Definition at line 1093 of file Molecule.h.

Referenced by wrap_coor_int(), and wrap_coor_int_dcd_selection().

1093 { return clusterSize[anum]; }

◆ get_cons_params()

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

Definition at line 1349 of file Molecule.h.

Referenced by ComputeRestraints::doForce().

1350  {
1351  k = consParams[consIndexes[atomnum]].k;
1352  refPos = consParams[consIndexes[atomnum]].refPos;
1353  }

◆ get_constorque_params()

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

Definition at line 1423 of file Molecule.h.

References consTorqueIndexes, and consTorqueParams.

Referenced by ComputeConsTorque::doForce().

1425  {
1426  v = consTorqueParams[consTorqueIndexes[atomnum]].v;
1427  a = consTorqueParams[consTorqueIndexes[atomnum]].a;
1428  p = consTorqueParams[consTorqueIndexes[atomnum]].p;
1429  }
int32 * consTorqueIndexes
Definition: Molecule.h:649
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:650

◆ get_crossterm()

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

Definition at line 1146 of file Molecule.h.

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

◆ get_crossterms_for_atom()

int32* Molecule::get_crossterms_for_atom ( int  anum)
inline

Definition at line 1221 of file Molecule.h.

1222  { return crosstermsByAtom[anum]; }

◆ get_cSMDcoffs()

const Real* Molecule::get_cSMDcoffs ( )
inline

Definition at line 921 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

921 {return cSMDcoffs;} ;

◆ get_cSMDindex()

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

Definition at line 917 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

917 {return cSMDindex;} ;

◆ get_cSMDindxLen()

int const* Molecule::get_cSMDindxLen ( )
inline

Definition at line 916 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

916 { return cSMDindxLen;} ;

◆ get_cSMDKs()

const Real* Molecule::get_cSMDKs ( )
inline

Definition at line 919 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

919 {return cSMDKs;} ;

◆ get_cSMDnumInst()

int Molecule::get_cSMDnumInst ( )
inline

Definition at line 915 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

915 { return cSMDnumInst;} ;

◆ get_cSMDpairs()

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

Definition at line 918 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

918 {return cSMDpairs;} ;

◆ get_cSMDVels()

const Real* Molecule::get_cSMDVels ( )
inline

Definition at line 920 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

920 {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 881 of file Molecule.h.

References dcd_params::dcdSelectionIndexReverse, and dcdSelectionParams.

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

881  {
882  return dcdSelectionParams[index].dcdSelectionIndexReverse[atomIndex];
883  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
std::vector< int32 > dcdSelectionIndexReverse
Definition: common.h:265

◆ get_dcd_selection_size()

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

Definition at line 886 of file Molecule.h.

References dcdSelectionParams, and dcd_params::size.

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

886  {
887  return dcdSelectionParams[index].size;
888  }
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
int size
Definition: common.h:266

◆ get_dihedral()

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

Definition at line 1143 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

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

◆ get_dihedrals_for_atom()

int32* Molecule::get_dihedrals_for_atom ( int  anum)
inline

Definition at line 1217 of file Molecule.h.

Referenced by atoms_1to4(), and dumpbench().

1218  { return dihedralsByAtom[anum]; }

◆ get_donor()

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

Definition at line 1171 of file Molecule.h.

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

◆ get_excl_check_for_atom()

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

Definition at line 1241 of file Molecule.h.

Referenced by dumpbench().

1241  {
1242  return &all_exclusions[anum];
1243  }

◆ get_exclusion()

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

Definition at line 1181 of file Molecule.h.

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

◆ get_exclusions_for_atom()

int32* Molecule::get_exclusions_for_atom ( int  anum)
inline

Definition at line 1223 of file Molecule.h.

1224  { return exclusionsByAtom[anum]; }

◆ get_fep_bonded_type()

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

Definition at line 1477 of file Molecule.h.

References NAMD_die(), order, and simParams.

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

1478  {
1479  int typeSum = 0;
1480  for ( int i=0; i < order; ++i ) {
1481  typeSum += (fepAtomFlags[atomID[i]] == 2 ? -1 : fepAtomFlags[atomID[i]]);
1482  }
1483  // Increase the cutoff if scaling purely alchemical bonds.
1484  // This really only applies when order = 2.
1485  if ( simParams->alchBondDecouple ) order++;
1486 
1487  // The majority of interactions are type 0, so catch those first.
1488  if ( typeSum == 0 || abs(typeSum) == order ) return 0;
1489  else if ( 0 < typeSum && typeSum < order ) return 1;
1490  else if ( -order < typeSum && typeSum < 0 ) return 2;
1491 
1492  // Alchemify should always keep this from bombing, but just in case...
1493  NAMD_die("Unexpected alchemical bonded interaction!");
1494  return 0;
1495  }
#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 1432 of file Molecule.h.

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

1433  {
1434  return(fepAtomFlags[anum]);
1435  }

◆ get_full_exclusions_for_atom()

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

Definition at line 1225 of file Molecule.h.

1226  { return fullExclusionsByAtom[anum]; }

◆ get_go_cutoff()

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

Definition at line 1652 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().

1652 { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
Real cutoff
Definition: Molecule.h:113

◆ get_go_epsilon()

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

Definition at line 1661 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().

1661 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
Real epsilon
Definition: Molecule.h:107

◆ get_go_epsilonRep()

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

Definition at line 1655 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().

1655 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };
Real epsilonRep
Definition: Molecule.h:112
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635

◆ get_go_exp_a()

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

Definition at line 1664 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().

1664 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };
#define MAX_GO_CHAINS
Definition: Molecule.h:34
int exp_a
Definition: Molecule.h:108
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635

◆ get_go_exp_b()

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

Definition at line 1667 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().

1667 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };
int exp_b
Definition: Molecule.h:109
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635

◆ get_go_exp_rep()

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

Definition at line 1670 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().

1670 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
int exp_rep
Definition: Molecule.h:110

◆ 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:1664
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1652
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1655
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
bool * goWithinCutoff
Definition: Molecule.h:681
Molecule stores the structural information for the system.
Definition: Molecule.h:175
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1661
int32 * atomChainTypes
Definition: Molecule.h:677
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1658
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1670
Real * goSigmas
Definition: Molecule.h:680
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1667
int32 * goSigmaIndices
Definition: Molecule.h:678
int numGoAtoms
Definition: Molecule.h:676
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:1664
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1652
int * pointerToGoBeg
Definition: Molecule.h:691
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1655
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
double * goSigmaPairA
Definition: Molecule.h:689
Molecule stores the structural information for the system.
Definition: Molecule.h:175
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1661
int32 * atomChainTypes
Definition: Molecule.h:677
int * pointerToGoEnd
Definition: Molecule.h:692
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1658
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1670
int32 * goResidIndices
Definition: Molecule.h:679
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
double * goSigmaPairB
Definition: Molecule.h:690
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1667
int * goIndxLJB
Definition: Molecule.h:688
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:1664
Real get_go_cutoff(int chain1, int chain2)
Definition: Molecule.h:1652
Real * goCoordinates
Definition: Molecule.h:682
Real get_go_epsilonRep(int chain1, int chain2)
Definition: Molecule.h:1655
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:175
Real get_go_epsilon(int chain1, int chain2)
Definition: Molecule.h:1661
int32 * atomChainTypes
Definition: Molecule.h:677
Real get_go_sigmaRep(int chain1, int chain2)
Definition: Molecule.h:1658
int get_go_exp_rep(int chain1, int chain2)
Definition: Molecule.h:1670
int * goResids
Definition: Molecule.h:683
Bool go_restricted(int, int, int)
Definition: GoMolecule.C:526
int get_go_exp_b(int chain1, int chain2)
Definition: Molecule.h:1667
int32 * goSigmaIndices
Definition: Molecule.h:678
double BigReal
Definition: common.h:123

◆ get_go_sigmaRep()

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

Definition at line 1658 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().

1658 { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
Real sigmaRep
Definition: Molecule.h:111

◆ get_gridfrc_grid()

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

Definition at line 1363 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().

1364  {
1365  GridforceGrid *result = NULL;
1366  if (gridnum >= 0 && gridnum < numGridforceGrids) {
1367  result = gridfrcGrid[gridnum];
1368  }
1369  return result;
1370  }
int numGridforceGrids
Definition: Molecule.h:624

◆ get_gridfrc_params()

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

Definition at line 1357 of file Molecule.h.

Referenced by ComputeGridForce::do_calc().

1358  {
1359  k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
1360  q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
1361  }

◆ 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:713
Real * giSigma2
Definition: Molecule.h:714
Real * pairC6
Definition: Molecule.h:701
int * pointerToLJEnd
Definition: Molecule.h:698
Real * gA
Definition: Molecule.h:710
int * indxLJB
Definition: Molecule.h:700
int * pointerToGaussBeg
Definition: Molecule.h:705
Real * gMu1
Definition: Molecule.h:711
int * pointerToLJBeg
Definition: Molecule.h:697
Real * gRepulsive
Definition: Molecule.h:715
int * indxGaussB
Definition: Molecule.h:709
int * pointerToGaussEnd
Definition: Molecule.h:706
Real * pairC12
Definition: Molecule.h:702
Real * giSigma1
Definition: Molecule.h:712
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 1140 of file Molecule.h.

Referenced by dumpbench().

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

◆ get_impropers_for_atom()

int32* Molecule::get_impropers_for_atom ( int  anum)
inline

Definition at line 1219 of file Molecule.h.

Referenced by dumpbench().

1220  { return impropersByAtom[anum]; }

◆ get_lphost()

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

Definition at line 1150 of file Molecule.h.

Referenced by ComputeLonepairsCUDA::updateAtoms().

1150  {
1151  // don't call unless simParams->drudeOn == TRUE
1152  // otherwise lphostIndexes array doesn't exist!
1153  int index = lphostIndexes[atomid];
1154  return (index != -1 ? &(lphosts[index]) : NULL);
1155  }

◆ get_mod_exclusions_for_atom()

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

Definition at line 1227 of file Molecule.h.

1228  { return modExclusionsByAtom[anum]; }

◆ get_mother_atom()

int Molecule::get_mother_atom ( int  )

◆ get_movdrag_params()

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

Definition at line 1408 of file Molecule.h.

Referenced by Sequencer::addMovDragToPosition().

1409  {
1410  v = movDragParams[movDragIndexes[atomnum]].v;
1411  }

◆ get_noPC()

Bool Molecule::get_noPC ( )
inline

Definition at line 903 of file Molecule.h.

Referenced by ComputeQM::initialize().

903 { 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 854 of file Molecule.h.

854 {return qmAtomGroup[indx]; } ;

◆ get_qmcSMD()

Bool Molecule::get_qmcSMD ( )
inline

Definition at line 914 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

914 { return qmcSMD;} ;

◆ get_qmCustomPCIdxs()

int* Molecule::get_qmCustomPCIdxs ( )
inline

Definition at line 912 of file Molecule.h.

Referenced by ComputeQM::initialize().

912 { return qmCustomPCIdxs; } ;

◆ get_qmCustPCSizes()

int* Molecule::get_qmCustPCSizes ( )
inline

Definition at line 911 of file Molecule.h.

Referenced by ComputeQM::initialize().

911 { return qmCustPCSizes; } ;

◆ get_qmDummyBondVal()

const BigReal* Molecule::get_qmDummyBondVal ( )
inline

Definition at line 868 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

868 { return qmDummyBondVal; } ;

◆ get_qmDummyElement()

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

Definition at line 873 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

873 { return qmDummyElement; } ;

◆ get_qmElements()

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

Definition at line 860 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

860 {return qmElementArray;} ;

◆ get_qmGrpBonds()

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

Definition at line 871 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

871 { return qmGrpBonds; } ;

◆ get_qmGrpChrg()

Real* Molecule::get_qmGrpChrg ( )
inline

Definition at line 864 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

864 {return qmGrpChrg; } ;

◆ get_qmGrpID()

Real* Molecule::get_qmGrpID ( )
inline

Definition at line 863 of file Molecule.h.

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

863 { return qmGrpID; } ;

◆ get_qmGrpMult()

Real* Molecule::get_qmGrpMult ( )
inline

Definition at line 865 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

865 {return qmGrpMult; } ;

◆ get_qmGrpNumBonds()

const int* Molecule::get_qmGrpNumBonds ( )
inline

Definition at line 869 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

869 { return qmGrpNumBonds; } ;

◆ get_qmGrpSizes()

const int* Molecule::get_qmGrpSizes ( )
inline

Definition at line 862 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

862 {return qmGrpSizes; } ;

◆ get_qmLSSFreq()

int Molecule::get_qmLSSFreq ( )
inline

Definition at line 894 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

894 { return qmLSSFreq; } ;

◆ get_qmLSSIdxs()

int* Molecule::get_qmLSSIdxs ( )
inline

Definition at line 892 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

892 { return qmLSSIdxs;} ;

◆ get_qmLSSMass()

Mass* Molecule::get_qmLSSMass ( )
inline

Definition at line 893 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

893 { return qmLSSMass; } ;

◆ get_qmLSSRefIDs()

int* Molecule::get_qmLSSRefIDs ( )
inline

Definition at line 896 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

896 { return qmLSSRefIDs ; } ;

◆ get_qmLSSRefMass()

Mass* Molecule::get_qmLSSRefMass ( )
inline

Definition at line 898 of file Molecule.h.

898 {return qmLSSRefMass; } ;

◆ get_qmLSSRefSize()

int* Molecule::get_qmLSSRefSize ( )
inline

Definition at line 897 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

897 { return qmLSSRefSize ; } ;

◆ get_qmLSSResSize()

int Molecule::get_qmLSSResSize ( )
inline

Definition at line 895 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

895 { return qmLSSResidueSize; } ;

◆ get_qmLSSSize()

int* Molecule::get_qmLSSSize ( )
inline

Definition at line 891 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

891 { return qmLSSSize;} ;

◆ get_qmMeMMindx()

int* Molecule::get_qmMeMMindx ( )
inline

Definition at line 905 of file Molecule.h.

Referenced by ComputeQM::initialize().

905 { return qmMeMMindx; } ;

◆ get_qmMeNumBonds()

int Molecule::get_qmMeNumBonds ( )
inline

Definition at line 904 of file Molecule.h.

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

904 { return qmMeNumBonds; } ;

◆ get_qmMeQMGrp()

Real* Molecule::get_qmMeQMGrp ( )
inline

Definition at line 906 of file Molecule.h.

Referenced by ComputeQM::initialize().

906 { return qmMeQMGrp; } ;

◆ get_qmMMBond()

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

Definition at line 870 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

870 { return qmMMBond; } ;

◆ get_qmMMBondedIndx()

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

Definition at line 872 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

872 { return qmMMBondedIndx; } ;

◆ get_qmMMChargeTarget()

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

Definition at line 875 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

875 { return qmMMChargeTarget; } ;

◆ get_qmMMNumTargs()

const int* Molecule::get_qmMMNumTargs ( )
inline

Definition at line 876 of file Molecule.h.

Referenced by ComputeQMMgr::recvPntChrg().

876 { return qmMMNumTargs; } ;

◆ get_qmMMSolv()

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

Definition at line 899 of file Molecule.h.

899 { return qmClassicSolv;} ;

◆ get_qmNumBonds()

int Molecule::get_qmNumBonds ( )
inline

Definition at line 867 of file Molecule.h.

867 { return qmNumBonds; } ;

◆ get_qmNumGrps()

int Molecule::get_qmNumGrps ( ) const
inline

Definition at line 861 of file Molecule.h.

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

861 {return qmNumGrps; } ;

◆ get_qmPCFreq()

int Molecule::get_qmPCFreq ( )
inline

Definition at line 908 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

908 { return qmPCFreq; } ;

◆ get_qmReplaceAll()

Bool Molecule::get_qmReplaceAll ( )
inline

Definition at line 901 of file Molecule.h.

Referenced by ComputeQMMgr::recvPartQM().

901 {return qmReplaceAll; } ;

◆ get_qmTotCustPCs()

int Molecule::get_qmTotCustPCs ( )
inline

Definition at line 910 of file Molecule.h.

Referenced by ComputeQM::initialize().

910 { 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 1414 of file Molecule.h.

Referenced by Sequencer::addRotDragToPosition().

1416  {
1417  v = rotDragParams[rotDragIndexes[atomnum]].v;
1418  a = rotDragParams[rotDragIndexes[atomnum]].a;
1419  p = rotDragParams[rotDragIndexes[atomnum]].p;
1420  }

◆ get_ss_type()

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

Definition at line 1443 of file Molecule.h.

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

1444  {
1445  return(ssAtomFlags[anum]);
1446  }

◆ get_stir_refPos()

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

Definition at line 1389 of file Molecule.h.

1390  {
1391  refPos = stirParams[stirIndexes[atomnum]].refPos;
1392  }

◆ get_stir_startTheta()

Real Molecule::get_stir_startTheta ( int  atomnum) const
inline

Definition at line 1401 of file Molecule.h.

Referenced by ComputeStir::doForce().

1402  {
1403  return stirParams[stirIndexes[atomnum]].startTheta;
1404  }

◆ getAllAcceptors()

Bond* Molecule::getAllAcceptors ( ) const
inline

Definition at line 1177 of file Molecule.h.

1177 {return acceptors;}

◆ getAllAngles()

Angle* Molecule::getAllAngles ( ) const
inline

Definition at line 1160 of file Molecule.h.

Referenced by buildAngleData().

1160 {return angles;}

◆ getAllBonds()

Bond* Molecule::getAllBonds ( ) const
inline

Definition at line 1159 of file Molecule.h.

Referenced by buildBondData().

1159 {return bonds;}

◆ getAllCrossterms()

Crossterm* Molecule::getAllCrossterms ( ) const
inline

Definition at line 1163 of file Molecule.h.

Referenced by buildCrosstermData().

1163 {return crossterms;}

◆ getAllDihedrals()

Dihedral* Molecule::getAllDihedrals ( ) const
inline

Definition at line 1162 of file Molecule.h.

Referenced by buildDihedralData().

1162 {return dihedrals;}

◆ getAllDonors()

Bond* Molecule::getAllDonors ( ) const
inline

Definition at line 1176 of file Molecule.h.

1176 {return donors;}

◆ getAllImpropers()

Improper* Molecule::getAllImpropers ( ) const
inline

Definition at line 1161 of file Molecule.h.

Referenced by buildImproperData().

1161 {return impropers;}

◆ getAllLphosts()

Lphost* Molecule::getAllLphosts ( ) const
inline

Definition at line 1167 of file Molecule.h.

1167 { return lphosts; }

◆ GetAtomAlpha()

BigReal Molecule::GetAtomAlpha ( int  i) const
inline

Definition at line 511 of file Molecule.h.

References drude_constants::alpha.

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

◆ getAtomNames()

AtomNameInfo* Molecule::getAtomNames ( ) const
inline

Definition at line 520 of file Molecule.h.

Referenced by buildAtomData().

520 { return atomNames; }

◆ getAtoms()

Atom* Molecule::getAtoms ( ) const
inline

Definition at line 519 of file Molecule.h.

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

519 { return atoms; }

◆ getAtomSegResInfo()

AtomSegResInfo* Molecule::getAtomSegResInfo ( ) const
inline

Definition at line 523 of file Molecule.h.

Referenced by buildAtomData().

523 { return atomSegResids; }

◆ getBFactorData()

const float* Molecule::getBFactorData ( )
inline

Definition at line 1101 of file Molecule.h.

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

1101 { return (const float *)bfactor; }

◆ getEnergyTailCorr()

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

◆ getFepAtomFlags()

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

Definition at line 1438 of file Molecule.h.

1438  {
1439  return fepAtomFlags;
1440  }

◆ getLcpoParamType()

int const* Molecule::getLcpoParamType ( )
inline

Definition at line 507 of file Molecule.h.

Referenced by HomePatch::setLcpoType().

507  {
508  return lcpoParamType;
509  }

◆ getOccupancyData()

const float* Molecule::getOccupancyData ( )
inline

Definition at line 1097 of file Molecule.h.

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

1097 { 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:35
#define FALSE
Definition: common.h:127
#define MAX_GO_CHAINS
Definition: Molecule.h:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
#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:684
Real * goCoordinates
Definition: Molecule.h:682
bool * goWithinCutoff
Definition: Molecule.h:681
int32 * atomChainTypes
Definition: Molecule.h:677
int * goResids
Definition: Molecule.h:683
Real * goSigmas
Definition: Molecule.h:680
BigReal energyNonnative
Definition: Molecule.h:719
BigReal energyNative
Definition: Molecule.h:718
int32 * goSigmaIndices
Definition: Molecule.h:678
int numGoAtoms
Definition: Molecule.h:676

◆ initialize()

void Molecule::initialize ( )

◆ is_atom_constorqued()

Bool Molecule::is_atom_constorqued ( int  atomnum) const
inline

Definition at line 1314 of file Molecule.h.

References consTorqueIndexes, FALSE, and numConsTorque.

1315  {
1316  if (numConsTorque)
1317  {
1318  // Check the index to see if it is constrained
1319  return(consTorqueIndexes[atomnum] != -1);
1320  }
1321  else
1322  {
1323  // No constraints at all, so just return FALSE
1324  return(FALSE);
1325  }
1326  }
#define FALSE
Definition: common.h:127
int32 * consTorqueIndexes
Definition: Molecule.h:649
int numConsTorque
Definition: Molecule.h:629

◆ is_atom_constrained()

Bool Molecule::is_atom_constrained ( int  atomnum) const
inline

Definition at line 1265 of file Molecule.h.

References FALSE, and numConstraints.

Referenced by ComputeRestraints::doForce().

1266  {
1267  if (numConstraints)
1268  {
1269  // Check the index to see if it is constrained
1270  return(consIndexes[atomnum] != -1);
1271  }
1272  else
1273  {
1274  // No constraints at all, so just return FALSE
1275  return(FALSE);
1276  }
1277  }
#define FALSE
Definition: common.h:127
int numConstraints
Definition: Molecule.h:622

◆ is_atom_dcd_selection()

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

Definition at line 1331 of file Molecule.h.

References FALSE.

1332  {
1333  if (dcdSelectionAtoms)
1334  {
1335  // Check the index to see if it is selected
1336  return(atoms[atomnum].flags.dcdSelection & tag);
1337  }
1338  else
1339  {
1340  // just return FALSE
1341  return(FALSE);
1342  }
1343  }
#define FALSE
Definition: common.h:127

◆ is_atom_exPressure()

Bool Molecule::is_atom_exPressure ( int  atomnum) const
inline

Definition at line 1539 of file Molecule.h.

References numExPressureAtoms.

Referenced by Sequencer::langevinPiston().

1540  {
1541  return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
1542  }
int numExPressureAtoms
Definition: Molecule.h:632

◆ is_atom_fixed()

Bool Molecule::is_atom_fixed ( int  atomnum) const
inline

Definition at line 1499 of file Molecule.h.

References numFixedAtoms.

Referenced by WorkDistrib::createAtomLists().

1500  {
1501  return (numFixedAtoms && fixedAtomFlags[atomnum]);
1502  }
int numFixedAtoms
Definition: Molecule.h:630

◆ is_atom_gridforced()

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

Definition at line 1249 of file Molecule.h.

References FALSE, and numGridforceGrids.

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

1250  {
1251  if (numGridforceGrids)
1252  {
1253  return(gridfrcIndexes[gridnum][atomnum] != -1);
1254  }
1255  else
1256  {
1257  return(FALSE);
1258  }
1259  }
#define FALSE
Definition: common.h:127
int numGridforceGrids
Definition: Molecule.h:624

◆ is_atom_movdragged()

Bool Molecule::is_atom_movdragged ( int  atomnum) const
inline

Definition at line 1282 of file Molecule.h.

References FALSE, and numMovDrag.

Referenced by Sequencer::addMovDragToPosition().

1283  {
1284  if (numMovDrag)
1285  {
1286  // Check the index to see if it is constrained
1287  return(movDragIndexes[atomnum] != -1);
1288  }
1289  else
1290  {
1291  // No constraints at all, so just return FALSE
1292  return(FALSE);
1293  }
1294  }
#define FALSE
Definition: common.h:127
int numMovDrag
Definition: Molecule.h:627

◆ is_atom_rotdragged()

Bool Molecule::is_atom_rotdragged ( int  atomnum) const
inline

Definition at line 1298 of file Molecule.h.

References FALSE, and numRotDrag.

Referenced by Sequencer::addRotDragToPosition().

1299  {
1300  if (numRotDrag)
1301  {
1302  // Check the index to see if it is constrained
1303  return(rotDragIndexes[atomnum] != -1);
1304  }
1305  else
1306  {
1307  // No constraints at all, so just return FALSE
1308  return(FALSE);
1309  }
1310  }
#define FALSE
Definition: common.h:127
int numRotDrag
Definition: Molecule.h:628

◆ is_atom_stirred()

Bool Molecule::is_atom_stirred ( int  atomnum) const
inline

Definition at line 1520 of file Molecule.h.

References FALSE, and numStirredAtoms.

Referenced by ComputeStir::doForce().

1521  {
1522  if (numStirredAtoms)
1523  {
1524  // Check the index to see if it is constrained
1525  return(stirIndexes[atomnum] != -1);
1526  }
1527  else
1528  {
1529  // No constraints at all, so just return FALSE
1530  return(FALSE);
1531  }
1532  }
#define FALSE
Definition: common.h:127
int numStirredAtoms
Definition: Molecule.h:631

◆ is_drude()

Bool Molecule::is_drude ( int  )

◆ is_group_fixed()

Bool Molecule::is_group_fixed ( int  atomnum) const
inline

Definition at line 1535 of file Molecule.h.

References numFixedAtoms.

1536  {
1537  return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
1538  }
int numFixedAtoms
Definition: Molecule.h:630

◆ 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 1383 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists().

1384  {
1385  return(langevinParams ? langevinParams[atomnum] : 0.);
1386  }

◆ num_deg_freedom()

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

Definition at line 552 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().

552  {
553  // local variables prefixed by s_
554  int64_t s_NumDegFreedom = 3 * (int64_t) numAtoms;
555  int64_t s_NumFixedAtoms = num_fixed_atoms();
556  if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
557  if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
558  if ( ! (s_NumFixedAtoms || numConstraints
559  || simParams->comMove || simParams->langevinOn) ) {
560  s_NumDegFreedom -= 3;
561  }
562  if ( ! isInitialReport && simParams->pairInteractionOn) {
563  //
564  // DJH: a kludge? We want to initially report system degrees of freedom
565  //
566  // this doesn't attempt to deal with fixed atoms or constraints
567  s_NumDegFreedom = 3 * numFepInitial;
568  }
569  int s_NumFixedRigidBonds =
570  (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
571  if (simParams->watmodel == WaterModel::TIP4) {
572  // numLonepairs is subtracted here because all lonepairs have a rigid bond
573  // to oxygen, but all of the LP degrees of freedom are dealt with above
574  s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
575  }
576  else {
577  // Non-polarized systems don't have LPs.
578  // For Drude model, bonds that attach LPs are not counted as rigid;
579  // LPs have already been subtracted from degrees of freedom.
580  s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds);
581  }
582  return s_NumDegFreedom;
583  }
Bool pairInteractionOn
WaterModel watmodel
int numLonepairs
Number of lone pairs.
Definition: Molecule.h:609
int numFixedRigidBonds
Definition: Molecule.h:639
int numFepInitial
Definition: Molecule.h:641
int num_fixed_atoms() const
Definition: Molecule.h:526
int numAtoms
Definition: Molecule.h:585
int numConstraints
Definition: Molecule.h:622
int numRigidBonds
Definition: Molecule.h:638

◆ num_fixed_atoms()

int Molecule::num_fixed_atoms ( ) const
inline

Definition at line 526 of file Molecule.h.

References numFixedAtoms, and simParams.

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

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

◆ num_fixed_groups()

int Molecule::num_fixed_groups ( ) const
inline

Definition at line 532 of file Molecule.h.

References num_fixed_atoms(), and numFixedGroups.

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

532  {
533  // local variables prefixed by s_
534  int s_NumFixedAtoms = num_fixed_atoms();
535  int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
536  return s_NumFixedGroups; // value is "turned on" SimParameters
537  }
int numFixedGroups
Definition: Molecule.h:637
int num_fixed_atoms() const
Definition: Molecule.h:526

◆ num_group_deg_freedom()

int64_t Molecule::num_group_deg_freedom ( ) const
inline

Definition at line 539 of file Molecule.h.

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

Referenced by Controller::receivePressure().

539  {
540  // local variables prefixed by s_
541  int64_t s_NumGroupDegFreedom = 3 * (int64_t) numHydrogenGroups;
542  int64_t s_NumFixedAtoms = num_fixed_atoms();
543  int s_NumFixedGroups = num_fixed_groups();
544  if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
545  if ( ! (s_NumFixedAtoms || numConstraints
546  || simParams->comMove || simParams->langevinOn) ) {
547  s_NumGroupDegFreedom -= 3;
548  }
549  return s_NumGroupDegFreedom;
550  }
int numHydrogenGroups
Definition: Molecule.h:633
int num_fixed_atoms() const
Definition: Molecule.h:526
int numConstraints
Definition: Molecule.h:622
int num_fixed_groups() const
Definition: Molecule.h:532

◆ 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:127
Definition: PDB.h:36
int size(void) const
Definition: ResizeArray.h:131
int numBonds
Definition: Molecule.h:588
#define QMSCHEMEZ2
Definition: Molecule.h:140
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:138
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:587
#define QMFormatMOPAC
Definition: Molecule.h:130
#define iout
Definition: InfoStream.h:51
int num_atoms(void)
Definition: PDB.C:323
#define QMFormatORCA
Definition: Molecule.h:129
#define QMSCHEMEZ3
Definition: Molecule.h:141
int32 atom1
Definition: structures.h:50
#define QMSCHEMEZ1
Definition: Molecule.h:139
#define QMSCHEMECS
Definition: Molecule.h:137
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:585
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:126
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 5475 of file Molecule.C.

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

Referenced by NamdState::loadStructure().

5476 {
5477 #ifdef MEM_OPT_VERSION
5478  DebugM(3, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5479 #else
5480  register int i;
5481  Real sigma;
5482  Real epsilon;
5483  Real sigma14;
5484  Real epsilon14;
5485 
5486  DebugM(3,"ATOM LIST\n" \
5487  << "******************************************\n" \
5488  << "NUM NAME TYPE RES MASS CHARGE CHARGE FEP-CHARGE" \
5489  << "SIGMA EPSILON SIGMA14 EPSILON14\n" \
5490  << endi);
5491 
5492  const int LJtypecount = params->get_num_vdw_params();
5493  for (i=0; i<numAtoms; i++)
5494  {
5495  const int vdw_type = simParams->soluteScalingOn ?
5496  ((atoms[i].vdw_type >= LJtypecount) ?
5497  ss_vdw_type[atoms[i].vdw_type-LJtypecount] : atoms[i].vdw_type) : atoms[i].vdw_type;
5498  params->get_vdw_params(&sigma, &epsilon, &sigma14, &epsilon14, vdw_type);
5499 
5500  DebugM(3,i+1 << " " << atomNames[i].atomname \
5501  << " " << atomNames[i].atomtype << " " \
5502  << atomNames[i].resname << " " << atoms[i].mass \
5503  << " " << atoms[i].charge << " " << sigma \
5504  << " " << epsilon << " " << sigma14 \
5505  << " " << epsilon14 << "\n" \
5506  << endi);
5507  }
5508 #endif
5509 }
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:585
int get_num_vdw_params(void)
Definition: Parameters.h:604
Index vdw_type
Definition: structures.h:39
int * ss_vdw_type
Definition: Molecule.h:485
void get_vdw_params(Real *sigma, Real *epsilon, Real *sigma14, Real *epsilon14, Index index)
Definition: Parameters.h:570

◆ print_bonds()

void Molecule::print_bonds ( Parameters params)

Definition at line 5521 of file Molecule.C.

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

Referenced by NamdState::loadStructure().

5522 {
5523 #ifdef MEM_OPT_VERSION
5524  DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5525 #else
5526  register int i;
5527  Real k;
5528  Real x0;
5529 
5530  DebugM(2,"BOND LIST\n" << "********************************\n" \
5531  << "ATOM1 ATOM2 TYPE1 TYPE2 k x0" \
5532  << endi);
5533 
5534  for (i=0; i<numBonds; i++)
5535  {
5536  params->get_bond_params(&k, &x0, bonds[i].bond_type);
5537 
5538  DebugM(2,bonds[i].atom1+1 << " " \
5539  << bonds[i].atom2+1 << " " \
5540  << atomNames[bonds[i].atom1].atomtype << " " \
5541  << atomNames[bonds[i].atom2].atomtype << " " << k \
5542  << " " << x0 << endi);
5543  }
5544 
5545 #endif
5546 }
int numBonds
Definition: Molecule.h:588
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:519

◆ print_exclusions()

void Molecule::print_exclusions ( )

Definition at line 5558 of file Molecule.C.

References DebugM, and endi().

Referenced by NamdState::loadStructure().

5559 {
5560 #ifdef MEM_OPT_VERSION
5561  DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
5562 #else
5563  register int i;
5564 
5565  DebugM(2,"EXPLICIT EXCLUSION LIST\n" \
5566  << "********************************\n" \
5567  << "ATOM1 ATOM2 " \
5568  << endi);
5569 
5570  for (i=0; i<numExclusions; i++)
5571  {
5572  DebugM(2,exclusions[i].atom1+1 << " " \
5573  << exclusions[i].atom2+1 << endi);
5574  }
5575 #endif
5576 }
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int numExclusions
Definition: Molecule.h:599

◆ 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:34
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
int NumGoChains
Definition: Molecule.h:1637

◆ 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:680
int numAtoms
Definition: Molecule.h:585
int32 * goSigmaIndices
Definition: Molecule.h:678
int numGoAtoms
Definition: Molecule.h:676

◆ put_stir_startTheta()

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

Definition at line 1395 of file Molecule.h.

1396  {
1397  stirParams[stirIndexes[atomnum]].startTheta = theta;
1398  }

◆ read_alch_unpert_angles()

void Molecule::read_alch_unpert_angles ( FILE *  fd)

Definition at line 1817 of file Molecule.C.

References NAMD_die(), and NAMD_read_int().

1817  {
1818  int atom_nums[3]; // Atom numbers for the three atoms
1819  register int j; // Loop counter
1820  int num_read=0; // Number of angles read so far
1821 
1823 
1824  if (alch_unpert_angles == NULL) {
1825  NAMD_die("memory allocation failed in Molecule::read_alch_unpert_angles");
1826  }
1827 
1828  while (num_read < num_alch_unpert_Angles) {
1829  for (j=0; j<3; j++) {
1830  atom_nums[j]=NAMD_read_int(fd, "ANGLES")-1;
1831 
1832  if (atom_nums[j] >= numAtoms) {
1833  char err_msg[128];
1834  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);
1835  NAMD_die(err_msg);
1836  }
1837  }
1838 
1839  alch_unpert_angles[num_read].atom1=atom_nums[0];
1840  alch_unpert_angles[num_read].atom2=atom_nums[1];
1841  alch_unpert_angles[num_read].atom3=atom_nums[2];
1842 
1843  ++num_read;
1844  }
1845  return;
1846 }
Angle * alch_unpert_angles
Definition: Molecule.h:605
int num_alch_unpert_Angles
Definition: Molecule.h:602
int32 atom2
Definition: structures.h:58
int32 atom1
Definition: structures.h:57
int32 atom3
Definition: structures.h:59
int numAtoms
Definition: Molecule.h:585
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 1694 of file Molecule.C.

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

1694  {
1695  int atom_nums[2]; // Atom indexes for the bonded atoms
1696  register int j; // Loop counter
1697  int num_read=0; // Number of bonds read so far
1698 
1700 
1701  if (alch_unpert_bonds == NULL) {
1702  NAMD_die("memory allocations failed in Molecule::read_alch_unpert_bonds");
1703  }
1704 
1705  while (num_read < num_alch_unpert_Bonds) {
1706  for (j=0; j<2; j++) {
1707  atom_nums[j]=NAMD_read_int(fd, "BONDS")-1;
1708 
1709  if (atom_nums[j] >= numAtoms) {
1710  char err_msg[128];
1711 
1712  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);
1713  NAMD_die(err_msg);
1714  }
1715  }
1716 
1717  Bond *b = &(alch_unpert_bonds[num_read]);
1718  b->atom1=atom_nums[0];
1719  b->atom2=atom_nums[1];
1720 
1721  ++num_read;
1722  }
1723  return;
1724 }
int num_alch_unpert_Bonds
Definition: Molecule.h:601
int32 atom1
Definition: structures.h:50
Bond * alch_unpert_bonds
Definition: Molecule.h:604
int numAtoms
Definition: Molecule.h:585
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 1965 of file Molecule.C.

References NAMD_die(), and NAMD_read_int().

1965  {
1966  int atom_nums[4]; // The 4 atom indexes
1967  int num_read=0; // number of dihedrals read so far
1968  register int j; // loop counter
1969 
1971 
1972  if (alch_unpert_dihedrals == NULL) {
1973  NAMD_die("memory allocation failed in Molecule::read_alch_unpert_dihedrals");
1974  }
1975 
1976  while (num_read < num_alch_unpert_Dihedrals) {
1977  for (j=0; j<4; j++) {
1978  atom_nums[j]=NAMD_read_int(fd, "DIHEDRALS")-1;
1979 
1980  if (atom_nums[j] >= numAtoms) {
1981  char err_msg[128];
1982 
1983  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);
1984  NAMD_die(err_msg);
1985  }
1986  }
1987 
1988  alch_unpert_dihedrals[num_read].atom1=atom_nums[0];
1989  alch_unpert_dihedrals[num_read].atom2=atom_nums[1];
1990  alch_unpert_dihedrals[num_read].atom3=atom_nums[2];
1991  alch_unpert_dihedrals[num_read].atom4=atom_nums[3];
1992 
1993  num_read++;
1994  }
1995  return;
1996 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:603
int32 atom3
Definition: structures.h:67
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:606
int32 atom4
Definition: structures.h:68
int numAtoms
Definition: Molecule.h:585
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:109
int NAMD_read_line(FILE *fd, char *buf, int bufsize)
Definition: strlib.C:38
Real epsilonRep
Definition: Molecule.h:112
#define MAX_RESTRICTIONS
Definition: Molecule.h:35
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:34
int exp_a
Definition: Molecule.h:108
int NAMD_blank_string(char *str)
Definition: strlib.C:222
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
int Bool
Definition: common.h:142
Real cutoff
Definition: Molecule.h:113
Real sigmaRep
Definition: Molecule.h:111
void NAMD_die(const char *err_msg)
Definition: common.C:147
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1636
int NumGoChains
Definition: Molecule.h:1637
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:114
Real epsilon
Definition: Molecule.h:107
#define TRUE
Definition: common.h:128
int exp_rep
Definition: Molecule.h:110

◆ 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:109
int * pointerToGoBeg
Definition: Molecule.h:691
Real epsilonRep
Definition: Molecule.h:112
Real * goCoordinates
Definition: Molecule.h:682
#define MAX_RESTRICTIONS
Definition: Molecule.h:35
float Real
Definition: common.h:118
int32_t int32
Definition: common.h:38
double * goSigmaPairA
Definition: Molecule.h:689
MIStream * get(char &data)
Definition: MStream.h:29
bool * goWithinCutoff
Definition: Molecule.h:681
#define MAX_GO_CHAINS
Definition: Molecule.h:34
int exp_a
Definition: Molecule.h:108
int32 * atomChainTypes
Definition: Molecule.h:677
int * pointerToGoEnd
Definition: Molecule.h:692
int * goIndxLJA
Definition: Molecule.h:687
int goNumLJPair
Definition: Molecule.h:686
int32 * goResidIndices
Definition: Molecule.h:679
GoChoices goMethod
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
int * goResids
Definition: Molecule.h:683
Real * goSigmas
Definition: Molecule.h:680
Real cutoff
Definition: Molecule.h:113
int numAtoms
Definition: Molecule.h:585
Real sigmaRep
Definition: Molecule.h:111
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:690
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1636
int NumGoChains
Definition: Molecule.h:1637
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:114
Real epsilon
Definition: Molecule.h:107
int32 * goSigmaIndices
Definition: Molecule.h:678
int * goIndxLJB
Definition: Molecule.h:688
int exp_rep
Definition: Molecule.h:110
int numGoAtoms
Definition: Molecule.h:676

◆ receive_Molecule()

void Molecule::receive_Molecule ( MIStream msg)

Definition at line 5955 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().

5955  {
5956  // Get the atom information
5957  msg->get(numAtoms);
5958 
5959 #ifdef MEM_OPT_VERSION
5960 //in the memory optimized version, only the atom signatures are recved
5961 //from the master Node. --Chao Mei
5962 
5963  msg->get(massPoolSize);
5964  if(atomMassPool) delete [] atomMassPool;
5965  atomMassPool = new Real[massPoolSize];
5966  msg->get(massPoolSize, atomMassPool);
5967 
5968  msg->get(chargePoolSize);
5969  if(atomChargePool) delete [] atomChargePool;
5970  atomChargePool = new Real[chargePoolSize];
5971  msg->get(chargePoolSize, atomChargePool);
5972 
5973  //get atoms' signatures
5974  msg->get(atomSigPoolSize);
5975  if(atomSigPool) delete [] atomSigPool;
5976  atomSigPool = new AtomSignature[atomSigPoolSize];
5977  for(int i=0; i<atomSigPoolSize; i++)
5978  atomSigPool[i].unpack(msg);
5979 
5980  //get exclusions' signatures
5981  msg->get(exclSigPoolSize);
5982  if(exclSigPool) delete [] exclSigPool;
5983  exclSigPool = new ExclusionSignature[exclSigPoolSize];
5984  for(int i=0; i<exclSigPoolSize; i++)
5985  exclSigPool[i].unpack(msg);
5986 
5987  msg->get(numHydrogenGroups);
5988  msg->get(maxHydrogenGroupSize);
5989  msg->get(numMigrationGroups);
5990  msg->get(maxMigrationGroupSize);
5991  msg->get(isOccupancyValid);
5992  msg->get(isBFactorValid);
5993 
5994  //get names for atoms
5995  msg->get(atomNamePoolSize);
5996  atomNamePool = new char *[atomNamePoolSize];
5997  for(int i=0; i<atomNamePoolSize;i++) {
5998  int len;
5999  msg->get(len);
6000  atomNamePool[i] = nameArena->getNewArray(len+1);
6001  msg->get(len, atomNamePool[i]);
6002  }
6003 
6004  if(simParams->fixedAtomsOn){
6005  int numFixedAtomsSet;
6006  msg->get(numFixedAtoms);
6007  msg->get(numFixedAtomsSet);
6008  fixedAtomsSet = new AtomSetList(numFixedAtomsSet);
6009  msg->get(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
6010  }
6011 
6012  if(simParams->constraintsOn){
6013  int numConstrainedAtomsSet;
6014  msg->get(numConstraints);
6015  msg->get(numConstrainedAtomsSet);
6016  constrainedAtomsSet = new AtomSetList(numConstrainedAtomsSet);
6017  msg->get(numConstrainedAtomsSet*sizeof(AtomSet), (char *)(constrainedAtomsSet->begin()));
6018  }
6019 
6020 #else
6021  delete [] atoms;
6022  atoms= new Atom[numAtoms];
6023  msg->get(numAtoms*sizeof(Atom), (char*)atoms);
6024 
6025  // Get the bond information
6026  msg->get(numRealBonds);
6027  msg->get(numBonds);
6028  if (numBonds)
6029  {
6030  delete [] bonds;
6031  bonds=new Bond[numBonds];
6032  msg->get(numBonds*sizeof(Bond), (char*)bonds);
6033  }
6034 
6035  // Get the angle information
6036  msg->get(numAngles);
6037  if (numAngles)
6038  {
6039  delete [] angles;
6040  angles=new Angle[numAngles];
6041  msg->get(numAngles*sizeof(Angle), (char*)angles);
6042  }
6043 
6044  // Get the dihedral information
6045  msg->get(numDihedrals);
6046  if (numDihedrals)
6047  {
6048  delete [] dihedrals;
6049  dihedrals=new Dihedral[numDihedrals];
6050  msg->get(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
6051  }
6052 
6053  if (simParams->sdScaling) {
6054  msg->get(num_alch_unpert_Bonds);
6056  msg->get(num_alch_unpert_Bonds*sizeof(Bond), (char*)alch_unpert_bonds);
6057 
6060  msg->get(num_alch_unpert_Angles*sizeof(Angle), (char*)alch_unpert_angles);
6061 
6065  }
6066 
6067  // Get the improper information
6068  msg->get(numImpropers);
6069  if (numImpropers)
6070  {
6071  delete [] impropers;
6072  impropers=new Improper[numImpropers];
6073  msg->get(numImpropers*sizeof(Improper), (char*)impropers);
6074  }
6075 
6076  // Get the crossterm information
6077  msg->get(numCrossterms);
6078  if (numCrossterms)
6079  {
6080  delete [] crossterms;
6081  crossterms=new Crossterm[numCrossterms];
6082  msg->get(numCrossterms*sizeof(Crossterm), (char*)crossterms);
6083  }
6084 
6085  // Get the hydrogen bond donors
6086  msg->get(numDonors);
6087  if (numDonors)
6088  {
6089  delete [] donors;
6090  donors=new Bond[numDonors];
6091  msg->get(numDonors*sizeof(Bond), (char*)donors);
6092  }
6093 
6094  // Get the hydrogen bond acceptors
6095  msg->get(numAcceptors);
6096  if (numAcceptors)
6097  {
6098  delete [] acceptors;
6099  acceptors=new Bond[numAcceptors];
6100  msg->get(numAcceptors*sizeof(Bond), (char*)acceptors);
6101  }
6102 
6103  // Get the exclusion information
6104  msg->get(numExclusions);
6105  if (numExclusions)
6106  {
6107  delete [] exclusions;
6108  exclusions=new Exclusion[numExclusions];
6109  msg->get(numExclusions*sizeof(Exclusion), (char*)exclusions);
6110  }
6111 
6112  // Get the constraint information, if they are active
6113  if (simParams->constraintsOn)
6114  {
6115  msg->get(numConstraints);
6116 
6117  delete [] consIndexes;
6118  consIndexes = new int32[numAtoms];
6119 
6120  msg->get(numAtoms, consIndexes);
6121 
6122  if (numConstraints)
6123  {
6124  delete [] consParams;
6125  consParams = new ConstraintParams[numConstraints];
6126 
6127  msg->get(numConstraints*sizeof(ConstraintParams), (char*)consParams);
6128  }
6129  }
6130 #endif
6131 
6132  /* BEGIN gf */
6133  if (simParams->mgridforceOn)
6134  {
6135  DebugM(3, "Receiving gridforce info\n");
6136 
6137  msg->get(numGridforceGrids);
6138 
6139  DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
6140 
6141  delete [] numGridforces;
6142  numGridforces = new int[numGridforceGrids];
6143 
6144  delete [] gridfrcIndexes; // Should I be deleting elements of these first?
6145  delete [] gridfrcParams;
6146  delete [] gridfrcGrid;
6147  gridfrcIndexes = new int32*[numGridforceGrids];
6148  gridfrcParams = new GridforceParams*[numGridforceGrids];
6149  gridfrcGrid = new GridforceGrid*[numGridforceGrids];
6150 
6151  int grandTotalGrids = 0;
6152  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
6153  msg->get(numGridforces[gridnum]);
6154 
6155  gridfrcIndexes[gridnum] = new int32[numAtoms];
6156  msg->get(numAtoms, gridfrcIndexes[gridnum]);
6157 
6158  if (numGridforces[gridnum])
6159  {
6160  gridfrcParams[gridnum] = new GridforceParams[numGridforces[gridnum]];
6161  msg->get(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
6162  }
6163 
6164  gridfrcGrid[gridnum] = GridforceGrid::unpack_grid(gridnum, msg);
6165 
6166  grandTotalGrids++;
6167  }
6168  }
6169  /* END gf */
6170 
6171  // Get the stirring information, if stirring is active
6172  if (simParams->stirOn)
6173  {
6174  msg->get(numStirredAtoms);
6175 
6176  delete [] stirIndexes;
6177  stirIndexes = new int32[numAtoms];
6178 
6179  msg->get(numAtoms, stirIndexes);
6180 
6181  if (numStirredAtoms)
6182  {
6183  delete [] stirParams;
6184  stirParams = new StirParams[numStirredAtoms];
6185 
6186  msg->get(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
6187  }
6188  }
6189 
6190  // Get the moving drag information, if it is active
6191  if (simParams->movDragOn) {
6192  msg->get(numMovDrag);
6193  delete [] movDragIndexes;
6194  movDragIndexes = new int32[numAtoms];
6195  msg->get(numAtoms, movDragIndexes);
6196  if (numMovDrag)
6197  {
6198  delete [] movDragParams;
6199  movDragParams = new MovDragParams[numMovDrag];
6200  msg->get(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
6201  }
6202  }
6203 
6204  // Get the rotating drag information, if it is active
6205  if (simParams->rotDragOn) {
6206  msg->get(numRotDrag);
6207  delete [] rotDragIndexes;
6208  rotDragIndexes = new int32[numAtoms];
6209  msg->get(numAtoms, rotDragIndexes);
6210  if (numRotDrag)
6211  {
6212  delete [] rotDragParams;
6213  rotDragParams = new RotDragParams[numRotDrag];
6214  msg->get(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
6215  }
6216  }
6217 
6218  // Get the "constant" torque information, if it is active
6219  if (simParams->consTorqueOn) {
6220  msg->get(numConsTorque);
6221  delete [] consTorqueIndexes;
6224  if (numConsTorque)
6225  {
6226  delete [] consTorqueParams;
6227  consTorqueParams = new ConsTorqueParams[numConsTorque];
6228  msg->get(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
6229  }
6230  }
6231 
6232  // Get the constant force information, if it's active
6233  if (simParams->consForceOn)
6234  { msg->get(numConsForce);
6235  delete [] consForceIndexes;
6237  msg->get(numAtoms, consForceIndexes);
6238  if (numConsForce)
6239  { delete [] consForce;
6240  consForce = new Vector[numConsForce];
6241  msg->get(numConsForce*sizeof(Vector), (char*)consForce);
6242  }
6243  }
6244 
6245  // Get molecule information for MC barostat
6246  if (simParams->monteCarloPressureOn) {
6247  msg->get(numMolecules);
6248  msg->get(numLargeMolecules);
6249  delete [] moleculeAtom;
6250  delete [] moleculeStartIndex;
6251  moleculeAtom = new int32[numAtoms];
6253  msg->get(numAtoms, moleculeAtom);
6255  }
6256 
6257  if (simParams->excludeFromPressure) {
6258  exPressureAtomFlags = new int32[numAtoms];
6259  msg->get(numExPressureAtoms);
6260  msg->get(numAtoms, exPressureAtomFlags);
6261  }
6262 
6263 #ifndef MEM_OPT_VERSION
6264  // Get the langevin parameters, if they are active
6265  if (simParams->langevinOn || simParams->tCoupleOn)
6266  {
6267  delete [] langevinParams;
6268  langevinParams = new Real[numAtoms];
6269 
6270  msg->get(numAtoms, langevinParams);
6271  }
6272 
6273  // Get the fixed atoms, if they are active
6274  if (simParams->fixedAtomsOn)
6275  {
6276  delete [] fixedAtomFlags;
6277  fixedAtomFlags = new int32[numAtoms];
6278 
6279  msg->get(numFixedAtoms);
6280  msg->get(numAtoms, fixedAtomFlags);
6281  msg->get(numFixedRigidBonds);
6282  }
6283 
6284  if (simParams->qmForcesOn)
6285  {
6286  if( qmAtomGroup != 0)
6287  delete [] qmAtomGroup;
6288  qmAtomGroup = new Real[numAtoms];
6289 
6290  msg->get(numAtoms, qmAtomGroup);
6291 
6292  msg->get(qmNumQMAtoms);
6293 
6294  if( qmAtmChrg != 0)
6295  delete [] qmAtmChrg;
6296  qmAtmChrg = new Real[qmNumQMAtoms];
6297 
6298  msg->get(qmNumQMAtoms, qmAtmChrg);
6299 
6300  if( qmAtmIndx != 0)
6301  delete [] qmAtmIndx;
6302  qmAtmIndx = new int[qmNumQMAtoms];
6303 
6304  msg->get(qmNumQMAtoms, qmAtmIndx);
6305 
6306  msg->get(qmNoPC);
6307 
6308  msg->get(qmNumBonds);
6309 
6310  msg->get(qmMeNumBonds);
6311 
6312  if( qmMeMMindx != 0)
6313  delete [] qmMeMMindx;
6314  qmMeMMindx = new int[qmMeNumBonds];
6315 
6316  msg->get(qmMeNumBonds, qmMeMMindx);
6317 
6318  if( qmMeQMGrp != 0)
6319  delete [] qmMeQMGrp;
6320  qmMeQMGrp = new Real[qmMeNumBonds];
6321 
6322  msg->get(qmMeNumBonds, qmMeQMGrp);
6323 
6324  msg->get(qmPCFreq);
6325 
6326  msg->get(qmNumGrps);
6327 
6328  if( qmGrpID != 0)
6329  delete [] qmGrpID;
6330  qmGrpID = new Real[qmNumGrps];
6331  msg->get(qmNumGrps, qmGrpID);
6332 
6333  if( qmCustPCSizes != 0)
6334  delete [] qmCustPCSizes;
6335  qmCustPCSizes = new int[qmNumGrps];
6336  msg->get(qmNumGrps, qmCustPCSizes);
6337 
6338  msg->get(qmTotCustPCs);
6339 
6340  if( qmCustomPCIdxs != 0)
6341  delete [] qmCustomPCIdxs;
6342  qmCustomPCIdxs = new int[qmTotCustPCs];
6343  msg->get(qmTotCustPCs, qmCustomPCIdxs);
6344  }
6345 
6346 //fepb
6347  //receive fep atom info
6348  if (simParams->alchOn || simParams->lesOn || simParams->pairInteractionOn) {
6349  delete [] fepAtomFlags;
6350  fepAtomFlags = new unsigned char[numAtoms];
6351 
6352  msg->get(numFepInitial);
6353  msg->get(numFepFinal);
6354  msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
6355  }
6356 //fepe
6357 
6358 //soluteScaling
6359  if (simParams->soluteScalingOn) {
6360  delete [] ssAtomFlags;
6361  delete [] ss_vdw_type;
6362  delete [] ss_index;
6363  ssAtomFlags = new unsigned char[numAtoms];
6364  ss_vdw_type = new int [params->get_num_vdw_params()];
6365  ss_index = new int [numAtoms];
6366  msg->get(numAtoms*sizeof(unsigned char), (char*)ssAtomFlags);
6367  msg->get(ss_num_vdw_params);
6368  msg->get(params->get_num_vdw_params()*sizeof(int), (char*)ss_vdw_type);
6369  msg->get(numAtoms*sizeof(int), (char*)ss_index);
6370  }
6371 //soluteScaling
6372 #ifdef OPENATOM_VERSION
6373  // This needs to be refactored into its own version
6374  if (simParams->openatomOn) {
6375  delete [] fepAtomFlags;
6376  fepAtomFlags = new unsigned char[numAtoms];
6377 
6378  msg->get(numFepInitial);
6379  msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
6380 #endif //OPENATOM_VERSION
6381 
6382  // DRUDE: receive data read from PSF
6383  msg->get(is_lonepairs_psf);
6384  if (is_lonepairs_psf) {
6385  msg->get(numLphosts);
6386  delete[] lphosts;
6387  lphosts = new Lphost[numLphosts];
6388  msg->get(numLphosts*sizeof(Lphost), (char*)lphosts);
6389  }
6390  msg->get(is_drude_psf);
6391  if (is_drude_psf) {
6392  delete[] drudeConsts;
6393  drudeConsts = new DrudeConst[numAtoms];
6394  msg->get(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
6395  msg->get(numTholes);
6396  delete[] tholes;
6397  tholes = new Thole[numTholes];
6398  msg->get(numTholes*sizeof(Thole), (char*)tholes);
6399  msg->get(numAnisos);
6400  delete[] anisos;
6401  anisos = new Aniso[numAnisos];
6402  msg->get(numAnisos*sizeof(Aniso), (char*)anisos);
6403  }
6404  msg->get(numZeroMassAtoms);
6405  // DRUDE
6406 
6407  //LCPO
6408  if (simParams->LCPOOn) {
6409  delete [] lcpoParamType;
6410  lcpoParamType = new int[numAtoms];
6411  msg->get(numAtoms, (int*)lcpoParamType);
6412  }
6413 
6414  //Receive GromacsPairStuff -- JLai
6415 
6416  if (simParams->goGroPair) {
6417  msg->get(numLJPair);
6418  delete [] indxLJA;
6419  indxLJA = new int[numLJPair];
6420  msg->get(numLJPair,indxLJA);
6421  delete [] indxLJB;
6422  indxLJB = new int[numLJPair];
6423  msg->get(numLJPair,indxLJB);
6424  delete [] pairC6;
6425  pairC6 = new Real[numLJPair];
6426  msg->get(numLJPair,pairC6);
6427  delete [] pairC12;
6428  pairC12 = new Real[numLJPair];
6429  msg->get(numLJPair,pairC12);
6430  delete [] gromacsPair_type;
6431  gromacsPair_type = new int[numLJPair];
6433  delete [] pointerToLJBeg;
6434  pointerToLJBeg = new int[numAtoms];
6435  msg->get((numAtoms),pointerToLJBeg);
6436  delete [] pointerToLJEnd;
6437  pointerToLJEnd = new int[numAtoms];
6438  msg->get((numAtoms),pointerToLJEnd);
6439  // JLai
6440  delete [] gromacsPair;
6442  for(int i=0; i < numLJPair; i++) {
6443  gromacsPair[i].atom1 = indxLJA[i];
6444  gromacsPair[i].atom2 = indxLJB[i];
6445  gromacsPair[i].pairC6 = pairC6[i];
6446  gromacsPair[i].pairC12 = pairC12[i];
6448  }
6449  //
6450  msg->get(numGaussPair);
6451  delete [] indxGaussA;
6452  indxGaussA = new int[numGaussPair];
6453  msg->get(numGaussPair,indxGaussA);
6454  delete [] indxGaussB;
6455  indxGaussB = new int[numGaussPair];
6456  msg->get(numGaussPair,indxGaussB);
6457  delete [] gA;
6458  gA = new Real[numGaussPair];
6459  msg->get(numGaussPair,gA);
6460  delete [] gMu1;
6461  gMu1 = new Real[numGaussPair];
6462  msg->get(numGaussPair,gMu1);
6463  delete [] giSigma1;
6464  giSigma1 = new Real[numGaussPair];
6465  msg->get(numGaussPair,giSigma1);
6466  delete [] gMu2;
6467  gMu2 = new Real[numGaussPair];
6468  msg->get(numGaussPair,gMu2);
6469  delete [] giSigma2;
6470  giSigma2 = new Real[numGaussPair];
6471  msg->get(numGaussPair,giSigma2);
6472  delete [] gRepulsive;
6473  gRepulsive = new Real[numGaussPair];
6474  msg->get(numGaussPair,gRepulsive);
6475  delete [] pointerToGaussBeg;
6476  pointerToGaussBeg = new int[numAtoms];
6477  msg->get((numAtoms),pointerToGaussBeg);
6478  delete [] pointerToGaussEnd;
6479  pointerToGaussEnd = new int[numAtoms];
6480  msg->get((numAtoms),pointerToGaussEnd);
6481  //
6482  }
6483 #endif
6484 
6485  // Now free the message
6486  delete msg;
6487 
6488 #ifdef MEM_OPT_VERSION
6489 
6490  build_excl_check_signatures();
6491 
6492  //set num{Calc}Tuples(Bonds,...,Impropers) to 0
6493  numBonds = numCalcBonds = 0;
6494  numAngles = numCalcAngles = 0;
6499  // JLai
6500  numLJPair = numCalcLJPair = 0;
6501  // End of JLai
6502 
6503 #else
6504 
6505  // analyze the data and find the status of each atom
6506  build_atom_status();
6507  build_lists_by_atom();
6508 
6509 
6510 #endif
6511 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:603
int * indxGaussA
Definition: Molecule.h:708
Type * getNewArray(int n)
Definition: ObjectArena.h:49
int numCalcBonds
Definition: Molecule.h:655
Real * gMu2
Definition: Molecule.h:713
int numBonds
Definition: Molecule.h:588
int numCalcLJPair
Definition: Molecule.h:696
Bool monteCarloPressureOn
Real * giSigma2
Definition: Molecule.h:714
int numHydrogenGroups
Definition: Molecule.h:633
int numAnisos
Number of anisotropic terms.
Definition: Molecule.h:612
Angle * alch_unpert_angles
Definition: Molecule.h:605
Definition: Vector.h:72
Real * pairC6
Definition: Molecule.h:701
Real pairC6
Definition: structures.h:99
Bool excludeFromPressure
int num_alch_unpert_Bonds
Definition: Molecule.h:601
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:620
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:698
int numGridforceGrids
Definition: Molecule.h:624
int numRealBonds
Definition: Molecule.h:587
MIStream * get(char &data)
Definition: MStream.h:29
int num_alch_unpert_Angles
Definition: Molecule.h:602
int numMovDrag
Definition: Molecule.h:627
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:606
Real * gA
Definition: Molecule.h:710
Bool pairInteractionOn
Real pairC12
Definition: structures.h:98
int * indxLJB
Definition: Molecule.h:700
int numFepFinal
Definition: Molecule.h:642
int * pointerToGaussBeg
Definition: Molecule.h:705
int numGaussPair
Definition: Molecule.h:707
int32 atom2
Definition: structures.h:97
int numCalcCrossterms
Definition: Molecule.h:659
int isOccupancyValid
Definition: Molecule.h:1557
int32 * consTorqueIndexes
Definition: Molecule.h:649
int64 numTotalExclusions
Definition: Molecule.h:600
Real * gMu1
Definition: Molecule.h:711
int * pointerToLJBeg
Definition: Molecule.h:697
Real * gRepulsive
Definition: Molecule.h:715
int * indxGaussB
Definition: Molecule.h:709
int64 numCalcFullExclusions
Definition: Molecule.h:661
int is_drude_psf
Definition: Molecule.h:489
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:618
int numFixedRigidBonds
Definition: Molecule.h:639
int numFepInitial
Definition: Molecule.h:641
int numMolecules
Number of molecules.
Definition: Molecule.h:617
int * pointerToGaussEnd
Definition: Molecule.h:706
int numAcceptors
Definition: Molecule.h:598
int numTholes
Number of Thole terms.
Definition: Molecule.h:611
int numCalcDihedrals
Definition: Molecule.h:657
int numExPressureAtoms
Definition: Molecule.h:632
Bond * alch_unpert_bonds
Definition: Molecule.h:604
int numFixedAtoms
Definition: Molecule.h:630
int numCalcImpropers
Definition: Molecule.h:658
int numAngles
Definition: Molecule.h:589
Real * pairC12
Definition: Molecule.h:702
int numAtoms
Definition: Molecule.h:585
int * gromacsPair_type
Definition: Molecule.h:703
int numStirredAtoms
Definition: Molecule.h:631
int numCrossterms
Definition: Molecule.h:596
int numConsForce
Definition: Molecule.h:645
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:650
int get_num_vdw_params(void)
Definition: Parameters.h:604
int * ss_index
Definition: Molecule.h:486
int maxMigrationGroupSize
Definition: Molecule.h:636
int numDihedrals
Definition: Molecule.h:590
int numImpropers
Definition: Molecule.h:595
int numConsTorque
Definition: Molecule.h:629
int numConstraints
Definition: Molecule.h:622
int64 numCalcExclusions
Definition: Molecule.h:660
int32 * consForceIndexes
Definition: Molecule.h:646
static GridforceGrid * unpack_grid(int gridnum, MIStream *msg)
Definition: GridForceGrid.C:60
int maxHydrogenGroupSize
Definition: Molecule.h:634
int numMigrationGroups
Definition: Molecule.h:635
Real * giSigma1
Definition: Molecule.h:712
int numZeroMassAtoms
Number of atoms with zero mass.
Definition: Molecule.h:614
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:619
Vector * consForce
Definition: Molecule.h:647
int * indxLJA
Definition: Molecule.h:699
int * ss_vdw_type
Definition: Molecule.h:485
int * numGridforces
Definition: Molecule.h:625
Index gromacsPair_type
Definition: structures.h:100
int is_lonepairs_psf
Definition: Molecule.h:490
int numLphosts
Number of lone pair host records in PSF.
Definition: Molecule.h:613
int numDonors
Definition: Molecule.h:597
int isBFactorValid
Definition: Molecule.h:1557
int numCalcAngles
Definition: Molecule.h:656
int ss_num_vdw_params
Definition: Molecule.h:484
int numRotDrag
Definition: Molecule.h:628
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313
int32 atom1
Definition: structures.h:96
int numLJPair
Definition: Molecule.h:695
int numExclusions
Definition: Molecule.h:599

◆ 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 1545 of file Molecule.h.

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

1546  {
1547  return(rigidBondLengths[atomnum]);
1548  }

◆ 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:109
void end(void)
Definition: MStream.C:176
int * pointerToGoBeg
Definition: Molecule.h:691
Real epsilonRep
Definition: Molecule.h:112
Real * goCoordinates
Definition: Molecule.h:682
#define MAX_RESTRICTIONS
Definition: Molecule.h:35
float Real
Definition: common.h:118
double * goSigmaPairA
Definition: Molecule.h:689
bool * goWithinCutoff
Definition: Molecule.h:681
#define MAX_GO_CHAINS
Definition: Molecule.h:34
int exp_a
Definition: Molecule.h:108
int32 * atomChainTypes
Definition: Molecule.h:677
int * pointerToGoEnd
Definition: Molecule.h:692
int * goIndxLJA
Definition: Molecule.h:687
int goNumLJPair
Definition: Molecule.h:686
int32 * goResidIndices
Definition: Molecule.h:679
GoChoices goMethod
GoValue go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
Definition: Molecule.h:1635
int * goResids
Definition: Molecule.h:683
Real * goSigmas
Definition: Molecule.h:680
Real cutoff
Definition: Molecule.h:113
int numAtoms
Definition: Molecule.h:585
Real sigmaRep
Definition: Molecule.h:111
void NAMD_die(const char *err_msg)
Definition: common.C:147
double * goSigmaPairB
Definition: Molecule.h:690
int go_indices[MAX_GO_CHAINS+1]
Definition: Molecule.h:1636
MOStream * put(char data)
Definition: MStream.h:112
int NumGoChains
Definition: Molecule.h:1637
int restrictions[MAX_RESTRICTIONS]
Definition: Molecule.h:114
Real epsilon
Definition: Molecule.h:107
int32 * goSigmaIndices
Definition: Molecule.h:678
int * goIndxLJB
Definition: Molecule.h:688
int exp_rep
Definition: Molecule.h:110
int numGoAtoms
Definition: Molecule.h:676

◆ send_Molecule()

void Molecule::send_Molecule ( MOStream msg)

Definition at line 5589 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().

5589  {
5590 #ifdef MEM_OPT_VERSION
5591 //in the memory optimized version, only the atom signatures are broadcast
5592 //to other Nodes. --Chao Mei
5593 
5594  msg->put(numAtoms);
5595 
5596  msg->put(massPoolSize);
5597  msg->put(massPoolSize, atomMassPool);
5598 
5599  msg->put(chargePoolSize);
5600  msg->put(chargePoolSize, atomChargePool);
5601 
5602  //put atoms' signatures
5603  msg->put(atomSigPoolSize);
5604  for(int i=0; i<atomSigPoolSize; i++)
5605  atomSigPool[i].pack(msg);
5606 
5607  //put atom's exclusion signatures
5608  msg->put(exclSigPoolSize);
5609  for(int i=0; i<exclSigPoolSize; i++)
5610  exclSigPool[i].pack(msg);
5611 
5612  msg->put(numHydrogenGroups);
5613  msg->put(maxHydrogenGroupSize);
5614  msg->put(numMigrationGroups);
5615  msg->put(maxMigrationGroupSize);
5616  msg->put(isOccupancyValid);
5617  msg->put(isBFactorValid);
5618 
5619  //put names for atoms
5620  msg->put(atomNamePoolSize);
5621  for(int i=0; i<atomNamePoolSize;i++) {
5622  int len = strlen(atomNamePool[i]);
5623  msg->put(len);
5624  msg->put(len*sizeof(char), atomNamePool[i]);
5625  }
5626 
5627  if(simParams->fixedAtomsOn){
5628  int numFixedAtomsSet = fixedAtomsSet->size();
5629  msg->put(numFixedAtoms);
5630  msg->put(numFixedAtomsSet);
5631  msg->put(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
5632  }
5633 
5634  if (simParams->constraintsOn) {
5635  int numConstrainedAtomsSet = constrainedAtomsSet->size();
5636  msg->put(numConstraints);
5637  msg->put(numConstrainedAtomsSet);
5638  msg->put(numConstrainedAtomsSet*sizeof(AtomSet), (char *)(constrainedAtomsSet->begin()));
5639  }
5640 
5641 #else
5642  msg->put(numAtoms);
5643  msg->put(numAtoms*sizeof(Atom), (char*)atoms);
5644 
5645  // Send the bond information
5646  msg->put(numRealBonds);
5647  msg->put(numBonds);
5648 
5649  if (numBonds)
5650  {
5651  msg->put(numBonds*sizeof(Bond), (char*)bonds);
5652  }
5653 
5654  // Send the angle information
5655  msg->put(numAngles);
5656  if (numAngles)
5657  {
5658  msg->put(numAngles*sizeof(Angle), (char*)angles);
5659  }
5660 
5661  // Send the dihedral information
5662  msg->put(numDihedrals);
5663  if (numDihedrals)
5664  {
5665  msg->put(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
5666  }
5667 
5668  if (simParams->sdScaling) {
5669  msg->put(num_alch_unpert_Bonds);
5670  msg->put(num_alch_unpert_Bonds*sizeof(Bond), (char*)alch_unpert_bonds);
5671 
5673  msg->put(num_alch_unpert_Angles*sizeof(Angle), (char*)alch_unpert_angles);
5674 
5677  }
5678 
5679  // Send the improper information
5680  msg->put(numImpropers);
5681  if (numImpropers)
5682  {
5683  msg->put(numImpropers*sizeof(Improper), (char*)impropers);
5684  }
5685 
5686  // Send the crossterm information
5687  msg->put(numCrossterms);
5688  if (numCrossterms)
5689  {
5690  msg->put(numCrossterms*sizeof(Crossterm), (char*)crossterms);
5691  }
5692 
5693  // send the hydrogen bond donor information
5694  msg->put(numDonors);
5695  if(numDonors)
5696  {
5697  msg->put(numDonors*sizeof(Bond), (char*)donors);
5698  }
5699 
5700  // send the hydrogen bond acceptor information
5701  msg->put(numAcceptors);
5702  if(numAcceptors)
5703  {
5704  msg->put(numAcceptors*sizeof(Bond), (char*)acceptors);
5705  }
5706 
5707  // Send the exclusion information
5708  msg->put(numExclusions);
5709  if (numExclusions)
5710  {
5711  msg->put(numExclusions*sizeof(Exclusion), (char*)exclusions);
5712  }
5713  // Send the constraint information, if used
5714  if (simParams->constraintsOn)
5715  {
5716  msg->put(numConstraints);
5717 
5718  msg->put(numAtoms, consIndexes);
5719 
5720  if (numConstraints)
5721  {
5722  msg->put(numConstraints*sizeof(ConstraintParams), (char*)consParams);
5723  }
5724  }
5725 #endif
5726 
5727  /* BEGIN gf */
5728  // Send the gridforce information, if used
5729  if (simParams->mgridforceOn)
5730  {
5731  DebugM(3, "Sending gridforce info\n" << endi);
5732  msg->put(numGridforceGrids);
5733 
5734  for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
5735  msg->put(numGridforces[gridnum]);
5736  msg->put(numAtoms, gridfrcIndexes[gridnum]);
5737  if (numGridforces[gridnum])
5738  {
5739  msg->put(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
5740  }
5741  GridforceGrid::pack_grid(gridfrcGrid[gridnum], msg);
5742  }
5743  }
5744  /* END gf */
5745 
5746  // Send the stirring information, if used
5747  if (simParams->stirOn)
5748  {
5749  //CkPrintf ("DEBUG: putting numStirredAtoms..\n");
5750  msg->put(numStirredAtoms);
5751  //CkPrintf ("DEBUG: putting numAtoms,stirIndexes.. numAtoms=%d\n",numStirredAtoms);
5752  msg->put(numAtoms, stirIndexes);
5753  //CkPrintf ("DEBUG: if numStirredAtoms..\n");
5754  if (numStirredAtoms)
5755  {
5756  //CkPrintf ("DEBUG: big put, with (char*)stirParams\n");
5757  msg->put(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
5758  }
5759  }
5760 
5761 
5762  // Send the moving drag information, if used
5763  if (simParams->movDragOn) {
5764  msg->put(numMovDrag);
5765  msg->put(numAtoms, movDragIndexes);
5766  if (numMovDrag)
5767  {
5768  msg->put(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
5769  }
5770  }
5771 
5772  // Send the rotating drag information, if used
5773  if (simParams->rotDragOn) {
5774  msg->put(numRotDrag);
5775  msg->put(numAtoms, rotDragIndexes);
5776  if (numRotDrag)
5777  {
5778  msg->put(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
5779  }
5780  }
5781 
5782  // Send the "constant" torque information, if used
5783  if (simParams->consTorqueOn) {
5784  msg->put(numConsTorque);
5786  if (numConsTorque)
5787  {
5788  msg->put(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
5789  }
5790  }
5791 
5792  // Send the constant force information, if used
5793  if (simParams->consForceOn)
5794  { msg->put(numConsForce);
5795  msg->put(numAtoms, consForceIndexes);
5796  if (numConsForce)
5797  msg->put(numConsForce*sizeof(Vector), (char*)consForce);
5798  }
5799 
5800  // Send molecule information for MC barostat
5801  if (simParams->monteCarloPressureOn) {
5802  msg->put(numMolecules);
5803  msg->put(numLargeMolecules);
5804  msg->put(numAtoms, moleculeAtom);
5806  }
5807 
5808  if (simParams->excludeFromPressure) {
5809  msg->put(numExPressureAtoms);
5810  msg->put(numAtoms, exPressureAtomFlags);
5811  }
5812 
5813 #ifndef MEM_OPT_VERSION
5814  // Send the langevin parameters, if active
5815  if (simParams->langevinOn || simParams->tCoupleOn)
5816  {
5817  msg->put(numAtoms, langevinParams);
5818  }
5819 
5820  // Send fixed atoms, if active
5821  if (simParams->fixedAtomsOn)
5822  {
5823  msg->put(numFixedAtoms);
5824  msg->put(numAtoms, fixedAtomFlags);
5825  msg->put(numFixedRigidBonds);
5826  }
5827 
5828  if (simParams->qmForcesOn)
5829  {
5830  msg->put(numAtoms, qmAtomGroup);
5831  msg->put(qmNumQMAtoms);
5832  msg->put(qmNumQMAtoms, qmAtmChrg);
5833  msg->put(qmNumQMAtoms, qmAtmIndx);
5834  msg->put(qmNoPC);
5835  msg->put(qmNumBonds);
5836  msg->put(qmMeNumBonds);
5837  msg->put(qmMeNumBonds, qmMeMMindx);
5838  msg->put(qmMeNumBonds, qmMeQMGrp);
5839  msg->put(qmPCFreq);
5840  msg->put(qmNumGrps);
5841  msg->put(qmNumGrps, qmGrpID);
5842  msg->put(qmNumGrps, qmCustPCSizes);
5843  msg->put(qmTotCustPCs);
5844  msg->put(qmTotCustPCs, qmCustomPCIdxs);
5845  }
5846 
5847  //fepb
5848  // send fep atom info
5849  if (simParams->alchOn || simParams->lesOn || simParams->pairInteractionOn) {
5850  msg->put(numFepInitial);
5851  msg->put(numFepFinal);
5852  msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
5853  }
5854  //fepe
5855 
5856  if (simParams->soluteScalingOn) {
5857  msg->put(numAtoms*sizeof(char), (char*)ssAtomFlags);
5858  msg->put(ss_num_vdw_params);
5859  msg->put(params->get_num_vdw_params()*sizeof(int), (char*)ss_vdw_type);
5860  msg->put(numAtoms*sizeof(int), (char*)ss_index);
5861  }
5862 
5863  #ifdef OPENATOM_VERSION
5864  // needs to be refactored into its own openatom version
5865  if (simParams->openatomOn ) {
5866  msg->put(numFepInitial);
5867  msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
5868  }
5869  #endif //OPENATOM_VERSION
5870 
5871  // DRUDE: send data read from PSF
5872  msg->put(is_lonepairs_psf);
5873  if (is_lonepairs_psf) {
5874  msg->put(numLphosts);
5875  msg->put(numLphosts*sizeof(Lphost), (char*)lphosts);
5876  }
5877  msg->put(is_drude_psf);
5878  if (is_drude_psf) {
5879  msg->put(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
5880  msg->put(numTholes);
5881  msg->put(numTholes*sizeof(Thole), (char*)tholes);
5882  msg->put(numAnisos);
5883  msg->put(numAnisos*sizeof(Aniso), (char*)anisos);
5884  }
5885  msg->put(numZeroMassAtoms);
5886  // DRUDE
5887 
5888  //LCPO
5889  if (simParams->LCPOOn) {
5890  msg->put(numAtoms, (int*)lcpoParamType);
5891  }
5892 
5893  //Send GromacsPairStuff -- JLai
5894  if (simParams->goGroPair) {
5895  msg->put(numLJPair);
5896  msg->put(numLJPair,indxLJA);
5897  msg->put(numLJPair,indxLJB);
5898  msg->put(numLJPair,pairC6);
5899  msg->put(numLJPair,pairC12);
5901  msg->put((numAtoms),pointerToLJBeg);
5902  msg->put((numAtoms),pointerToLJEnd);
5903  msg->put(numGaussPair);
5904  msg->put(numGaussPair,indxGaussA);
5905  msg->put(numGaussPair,indxGaussB);
5906  msg->put(numGaussPair,gA);
5907  msg->put(numGaussPair,gMu1);
5908  msg->put(numGaussPair,giSigma1);
5909  msg->put(numGaussPair,gMu2);
5910  msg->put(numGaussPair,giSigma2);
5911  msg->put(numGaussPair,gRepulsive);
5912  msg->put((numAtoms),pointerToGaussBeg);
5913  msg->put((numAtoms),pointerToGaussEnd);
5914  }
5915 #endif
5916 
5917  // Broadcast the message to the other nodes
5918  msg->end();
5919  delete msg;
5920 
5921 #ifdef MEM_OPT_VERSION
5922 
5923  build_excl_check_signatures();
5924 
5925  //set num{Calc}Tuples(Bonds,...,Impropers) to 0
5926  numBonds = numCalcBonds = 0;
5927  numAngles = numCalcAngles = 0;
5932  // JLai
5933  numLJPair = numCalcLJPair = 0;
5934  // End of JLai
5935 
5936 #else
5937 
5938  // Now build arrays of indexes into these arrays by atom
5939  build_lists_by_atom();
5940 
5941 #endif
5942 }
int num_alch_unpert_Dihedrals
Definition: Molecule.h:603
int * indxGaussA
Definition: Molecule.h:708
void end(void)
Definition: MStream.C:176
int numCalcBonds
Definition: Molecule.h:655
Real * gMu2
Definition: Molecule.h:713
int numBonds
Definition: Molecule.h:588
int numCalcLJPair
Definition: Molecule.h:696
Bool monteCarloPressureOn
Real * giSigma2
Definition: Molecule.h:714
int numHydrogenGroups
Definition: Molecule.h:633
int numAnisos
Number of anisotropic terms.
Definition: Molecule.h:612
Angle * alch_unpert_angles
Definition: Molecule.h:605
Definition: Vector.h:72
Real * pairC6
Definition: Molecule.h:701
Bool excludeFromPressure
int num_alch_unpert_Bonds
Definition: Molecule.h:601
static void pack_grid(GridforceGrid *grid, MOStream *msg)
Definition: GridForceGrid.C:50
int32 * moleculeAtom
atom index for all molecules
Definition: Molecule.h:620
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int * pointerToLJEnd
Definition: Molecule.h:698
int numGridforceGrids
Definition: Molecule.h:624
int numRealBonds
Definition: Molecule.h:587
int num_alch_unpert_Angles
Definition: Molecule.h:602
int numMovDrag
Definition: Molecule.h:627
Dihedral * alch_unpert_dihedrals
Definition: Molecule.h:606
Real * gA
Definition: Molecule.h:710
Bool pairInteractionOn
int * indxLJB
Definition: Molecule.h:700
int numFepFinal
Definition: Molecule.h:642
int * pointerToGaussBeg
Definition: Molecule.h:705
int numGaussPair
Definition: Molecule.h:707
int numCalcCrossterms
Definition: Molecule.h:659
int isOccupancyValid
Definition: Molecule.h:1557
int32 * consTorqueIndexes
Definition: Molecule.h:649
int64 numTotalExclusions
Definition: Molecule.h:600
Real * gMu1
Definition: Molecule.h:711
int * pointerToLJBeg
Definition: Molecule.h:697
Real * gRepulsive
Definition: Molecule.h:715
int * indxGaussB
Definition: Molecule.h:709
int64 numCalcFullExclusions
Definition: Molecule.h:661
int is_drude_psf
Definition: Molecule.h:489
int numLargeMolecules
Number of large molecules (compare to LARGEMOLTH)
Definition: Molecule.h:618
int numFixedRigidBonds
Definition: Molecule.h:639
int numFepInitial
Definition: Molecule.h:641
int numMolecules
Number of molecules.
Definition: Molecule.h:617
int * pointerToGaussEnd
Definition: Molecule.h:706
int numAcceptors
Definition: Molecule.h:598
int numTholes
Number of Thole terms.
Definition: Molecule.h:611
int numCalcDihedrals
Definition: Molecule.h:657
int numExPressureAtoms
Definition: Molecule.h:632
Bond * alch_unpert_bonds
Definition: Molecule.h:604
int numFixedAtoms
Definition: Molecule.h:630
int numCalcImpropers
Definition: Molecule.h:658
int numAngles
Definition: Molecule.h:589
Real * pairC12
Definition: Molecule.h:702
int numAtoms
Definition: Molecule.h:585
int * gromacsPair_type
Definition: Molecule.h:703
int numStirredAtoms
Definition: Molecule.h:631
int numCrossterms
Definition: Molecule.h:596
int numConsForce
Definition: Molecule.h:645
HashPool< HashString > atomNamePool
Definition: CompressPsf.C:309
ConsTorqueParams * consTorqueParams
Definition: Molecule.h:650
int get_num_vdw_params(void)
Definition: Parameters.h:604
int * ss_index
Definition: Molecule.h:486
int maxMigrationGroupSize
Definition: Molecule.h:636
int numDihedrals
Definition: Molecule.h:590
int numImpropers
Definition: Molecule.h:595
int numConsTorque
Definition: Molecule.h:629
int numConstraints
Definition: Molecule.h:622
int64 numCalcExclusions
Definition: Molecule.h:660
int32 * consForceIndexes
Definition: Molecule.h:646
int maxHydrogenGroupSize
Definition: Molecule.h:634
int numMigrationGroups
Definition: Molecule.h:635
Real * giSigma1
Definition: Molecule.h:712
int numZeroMassAtoms
Number of atoms with zero mass.
Definition: Molecule.h:614
int32 * moleculeStartIndex
starting index of each molecule
Definition: Molecule.h:619
Vector * consForce
Definition: Molecule.h:647
int * indxLJA
Definition: Molecule.h:699
MOStream * put(char data)
Definition: MStream.h:112
int * ss_vdw_type
Definition: Molecule.h:485
int * numGridforces
Definition: Molecule.h:625
int is_lonepairs_psf
Definition: Molecule.h:490
int numLphosts
Number of lone pair host records in PSF.
Definition: Molecule.h:613
int numDonors
Definition: Molecule.h:597
int isBFactorValid
Definition: Molecule.h:1557
int numCalcAngles
Definition: Molecule.h:656
int ss_num_vdw_params
Definition: Molecule.h:484
int numRotDrag
Definition: Molecule.h:628
HashPool< AtomSigInfo > atomSigPool
Definition: CompressPsf.C:313
int numLJPair
Definition: Molecule.h:695
int numExclusions
Definition: Molecule.h:599

◆ set_gridfrc_grid()

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

Definition at line 1372 of file Molecule.h.

References numGridforceGrids.

Referenced by Node::reloadGridforceGrid().

1373  {
1374  if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
1375  gridfrcGrid[gridnum] = grid;
1376  return 0;
1377  } else {
1378  return -1;
1379  }
1380  }
int numGridforceGrids
Definition: Molecule.h:624

◆ set_qm_replaceAll()

void Molecule::set_qm_replaceAll ( Bool  newReplaceAll)
inline

Definition at line 851 of file Molecule.h.

Referenced by NamdState::loadStructure().

851 { qmReplaceAll = newReplaceAll; } ;

◆ setBFactorData()

void Molecule::setBFactorData ( molfile_atom_t *  atomarray)

Definition at line 3277 of file Molecule.C.

3277  {
3278  bfactor = new float[numAtoms];
3279  for(int i=0; i<numAtoms; i++) {
3280  bfactor[i] = atomarray[i].bfactor;
3281  }
3282 }
int numAtoms
Definition: Molecule.h:585

◆ setOccupancyData()

void Molecule::setOccupancyData ( molfile_atom_t *  atomarray)

Definition at line 3270 of file Molecule.C.

3270  {
3271  occupancy = new float[numAtoms];
3272  for(int i=0; i<numAtoms; i++) {
3273  occupancy[i] = atomarray[i].occupancy;
3274  }
3275 }
int numAtoms
Definition: Molecule.h:585

Friends And Related Function Documentation

◆ AngleElem

friend class AngleElem
friend

Definition at line 240 of file Molecule.h.

◆ AnisoElem

friend class AnisoElem
friend

Definition at line 244 of file Molecule.h.

◆ BondElem

friend class BondElem
friend

Definition at line 239 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 241 of file Molecule.h.

◆ ExclElem

friend class ExclElem
friend

Definition at line 238 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 242 of file Molecule.h.

◆ TholeElem

friend class TholeElem
friend

Definition at line 243 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 592 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ alchDroppedDihedrals

int Molecule::alchDroppedDihedrals

Definition at line 593 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ alchDroppedImpropers

int Molecule::alchDroppedImpropers

Definition at line 594 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ atomChainTypes

int32* Molecule::atomChainTypes

◆ consForce

Vector* Molecule::consForce

Definition at line 647 of file Molecule.h.

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

◆ consForceIndexes

int32* Molecule::consForceIndexes

Definition at line 646 of file Molecule.h.

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

◆ consTorqueIndexes

int32* Molecule::consTorqueIndexes

◆ consTorqueParams

ConsTorqueParams* Molecule::consTorqueParams

Definition at line 650 of file Molecule.h.

Referenced by get_constorque_params().

◆ dcdSelectionKeyMap

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

Definition at line 482 of file Molecule.h.

◆ dcdSelectionParams

DCDParams Molecule::dcdSelectionParams[16]

◆ energyNative

BigReal Molecule::energyNative

Definition at line 718 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

◆ energyNonnative

BigReal Molecule::energyNonnative

Definition at line 719 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

◆ gA

Real* Molecule::gA

Definition at line 710 of file Molecule.h.

Referenced by get_gro_force2().

◆ giSigma1

Real* Molecule::giSigma1

Definition at line 712 of file Molecule.h.

Referenced by get_gro_force2().

◆ giSigma2

Real* Molecule::giSigma2

Definition at line 714 of file Molecule.h.

Referenced by get_gro_force2().

◆ gMu1

Real* Molecule::gMu1

Definition at line 711 of file Molecule.h.

Referenced by get_gro_force2().

◆ gMu2

Real* Molecule::gMu2

Definition at line 713 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 1636 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 687 of file Molecule.h.

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

◆ goIndxLJB

int* Molecule::goIndxLJB

Definition at line 688 of file Molecule.h.

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

◆ goNumLJPair

int Molecule::goNumLJPair

Definition at line 686 of file Molecule.h.

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

◆ goPDB

PDB* Molecule::goPDB

Definition at line 684 of file Molecule.h.

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

◆ goResidIndices

int32* Molecule::goResidIndices

Definition at line 679 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 689 of file Molecule.h.

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

◆ goSigmaPairB

double* Molecule::goSigmaPairB

Definition at line 690 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 715 of file Molecule.h.

Referenced by get_gro_force2().

◆ gromacsPair_type

int* Molecule::gromacsPair_type

Definition at line 703 of file Molecule.h.

◆ hydrogenGroup

HydrogenGroup Molecule::hydrogenGroup

Definition at line 673 of file Molecule.h.

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

◆ indxGaussA

int* Molecule::indxGaussA

Definition at line 708 of file Molecule.h.

◆ indxGaussB

int* Molecule::indxGaussB

Definition at line 709 of file Molecule.h.

Referenced by get_gro_force2().

◆ indxLJA

int* Molecule::indxLJA

Definition at line 699 of file Molecule.h.

◆ indxLJB

int* Molecule::indxLJB

Definition at line 700 of file Molecule.h.

Referenced by get_gro_force2().

◆ is_drude_psf

int Molecule::is_drude_psf

Definition at line 489 of file Molecule.h.

◆ is_lonepairs_psf

int Molecule::is_lonepairs_psf

Definition at line 490 of file Molecule.h.

◆ isBFactorValid

int Molecule::isBFactorValid

Definition at line 1557 of file Molecule.h.

◆ isOccupancyValid

int Molecule::isOccupancyValid

Definition at line 1557 of file Molecule.h.

◆ maxHydrogenGroupSize

int Molecule::maxHydrogenGroupSize

Definition at line 634 of file Molecule.h.

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

◆ maxMigrationGroupSize

int Molecule::maxMigrationGroupSize

Definition at line 636 of file Molecule.h.

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

◆ moleculeAtom

int32* Molecule::moleculeAtom

atom index for all molecules

Definition at line 620 of file Molecule.h.

◆ moleculeStartIndex

int32* Molecule::moleculeStartIndex

starting index of each molecule

Definition at line 619 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 598 of file Molecule.h.

◆ numAngles

int Molecule::numAngles

◆ numAnisos

int Molecule::numAnisos

Number of anisotropic terms.

Definition at line 612 of file Molecule.h.

Referenced by AnisoElem::getMoleculePointers().

◆ numAtoms

int Molecule::numAtoms

◆ numBonds

int Molecule::numBonds

◆ numCalcAngles

int Molecule::numCalcAngles

Definition at line 656 of file Molecule.h.

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

◆ numCalcAnisos

int Molecule::numCalcAnisos

Definition at line 665 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcBonds

int Molecule::numCalcBonds

Definition at line 655 of file Molecule.h.

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

◆ numCalcCrossterms

int Molecule::numCalcCrossterms

Definition at line 659 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcDihedrals

int Molecule::numCalcDihedrals

Definition at line 657 of file Molecule.h.

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

◆ numCalcExclusions

int64 Molecule::numCalcExclusions

Definition at line 660 of file Molecule.h.

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

◆ numCalcFullExclusions

int64 Molecule::numCalcFullExclusions

Definition at line 661 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numCalcImpropers

int Molecule::numCalcImpropers

Definition at line 658 of file Molecule.h.

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

◆ numCalcLJPair

int Molecule::numCalcLJPair

Definition at line 696 of file Molecule.h.

◆ numCalcTholes

int Molecule::numCalcTholes

Definition at line 664 of file Molecule.h.

Referenced by Controller::compareChecksums().

◆ numConsForce

int Molecule::numConsForce

Definition at line 645 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numConsTorque

int Molecule::numConsTorque

Definition at line 629 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 597 of file Molecule.h.

◆ numDrudeAtoms

int Molecule::numDrudeAtoms

Number of Drude particles.

Definition at line 610 of file Molecule.h.

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

◆ numExclusions

int Molecule::numExclusions

Definition at line 599 of file Molecule.h.

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

◆ numExPressureAtoms

int Molecule::numExPressureAtoms

Definition at line 632 of file Molecule.h.

Referenced by is_atom_exPressure().

◆ numFepFinal

int Molecule::numFepFinal

Definition at line 642 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 707 of file Molecule.h.

◆ numGoAtoms

int Molecule::numGoAtoms

◆ NumGoChains

int Molecule::NumGoChains

Definition at line 1637 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 625 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 618 of file Molecule.h.

◆ numLJPair

int Molecule::numLJPair

Definition at line 695 of file Molecule.h.

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

◆ numLonepairs

int Molecule::numLonepairs

Number of lone pairs.

Definition at line 609 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 613 of file Molecule.h.

◆ numMigrationGroups

int Molecule::numMigrationGroups

Definition at line 635 of file Molecule.h.

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

◆ numMolecules

int Molecule::numMolecules

Number of molecules.

Definition at line 617 of file Molecule.h.

Referenced by Controller::monteCarloPressure_accept().

◆ numMovDrag

int Molecule::numMovDrag

Definition at line 627 of file Molecule.h.

Referenced by is_atom_movdragged().

◆ numMultipleDihedrals

int Molecule::numMultipleDihedrals

Definition at line 669 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numMultipleImpropers

int Molecule::numMultipleImpropers

Definition at line 671 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ numPair

int Molecule::numPair

Definition at line 694 of file Molecule.h.

◆ numRealBonds

int Molecule::numRealBonds

Definition at line 587 of file Molecule.h.

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

◆ numRigidBonds

int Molecule::numRigidBonds

◆ numRotDrag

int Molecule::numRotDrag

Definition at line 628 of file Molecule.h.

Referenced by is_atom_rotdragged().

◆ numStirredAtoms

int Molecule::numStirredAtoms

Definition at line 631 of file Molecule.h.

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

◆ numTholes

int Molecule::numTholes

Number of Thole terms.

Definition at line 611 of file Molecule.h.

Referenced by TholeElem::getMoleculePointers().

◆ numTotalExclusions

int64 Molecule::numTotalExclusions

Definition at line 600 of file Molecule.h.

◆ numZeroMassAtoms

int Molecule::numZeroMassAtoms

Number of atoms with zero mass.

Definition at line 614 of file Molecule.h.

◆ pairC12

Real* Molecule::pairC12

Definition at line 702 of file Molecule.h.

Referenced by get_gro_force2().

◆ pairC6

Real* Molecule::pairC6

Definition at line 701 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGaussBeg

int* Molecule::pointerToGaussBeg

Definition at line 705 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGaussEnd

int* Molecule::pointerToGaussEnd

Definition at line 706 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToGoBeg

int* Molecule::pointerToGoBeg

Definition at line 691 of file Molecule.h.

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

◆ pointerToGoEnd

int* Molecule::pointerToGoEnd

Definition at line 692 of file Molecule.h.

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

◆ pointerToLJBeg

int* Molecule::pointerToLJBeg

Definition at line 697 of file Molecule.h.

Referenced by get_gro_force2().

◆ pointerToLJEnd

int* Molecule::pointerToLJEnd

Definition at line 698 of file Molecule.h.

Referenced by get_gro_force2().

◆ r_ohc

Real Molecule::r_ohc

Definition at line 495 of file Molecule.h.

◆ r_om

Real Molecule::r_om

Definition at line 494 of file Molecule.h.

◆ ss_index

int* Molecule::ss_index

Definition at line 486 of file Molecule.h.

◆ ss_num_vdw_params

int Molecule::ss_num_vdw_params

Definition at line 484 of file Molecule.h.

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

◆ ss_vdw_type

int* Molecule::ss_vdw_type

Definition at line 485 of file Molecule.h.

Referenced by ComputeLjPmeSerialMgr::getLJparameters().

◆ suspiciousAlchBonds

int Molecule::suspiciousAlchBonds

Definition at line 591 of file Molecule.h.

Referenced by NamdState::loadStructure().

◆ tail_corr_dUdl_1

BigReal Molecule::tail_corr_dUdl_1

Definition at line 500 of file Molecule.h.

◆ tail_corr_dUdl_2

BigReal Molecule::tail_corr_dUdl_2

Definition at line 500 of file Molecule.h.

◆ tail_corr_ener

BigReal Molecule::tail_corr_ener

Definition at line 498 of file Molecule.h.

Referenced by Controller::rescaleaccelMD().

◆ tail_corr_virial

BigReal Molecule::tail_corr_virial

Definition at line 499 of file Molecule.h.

◆ tail_corr_virial_1

BigReal Molecule::tail_corr_virial_1

Definition at line 501 of file Molecule.h.

◆ tail_corr_virial_2

BigReal Molecule::tail_corr_virial_2

Definition at line 501 of file Molecule.h.


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