Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Molecule Class Reference

#include <Molecule.h>

List of all members.

Public Member Functions

int const * getLcpoParamType ()
AtomgetAtoms () const
AtomNameInfogetAtomNames () const
AtomSegResInfogetAtomSegResInfo () const
int num_fixed_atoms () const
int num_fixed_groups () const
int num_group_deg_freedom () const
int num_deg_freedom (int isInitialReport=0) const
 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 *, 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_fep_flags (StringList *, StringList *, PDB *, char *, const char *)
void delete_alch_bonded (void)
void build_exPressure_atoms (StringList *, StringList *, PDB *, char *)
void print_go_sigmas ()
void build_go_sigmas (StringList *, char *)
void build_go_arrays (StringList *, char *)
BigReal get_go_force (BigReal, int, int, BigReal *, BigReal *) const
BigReal get_go_force_new (BigReal, int, int, BigReal *, BigReal *) const
BigReal get_go_energy_new (BigReal, int, int) 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
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
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_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

int is_drude_psf
int is_lonepairs_psf
Real r_om
Real r_ohc
BigReal tail_corr_ener
BigReal tail_corr_virial
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
int numTotalExclusions
int numLonepairs
int numDrudeAtoms
int numTholes
int numAnisos
int numLphosts
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
int numCalcExclusions
int numCalcTholes
int numCalcAnisos
int numMultipleDihedrals
int numMultipleImpropers
HydrogenGroup hydrogenGroup
int numGoAtoms
int32atomChainTypes
int32goSigmaIndices
RealgoSigmas
bool * goWithinCutoff
RealgoCoordinates
int * goResids
PDBgoPDB
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 WorkDistrib


Constructor & Destructor Documentation

Molecule::Molecule SimParameters ,
Parameters param
 

Definition at line 380 of file Molecule.C.

References initialize(), and simParams.

00381 {
00382   initialize(simParams,param);
00383 }

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

Definition at line 393 of file Molecule.C.

References initialize(), SimParameters::LCPOOn, simParams, and SimParameters::useCompressedPsf.

00394 {
00395   initialize(simParams,param);
00396 
00397 #ifdef MEM_OPT_VERSION
00398   if(simParams->useCompressedPsf)
00399       read_mol_signatures(filename, param, cfgList);
00400 #else
00401         read_psf_file(filename, param); 
00402  //LCPO
00403   if (simParams->LCPOOn)
00404     assignLCPOTypes( 0 );
00405 #endif      
00406  }

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

Definition at line 415 of file Molecule.C.

References initialize(), SimParameters::LCPOOn, NAMD_die(), numAngles, numAtoms, numBonds, numCrossterms, numDihedrals, numImpropers, numRealBonds, setBFactorData(), setOccupancyData(), and simParams.

00416 {
00417 #ifdef MEM_OPT_VERSION
00418   NAMD_die("Sorry, plugin IO is not supported in the memory optimized version.");
00419 #else
00420     initialize(simParams, param);
00421     numAtoms = natoms;
00422     int optflags = MOLFILE_BADOPTIONS;
00423     molfile_atom_t *atomarray = (molfile_atom_t *) malloc(natoms*sizeof(molfile_atom_t));
00424     memset(atomarray, 0, natoms*sizeof(molfile_atom_t));
00425 
00426     //1a. read basic atoms information
00427     int rc = pIOHdl->read_structure(pIOFileHdl, &optflags, atomarray);
00428     if (rc != MOLFILE_SUCCESS && rc != MOLFILE_NOSTRUCTUREDATA) {
00429         free(atomarray);
00430         NAMD_die("ERROR: plugin failed reading structure data");
00431     }
00432     if(optflags == MOLFILE_BADOPTIONS) {
00433         free(atomarray);
00434         NAMD_die("ERROR: plugin didn't initialize optional data flags");
00435     }
00436     if(optflags & MOLFILE_OCCUPANCY) {
00437         setOccupancyData(atomarray);
00438     }
00439     if(optflags & MOLFILE_BFACTOR) {
00440         setBFactorData(atomarray);
00441     }
00442     //1b. load basic atoms information to the molecule object
00443     plgLoadAtomBasics(atomarray);    
00444     free(atomarray);
00445 
00446     //2a. read bonds
00447     //indices are one-based in read_bonds
00448     int *from, *to;
00449     float *bondorder;
00450     int *bondtype, nbondtypes;
00451     char **bondtypename;
00452     if(pIOHdl->read_bonds!=NULL) {
00453         if(pIOHdl->read_bonds(pIOFileHdl, &numBonds, &from, &to, &bondorder,
00454                                  &bondtype, &nbondtypes, &bondtypename)){
00455             NAMD_die("ERROR: failed reading bond information.");
00456         }
00457     }    
00458     //2b. load bonds information to the molecule object
00459     if(numBonds!=0) {
00460         plgLoadBonds(from,to);
00461     }
00462 
00463     //3a. read other bonded structures
00464     int *plgAngles, *plgDihedrals, *plgImpropers, *plgCterms;
00465     int ctermcols, ctermrows;
00466     int *angletypes, numangletypes, *dihedraltypes, numdihedraltypes;
00467     int *impropertypes, numimpropertypes; 
00468     char **angletypenames, **dihedraltypenames, **impropertypenames;
00469 
00470     plgAngles=plgDihedrals=plgImpropers=plgCterms=NULL;
00471     if(pIOHdl->read_angles!=NULL) {
00472         if(pIOHdl->read_angles(pIOFileHdl,
00473                   &numAngles, &plgAngles,
00474                   &angletypes, &numangletypes, &angletypenames,
00475                   &numDihedrals, &plgDihedrals,
00476                   &dihedraltypes, &numdihedraltypes, &dihedraltypenames,
00477                   &numImpropers, &plgImpropers,
00478                   &impropertypes, &numimpropertypes, &impropertypenames,
00479                   &numCrossterms, &plgCterms, &ctermcols, &ctermrows)) {
00480             NAMD_die("ERROR: failed reading angle information.");
00481         }
00482     }
00483     //3b. load other bonded structures to the molecule object
00484     if(numAngles!=0) plgLoadAngles(plgAngles);
00485     if(numDihedrals!=0) plgLoadDihedrals(plgDihedrals);
00486     if(numImpropers!=0) plgLoadImpropers(plgImpropers);
00487     if(numCrossterms!=0) plgLoadCrossterms(plgCterms);
00488 
00489   numRealBonds = numBonds;
00490   build_atom_status();
00491   //LCPO
00492   if (simParams->LCPOOn)
00493     assignLCPOTypes( 2 );
00494 #endif
00495 }

Molecule::Molecule SimParameters ,
Parameters ,
Ambertoppar
 

Molecule::Molecule SimParameters ,
Parameters ,
const GromacsTopFile
 

Molecule::~Molecule  ) 
 

Definition at line 509 of file Molecule.C.

00510 {
00511   /*  Check to see if each array was ever allocated.  If it was   */
00512   /*  then free it            */
00513   if (atoms != NULL)
00514     delete [] atoms;
00515 
00516   if (atomNames != NULL)
00517   {
00518     // subarrarys allocated from arena - automatically deleted
00519     delete [] atomNames;
00520   }
00521   delete nameArena;
00522 
00523   if (resLookup != NULL)
00524     delete resLookup;
00525 
00526   // DRUDE: free arrays read from PSF
00527   if (drudeConsts != NULL) delete [] drudeConsts;
00528   if (lphosts != NULL) delete [] lphosts;
00529   if (anisos != NULL) delete [] anisos;
00530   if (tholes != NULL) delete [] tholes;
00531   if (lphostIndexes != NULL) delete [] lphostIndexes;
00532   // DRUDE
00533 
00534   //LCPO
00535   if (lcpoParamType != NULL) delete [] lcpoParamType;
00536 
00537   #ifdef MEM_OPT_VERSION
00538   if(eachAtomSig) delete [] eachAtomSig;
00539   if(atomSigPool) delete [] atomSigPool;
00540   #else
00541   if (bonds != NULL)
00542     delete [] bonds;
00543 
00544   if (angles != NULL)
00545     delete [] angles;
00546 
00547   if (dihedrals != NULL)
00548     delete [] dihedrals;
00549 
00550   if (impropers != NULL)
00551     delete [] impropers;
00552 
00553   if (crossterms != NULL)
00554     delete [] crossterms;
00555 
00556   if (exclusions != NULL)
00557     delete [] exclusions;
00558   #endif
00559 
00560   if (donors != NULL)
00561     delete [] donors;
00562 
00563   if (acceptors != NULL)
00564     delete [] acceptors;  
00565 
00566   #ifdef MEM_OPT_VERSION
00567   if(exclSigPool) delete [] exclSigPool;
00568   if(exclChkSigPool) delete [] exclChkSigPool;
00569   if(eachAtomExclSig) delete [] eachAtomExclSig;
00570   if(fixedAtomsSet) delete fixedAtomsSet;
00571   #else
00572   if (bondsByAtom != NULL)
00573        delete [] bondsByAtom;
00574   
00575   if (anglesByAtom != NULL)
00576        delete [] anglesByAtom;
00577   
00578   if (dihedralsByAtom != NULL)
00579        delete [] dihedralsByAtom;
00580   
00581   if (impropersByAtom != NULL)
00582        delete [] impropersByAtom;
00583   
00584   if (crosstermsByAtom != NULL)
00585        delete [] crosstermsByAtom;  
00586 
00587   if (exclusionsByAtom != NULL)
00588        delete [] exclusionsByAtom;
00589   
00590   if (fullExclusionsByAtom != NULL)
00591        delete [] fullExclusionsByAtom;
00592   
00593   if (modExclusionsByAtom != NULL)
00594        delete [] modExclusionsByAtom;
00595   
00596   if (all_exclusions != NULL)
00597        delete [] all_exclusions;
00598 
00599   // DRUDE
00600   if (tholesByAtom != NULL)
00601        delete [] tholesByAtom;
00602   if (anisosByAtom != NULL)
00603        delete [] anisosByAtom;
00604   // DRUDE
00605   #endif
00606 
00607   //LCPO
00608   if (lcpoParamType != NULL)
00609     delete [] lcpoParamType;
00610 
00611   if (fixedAtomFlags != NULL)
00612        delete [] fixedAtomFlags;
00613 
00614   if (stirIndexes != NULL)
00615     delete [] stirIndexes;
00616 
00617 
00618   #ifdef MEM_OPT_VERSION
00619   if(clusterSigs != NULL){      
00620       delete [] clusterSigs;
00621   }  
00622   #else
00623   if (cluster != NULL)
00624        delete [] cluster;  
00625   #endif
00626   if (clusterSize != NULL)
00627        delete [] clusterSize;
00628 
00629   if (exPressureAtomFlags != NULL)
00630        delete [] exPressureAtomFlags;
00631 
00632   if (rigidBondLengths != NULL)
00633        delete [] rigidBondLengths;
00634 
00635 //fepb
00636   if (fepAtomFlags != NULL)
00637        delete [] fepAtomFlags;
00638 //fepe
00639 
00640 
00641   #ifndef MEM_OPT_VERSION
00642   delete arena;
00643   delete exclArena;
00644   #endif
00645 }


Member Function Documentation

Real Molecule::atomcharge int  anum  )  const [inline]
 

Definition at line 717 of file Molecule.h.

References Real.

Referenced by NamdState::configListInit(), WorkDistrib::createAtomLists(), and Sequencer::reloadCharges().

00718   {
00719     #ifdef MEM_OPT_VERSION
00720     return atomChargePool[eachAtomCharge[anum]];
00721     #else
00722     return(atoms[anum].charge);
00723     #endif
00724   }

Real Molecule::atommass int  anum  )  const [inline]
 

Definition at line 707 of file Molecule.h.

References Real.

Referenced by colvarmodule::atom::atom(), NamdState::configListInit(), WorkDistrib::createAtomLists(), GlobalMasterFreeEnergy::getMass(), GlobalMasterEasy::getMass(), GlobalMaster::processData(), ComputeGlobal::recvResults(), Tcl_centerOfMass(), and Tcl_radiusOfGyration().

00708   {
00709     #ifdef MEM_OPT_VERSION
00710     return atomMassPool[eachAtomMass[anum]];
00711     #else
00712     return(atoms[anum].mass);
00713     #endif
00714   }

Bool Molecule::atoms_1to4 unsigned  int,
unsigned  int
 

Definition at line 1296 of file GoMolecule.C.

References Angle, dihedral::atom1, angle::atom1, bond::atom1, dihedral::atom2, angle::atom2, bond::atom2, dihedral::atom3, angle::atom3, dihedral::atom4, Bond, Bool, DebugM, Dihedral, get_angle(), get_angles_for_atom(), get_bond(), get_bonds_for_atom(), get_dihedral(), and get_dihedrals_for_atom().

Referenced by build_go_arrays(), and build_go_sigmas().

01298 {
01299   int bondNum;   //  Bonds in bonded list
01300   int angleNum;  //  Angles in angle list
01301   int dihedralNum;   //  Dihedrals in dihedral list
01302   int *bonds;
01303   int *angles;
01304   int *dihedrals;
01305   Bond *bond;     //  Temporary bond structure
01306   Angle *angle;   //  Temporary angle structure
01307   Dihedral *dihedral; //  Temporary dihedral structure
01308 
01309   DebugM(2,"atoms_1to4(" << atom1 << "," << atom2 << ")" << std::endl);
01310 
01311   bonds = get_bonds_for_atom(atom1);
01312   bondNum = *bonds;
01313   while(bondNum != -1) {
01314     bond = get_bond(bondNum);
01315     DebugM(2,"bond  atom1:" << bond->atom1 << ", atom2:" << bond->atom2 << std::endl);
01316     if (atom2 == bond->atom1 || atom2 == bond->atom2) {
01317       return TRUE;
01318     }
01319     bondNum = *(++bonds);
01320   }
01321 
01322   bonds = get_bonds_for_atom(atom2);
01323   bondNum = *bonds;
01324   while(bondNum != -1) {
01325     bond = get_bond(bondNum);
01326     DebugM(2,"bond  atom1:" << bond->atom1 << ", atom2:" << bond->atom2 << std::endl);
01327     if (atom1 == bond->atom1 || atom1 == bond->atom2) {
01328       return TRUE;
01329     }
01330     bondNum = *(++bonds);
01331   }
01332 
01333   angles = get_angles_for_atom(atom1);
01334   angleNum = *angles;
01335   while(angleNum != -1) {
01336     angle = get_angle(angleNum);
01337     DebugM(2,"angle  atom1:" << angle->atom1 << ", atom2:" << angle->atom2 << ", atom3:" << angle->atom3 << std::endl);
01338     if (atom2 == angle->atom1 || atom2 == angle->atom2 || atom2 == angle->atom3) {
01339       return TRUE;
01340     }
01341     angleNum = *(++angles);
01342   }
01343 
01344   angles = get_angles_for_atom(atom2);
01345   angleNum = *angles;
01346   while(angleNum != -1) {
01347     angle = get_angle(angleNum);
01348     DebugM(2,"angle  atom1:" << angle->atom1 << ", atom2:" << angle->atom2 << ", atom3:" << angle->atom3 << std::endl);
01349     if (atom1 == angle->atom1 || atom1 == angle->atom2 || atom1 == angle->atom3) {
01350       return TRUE;
01351     }
01352     angleNum = *(++angles);
01353   }
01354 
01355   dihedrals = get_dihedrals_for_atom(atom1);
01356   dihedralNum = *dihedrals;
01357   while(dihedralNum != -1) {
01358     dihedral = get_dihedral(dihedralNum);
01359     DebugM(2,"dihedral  atom1:" << dihedral->atom1 << ", atom2:" << dihedral->atom2 << ", atom3:" << dihedral->atom3 << ", atom4:" << dihedral->atom4 << std::endl);
01360     if (atom2 == dihedral->atom1 || atom2 == dihedral->atom2 \
01361         || atom2 == dihedral->atom3 || atom2 == dihedral->atom4) {
01362       return TRUE;
01363     }
01364     dihedralNum = *(++dihedrals);
01365   }
01366 
01367   dihedrals = get_dihedrals_for_atom(atom2);
01368   dihedralNum = *dihedrals;
01369   while(dihedralNum != -1) {
01370     dihedral = get_dihedral(dihedralNum);
01371     DebugM(2,"dihedral  atom1:" << dihedral->atom1 << ", atom2:" << dihedral->atom2 << ", atom3:" << dihedral->atom3 << ", atom4:" << dihedral->atom4 << std::endl);
01372     if (atom1 == dihedral->atom1 || atom1 == dihedral->atom2 \
01373         || atom1 == dihedral->atom3 || atom1 == dihedral->atom4) {
01374       return TRUE;
01375     }
01376     dihedralNum = *(++dihedrals);
01377   }
01378   
01379   return FALSE;
01380 }

Index Molecule::atomvdwtype int  anum  )  const [inline]
 

Definition at line 727 of file Molecule.h.

References Index, and AtomCstInfo::vdw_type.

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

00728   {      
00729       return(atoms[anum].vdw_type);
00730   }

void Molecule::build_constant_forces char *   ) 
 

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

void Molecule::build_extra_bonds Parameters parameters,
StringList file
 

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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 773 of file GoMolecule.C.

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

Referenced by NamdState::configListInit().

00775 {
00776   DebugM(3,"->build_go_arrays" << std::endl);
00777   //PDB *goPDB;      //  Pointer to PDB object to use
00778   int bcol = 4;      //  Column that data is in
00779   int32 chainType = 0;      //  b value from PDB file
00780   int i;         //  Loop counter
00781   int j;         //  Loop counter
00782   BigReal atomAtomDist;     //  Distance between two atoms -- JLai put back 
00783   int resid1;    //  Residue ID for first atom
00784   int resid2;    //  Residue ID for second atom
00785   int residDiff;     //  Difference between resid1 and resid2
00786   int goIndex;       //  Index into the goCoordinates array
00787   int goIndx;        //  Index into the goCoordinates array
00788   char filename[129];    //  Filename
00789   
00790   //JLai
00791   BigReal nativeEnergy, *native;
00792   BigReal nonnativeEnergy, *nonnative;
00793   nativeEnergy = 0;
00794   nonnativeEnergy = 0;
00795   native = &nativeEnergy;
00796   nonnative = &nonnativeEnergy;
00797 
00798   long nativeContacts = 0;
00799   long nonnativeContacts = 0;
00800 
00801   //  Get the PDB object that contains the Go coordinates.  If
00802   //  the user gave another file name, use it.  Otherwise, just use
00803   //  the PDB file that has the initial coordinates.  
00804   if (goCoordFile == NULL)
00805     {
00806       //goPDB = initial_pdb;
00807       NAMD_die("Error: goCoordFile is NULL - build_go_arrays");
00808     }
00809   else
00810   {
00811     if (goCoordFile->next != NULL)
00812       {
00813         NAMD_die("Multiple definitions of Go atoms PDB file in configuration file");
00814       }
00815     
00816     if ( (cwd == NULL) || (goCoordFile->data[0] == '/') )
00817       {
00818         strcpy(filename, goCoordFile->data);
00819       }
00820     else
00821       {
00822         strcpy(filename, cwd);
00823         strcat(filename, goCoordFile->data);
00824       }
00825     
00826     goPDB = new PDB(filename);
00827     if ( goPDB == NULL )
00828       {
00829         NAMD_die("goPDB memory allocation failed in Molecule::build_go_arrays");
00830       }
00831     
00832     if (goPDB->num_atoms() != numAtoms)
00833       {
00834         NAMD_die("Number of atoms in fixed atoms PDB doesn't match coordinate PDB");
00835       }
00836   }
00837   
00838   //  Allocate the array to hold Go atom indices into the sigma array
00839   goSigmaIndices = new int32[numAtoms];
00840   
00841   if (goSigmaIndices == NULL) {
00842     NAMD_die("goSigmaIndices memory allocation failed in Molecule::build_go_arrays");
00843   }
00844   
00845   numGoAtoms = 0;
00846   
00847   //  Loop through all the atoms and get the Go chain types
00848   for (i=0; i<numAtoms; i++) {
00849     chainType = (int32)(goPDB->atom(i))->occupancy();
00850     if ( chainType != 0 ) {
00851       DebugM(3,"build_go_arrays - atom:" << i << std::endl);
00852       goSigmaIndices[i] = numGoAtoms;
00853       numGoAtoms++;
00854     }
00855     else {
00856       goSigmaIndices[i] = -1;
00857     }
00858   }
00859 
00860   // Allocate the array to hold the sigma values for each Go atom pair
00872   //  Allocate the array to hold the chain types
00873   atomChainTypes = new int32[numGoAtoms];
00874 
00875   if (atomChainTypes == NULL) {
00876     NAMD_die("atomChainTypes memory allocation failed in Molecule::build_go_arrays");
00877   }
00878 
00879   // Allocate the array to hold (x,y,z) coordinates for all of the Go atoms
00880   goCoordinates = new Real[numGoAtoms*3];
00881 
00882   if (goCoordinates == NULL) {
00883     NAMD_die("goCoordinates memory allocation failed in Molecule::build_go_arrays");
00884   }
00885 
00886   goResids = new int[numGoAtoms];
00887 
00888   // Allocate the array to hold PDB residu IDs for all of the Go atoms
00889   if (goResids == NULL) {
00890     NAMD_die("goResids memory allocation failed in Molecule::build_go_arrays");
00891   }
00892   
00893   for (i=0; i<numAtoms; i++) {
00894     goIndex = goSigmaIndices[i];
00895     if (goIndex != -1) {
00896       //  Assign the chainType value!
00897       //  Get the chainType from the occupancy field
00898       atomChainTypes[goIndex] = (int32)(goPDB->atom(i))->occupancy();
00899       goCoordinates[goIndex*3] = goPDB->atom(i)->xcoor();
00900       goCoordinates[goIndex*3 + 1] = goPDB->atom(i)->ycoor();
00901       goCoordinates[goIndex*3 + 2] = goPDB->atom(i)->zcoor();
00902       goResids[goIndex] = goPDB->atom(i)->residueseq();
00903     }
00904   }
00905       // JLai
00906   energyNative = 0;
00907   energyNonnative = 0;
00908   //printf("INIT ENERGY: (N) %f (NN) %f\n", energyNative, energyNonnative);
00909   for (i=0; i<numAtoms-1; i++) {
00910     goIndex = goSigmaIndices[i];
00911     if (goIndex != -1) {
00912       for (j=i+1; j<numAtoms;j++) {
00913         goIndx = goSigmaIndices[j];
00914         if (goIndx != -1) {
00915           resid1 = (goPDB->atom(i))->residueseq();
00916           resid2 = (goPDB->atom(j))->residueseq();
00917           residDiff = resid2 - resid1;
00918           if (residDiff < 0) residDiff = -residDiff;
00919           if (atomChainTypes[goIndex] && atomChainTypes[goIndx] &&
00920               !(this->go_restricted(atomChainTypes[goIndex],atomChainTypes[goIndx],residDiff)) &&
00921               !atoms_1to4(i,j)) {
00922             atomAtomDist = sqrt(pow((goPDB->atom(i))->xcoor() - (goPDB->atom(j))->xcoor(), 2.0) +
00923                                 pow((goPDB->atom(i))->ycoor() - (goPDB->atom(j))->ycoor(), 2.0) +
00924                                 pow((goPDB->atom(i))->zcoor() - (goPDB->atom(j))->zcoor(), 2.0));
00925             //get_go_force_new(atomAtomDist, i, j, native, nonnative);
00926             //energyNative += nativeEnergy;
00927             //energyNonnative += nonnativeEnergy;
00928             //if ( (nativeEnergy)*(nativeEnergy) > 0.1 ) {
00929             //  printf("GO: %d %d %f %f",i,j,atomAtomDist,nativeEnergy);
00930             //} 
00931             if (atomAtomDist <= this->get_go_cutoff(atomChainTypes[goIndex],atomChainTypes[goIndx]) ) {
00932               nativeContacts++;
00933             } else {
00934               nonnativeContacts++;
00935             }    
00936           }
00937         }
00938       }
00939     }
00940   }
00941   iout << iINFO << "Number of UNIQUE    native contacts: " << nativeContacts     << "\n" << endi;
00942   iout << iINFO << "Number of UNIQUE nonnative contacts: " << nonnativeContacts  << "\n" << endi;
00943   
00944   //  If we had to create a PDB object, delete it now
00945   if (goCoordFile != NULL) {
00946     delete goPDB;
00947   }
00948   
00949   return;
00950 }

void Molecule::build_go_params StringList  ) 
 

Definition at line 80 of file GoMolecule.C.

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

Referenced by NamdState::configListInit().

00080                                             {
00081   iout << iINFO << "Building Go Parameters" << "\n" << endi;
00082 #ifdef MEM_OPT_VERSION
00083   NAMD_die("Go forces are not supported in memory-optimized builds.");
00084 #else
00085   build_lists_by_atom();
00086 #endif
00087   int iterator = 0;
00088     do
00089     {
00090       iout << iINFO << "Reading Go File: " << iterator << "\n" << endi;
00091       read_go_file(g->data);
00092       g = g->next;
00093       iterator++;
00094     } while ( g != NULL && iterator < 100);    
00095 }

void Molecule::build_go_sigmas StringList ,
char * 
 

Definition at line 582 of file GoMolecule.C.

References PDB::atom(), atomChainTypes, atoms_1to4(), BigReal, StringList::data, DebugM, get_go_cutoff(), get_go_exp_a(), get_go_exp_b(), go_restricted(), goSigmaIndices, goSigmas, goWithinCutoff, iINFO(), int32, iout, j, NAMD_die(), StringList::next, PDB::num_atoms(), numGoAtoms, and Real.

Referenced by NamdState::configListInit().

00584 {
00585   DebugM(3,"->build_go_sigmas" << std::endl);
00586   PDB *goPDB;      //  Pointer to PDB object to use
00587   int bcol = 4;      //  Column that data is in
00588   int32 chainType = 0;      //  b value from PDB file
00589   int i;         //  Loop counter
00590   int j;         //  Loop counter
00591   int resid1;    //  Residue ID for first atom
00592   int resid2;    //  Residue ID for second atom
00593   int residDiff;     //  Difference between resid1 and resid2
00594   Real sigma;    //  Sigma calculated for a Go atom pair
00595   Real atomAtomDist;     //  Distance between two atoms
00596   Real exp_a;            //  First exponent in L-J like formula
00597   Real exp_b;            //  Second exponent in L-J like formula
00598   char filename[129];    //  Filename
00599   
00600   //JLai
00601   BigReal nativeEnergy, *native;
00602   BigReal nonnativeEnergy, *nonnative;
00603   nativeEnergy = 0;
00604   nonnativeEnergy = 0;
00605   native = &nativeEnergy;
00606   nonnative = &nonnativeEnergy;
00607 
00608   long nativeContacts = 0;
00609   long nonnativeContacts = 0;
00610 
00611   //  Get the PDB object that contains the Go coordinates.  If
00612   //  the user gave another file name, use it.  Otherwise, just use
00613   //  the PDB file that has the initial coordinates.  
00614   if (goCoordFile == NULL)
00615     {
00616       //goPDB = initial_pdb;
00617       NAMD_die("Error: goCoordFile is NULL - build_go_sigmas");
00618     }
00619   else
00620   {
00621     if (goCoordFile->next != NULL)
00622       {
00623         NAMD_die("Multiple definitions of Go atoms PDB file in configuration file");
00624       }
00625     
00626     if ( (cwd == NULL) || (goCoordFile->data[0] == '/') )
00627       {
00628         strcpy(filename, goCoordFile->data);
00629       }
00630     else
00631       {
00632         strcpy(filename, cwd);
00633         strcat(filename, goCoordFile->data);
00634       }
00635     
00636     goPDB = new PDB(filename);
00637     if ( goPDB == NULL )
00638       {
00639         NAMD_die("Memory allocation failed in Molecule::build_go_sigmas");
00640       }
00641     
00642     if (goPDB->num_atoms() != numAtoms)
00643       {
00644         NAMD_die("Number of atoms in fixed atoms PDB doesn't match coordinate PDB");
00645       }
00646   }
00647   //  Allocate the array to hold the chain types
00648   atomChainTypes = new int32[numAtoms];
00649   //  Allocate the array to hold Go atom indices into the sigma array
00650   goSigmaIndices = new int32[numAtoms];
00651   
00652   if (atomChainTypes == NULL) {
00653     NAMD_die("memory allocation failed in Molecule::build_go_sigmas");
00654   }
00655   
00656   numGoAtoms = 0;
00657   
00658   //  Loop through all the atoms and get the Go chain types
00659   for (i=0; i<numAtoms; i++) {
00660     //  Get the chainType from the occupancy field
00661     chainType = (int32)(goPDB->atom(i))->occupancy();
00662     //  Assign the chainType value
00663     if ( chainType != 0 ) {
00664       //DebugM(3,"build_go_sigmas - atom:" << i << ", chainType:" << chainType << std::endl);
00665       atomChainTypes[i] = chainType;
00666       goSigmaIndices[i] = numGoAtoms;
00667       numGoAtoms++;
00668     }
00669     else {
00670       atomChainTypes[i] = 0;
00671       goSigmaIndices[i] = -1;
00672     }
00673     //printf("CT: %d %d %d %d\n",i,numGoAtoms,atomChainTypes[i],goSigmaIndices[i]);
00674   }
00675 
00676   // Allocate the array to hold the sigma values for each Go atom pair
00677   goSigmas = new Real[numGoAtoms*numGoAtoms];
00678   goWithinCutoff = new bool[numGoAtoms*numGoAtoms];
00679   for (i=0; i<numGoAtoms; i++) {
00680     for (j=0; j<numGoAtoms; j++) {
00681       goSigmas[i*numGoAtoms + j] = -1.0;
00682       goWithinCutoff[i*numGoAtoms + j] = false;
00683     }
00684   }
00685   //  Loop through all atom pairs and calculate sigmas
00686   DebugM(3,"    numAtoms=" << numAtoms << std::endl);
00687   for (i=0; i<numAtoms; i++) {
00688     //DebugM(3,"    i=" << i << std::endl);
00689     resid1 = (goPDB->atom(i))->residueseq();
00690     //DebugM(3,"    resid1=" << resid1 << std::endl);
00691     //if ( goSigmaIndices[i] != -1) {
00692     //  goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[i]] = 0.0;
00693     //}
00694      for (j=i+1; j<numAtoms; j++) {
00695       //DebugM(3,"    j=" << j << std::endl);
00696       resid2 = (goPDB->atom(j))->residueseq();
00697       //printf("GSIi %d %d %d\n",i,numAtoms,goSigmaIndices[i]);
00698       //printf("SAN CHECK: %d\n",goSigmaIndices[37]);
00699       //printf("GSIj %d %d %d\n",j,numAtoms,goSigmaIndices[j]);
00700       //printf("ATOMS_1to4 %d\n",!atoms_1to4(i,j));
00701       //DebugM(3,"    resid2=" << resid2 << std::endl);
00702       //  if goSigmaIndices aren't defined, don't set anything in goSigmas
00703       if ( goSigmaIndices[i] != -1 && goSigmaIndices[j] != -1 && !atoms_1to4(i,j) ) {
00704         //printf("TAKING DIFFERENCE\n");
00705         residDiff = resid2 - resid1;
00706         //printf("RESIDDIFF %d\n",residDiff);
00707         if (residDiff < 0) residDiff = -residDiff;
00708         //printf("RESIDDIFF2 %d\n",residDiff);
00709         //  if this is a Go atom pair that is not restricted
00710         //    calculate sigma
00711         //  sigmas are initially set to -1.0 if the atom pair fails go_restricted
00712         //printf("CHECKING LOOPING\n");
00713         if ( atomChainTypes[i] && atomChainTypes[j] &&
00714              !(this->go_restricted(atomChainTypes[i],atomChainTypes[j],residDiff)) ) {
00715           atomAtomDist = sqrt(pow((goPDB->atom(i))->xcoor() - (goPDB->atom(j))->xcoor(), 2.0) +
00716                               pow((goPDB->atom(i))->ycoor() - (goPDB->atom(j))->ycoor(), 2.0) +
00717                               pow((goPDB->atom(i))->zcoor() - (goPDB->atom(j))->zcoor(), 2.0));
00718           if ( atomAtomDist <= this->get_go_cutoff(atomChainTypes[i],atomChainTypes[j]) ) {
00719             exp_a = this->get_go_exp_a(atomChainTypes[i],atomChainTypes[j]);
00720             exp_b = this->get_go_exp_b(atomChainTypes[i],atomChainTypes[j]);
00721             sigma = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
00722             goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[j]] = sigma;
00723             goSigmas[goSigmaIndices[j]*numGoAtoms + goSigmaIndices[i]] = sigma;
00724             goWithinCutoff[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[j]] = true;
00725             goWithinCutoff[goSigmaIndices[j]*numGoAtoms + goSigmaIndices[i]] = true;
00726             nativeContacts++;
00727             //get_go_force(atomAtomDist, i, j, native, nonnative);
00728             //energyNative += nativeEnergy;
00729             //energyNonnative += nonnativeEnergy;
00730           } else {
00731             goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[j]] = 0.0;
00732             goSigmas[goSigmaIndices[j]*numGoAtoms + goSigmaIndices[i]] = 0.0;
00733             nonnativeContacts++;
00734             //get_go_force(atomAtomDist, i, j, native, nonnative);
00735             //energyNative += nativeEnergy;
00736             //energyNonnative += nonnativeEnergy;    
00737           }
00738         } else {
00739           goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[j]] = -1.0;
00740           goSigmas[goSigmaIndices[j]*numGoAtoms + goSigmaIndices[i]] = -1.0;
00741         }
00742       } 
00743     }
00744   }
00745 
00746   iout << iINFO << "Number of UNIQUE    native contacts: " << nativeContacts << "\n" << endi;
00747   iout << iINFO << "Number of UNIQUE nonnative contacts: " << nonnativeContacts << "\n" << endi;
00748   
00749   //  If we had to create a PDB object, delete it now
00750   if (goCoordFile != NULL) {
00751     delete goPDB;
00752   }
00753   
00754   return;
00755 }

void Molecule::build_gridforce_params StringList ,
StringList ,
StringList ,
StringList ,
PDB ,
char * 
 

Definition at line 5546 of file Molecule.C.

References PDB::atom(), DebugM, endi(), MGridforceParamsList::get_first(), GridforceGrid::get_total_grids(), MGridforceParams::gridforceCol, MGridforceParams::gridforceFile, MGridforceParams::gridforceQcol, MGridforceParams::gridforceVfile, int32, iout, iWARN(), SimParameters::mgridforcelist, NAMD_die(), GridforceGrid::new_grid(), MGridforceParams::next, PDB::num_atoms(), numGridforceGrids, numGridforces, and Real.

Referenced by NamdState::configListInit().

05552 {
05553     PDB *kPDB;
05554     register int i;             //  Loop counters
05555     register int j;
05556     register int k;
05557 
05558     DebugM(3,  "Entered build_gridforce_params multi...\n");
05559 //     DebugM(3, "\tgridfrcfile = " << gridfrcfile->data << endi);
05560 //     DebugM(3, "\tgridfrccol = " << gridfrccol->data << endi);
05561     
05562     MGridforceParams* mgridParams = simParams->mgridforcelist.get_first();
05563     numGridforceGrids = 0;
05564     while (mgridParams != NULL) {
05565         numGridforceGrids++;
05566         mgridParams = mgridParams->next;
05567     }
05568     
05569     DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
05570     gridfrcIndexes = new int32*[numGridforceGrids];
05571     gridfrcParams = new GridforceParams*[numGridforceGrids];
05572     gridfrcGrid = new GridforceGrid*[numGridforceGrids];
05573     numGridforces = new int[numGridforceGrids];
05574     
05575     int grandTotalGrids = 0;    // including all subgrids
05576     
05577     mgridParams = simParams->mgridforcelist.get_first();
05578     for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
05579         int current_index=0;    //  Index into values used
05580         int kcol = 5;           //  Column to look for force constant in
05581         int qcol = 0;           //  Column for charge (default 0: use electric charge)
05582         Real kval = 0;          //  Force constant value retreived
05583         char filename[129];     //  PDB filename
05584         char potfilename[129];  //  Potential file name
05585         
05586         if (mgridParams == NULL) {
05587             NAMD_die("Problem with mgridParams!");
05588         }
05589         
05590         // Now load values from mgridforcelist object
05591         if (mgridParams->gridforceFile == NULL)
05592         {
05593             kPDB = initial_pdb;
05594         }
05595         else
05596         {
05597             DebugM(4, "mgridParams->gridforceFile = " << mgridParams->gridforceFile << "\n" << endi);
05598             
05599             if ( (cwd == NULL) || (mgridParams->gridforceFile[0] == '/') )
05600             {
05601                 strcpy(filename, mgridParams->gridforceFile);
05602             }
05603             else
05604             {
05605                 strcpy(filename, cwd);
05606                 strcat(filename, mgridParams->gridforceFile);
05607             }
05608         
05609             kPDB = new PDB(filename);
05610             if ( kPDB == NULL )
05611             {
05612                 NAMD_die("Memory allocation failed in Molecule::build_gridforce_params");
05613             }
05614            
05615             if (kPDB->num_atoms() != numAtoms)
05616             {
05617                 NAMD_die("Number of atoms in grid force PDB doesn't match coordinate PDB");
05618             }
05619         }
05620 
05621         //  Get the column that the force constant is going to be in.  It
05622         //  can be in any of the 5 floating point fields in the PDB, according
05623         //  to what the user wants.  The allowable fields are X, Y, Z, O, or
05624         //  B which correspond to the 1st, 2nd, ... 5th floating point fields.
05625         //  The default is the 5th field, which is beta (temperature factor)
05626         if (mgridParams->gridforceCol == NULL)
05627         {
05628             kcol = 5;
05629         }
05630         else
05631         {
05632             if (strcasecmp(mgridParams->gridforceCol, "X") == 0)
05633             {
05634                 kcol=1;
05635             }
05636             else if (strcasecmp(mgridParams->gridforceCol, "Y") == 0)
05637             {
05638                 kcol=2;
05639             }
05640             else if (strcasecmp(mgridParams->gridforceCol, "Z") == 0)
05641             {
05642                 kcol=3;
05643             }
05644             else if (strcasecmp(mgridParams->gridforceCol, "O") == 0)
05645             {
05646                 kcol=4;
05647             }
05648             else if (strcasecmp(mgridParams->gridforceCol, "B") == 0)
05649             {
05650                 kcol=5;
05651             }
05652             else
05653             {
05654                 NAMD_die("gridforcecol must have value of X, Y, Z, O, or B");
05655             }
05656         }
05657     
05658         //  Get the column that the charge is going to be in.
05659         if (mgridParams->gridforceQcol == NULL)
05660         {
05661             qcol = 0;   // Default: don't read charge from file, use electric charge
05662         }
05663         else
05664         {
05665             if (strcasecmp(mgridParams->gridforceQcol, "X") == 0)
05666             {
05667                 qcol=1;
05668             }
05669             else if (strcasecmp(mgridParams->gridforceQcol, "Y") == 0)
05670             {
05671                 qcol=2;
05672             }
05673             else if (strcasecmp(mgridParams->gridforceQcol, "Z") == 0)
05674             {
05675                 qcol=3;
05676             }
05677             else if (strcasecmp(mgridParams->gridforceQcol, "O") == 0)
05678             {
05679                 qcol=4;
05680             }
05681             else if (strcasecmp(mgridParams->gridforceQcol, "B") == 0)
05682             {
05683                 qcol=5;
05684             }
05685             else
05686             {
05687                 NAMD_die("gridforcechargecol must have value of X, Y, Z, O, or B");
05688             }
05689         }
05690     
05691         if (kcol == qcol) {
05692             NAMD_die("gridforcecol and gridforcechargecol cannot have same value");
05693         }
05694 
05695     
05696         //  Allocate an array that will store an index into the constraint
05697         //  parameters for each atom.  If the atom is not constrained, its
05698         //  value will be set to -1 in this array.
05699         gridfrcIndexes[gridnum] = new int32[numAtoms];
05700        
05701         if (gridfrcIndexes[gridnum] == NULL)
05702         {
05703             NAMD_die("memory allocation failed in Molecule::build_gridforce_params()");
05704         }
05705         
05706         //  Loop through all the atoms and find out which ones are constrained
05707         for (i=0; i<numAtoms; i++)
05708         {
05709             //  Get the k value based on where we were told to find it
05710             switch (kcol)
05711             {
05712             case 1:
05713                 kval = (kPDB->atom(i))->xcoor();
05714                 break;
05715             case 2:
05716                 kval = (kPDB->atom(i))->ycoor();
05717                 break;
05718             case 3:
05719                 kval = (kPDB->atom(i))->zcoor();
05720                 break;
05721             case 4:
05722                 kval = (kPDB->atom(i))->occupancy();
05723                 break;
05724             case 5:
05725                 kval = (kPDB->atom(i))->temperaturefactor();
05726                 break;
05727             }
05728            
05729             if (kval > 0.0)
05730             {
05731                 //  This atom is constrained
05732                 gridfrcIndexes[gridnum][i] = current_index;
05733                 current_index++;
05734             }
05735             else
05736             {
05737                 //  This atom is not constrained
05738                 gridfrcIndexes[gridnum][i] = -1;
05739             }
05740         }
05741     
05742         if (current_index == 0)
05743         {
05744             //  Constraints were turned on, but there weren't really any constrained
05745             iout << iWARN << "NO GRIDFORCE ATOMS WERE FOUND, BUT GRIDFORCE IS ON . . .\n" << endi;
05746         }
05747         else
05748         {
05749             //  Allocate an array to hold the constraint parameters
05750             gridfrcParams[gridnum] = new GridforceParams[current_index];
05751             if (gridfrcParams[gridnum] == NULL)
05752             {
05753                 NAMD_die("memory allocation failed in Molecule::build_gridforce_params");
05754             }
05755         }
05756     
05757         numGridforces[gridnum] = current_index;
05758 
05759         //  Loop through all the atoms and assign the parameters for those
05760         //  that are constrained
05761         for (i=0; i<numAtoms; i++)
05762         {
05763             if (gridfrcIndexes[gridnum][i] != -1)
05764             {
05765                 //  This atom has grid force, so get the k value again
05766                 switch (kcol)
05767                 {
05768                 case 1:
05769                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->xcoor();
05770                     break;
05771                 case 2:
05772                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->ycoor();
05773                     break;
05774                 case 3:
05775                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->zcoor();
05776                     break;
05777                 case 4:
05778                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->occupancy();
05779                     break;
05780                 case 5:
05781                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].k = (kPDB->atom(i))->temperaturefactor();
05782                     break;
05783                 }
05784             
05785                 //  Also get charge column
05786                 switch (qcol)
05787                 {
05788                 case 0:
05789 #ifdef MEM_OPT_VERSION
05790                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atomChargePool[eachAtomCharge[i]];
05791 #else
05792                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = atoms[i].charge;
05793 #endif
05794                     break;
05795                 case 1:
05796                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->xcoor();
05797                     break;
05798                 case 2:
05799                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->ycoor();
05800                     break;
05801                 case 3:
05802                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->zcoor();
05803                     break;
05804                 case 4:
05805                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->occupancy();
05806                     break;
05807                 case 5:
05808                     gridfrcParams[gridnum][gridfrcIndexes[gridnum][i]].q = (kPDB->atom(i))->temperaturefactor();
05809                     break;
05810                 }
05811             }
05812         }
05813        
05814         //  If we had to create new PDB objects, delete them now
05815         if (mgridParams->gridforceFile != NULL)
05816         {
05817             delete kPDB;
05818         }
05819     
05820         //  Now we fill in our grid information
05821     
05822         // Open potential file
05823         if ( (cwd == NULL) || (mgridParams->gridforceVfile[0] == '/') )
05824         {
05825             strcpy(potfilename, mgridParams->gridforceVfile);
05826         }
05827         else
05828         {
05829             strcpy(potfilename, cwd);
05830             strcat(potfilename, mgridParams->gridforceVfile);
05831         }
05832     
05833 //        iout << iINFO << "Allocating grid " << gridnum
05834 //             << "\n" << endi;
05835         
05836         DebugM(3, "allocating GridforceGrid(" << gridnum << ")\n");
05837         gridfrcGrid[gridnum] = GridforceGrid::new_grid(gridnum, potfilename, simParams, mgridParams);
05838         
05839         grandTotalGrids += gridfrcGrid[gridnum]->get_total_grids();
05840         DebugM(4, "grandTotalGrids = " << grandTotalGrids << "\n" << endi);
05841         
05842         // Finally, get next mgridParams pointer
05843         mgridParams = mgridParams->next;
05844     }
05845 }

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

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

int Molecule::checkexcl int  atom1,
int  atom2
const
 

void Molecule::delete_alch_bonded void   ) 
 

Referenced by NamdState::configListInit().

void Molecule::freeBFactorData  )  [inline]
 

Definition at line 703 of file Molecule.h.

Referenced by NamdState::configListInit().

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

void Molecule::freeOccupancyData  )  [inline]
 

Definition at line 699 of file Molecule.h.

Referenced by NamdState::configListInit().

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

Bond* Molecule::get_acceptor int  dnum  )  const [inline]
 

Definition at line 774 of file Molecule.h.

References Bond.

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

Angle* Molecule::get_angle int  anum  )  const [inline]
 

Definition at line 737 of file Molecule.h.

References Angle.

Referenced by atoms_1to4(), and dumpbench().

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

int32* Molecule::get_angles_for_atom int  anum  )  [inline]
 

Definition at line 816 of file Molecule.h.

References int32.

Referenced by atoms_1to4(), and dumpbench().

00817       { return anglesByAtom[anum]; }

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

Definition at line 165 of file Molecule.C.

References ResidueLookupElem::lookup(), and NAMD_die().

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

00166                                                        {
00167 
00168   if (atomNames == NULL || resLookup == NULL)
00169   {
00170     NAMD_die("Tried to find atom from name on node other than node 0");
00171   }
00172   int i = 0;
00173   int end = 0;
00174   if ( resLookup->lookup(segid,resid,&i,&end) ) return -1;
00175   if ( index >= 0 && index < ( end - i ) ) return ( index + i );
00176   return -1;
00177 }

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

Definition at line 128 of file Molecule.C.

References atomNamePool, Index, ResidueLookupElem::lookup(), and NAMD_die().

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

00129                                                                {
00130 
00131   if (atomNames == NULL || resLookup == NULL)
00132   {
00133     NAMD_die("Tried to find atom from name on node other than node 0");
00134   }
00135 
00136   int i = 0;
00137   int end = 0;
00138   if ( resLookup->lookup(segid,resid,&i,&end) ) return -1;
00139   for ( ; i < end; ++i ) {
00140     #ifdef MEM_OPT_VERSION    
00141     Index idx = atomNames[i].atomnameIdx;
00142     if(!strcasecmp(aname, atomNamePool[idx])) return i;
00143     #else
00144     if ( ! strcasecmp(aname,atomNames[i].atomname) ) return i;
00145     #endif
00146   }
00147   return -1;
00148 }

const char* Molecule::get_atomtype int  anum  )  const [inline]
 

Definition at line 785 of file Molecule.h.

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

00786   {
00787     if (atomNames == NULL)
00788     {
00789       NAMD_die("Tried to find atom type on node other than node 0");
00790     }
00791 
00792     #ifdef MEM_OPT_VERSION    
00793     return atomTypePool[atomNames[anum].atomtypeIdx];
00794     #else
00795     return(atomNames[anum].atomtype);
00796     #endif
00797   }

Bond* Molecule::get_bond int  bnum  )  const [inline]
 

Definition at line 734 of file Molecule.h.

References Bond.

Referenced by atoms_1to4(), and dumpbench().

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

int32* Molecule::get_bonds_for_atom int  anum  )  [inline]
 

Definition at line 814 of file Molecule.h.

References int32.

Referenced by atoms_1to4(), and dumpbench().

00815       { return bondsByAtom[anum]; } 

int Molecule::get_cluster int  anum  )  const [inline]
 

Definition at line 692 of file Molecule.h.

Referenced by wrap_coor_int().

00692 { return cluster[anum]; }

int Molecule::get_clusterSize int  anum  )  const [inline]
 

Definition at line 693 of file Molecule.h.

Referenced by wrap_coor_int().

00693 { return clusterSize[anum]; }

void Molecule::get_cons_params Real k,
Vector refPos,
int  atomnum
const [inline]
 

Definition at line 928 of file Molecule.h.

Referenced by ComputeRestraints::doForce().

00929   {
00930     k = consParams[consIndexes[atomnum]].k;
00931     refPos = consParams[consIndexes[atomnum]].refPos;
00932   }

void Molecule::get_constorque_params BigReal v,
Vector a,
Vector p,
int  atomnum
const [inline]
 

Definition at line 1001 of file Molecule.h.

Referenced by ComputeConsTorque::doForce().

01003   {
01004     v = consTorqueParams[consTorqueIndexes[atomnum]].v;
01005     a = consTorqueParams[consTorqueIndexes[atomnum]].a;
01006     p = consTorqueParams[consTorqueIndexes[atomnum]].p;
01007   }

Crossterm* Molecule::get_crossterm int  inum  )  const [inline]
 

Definition at line 746 of file Molecule.h.

References Crossterm.

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

int32* Molecule::get_crossterms_for_atom int  anum  )  [inline]
 

Definition at line 822 of file Molecule.h.

References int32.

00823       { return crosstermsByAtom[anum]; }  

Dihedral* Molecule::get_dihedral int  dnum  )  const [inline]
 

Definition at line 743 of file Molecule.h.

References Dihedral.

Referenced by atoms_1to4(), and dumpbench().

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

int32* Molecule::get_dihedrals_for_atom int  anum  )  [inline]
 

Definition at line 818 of file Molecule.h.

References int32.

Referenced by atoms_1to4(), and dumpbench().

00819       { return dihedralsByAtom[anum]; }

Bond* Molecule::get_donor int  dnum  )  const [inline]
 

Definition at line 771 of file Molecule.h.

References Bond.

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

const ExclusionCheck* Molecule::get_excl_check_for_atom int  anum  )  const [inline]
 

Definition at line 842 of file Molecule.h.

Referenced by dumpbench().

00842                                                                {      
00843       return &all_exclusions[anum];             
00844   }

Exclusion* Molecule::get_exclusion int  ex  )  const [inline]
 

Definition at line 781 of file Molecule.h.

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

int32* Molecule::get_exclusions_for_atom int  anum  )  [inline]
 

Definition at line 824 of file Molecule.h.

References int32.

00825       { return exclusionsByAtom[anum]; }

unsigned char Molecule::get_fep_type int  anum  )  const [inline]
 

Definition at line 1010 of file Molecule.h.

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

01011         {
01012                 return(fepAtomFlags[anum]);
01013         }

const int32* Molecule::get_full_exclusions_for_atom int  anum  )  const [inline]
 

Definition at line 826 of file Molecule.h.

References int32.

Referenced by ComputeNonbondedCUDA::build_exclusions(), and ComputeNonbondedCUDA::finishWork().

00827       { return fullExclusionsByAtom[anum]; }

Real Molecule::get_go_cutoff int  chain1,
int  chain2
[inline]
 

Definition at line 1202 of file Molecule.h.

References go_val::cutoff, MAX_GO_CHAINS, and Real.

Referenced by build_go_arrays(), and build_go_sigmas().

01202 { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };

BigReal Molecule::get_go_energy_new BigReal  ,
int  ,
int 
const
 

Definition at line 1198 of file GoMolecule.C.

References atomChainTypes, BigReal, DebugM, goCoordinates, goResids, goSigmaIndices, int32, and Real.

01201 {
01202   int resid1;
01203   int resid2;
01204   int residDiff;
01205   Real xcoorDiff;
01206   Real ycoorDiff;
01207   Real zcoorDiff;
01208   Real atomAtomDist;
01209   Real exp_a;
01210   Real exp_b;
01211   Real sigma_ij;
01212   Real epsilon;
01213   Real epsilonRep;
01214   Real sigmaRep;
01215     
01216   BigReal goEnergy= 0.0;
01217 
01218   //  determine which Go chain pair we are working with
01219   DebugM(3,"get_go_energy - (" << atom1 << "," << atom2 << ")" << std::endl);
01220   int goIndex1 = goSigmaIndices[atom1];
01221   int goIndex2 = goSigmaIndices[atom2];
01222 
01223   int32 chain1 = atomChainTypes[goIndex1];
01224   int32 chain2 = atomChainTypes[goIndex2];
01225 
01226   DebugM(3,"  chain1:" << chain1 << ", chain2:" << chain2 << std::endl);
01227   if (chain1 == 0 || chain2 == 0)  return 0.0;
01228 
01229   //  retrieve Go cutoff for this chain pair
01230   Real goCutoff = const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2);
01231   DebugM(3,"  goCutoff:" << goCutoff << std::endl);
01232   if (goCutoff == 0)  return 0.0;
01233 
01234   //  sigmas are initially set to -1.0 if the atom pair fails go_restricted
01235   //  no goSigmas array anymore
01236   //Real sigma_ij = goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]];
01237 
01238   // XXX - used to be a condition for the following if
01239   //if the atoms are within 4 of each other
01240   //if ( !atoms_1to4(atom1,atom2) ) {
01241 
01242   //  if goSigmaIndices aren't defined, don't calculate energies
01243   if ( goIndex1 != -1 && goIndex2 != -1 ) {
01244     resid1 = goResids[goIndex1];
01245     resid2 = goResids[goIndex2];
01246     residDiff = resid2 - resid1;
01247     if (residDiff < 0) residDiff = -residDiff;
01248     //  if this is a Go atom pair that is not restricted
01249     if ( !(const_cast<Molecule*>(this)->go_restricted(chain1,chain2,residDiff)) ) {
01250       xcoorDiff = goCoordinates[goIndex1*3] - goCoordinates[goIndex2*3];
01251       ycoorDiff = goCoordinates[goIndex1*3 + 1] - goCoordinates[goIndex2*3 + 1];
01252       zcoorDiff = goCoordinates[goIndex1*3 + 2] - goCoordinates[goIndex2*3 + 2];
01253       atomAtomDist = sqrt(xcoorDiff*xcoorDiff + ycoorDiff*ycoorDiff + zcoorDiff*zcoorDiff);
01254 
01255       //  if attractive then calculate attractive
01256       if ( atomAtomDist <= const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2) ) {
01257         exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
01258         exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
01259         sigma_ij = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
01260         
01261         epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
01262         goEnergy = (4 * epsilon * ( pow(sigma_ij/r,static_cast<double>(exp_a)) -  pow(sigma_ij/r,static_cast<double>(exp_b)) ) ); // JLai I changed some of the expressions
01263         DebugM(3,"get_go_energy - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", exp_a:" << exp_a << ", exp_b:" << exp_b << ", sigma_ij:" << sigma_ij << ", r:" << r << ", goForce:" << goForce << std::endl);
01264       }
01265       
01266       //  if repulsive then calculate repulsive
01267       else {
01268         epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1,chain2);
01269         sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1,chain2);
01270         goEnergy = (4 * epsilonRep * pow(sigmaRep/r,12.0)); // JLai I changed some of the expressions
01271         DebugM(3,"get_go_energy - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", epsilonRep:" << epsilonRep << ", sigmaRep:" << sigmaRep << ", r:" << r << ", goForce:" << goForce << std::endl);
01272       }
01273     }
01274   }
01275   
01276   //DebugM(3,"goForce:" << goForce << std::endl);
01277   return goEnergy;
01278 }

Real Molecule::get_go_epsilon int  chain1,
int  chain2
[inline]
 

Definition at line 1211 of file Molecule.h.

References go_val::epsilon, MAX_GO_CHAINS, and Real.

01211 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };

Real Molecule::get_go_epsilonRep int  chain1,
int  chain2
[inline]
 

Definition at line 1205 of file Molecule.h.

References go_val::epsilonRep, MAX_GO_CHAINS, and Real.

01205 { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };

int Molecule::get_go_exp_a int  chain1,
int  chain2
[inline]
 

Definition at line 1214 of file Molecule.h.

References go_val::exp_a, and MAX_GO_CHAINS.

Referenced by build_go_sigmas().

01214 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };

int Molecule::get_go_exp_b int  chain1,
int  chain2
[inline]
 

Definition at line 1217 of file Molecule.h.

References go_val::exp_b, and MAX_GO_CHAINS.

Referenced by build_go_sigmas().

01217 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };

int Molecule::get_go_exp_rep int  chain1,
int  chain2
[inline]
 

Definition at line 1220 of file Molecule.h.

References go_val::exp_rep, and MAX_GO_CHAINS.

01220 { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };

BigReal Molecule::get_go_force BigReal  ,
int  ,
int  ,
BigReal ,
BigReal
const
 

Definition at line 1002 of file GoMolecule.C.

References atomChainTypes, BigReal, goSigmaIndices, goSigmas, goWithinCutoff, int32, numGoAtoms, and Real.

01007 {
01008   //BigReal scaleFactor = 1.0/r;
01009   BigReal goForce = 0.0;
01010   Real pow1;
01011   Real pow2;
01012   //  determine which Go chain pair we are working with
01013   //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ")" << std::endl);
01014   int32 chain1 = atomChainTypes[atom1];
01015   int32 chain2 = atomChainTypes[atom2];
01016 
01017   //DebugM(3,"  chain1:" << chain1 << ", chain2:" << chain2 << std::endl);
01018   if (chain1 == 0 || chain2 == 0)  return 0.0;
01019 
01020   //  retrieve Go cutoff for this chain pair
01021   //TMP// JLai -- I'm going to replace this with a constant accessor.  This is just a temporary thing
01022   Real goCutoff = const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2);
01023   //DebugM(3,"  goCutoff:" << goCutoff << std::endl);
01024   if (goCutoff == 0)  return 0.0;
01025   //  if repulsive then calculate repulsive
01026   //  sigmas are initially set to -1.0 if the atom pair fails go_restricted
01027   if (goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]] != -1.0) {
01028     if (!goWithinCutoff[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]]) {
01029       Real epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1,chain2);
01030       Real sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1,chain2);
01031       int exp_rep = const_cast<Molecule*>(this)->get_go_exp_rep(chain1,chain2);
01032       pow1 = pow(sigmaRep/r,exp_rep);
01033       goForce = ((12.0/r) * epsilonRep * pow1);
01034       *goNative = 0;
01035       *goNonnative = (4 * epsilonRep * pow1 );
01036       //printf("ATOM " + atom1 + " " +  atom2);
01037       //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", epsilonRep:" << epsilonRep << ", sigmaRep:" << sigmaRep << ", r:" << r << ", goForce:" << goForce << std::endl);
01038     }
01039     //  if attractive then calculate attractive
01040     else {
01041       int goSigmaIndex1 = goSigmaIndices[atom1];
01042       int goSigmaIndex2 = goSigmaIndices[atom2];
01043       if (goSigmaIndex1 != -1 && goSigmaIndex2 != -1) {
01044         Real epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
01045         int exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
01046         int exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
01047         Real sigma_ij = goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]];
01048         //goEnergy = (4 * epsilon * ( pow(sigma_ij/r,exp_a) - pow(sigma_ij/r,exp_b) )) / (r * scaleFactor);
01049         // Positive gradient of potential, not negative gradient of potential
01050         pow1 = pow(sigma_ij/r,exp_a);
01051         pow2 = pow(sigma_ij/r,exp_b);
01052         goForce = ((4/r) * epsilon * (exp_a * pow1 - exp_b * pow2));
01053         //Real sigmaRep = this->get_go_sigmaRep(chain1,chain2);
01054         //goForce = ((4/r) * epsilon * (exp_a * pow(sigmaRep/r,exp_a) - exp_b * pow(sigmaRep/r,exp_b)));
01055         //DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", sigma_ij:" << sigma_ij << ", r:" << r << ", goForce:" << goForce << std::endl);
01056         *goNative = (4 * epsilon * ( pow1 -  pow2 ) );
01057         *goNonnative = 0;
01058       }
01059     }
01060   }
01061   //DebugM(3,"goForce:" << goForce << std::endl);
01062   return goForce;
01063 }

BigReal Molecule::get_go_force_new BigReal  ,
int  ,
int  ,
BigReal ,
BigReal
const
 

Definition at line 1081 of file GoMolecule.C.

References atomChainTypes, BigReal, DebugM, goCoordinates, goResids, goSigmaIndices, int32, and Real.

01086 {
01087   int resid1;
01088   int resid2;
01089   int residDiff;
01090   Real xcoorDiff;
01091   Real ycoorDiff;
01092   Real zcoorDiff;
01093   Real atomAtomDist;
01094   Real exp_a;
01095   Real exp_b;
01096   Real sigma_ij;
01097   Real epsilon;
01098   Real epsilonRep;
01099   Real sigmaRep;
01100   Real pow1;
01101   Real pow2;
01102   
01103   BigReal goForce = 0.0;
01104   *goNative = 0;
01105   *goNonnative = 0;
01106 
01107   //  determine which Go chain pair we are working with
01108   DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ")" << std::endl);
01109   int goIndex1 = goSigmaIndices[atom1];
01110   int goIndex2 = goSigmaIndices[atom2];
01111 
01112   int32 chain1 = atomChainTypes[goIndex1];
01113   int32 chain2 = atomChainTypes[goIndex2];
01114 
01115   DebugM(3,"  chain1:" << chain1 << ", chain2:" << chain2 << std::endl);
01116   if (chain1 == 0 || chain2 == 0)  return 0.0;
01117 
01118   //  retrieve Go cutoff for this chain pair
01119   Real goCutoff = const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2);
01120   DebugM(3,"  goCutoff:" << goCutoff << std::endl);
01121   if (goCutoff == 0)  return 0.0;
01122 
01123   //  sigmas are initially set to -1.0 if the atom pair fails go_restricted
01124   //  no goSigmas array anymore
01125   //Real sigma_ij = goSigmas[goSigmaIndices[atom1]*numGoAtoms + goSigmaIndices[atom2]];
01126 
01127   // XXX - used to be a condition for the following if
01128   //if the atoms are within 4 of each other
01129   //if ( !atoms_1to4(atom1,atom2) ) {
01130 
01131   //  if goSigmaIndices aren't defined, don't calculate forces
01132   if ( goIndex1 != -1 && goIndex2 != -1 ) {
01133     resid1 = goResids[goIndex1];
01134     resid2 = goResids[goIndex2];
01135     residDiff = resid2 - resid1;
01136     if (residDiff < 0) residDiff = -residDiff;
01137     //  if this is a Go atom pair that is not restricted
01138     if ( !(const_cast<Molecule*>(this)->go_restricted(chain1,chain2,residDiff)) ) {
01139       xcoorDiff = goCoordinates[goIndex1*3] - goCoordinates[goIndex2*3];
01140       ycoorDiff = goCoordinates[goIndex1*3 + 1] - goCoordinates[goIndex2*3 + 1];
01141       zcoorDiff = goCoordinates[goIndex1*3 + 2] - goCoordinates[goIndex2*3 + 2];
01142       atomAtomDist = sqrt(xcoorDiff*xcoorDiff + ycoorDiff*ycoorDiff + zcoorDiff*zcoorDiff);
01143       
01144       //  if attractive then calculate attractive
01145       if ( atomAtomDist <= const_cast<Molecule*>(this)->get_go_cutoff(chain1,chain2) ) {
01146         exp_a = const_cast<Molecule*>(this)->get_go_exp_a(chain1,chain2);
01147         exp_b = const_cast<Molecule*>(this)->get_go_exp_b(chain1,chain2);
01148         sigma_ij = pow(static_cast<double>(exp_b/exp_a),(1.0/(exp_a-exp_b))) * atomAtomDist;
01149         
01150         // [JLai] print out atoms involved in native contacts
01151         // printf("ATOM1: %d C1: %d ATOM2: %d C2: %d\n", atom1,chain1,atom2,chain2);
01152 
01153         epsilon = const_cast<Molecule*>(this)->get_go_epsilon(chain1,chain2);
01154         pow1 = pow(sigma_ij/r,static_cast<double>(exp_a));
01155         pow2 = pow(sigma_ij/r,static_cast<double>(exp_b));
01156         //goForce = ((4/r) * epsilon * (exp_a * pow(sigma_ij/r,exp_a) - exp_b * pow(sigma_ij/r,exp_b)));
01157         goForce = ((4/r) * epsilon * (exp_a * pow1 - exp_b * pow2));
01158         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);
01159         //goEnergy = (4 * epsilon * ( pow(sigma_ij/r,exp_a) -  pow(sigma_ij/r,exp_b) ) ); // JLai I changed some of the expressions
01160         *goNative = (4 * epsilon * ( pow1 -  pow2 ) ); 
01161         *goNonnative = 0;
01162       }
01163       
01164       //  if repulsive then calculate repulsive
01165       else {
01166         epsilonRep = const_cast<Molecule*>(this)->get_go_epsilonRep(chain1,chain2);
01167         sigmaRep = const_cast<Molecule*>(this)->get_go_sigmaRep(chain1,chain2);
01168         pow1 = pow(sigmaRep/r,12.0);
01169         //goForce = ((12.0/r) * epsilonRep * pow(sigmaRep/r,12.0));
01170         goForce = ((12.0/r) * epsilonRep * pow1);
01171         DebugM(3,"get_go_force - (" << atom1 << "," << atom2 << ") chain1:" << chain1 << ", chain2:" << chain2 << ", epsilonRep:" << epsilonRep << ", sigmaRep:" << sigmaRep << ", r:" << r << ", goForce:" << goForce << std::endl);
01172         //goEnergy = (4 * epsilonRep * pow(sigmaRep/r,12.0)); // JLai I changed some of the expressions
01173         *goNonnative = (4 * epsilonRep * pow1); 
01174         *goNative = 0;
01175       }
01176     }
01177   }
01178   
01179   //DebugM(3,"goForce:" << goForce << std::endl);
01180   return goForce;
01181 }

Real Molecule::get_go_sigmaRep int  chain1,
int  chain2
[inline]
 

Definition at line 1208 of file Molecule.h.

References MAX_GO_CHAINS, Real, and go_val::sigmaRep.

01208 { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };

GridforceGrid* Molecule::get_gridfrc_grid int  gridnum  )  const [inline]
 

Definition at line 941 of file Molecule.h.

Referenced by ComputeGridForce::doForce(), and Node::reloadGridforceGrid().

00942   {
00943       GridforceGrid *result = NULL;
00944       if (gridnum >= 0 && gridnum < numGridforceGrids) {
00945           result = gridfrcGrid[gridnum];
00946       }
00947       return result;
00948   }

void Molecule::get_gridfrc_params Real k,
Charge q,
int  atomnum,
int  gridnum
const [inline]
 

Definition at line 935 of file Molecule.h.

Referenced by ComputeGridForce::do_calc().

00936   {
00937       k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
00938       q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
00939   }

int Molecule::get_groupSize int   ) 
 

Improper* Molecule::get_improper int  inum  )  const [inline]
 

Definition at line 740 of file Molecule.h.

References Improper.

Referenced by dumpbench().

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

int32* Molecule::get_impropers_for_atom int  anum  )  [inline]
 

Definition at line 820 of file Molecule.h.

References int32.

Referenced by dumpbench().

00821       { return impropersByAtom[anum]; }  

Lphost* Molecule::get_lphost int  atomid  )  const [inline]
 

Definition at line 750 of file Molecule.h.

References Lphost.

00750                                        {
00751     // don't call unless simParams->drudeOn == TRUE
00752     // otherwise lphostIndexes array doesn't exist!
00753     int index = lphostIndexes[atomid];
00754     return (index != -1 ? &(lphosts[index]) : NULL);
00755   }

const int32* Molecule::get_mod_exclusions_for_atom int  anum  )  const [inline]
 

Definition at line 828 of file Molecule.h.

References int32.

00829       { return modExclusionsByAtom[anum]; }

int Molecule::get_mother_atom int   ) 
 

void Molecule::get_movdrag_params Vector v,
int  atomnum
const [inline]
 

Definition at line 986 of file Molecule.h.

Referenced by Sequencer::addMovDragToPosition().

00987   {
00988     v = movDragParams[movDragIndexes[atomnum]].v;
00989   }

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

Definition at line 151 of file Molecule.C.

References ResidueLookupElem::lookup(), and NAMD_die().

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

00152                                             {
00153 
00154   if (atomNames == NULL || resLookup == NULL)
00155   {
00156     NAMD_die("Tried to find atom from name on node other than node 0");
00157   }
00158   int i = 0;
00159   int end = 0;
00160   if ( resLookup->lookup(segid,resid,&i,&end) ) return 0;
00161   return ( end - i );
00162 }

void Molecule::get_rotdrag_params BigReal v,
Vector a,
Vector p,
int  atomnum
const [inline]
 

Definition at line 992 of file Molecule.h.

Referenced by Sequencer::addRotDragToPosition().

00994   {
00995     v = rotDragParams[rotDragIndexes[atomnum]].v;
00996     a = rotDragParams[rotDragIndexes[atomnum]].a;
00997     p = rotDragParams[rotDragIndexes[atomnum]].p;
00998   }

void Molecule::get_stir_refPos Vector refPos,
int  atomnum
const [inline]
 

Definition at line 967 of file Molecule.h.

00968   {
00969     refPos = stirParams[stirIndexes[atomnum]].refPos;
00970   }

Real Molecule::get_stir_startTheta int  atomnum  )  const [inline]
 

Definition at line 979 of file Molecule.h.

References Real.

Referenced by ComputeStir::doForce().

00980   {
00981     return stirParams[stirIndexes[atomnum]].startTheta;
00982   }

Bond* Molecule::getAllAcceptors  )  const [inline]
 

Definition at line 777 of file Molecule.h.

References Bond.

00777 {return acceptors;}

Angle* Molecule::getAllAngles  )  const [inline]
 

Definition at line 760 of file Molecule.h.

References Angle.

Referenced by buildAngleData().

00760 {return angles;}

Bond* Molecule::getAllBonds  )  const [inline]
 

Definition at line 759 of file Molecule.h.

References Bond.

Referenced by buildBondData().

00759 {return bonds;}

Crossterm* Molecule::getAllCrossterms  )  const [inline]
 

Definition at line 763 of file Molecule.h.

References Crossterm.

Referenced by buildCrosstermData().

00763 {return crossterms;}

Dihedral* Molecule::getAllDihedrals  )  const [inline]
 

Definition at line 762 of file Molecule.h.

References Dihedral.

Referenced by buildDihedralData().

00762 {return dihedrals;}

Bond* Molecule::getAllDonors  )  const [inline]
 

Definition at line 776 of file Molecule.h.

References Bond.

00776 {return donors;}

Improper* Molecule::getAllImpropers  )  const [inline]
 

Definition at line 761 of file Molecule.h.

References Improper.

Referenced by buildImproperData().

00761 {return impropers;}

Lphost* Molecule::getAllLphosts  )  const [inline]
 

Definition at line 767 of file Molecule.h.

References Lphost.

00767 { return lphosts; }

AtomNameInfo* Molecule::getAtomNames  )  const [inline]
 

Definition at line 423 of file Molecule.h.

References AtomNameInfo.

Referenced by buildAtomData().

00423 { return atomNames; }

Atom* Molecule::getAtoms  )  const [inline]
 

Definition at line 422 of file Molecule.h.

References Atom.

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

00422 { return atoms; }

AtomSegResInfo* Molecule::getAtomSegResInfo  )  const [inline]
 

Definition at line 426 of file Molecule.h.

References AtomSegResInfo.

Referenced by buildAtomData().

00426 { return atomSegResids; }

const float* Molecule::getBFactorData  )  [inline]
 

Definition at line 701 of file Molecule.h.

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

00701 { return (const float *)bfactor; }

int const* Molecule::getLcpoParamType  )  [inline]
 

Definition at line 414 of file Molecule.h.

Referenced by HomePatch::setLcpoType().

00414                                  {
00415     return lcpoParamType;
00416   }

const float* Molecule::getOccupancyData  )  [inline]
 

Definition at line 697 of file Molecule.h.

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

00697 { return (const float *)occupancy; }

Bool Molecule::go_restricted int  ,
int  ,
int 
 

Definition at line 520 of file GoMolecule.C.

References Bool, go_array, go_indices, MAX_GO_CHAINS, and go_val::restrictions.

Referenced by build_go_arrays(), and build_go_sigmas().

00521 {
00522   int i;      //  Loop counter
00523 
00524   for(i=0; i<MAX_RESTRICTIONS; i++) {
00525 #if CODE_REDUNDANT
00526     if (go_array[go_indices[chain1]*MAX_GO_CHAINS +
00527                  go_indices[chain2]].restrictions[i] == rDiff) {
00528       return TRUE;
00529     } else if (go_array[go_indices[chain1]*MAX_GO_CHAINS +
00530                         go_indices[chain2]].restrictions[i] == -1) {
00531       return FALSE;
00532     }
00533 #endif
00534     if (go_array[(MAX_GO_CHAINS*chain1) + chain2].restrictions[i]  == rDiff) {
00535       return TRUE;
00536     } else if (go_array[(MAX_GO_CHAINS*chain1) + chain2].restrictions[i] == -1) {
00537       return FALSE;
00538     }
00539   }
00540   return FALSE;
00541 }

void Molecule::goInit  ) 
 

Definition at line 54 of file GoMolecule.C.

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

00054                       {
00055   numGoAtoms=0;
00056   energyNative=0;
00057   energyNonnative=0;
00058   atomChainTypes=NULL;
00059   goSigmaIndices=NULL;
00060   goSigmas=NULL;
00061   goWithinCutoff=NULL;
00062   goCoordinates=NULL;
00063   goResids=NULL;
00064   goPDB=NULL;
00065 }

void Molecule::initialize  ) 
 

Referenced by Molecule().

Bool Molecule::is_atom_constorqued int  atomnum  )  const [inline]
 

Definition at line 913 of file Molecule.h.

References Bool.

00914   {
00915     if (numConsTorque)
00916     {
00917       //  Check the index to see if it is constrained
00918       return(consTorqueIndexes[atomnum] != -1);
00919     }
00920     else
00921     {
00922       //  No constraints at all, so just return FALSE
00923       return(FALSE);
00924     }
00925   }

Bool Molecule::is_atom_constrained int  atomnum  )  const [inline]
 

Definition at line 865 of file Molecule.h.

References Bool.

Referenced by ComputeRestraints::doForce().

00866   {
00867     if (numConstraints)
00868     {
00869       //  Check the index to see if it is constrained
00870       return(consIndexes[atomnum] != -1);
00871     }
00872     else
00873     {
00874       //  No constraints at all, so just return FALSE
00875       return(FALSE);
00876     }
00877   }

Bool Molecule::is_atom_exPressure int  atomnum  )  const [inline]
 

Definition at line 1051 of file Molecule.h.

References Bool.

Referenced by Sequencer::langevinPiston().

01052   {
01053     return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
01054   }

Bool Molecule::is_atom_fixed int  atomnum  )  const [inline]
 

Definition at line 1017 of file Molecule.h.

References Bool.

Referenced by WorkDistrib::createAtomLists().

01018   {
01019     return (numFixedAtoms && fixedAtomFlags[atomnum]);
01020   }

Bool Molecule::is_atom_gridforced int  atomnum,
int  gridnum
const [inline]
 

Definition at line 850 of file Molecule.h.

References Bool.

Referenced by ComputeGridForce::do_calc().

00851   {
00852       if (numGridforceGrids)
00853       {
00854           return(gridfrcIndexes[gridnum][atomnum] != -1);
00855       }
00856       else
00857       {
00858           return(FALSE);
00859       }
00860   }

Bool Molecule::is_atom_movdragged int  atomnum  )  const [inline]
 

Definition at line 881 of file Molecule.h.

References Bool.

Referenced by Sequencer::addMovDragToPosition().

00882   {
00883     if (numMovDrag)
00884     {
00885       //  Check the index to see if it is constrained
00886       return(movDragIndexes[atomnum] != -1);
00887     }
00888     else
00889     {
00890       //  No constraints at all, so just return FALSE
00891       return(FALSE);
00892     }
00893   }

Bool Molecule::is_atom_rotdragged int  atomnum  )  const [inline]
 

Definition at line 897 of file Molecule.h.

References Bool.

Referenced by Sequencer::addRotDragToPosition().

00898   {
00899     if (numRotDrag)
00900     {
00901       //  Check the index to see if it is constrained
00902       return(rotDragIndexes[atomnum] != -1);
00903     }
00904     else
00905     {
00906       //  No constraints at all, so just return FALSE
00907       return(FALSE);
00908     }
00909   }

Bool Molecule::is_atom_stirred int  atomnum  )  const [inline]
 

Definition at line 1032 of file Molecule.h.

References Bool.

Referenced by ComputeStir::doForce().

01033   {
01034     if (numStirredAtoms)
01035     {
01036       //  Check the index to see if it is constrained
01037       return(stirIndexes[atomnum] != -1);
01038     }
01039     else
01040     {
01041       //  No constraints at all, so just return FALSE
01042       return(FALSE);
01043     }
01044   }

Bool Molecule::is_drude int   ) 
 

Bool Molecule::is_group_fixed int  atomnum  )  const [inline]
 

Definition at line 1047 of file Molecule.h.

References Bool.

01048   {
01049     return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
01050   }

Bool Molecule::is_hydrogen int   ) 
 

Bool Molecule::is_hydrogenGroupParent int   ) 
 

Bool Molecule::is_lp int   ) 
 

Bool Molecule::is_oxygen int   ) 
 

Bool Molecule::is_water int   ) 
 

Referenced by outputCompressedFile(), and wrap_coor_int().

Real Molecule::langevin_param int  atomnum  )  const [inline]
 

Definition at line 961 of file Molecule.h.

References Real.

Referenced by WorkDistrib::createAtomLists().

00962   {
00963     return(langevinParams ? langevinParams[atomnum] : 0.);
00964   }

int Molecule::num_deg_freedom int  isInitialReport = 0  )  const [inline]
 

Definition at line 455 of file Molecule.h.

References SimParameters::comMove, SimParameters::fixedAtomsOn, SimParameters::langevinOn, SimParameters::pairInteractionOn, simParams, and SimParameters::watmodel.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), and Controller::receivePressure().

00455                                                      {
00456     // local variables prefixed by s_
00457     int s_NumDegFreedom = 3 * numAtoms;
00458     int s_NumFixedAtoms = num_fixed_atoms();
00459     if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
00460     if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
00461     if ( ! (s_NumFixedAtoms || numConstraints
00462           || simParams->comMove || simParams->langevinOn) ) {
00463       s_NumDegFreedom -= 3;
00464     }
00465     if ( ! isInitialReport && simParams->pairInteractionOn) {
00466       //
00467       // DJH: a kludge?  We want to initially report system degrees of freedom
00468       //
00469       // this doesn't attempt to deal with fixed atoms or constraints
00470       s_NumDegFreedom = 3 * numFepInitial;
00471     }
00472     int s_NumFixedRigidBonds = 
00473       (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
00474     if (simParams->watmodel == WAT_TIP4) {
00475       // numLonepairs is subtracted here because all lonepairs have a rigid bond
00476       // to oxygen, but all of the LP degrees of freedom are dealt with above
00477       s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
00478     }
00479     else {
00480       // Non-polarized systems don't have LPs.
00481       // For Drude model, bonds that attach LPs are not counted as rigid;
00482       // LPs have already been subtracted from degrees of freedom.
00483       s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds);
00484     }
00485     return s_NumDegFreedom;
00486   }

int Molecule::num_fixed_atoms  )  const [inline]
 

Definition at line 429 of file Molecule.h.

References SimParameters::fixedAtomsOn, and simParams.

Referenced by Controller::receivePressure().

00429                               {
00430     // local variables prefixed by s_
00431     int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
00432     return s_NumFixedAtoms;  // value is "turned on" SimParameters
00433   }

int Molecule::num_fixed_groups  )  const [inline]
 

Definition at line 435 of file Molecule.h.

Referenced by Controller::receivePressure().

00435                                {
00436     // local variables prefixed by s_
00437     int s_NumFixedAtoms = num_fixed_atoms();
00438     int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
00439     return s_NumFixedGroups;  // value is "turned on" SimParameters
00440   }

int Molecule::num_group_deg_freedom  )  const [inline]
 

Definition at line 442 of file Molecule.h.

References SimParameters::comMove, SimParameters::langevinOn, and simParams.

Referenced by Controller::receivePressure().

00442                                     {
00443     // local variables prefixed by s_
00444     int s_NumGroupDegFreedom = 3 * numHydrogenGroups;
00445     int s_NumFixedAtoms = num_fixed_atoms();
00446     int s_NumFixedGroups = num_fixed_groups();
00447     if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
00448     if ( ! (s_NumFixedAtoms || numConstraints
00449           || simParams->comMove || simParams->langevinOn) ) {
00450       s_NumGroupDegFreedom -= 3;
00451     }
00452     return s_NumGroupDegFreedom;
00453   }

void Molecule::print_atoms Parameters  ) 
 

Definition at line 4770 of file Molecule.C.

References DebugM, endi(), Parameters::get_vdw_params(), and Real.

Referenced by NamdState::configListInit().

04771 {
04772 #ifdef MEM_OPT_VERSION
04773     DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
04774 #else   
04775   register int i;
04776   Real sigma;
04777   Real epsilon;
04778   Real sigma14;
04779   Real epsilon14;
04780 
04781   DebugM(2,"ATOM LIST\n" \
04782       << "******************************************\n" \
04783                   << "NUM  NAME TYPE RES  MASS    CHARGE CHARGE   FEP-CHARGE"  \
04784       << "SIGMA   EPSILON SIGMA14 EPSILON14\n" \
04785         << endi);
04786 
04787   for (i=0; i<numAtoms; i++)
04788   {
04789     params->get_vdw_params(&sigma, &epsilon, &sigma14, &epsilon14, 
04790         atoms[i].vdw_type);
04791 
04792     DebugM(2,i+1 << " " << atomNames[i].atomname  \
04793               << " " << atomNames[i].atomtype << " " \
04794               << atomNames[i].resname  << " " << atoms[i].mass  \
04795         << " " << atoms[i].charge << " " << sigma \
04796         << " " << epsilon << " " << sigma14 \
04797         << " " << epsilon14 << "\n" \
04798         << endi);
04799   }
04800 #endif  
04801 }

void Molecule::print_bonds Parameters  ) 
 

Definition at line 4813 of file Molecule.C.

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

Referenced by NamdState::configListInit().

04814 {
04815 #ifdef MEM_OPT_VERSION
04816     DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
04817 #else   
04818   register int i;
04819   Real k;
04820   Real x0;
04821 
04822   DebugM(2,"BOND LIST\n" << "********************************\n" \
04823       << "ATOM1 ATOM2 TYPE1 TYPE2      k        x0" \
04824       << endi);
04825 
04826   for (i=0; i<numBonds; i++)
04827   {
04828     params->get_bond_params(&k, &x0, bonds[i].bond_type);
04829 
04830     DebugM(2,bonds[i].atom1+1 << " " \
04831        << bonds[i].atom2+1 << " "   \
04832        << atomNames[bonds[i].atom1].atomtype << " "  \
04833        << atomNames[bonds[i].atom2].atomtype << " " << k \
04834        << " " << x0 << endi);
04835   }
04836   
04837 #endif  
04838 }

void Molecule::print_exclusions  ) 
 

Definition at line 4850 of file Molecule.C.

References DebugM, and endi().

Referenced by NamdState::configListInit().

04851 {
04852 #ifdef MEM_OPT_VERSION
04853     DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
04854 #else
04855   register int i;
04856 
04857   DebugM(2,"EXPLICIT EXCLUSION LIST\n" \
04858       << "********************************\n" \
04859             << "ATOM1 ATOM2 " \
04860       << endi);
04861 
04862   for (i=0; i<numExclusions; i++)
04863   {
04864     DebugM(2,exclusions[i].atom1+1 << "  " \
04865        << exclusions[i].atom2+1 << endi);
04866   }
04867 #endif
04868 }

void Molecule::print_go_params  ) 
 

Definition at line 553 of file GoMolecule.C.

References DebugM, go_array, j, and NumGoChains.

00554 {
00555   int i;
00556   int j;
00557   int index;
00558 
00559   DebugM(3,NumGoChains << " Go PARAMETERS 3\n" \
00560          << "*****************************************" << std::endl);
00561 
00562   for (i=0; i<NumGoChains; i++) {
00563     for (j=0; j<NumGoChains; j++) {
00564       index = (i * MAX_GO_CHAINS) + j;
00565       //  Real epsilon;    // Epsilon
00566       //  Real exp_a;      // First exponent for attractive L-J term
00567       //  Real exp_b;      // Second exponent for attractive L-J term
00568       //  Real sigmaRep;   // Sigma for repulsive term
00569       //  Real epsilonRep; // Epsilon for replusive term
00570       DebugM(3,"Go index=(" << i << "," << j << ") epsilon=" << go_array[index].epsilon \
00571              << " exp_a=" << go_array[index].exp_a << " exp_b=" << go_array[index].exp_b \
00572              << " exp_rep=" << go_array[index].exp_rep << " sigmaRep=" \
00573              << go_array[index].sigmaRep << " epsilonRep=" << go_array[index].epsilonRep \
00574              << " cutoff=" << go_array[index].cutoff << std::endl);
00575     }
00576   }
00577 
00578 }

void Molecule::print_go_sigmas  ) 
 

Definition at line 963 of file GoMolecule.C.

References DebugM, goSigmaIndices, goSigmas, j, numGoAtoms, and Real.

00964 {
00965   int i;  //  Counter
00966   int j;  //  Counter
00967   Real sigma;
00968 
00969   DebugM(3,"GO SIGMA ARRAY\n" \
00970          << "***************************" << std::endl);
00971   DebugM(3, "numGoAtoms: " << numGoAtoms << std::endl);
00972 
00973   if (goSigmaIndices == NULL) {
00974     DebugM(3, "GO SIGMAS HAVE NOT BEEN BUILT" << std::endl);
00975     return;
00976   }
00977 
00978   for (i=0; i<numAtoms; i++) {
00979     for (j=0; j<numAtoms; j++) {
00980       if ( goSigmaIndices[i] != -1 && goSigmaIndices[j] != -1 ) {
00981         //DebugM(3, "i: " << i << ", j: " << j << std::endl);
00982         sigma = goSigmas[goSigmaIndices[i]*numGoAtoms + goSigmaIndices[j]];
00983         if (sigma > 0.0) {
00984           DebugM(3, "(" << i << "," << j << ") - +" << sigma << " ");
00985         }
00986         else {
00987           DebugM(3, "(" << i << "," << j << ") - " << sigma << " ");
00988         }
00989       } else {
00990         //DebugM(3, "0 ");
00991       }
00992     }
00993     if ( goSigmaIndices[i] != -1 ) {
00994       DebugM(3, "-----------" << std::endl);
00995     }
00996   }
00997   return;
00998 }

void Molecule::put_stir_startTheta Real  theta,
int  atomnum
const [inline]
 

Definition at line 973 of file Molecule.h.

00974   {
00975     stirParams[stirIndexes[atomnum]].startTheta = theta;
00976   }

void Molecule::read_go_file char *   ) 
 

Definition at line 114 of file GoMolecule.C.

References Bool, go_val::cutoff, DebugM, go_val::epsilon, go_val::epsilonRep, go_val::exp_a, go_val::exp_b, go_val::exp_rep, go_array, go_indices, GoValue, iout, iWARN(), j, MAX_GO_CHAINS, NAMD_blank_string(), NAMD_die(), NAMD_find_first_word(), NAMD_read_line(), NumGoChains, Real, go_val::restrictions, and go_val::sigmaRep.

Referenced by build_go_params().

00116 {
00117 
00118   int i;                   // Counter
00119   int j;                   // Counter
00120   int  par_type=0;         //  What type of parameter are we currently
00121                            //  dealing with? (vide infra)
00122   // JLai -- uncommented
00123   int  skipline;           //  skip this line?
00124   int  skipall = 0;        //  skip rest of file;
00125   char buffer[512];           //  Buffer to store each line of the file
00126   char first_word[512];           //  First word of the current line
00127   int read_count = 0;      //  Count of input parameters on a given line
00128   int chain1 = 0;          //  First chain type for pair interaction
00129   int chain2 = 0;          //  Second chain type for pair interaction
00130   int int1;                //  First parameter int
00131   int int2;                //  Second parameter int
00132   Real r1;                 //  Parameter Real
00133   char in2[512];           //  Second parameter word
00134   GoValue *goValue1 = NULL;    //  current GoValue for loading parameters
00135   GoValue *goValue2 = NULL;    //  other current GoValue for loading parameters
00136   Bool sameGoChain = FALSE;    //  whether the current GoValue is within a chain or between chains
00137   int restrictionCount = 0;    //  number of Go restrictions set for a given chain pair
00138   FILE *pfile;                 //  File descriptor for the parameter file
00139 
00140   /*  Check to make sure that we haven't previously been told     */
00141   /*  that all the files were read                                */
00142   /*if (AllFilesRead)
00143     {
00144     NAMD_die("Tried to read another parameter file after being told that all files were read!");
00145     }*/
00146   
00147   /*  Initialize go_indices  */
00148   for (i=0; i<MAX_GO_CHAINS+1; i++) {
00149     go_indices[i] = -1;
00150   }
00151 
00152   /*  Initialize go_array   */
00153   for (i=0; i<MAX_GO_CHAINS*MAX_GO_CHAINS; i++) {
00154     go_array[i].epsilon = 1.25;
00155     go_array[i].exp_a = 12;
00156     go_array[i].exp_b = 6;
00157     go_array[i].exp_rep = 12;
00158     go_array[i].sigmaRep = 2.25;
00159     go_array[i].epsilonRep = 0.03;
00160     go_array[i].cutoff = 4.0;
00161     for (j=0; j<MAX_RESTRICTIONS; j++) {
00162       go_array[i].restrictions[j] = -1;
00163     }
00164   }
00165 
00166   /*  Try and open the file                                        */
00167   if ( (pfile = fopen(fname, "r")) == NULL)
00168     {
00169       char err_msg[256];
00170       
00171       sprintf(err_msg, "UNABLE TO OPEN GO PARAMETER FILE %s\n", fname);
00172       NAMD_die(err_msg);
00173     }
00174   
00175   /*  Keep reading in lines until we hit the EOF                        */
00176   while (NAMD_read_line(pfile, buffer) != -1)
00177     {
00178       /*  Get the first word of the line                        */
00179       NAMD_find_first_word(buffer, first_word);
00180       skipline=0;
00181       
00182       /*  First, screen out things that we ignore.                   */   
00183       /*  blank lines, lines that start with '!' or '*', lines that  */
00184       /*  start with "END".                                          */
00185       if (!NAMD_blank_string(buffer) &&
00186           (strncmp(first_word, "!", 1) != 0) &&
00187           (strncmp(first_word, "*", 1) != 0) &&
00188           (strncasecmp(first_word, "END", 3) != 0))
00189         {
00190           if ( skipall ) {
00191             iout << iWARN << "SKIPPING PART OF GO PARAMETER FILE AFTER RETURN STATEMENT\n" << endi;
00192             break;
00193           }
00194           /*  Now, determine the apropriate parameter type.   */
00195           if (strncasecmp(first_word, "chaintypes", 10)==0)
00196             {
00197               read_count=sscanf(buffer, "%s %d %d\n", first_word, &int1, &int2);
00198               if (read_count != 3) {
00199                 char err_msg[512];
00200                 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);
00201                 NAMD_die(err_msg);
00202               }
00203               chain1 = int1;
00204               chain2 = int2;
00205               if (chain1 < 1 || chain1 > MAX_GO_CHAINS ||
00206                   chain2 < 1 || chain2 > MAX_GO_CHAINS) {
00207                 char err_msg[512];
00208                 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);
00209                 NAMD_die(err_msg);
00210               }
00211               if (go_indices[chain1] == -1) {
00212                 go_indices[chain1] = NumGoChains;
00213                 NumGoChains++;
00214               }
00215               if (go_indices[chain2] == -1) {
00216                 go_indices[chain2] = NumGoChains;
00217                 NumGoChains++;
00218               }
00219               if (chain1 == chain2) {
00220                 sameGoChain = TRUE;
00221               } else {
00222                 sameGoChain = FALSE;
00223               }
00224               //goValue = &go_array[(chain1 * MAX_GO_CHAINS) + chain2];
00225               goValue1 = &go_array[(chain1*MAX_GO_CHAINS) + chain2];
00226               goValue2 = &go_array[(chain2*MAX_GO_CHAINS) + chain1];
00227 #if CODE_REDUNDANT
00228               goValue1 = &go_array[(go_indices[chain1]*MAX_GO_CHAINS) + go_indices[chain2]];
00229               goValue2 = &go_array[(go_indices[chain2]*MAX_GO_CHAINS) + go_indices[chain1]];
00230 #endif
00231               restrictionCount = 0;    //  restrictionCount applies to each chain pair separately
00232             }
00233           else if (strncasecmp(first_word, "epsilonRep", 10)==0)
00234             {
00235               read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
00236               if (read_count != 2) {}
00237               goValue1->epsilonRep = r1;
00238               if (!sameGoChain) {
00239                 goValue2->epsilonRep = r1;
00240               }
00241             }
00242           else if (strncasecmp(first_word, "epsilon", 7)==0)
00243             {
00244               // Read in epsilon
00245               read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
00246               if (read_count != 2) {}
00247               goValue1->epsilon = r1;
00248               if (!sameGoChain) {
00249                 goValue2->epsilon = r1;
00250               }
00251             }
00252           else if (strncasecmp(first_word, "exp_a", 5)==0)
00253             {
00254               read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
00255               if (read_count != 2) {}
00256               goValue1->exp_a = int1;
00257               if (!sameGoChain) {
00258                 goValue2->exp_a = int1;
00259               }
00260             }
00261           else if (strncasecmp(first_word, "exp_b", 5)==0)
00262             {
00263               read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
00264               if (read_count != 2) {}
00265               goValue1->exp_b = int1;
00266               if (!sameGoChain) {
00267                 goValue2->exp_b = int1;
00268               }
00269             }
00270           else if (strncasecmp(first_word, "exp_rep", 5)==0)
00271             {
00272               read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
00273               if (read_count != 2) {}
00274               goValue1->exp_b = int1;
00275               if (!sameGoChain) {
00276                 goValue2->exp_b = int1;
00277               }
00278             }
00279           else if (strncasecmp(first_word, "sigmaRep", 8)==0)
00280             {
00281               read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
00282               if (read_count != 2) {}
00283               goValue1->sigmaRep = r1;
00284               if (!sameGoChain) {
00285                 goValue2->sigmaRep = r1;
00286               }
00287             }
00288           else if (strncasecmp(first_word, "cutoff", 6)==0)
00289             {
00290               read_count=sscanf(buffer, "%s %f\n", first_word, &r1);
00291               if (read_count != 2) {}
00292               goValue1->cutoff = r1;
00293               if (!sameGoChain) {
00294                 goValue2->cutoff = r1;
00295               }
00296             }
00297           else if (strncasecmp(first_word, "restriction", 10)==0)
00298             {
00299               read_count=sscanf(buffer, "%s %d\n", first_word, &int1);
00300               if (read_count != 2) {}
00301               if (int1 < 0) {
00302                 DebugM(3, "ERROR: residue restriction value must be nonnegative.  int1=" << int1 << "\n");
00303               }
00304               if (!sameGoChain) {
00305                 //goValue2->restrictions[restrictionCount] = int1;
00306                 DebugM(3, "ERROR: residue restrictions should not be defined between two separate chains.  chain1=" << chain1 << ", chain2=" << chain2 << "\n");
00307               }
00308               else {
00309                 goValue1->restrictions[restrictionCount] = int1;
00310               }
00311               restrictionCount++;
00312             }
00313           else if (strncasecmp(first_word, "return", 4)==0)
00314             {
00315               skipall=8;
00316               skipline=1;
00317             }        
00318           else // if (par_type == 0)
00319             {
00320               /*  This is an unknown paramter.        */
00321               /*  This is BAD                                */
00322               char err_msg[512];
00323               
00324               sprintf(err_msg, "UNKNOWN PARAMETER IN GO PARAMETER FILE %s\nLINE=*%s*",fname, buffer);
00325               NAMD_die(err_msg);
00326             }
00327         }
00328       else
00329         {
00330           skipline=1;
00331         }
00332     }
00333   
00334   /*  Close the file  */
00335   fclose(pfile);
00336   
00337   return;
00338 }

void Molecule::read_parm Ambertoppar  ) 
 

void Molecule::receive_GoMolecule MIStream  ) 
 

Definition at line 1493 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, SimParameters::goMethod, goResids, goSigmaIndices, goSigmas, goWithinCutoff, int32, j, MAX_GO_CHAINS, MAX_RESTRICTIONS, NAMD_die(), numAtoms, numGoAtoms, NumGoChains, Real, go_val::restrictions, and go_val::sigmaRep.

01493                                                {
01494       // Ported by JLai -- Original by JE
01495       // JE - receive Go info
01496       Real *a1, *a2, *a3, *a4;
01497       int *i1, *i2, *i3, *i4;
01498       int maxGoChainsSqr = MAX_GO_CHAINS*MAX_GO_CHAINS;  // JE JLai Go code
01499       msg->get(NumGoChains);
01500       
01501       if (NumGoChains) {
01502         //go_indices = new int[MAX_GO_CHAINS+1];
01503         //go_array = new GoValue[MAX_GO_CHAINS*MAX_GO_CHAINS];
01504         
01505         //      int go_indices[MAX_GO_CHAINS+1];        //  Indices from chainIDs to go_array      
01506         //      GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS];   //  Array of Go params
01507         msg->get(MAX_GO_CHAINS+1,go_indices);
01508         
01509         a1 = new Real[maxGoChainsSqr];
01510         a2 = new Real[maxGoChainsSqr];
01511         a3 = new Real[maxGoChainsSqr];
01512         a4 = new Real[maxGoChainsSqr];
01513         i1 = new int[maxGoChainsSqr];
01514         i2 = new int[maxGoChainsSqr];
01515         i3 = new int[maxGoChainsSqr];
01516         i4 = new int[maxGoChainsSqr*MAX_RESTRICTIONS];
01517         
01518         if ( (a1 == NULL) || (a2 == NULL) || (a3 == NULL) || (a4 == NULL) || 
01519              (i1 == NULL) || (i2 == NULL) || (i3 == NULL) || (i4 == NULL) )
01520           {
01521             NAMD_die("memory allocation failed in Molecule::send_Molecule");
01522           }
01523         
01524         msg->get(maxGoChainsSqr, a1);
01525         msg->get(maxGoChainsSqr, a2);
01526         msg->get(maxGoChainsSqr, a3);
01527         msg->get(maxGoChainsSqr, a4);
01528         msg->get(maxGoChainsSqr, i1);
01529         msg->get(maxGoChainsSqr, i2);
01530         msg->get(maxGoChainsSqr, i3);
01531         msg->get(maxGoChainsSqr*MAX_RESTRICTIONS, i4);
01532         
01533         for (int i=0; i<maxGoChainsSqr; i++) {
01534           go_array[i].epsilon = a1[i];
01535           go_array[i].sigmaRep = a2[i];
01536           go_array[i].epsilonRep = a3[i];
01537           go_array[i].cutoff = a4[i];
01538           go_array[i].exp_a = i1[i];
01539           go_array[i].exp_b = i2[i];
01540           go_array[i].exp_rep = i3[i];
01541           for (int j=0; j<MAX_RESTRICTIONS; j++) {
01542             go_array[i].restrictions[j] = i4[i*MAX_RESTRICTIONS + j];
01543           }
01544         }
01545         
01546         delete [] a1;
01547         delete [] a2;
01548         delete [] a3;
01549         delete [] a4;
01550         delete [] i1;
01551         delete [] i2;
01552         delete [] i3;
01553         delete [] i4;
01554 
01555         //msg->get(MAX_GO_CHAINS*MAX_GO_CHAINS, (char*)go_array);
01556         
01557         /*DebugM(3,"NumGoChains:" << NumGoChains << std::endl);
01558           for (int ii=0; ii<MAX_GO_CHAINS; ii++) {
01559           for (int jj=0; jj<MAX_GO_CHAINS; jj++) {
01560           DebugM(3,"go_array[" << ii << "][" << jj << "]:" << go_array[ii][jj] << std::endl);
01561           }
01562           }
01563           for (int ii=0; ii<MAX_GO_CHAINS+1; ii++) {
01564           DebugM(3,"go_indices[" << ii << "]:" << go_indices[ii] << std::endl);
01565           }*/
01566       }
01567 
01568       // Go code
01569       if (simParams->goForcesOn) {
01570         switch(simParams->goMethod) {
01571         case 1:
01572           msg->get(numGoAtoms);
01573           //printf("Deleting goSigmaIndiciesA\n");
01574           delete [] goSigmaIndices;
01575           goSigmaIndices = new int32[numAtoms];
01576           //printf("Deleting atomChainTypesA\n");
01577           delete [] atomChainTypes;
01578           atomChainTypes = new int32[numGoAtoms];
01579           //printf("Deleting goSigmasA\n");
01580           delete [] goSigmas;
01581           goSigmas = new Real[numGoAtoms*numGoAtoms];
01582           //printf("Deleting goWithinCutoffA\n"); 
01583           delete [] goWithinCutoff;
01584           goWithinCutoff = new bool[numGoAtoms*numGoAtoms];
01585           msg->get(numAtoms, goSigmaIndices);
01586           msg->get(numGoAtoms, atomChainTypes);
01587           msg->get(numGoAtoms*numGoAtoms, goSigmas);
01588           msg->get(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
01589           break;          
01590         case 2: //GSR
01591           break;
01592         case 3:
01593           msg->get(numGoAtoms);
01594           //printf("Deleting goSigmaIndiciesB\n");
01595           delete [] goSigmaIndices;
01596           goSigmaIndices = new int32[numAtoms];
01597           //printf("Deleting atomChainTypesB\n");
01598           delete [] atomChainTypes;
01599           atomChainTypes = new int32[numGoAtoms];
01600           //delete [] goSigmas;
01601           //goSigmas = new Real[numGoAtoms*numGoAtoms];
01602           //delete [] goWithinCutoff;
01603           //goWithinCutoff = new bool[numGoAtoms*numGoAtoms];
01604           //printf("Deleting goCoordinatesB\n");
01605           delete [] goCoordinates;
01606           goCoordinates = new Real[numGoAtoms*3];
01607           //printf("Deleting goResidsB\n");
01608           delete [] goResids;
01609           goResids = new int[numGoAtoms];
01610           msg->get(numAtoms, goSigmaIndices);
01611           msg->get(numGoAtoms, atomChainTypes);
01612           //msg->get(numGoAtoms*numGoAtoms, goSigmas);
01613           //msg->get(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
01614           msg->get(numGoAtoms*3, goCoordinates);
01615           msg->get(numGoAtoms, goResids);
01616           break;
01617         }
01618       }
01619 
01620       delete msg;
01621 
01622 }

void Molecule::receive_Molecule MIStream  ) 
 

Definition at line 5162 of file Molecule.C.

References SimParameters::alchFepOn, SimParameters::alchThermIntOn, Angle, Aniso, Atom, atomNamePool, atomSigPool, Bond, consForce, consForceIndexes, SimParameters::consForceOn, consTorqueIndexes, SimParameters::consTorqueOn, consTorqueParams, SimParameters::constraintsOn, Crossterm, DebugM, Dihedral, DrudeConst, SimParameters::excludeFromPressure, SimParameters::fixedAtomsOn, MIStream::get(), GridforceGrid::get_total_grids(), ObjectArena< Type >::getNewArray(), Improper, int32, is_drude_psf, is_lonepairs_psf, isBFactorValid, isOccupancyValid, SimParameters::langevinOn, SimParameters::LCPOOn, SimParameters::lesOn, Lphost, maxHydrogenGroupSize, maxMigrationGroupSize, SimParameters::mgridforceOn, SimParameters::movDragOn, numAcceptors, numAngles, numAnisos, numBonds, numCalcAngles, numCalcBonds, numCalcCrossterms, numCalcDihedrals, numCalcExclusions, numCalcImpropers, numConsForce, numConsTorque, numConstraints, numCrossterms, numDihedrals, numDonors, numExclusions, numExPressureAtoms, numFepFinal, numFepInitial, numFixedAtoms, numFixedRigidBonds, numGridforceGrids, numGridforces, numHydrogenGroups, numImpropers, numLphosts, numMigrationGroups, numMovDrag, numRealBonds, numRotDrag, numStirredAtoms, numTotalExclusions, SimParameters::pairInteractionOn, Real, SimParameters::rotDragOn, SimParameters::stirOn, SimParameters::tCoupleOn, and GridforceGrid::unpack_grid().

05162                                             {
05163   //  Get the atom information
05164   msg->get(numAtoms);
05165 
05166 #ifdef MEM_OPT_VERSION
05167 //in the memory optimized version, only the atom signatures are recved
05168 //from the master Node. --Chao Mei
05169 
05170   msg->get(massPoolSize);
05171   if(atomMassPool) delete [] atomMassPool;
05172   atomMassPool = new Real[massPoolSize];
05173   msg->get(massPoolSize, atomMassPool);
05174 
05175   msg->get(chargePoolSize);
05176   if(atomChargePool) delete [] atomChargePool;
05177   atomChargePool = new Real[chargePoolSize];
05178   msg->get(chargePoolSize, atomChargePool);
05179 
05180   //get atoms' signatures
05181   msg->get(atomSigPoolSize);
05182   if(atomSigPool) delete [] atomSigPool;
05183   atomSigPool = new AtomSignature[atomSigPoolSize];
05184   for(int i=0; i<atomSigPoolSize; i++)
05185       atomSigPool[i].unpack(msg);
05186 
05187   //get exclusions' signatures
05188   msg->get(exclSigPoolSize);
05189   if(exclSigPool) delete [] exclSigPool;
05190   exclSigPool = new ExclusionSignature[exclSigPoolSize];
05191   for(int i=0; i<exclSigPoolSize; i++)
05192       exclSigPool[i].unpack(msg);
05193  
05194   msg->get(numHydrogenGroups);      
05195   msg->get(maxHydrogenGroupSize);      
05196   msg->get(numMigrationGroups);      
05197   msg->get(maxMigrationGroupSize);      
05198   msg->get(isOccupancyValid);
05199   msg->get(isBFactorValid);
05200 
05201    //get names for atoms
05202   msg->get(atomNamePoolSize);
05203   atomNamePool = new char *[atomNamePoolSize];
05204   for(int i=0; i<atomNamePoolSize;i++) {
05205     int len;
05206     msg->get(len);
05207     atomNamePool[i] = nameArena->getNewArray(len+1);
05208     msg->get(len, atomNamePool[i]);
05209   }
05210   
05211   if(simParams->fixedAtomsOn){
05212     int numFixedAtomsSet;
05213     msg->get(numFixedAtoms);
05214     msg->get(numFixedAtomsSet);
05215     fixedAtomsSet = new AtomSetList(numFixedAtomsSet);
05216     msg->get(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
05217   } 
05218 
05219       //  Now free the message 
05220       delete msg;
05221 
05222       build_excl_check_signatures();
05223 
05224     //set num{Calc}Tuples(Bonds,...,Impropers) to 0
05225     numBonds = numCalcBonds = 0;
05226     numAngles = numCalcAngles = 0;
05227     numDihedrals = numCalcDihedrals = 0;
05228     numImpropers = numCalcImpropers = 0;
05229     numCrossterms = numCalcCrossterms = 0;
05230     numTotalExclusions = numCalcExclusions = 0;  
05231 #else
05232   delete [] atoms;
05233   atoms= new Atom[numAtoms];  
05234   msg->get(numAtoms*sizeof(Atom), (char*)atoms);
05235 
05236   //  Get the bond information
05237   msg->get(numRealBonds);
05238   msg->get(numBonds);    
05239   if (numBonds)
05240   {
05241     delete [] bonds;
05242     bonds=new Bond[numBonds]; 
05243     msg->get(numBonds*sizeof(Bond), (char*)bonds);
05244   }  
05245   
05246   //  Get the angle information
05247   msg->get(numAngles);  
05248   if (numAngles)
05249   {
05250     delete [] angles;
05251     angles=new Angle[numAngles];  
05252     msg->get(numAngles*sizeof(Angle), (char*)angles);
05253   }  
05254   
05255   //  Get the dihedral information
05256   msg->get(numDihedrals);    
05257   if (numDihedrals)
05258   {
05259     delete [] dihedrals;
05260     dihedrals=new Dihedral[numDihedrals];  
05261     msg->get(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
05262   }  
05263   
05264   //  Get the improper information
05265   msg->get(numImpropers);
05266   if (numImpropers)
05267   {
05268     delete [] impropers;
05269     impropers=new Improper[numImpropers];  
05270     msg->get(numImpropers*sizeof(Improper), (char*)impropers);
05271   }
05272   
05273   //  Get the crossterm information
05274   msg->get(numCrossterms);
05275   if (numCrossterms)
05276   {
05277     delete [] crossterms;
05278     crossterms=new Crossterm[numCrossterms];  
05279     msg->get(numCrossterms*sizeof(Crossterm), (char*)crossterms);
05280   }
05281   
05282   //  Get the hydrogen bond donors
05283   msg->get(numDonors);  
05284   if (numDonors)
05285   {
05286     delete [] donors;
05287     donors=new Bond[numDonors];  
05288     msg->get(numDonors*sizeof(Bond), (char*)donors);
05289   }
05290   
05291   //  Get the hydrogen bond acceptors
05292   msg->get(numAcceptors);  
05293   if (numAcceptors)
05294   {
05295     delete [] acceptors;
05296     acceptors=new Bond[numAcceptors];  
05297     msg->get(numAcceptors*sizeof(Bond), (char*)acceptors);
05298   }
05299   
05300   //  Get the exclusion information 
05301   msg->get(numExclusions);  
05302   if (numExclusions)
05303   {
05304     delete [] exclusions;
05305     exclusions=new Exclusion[numExclusions];  
05306     msg->get(numExclusions*sizeof(Exclusion), (char*)exclusions);
05307   }
05308         
05309       //  Get the constraint information, if they are active
05310       if (simParams->constraintsOn)
05311       {
05312          msg->get(numConstraints);
05313 
05314          delete [] consIndexes;
05315          consIndexes = new int32[numAtoms];
05316          
05317          msg->get(numAtoms, consIndexes);
05318          
05319          if (numConstraints)
05320          {
05321            delete [] consParams;
05322            consParams = new ConstraintParams[numConstraints];
05323       
05324            msg->get(numConstraints*sizeof(ConstraintParams), (char*)consParams);
05325          }
05326       }
05327 
05328       /* BEGIN gf */
05329       if (simParams->mgridforceOn)
05330       {
05331          DebugM(3, "Receiving gridforce info\n");
05332          
05333          msg->get(numGridforceGrids);
05334          
05335          DebugM(3, "numGridforceGrids = " << numGridforceGrids << "\n");
05336          
05337          delete [] numGridforces;
05338          numGridforces = new int[numGridforceGrids];
05339          
05340          delete [] gridfrcIndexes;      // Should I be deleting elements of these first?
05341          delete [] gridfrcParams;
05342          delete [] gridfrcGrid;
05343          gridfrcIndexes = new int32*[numGridforceGrids];
05344          gridfrcParams = new GridforceParams*[numGridforceGrids];
05345          gridfrcGrid = new GridforceGrid*[numGridforceGrids];
05346          
05347          int grandTotalGrids = 0;
05348          for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
05349              msg->get(numGridforces[gridnum]);
05350              
05351              gridfrcIndexes[gridnum] = new int32[numAtoms];
05352              msg->get(numAtoms, gridfrcIndexes[gridnum]);
05353          
05354              if (numGridforces[gridnum])
05355              {
05356                  gridfrcParams[gridnum] = new GridforceParams[numGridforces[gridnum]];
05357                  msg->get(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
05358              }
05359              
05360              gridfrcGrid[gridnum] = GridforceGrid::unpack_grid(gridnum, msg);
05361              
05362              grandTotalGrids += gridfrcGrid[gridnum]->get_total_grids();
05363          }
05364       }
05365       /* END gf */
05366       
05367       //  Get the stirring information, if stirring is  active
05368       if (simParams->stirOn)
05369       {
05370          msg->get(numStirredAtoms);
05371 
05372          delete [] stirIndexes;
05373          stirIndexes = new int32[numAtoms];
05374          
05375          msg->get(numAtoms, stirIndexes);
05376          
05377          if (numStirredAtoms)
05378          {
05379            delete [] stirParams;
05380            stirParams = new StirParams[numStirredAtoms];
05381       
05382            msg->get(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
05383          }
05384       }
05385       
05386       //  Get the moving drag information, if it is active
05387       if (simParams->movDragOn) {
05388          msg->get(numMovDrag);
05389          delete [] movDragIndexes;
05390          movDragIndexes = new int32[numAtoms];
05391          msg->get(numAtoms, movDragIndexes);
05392          if (numMovDrag)
05393          {
05394            delete [] movDragParams;
05395            movDragParams = new MovDragParams[numMovDrag];
05396            msg->get(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
05397          }
05398       }
05399       
05400       //  Get the rotating drag information, if it is active
05401       if (simParams->rotDragOn) {
05402          msg->get(numRotDrag);
05403          delete [] rotDragIndexes;
05404          rotDragIndexes = new int32[numAtoms];
05405          msg->get(numAtoms, rotDragIndexes);
05406          if (numRotDrag)
05407          {
05408            delete [] rotDragParams;
05409            rotDragParams = new RotDragParams[numRotDrag];
05410            msg->get(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
05411          }
05412       }
05413       
05414       //  Get the "constant" torque information, if it is active
05415       if (simParams->consTorqueOn) {
05416          msg->get(numConsTorque);
05417          delete [] consTorqueIndexes;
05418          consTorqueIndexes = new int32[numAtoms];
05419          msg->get(numAtoms, consTorqueIndexes);
05420          if (numConsTorque)
05421          {
05422            delete [] consTorqueParams;
05423            consTorqueParams = new ConsTorqueParams[numConsTorque];
05424            msg->get(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
05425          }
05426       }
05427       
05428       // Get the constant force information, if it's active
05429       if (simParams->consForceOn)
05430       { msg->get(numConsForce);
05431         delete [] consForceIndexes;
05432         consForceIndexes = new int32[numAtoms];
05433         msg->get(numAtoms, consForceIndexes);
05434         if (numConsForce)
05435         { delete [] consForce;
05436           consForce = new Vector[numConsForce];
05437           msg->get(numConsForce*sizeof(Vector), (char*)consForce);
05438         }
05439       }
05440 
05441       //  Get the langevin parameters, if they are active
05442       if (simParams->langevinOn || simParams->tCoupleOn)
05443       {
05444         delete [] langevinParams;
05445         langevinParams = new Real[numAtoms];
05446 
05447         msg->get(numAtoms, langevinParams);
05448       }
05449 
05450       //  Get the fixed atoms, if they are active
05451       if (simParams->fixedAtomsOn)
05452       {
05453         delete [] fixedAtomFlags;
05454         fixedAtomFlags = new int32[numAtoms];
05455 
05456         msg->get(numFixedAtoms);
05457         msg->get(numAtoms, fixedAtomFlags);
05458         msg->get(numFixedRigidBonds);
05459       }
05460 
05461       if (simParams->excludeFromPressure) {
05462         exPressureAtomFlags = new int32[numAtoms];
05463         msg->get(numExPressureAtoms);
05464         msg->get(numAtoms, exPressureAtomFlags);
05465       }
05466 
05467 //fepb
05468       //receive fep atom info
05469       if (simParams->alchFepOn || simParams->lesOn || simParams->alchThermIntOn || simParams->pairInteractionOn) {
05470         delete [] fepAtomFlags;
05471         fepAtomFlags = new unsigned char[numAtoms];
05472 
05473         msg->get(numFepInitial);
05474         msg->get(numFepFinal);
05475         msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
05476       }
05477 //fepe
05478 
05479 #ifdef OPENATOM_VERSION
05480       // This needs to be refactored into its own version
05481       if (simParams->openatomOn) {
05482         delete [] fepAtomFlags;
05483         fepAtomFlags = new unsigned char[numAtoms];
05484 
05485         msg->get(numFepInitial);
05486         msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
05487 #endif //OPENATOM_VERSION
05488 
05489       // DRUDE: receive data read from PSF
05490       msg->get(is_lonepairs_psf);
05491       if (is_lonepairs_psf) {
05492         msg->get(numLphosts);
05493         delete[] lphosts;
05494         lphosts = new Lphost[numLphosts];
05495         msg->get(numLphosts*sizeof(Lphost), (char*)lphosts);
05496       }
05497       msg->get(is_drude_psf);
05498       if (is_drude_psf) {
05499         delete[] drudeConsts;
05500         drudeConsts = new DrudeConst[numAtoms];
05501         msg->get(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
05502         msg->get(numAnisos);
05503         delete[] anisos;
05504         anisos = new Aniso[numAnisos];
05505         msg->get(numAnisos*sizeof(Aniso), (char*)anisos);
05506       }
05507       // DRUDE
05508 
05509   //LCPO
05510   if (simParams->LCPOOn) {
05511     delete [] lcpoParamType;
05512     lcpoParamType = new int[numAtoms];
05513     msg->get(numAtoms, (int*)lcpoParamType);
05514   }
05515 
05516       //  Now free the message 
05517       delete msg;
05518 
05519       //  analyze the data and find the status of each atom
05520       build_atom_status();
05521       build_lists_by_atom();      
05522 #endif
05523 }

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

Referenced by Node::reloadCharges().

Real Molecule::rigid_bond_length int  atomnum  )  const [inline]
 

Definition at line 1057 of file Molecule.h.

References Real.

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

01058   {
01059     return(rigidBondLengths[atomnum]);
01060   }

void Molecule::send_GoMolecule MOStream  ) 
 

Definition at line 1394 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, SimParameters::goMethod, goResids, goSigmaIndices, goSigmas, goWithinCutoff, j, MAX_GO_CHAINS, MAX_RESTRICTIONS, NAMD_die(), numAtoms, numGoAtoms, NumGoChains, MOStream::put(), Real, go_val::restrictions, and go_val::sigmaRep.

01394                                             {
01395   Real *a1, *a2, *a3, *a4;
01396   int *i1, *i2, *i3, *i4;
01397   int maxGoChainsSqr = MAX_GO_CHAINS*MAX_GO_CHAINS;  // JE JLai Go code
01398   msg->put(NumGoChains);
01399   
01400   if (NumGoChains) {
01401     //      int go_indices[MAX_GO_CHAINS+1];        //  Indices from chainIDs to go_array      
01402     //      GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS];   //  Array of Go params
01403     msg->put(MAX_GO_CHAINS+1,go_indices);
01404 
01405     a1 = new Real[maxGoChainsSqr];
01406     a2 = new Real[maxGoChainsSqr];
01407     a3 = new Real[maxGoChainsSqr];
01408     a4 = new Real[maxGoChainsSqr];
01409     i1 = new int[maxGoChainsSqr];
01410     i2 = new int[maxGoChainsSqr];
01411     i3 = new int[maxGoChainsSqr];
01412     i4 = new int[maxGoChainsSqr*MAX_RESTRICTIONS];
01413 
01414     if ( (a1 == NULL) || (a2 == NULL) || (a3 == NULL) || (a4 == NULL) || 
01415          (i1 == NULL) || (i2 == NULL) || (i3 == NULL) || (i4 == NULL) )
01416     {
01417       NAMD_die("memory allocation failed in Molecules::send_Molecules");
01418     }
01419 
01420     for (int i=0; i<maxGoChainsSqr; i++) {
01421       a1[i] = go_array[i].epsilon;
01422       a2[i] = go_array[i].sigmaRep;
01423       a3[i] = go_array[i].epsilonRep;
01424       a4[i] = go_array[i].cutoff;
01425       i1[i] = go_array[i].exp_a;
01426       i2[i] = go_array[i].exp_b;
01427       i3[i] = go_array[i].exp_rep;
01428       for (int j=0; j<MAX_RESTRICTIONS; j++) {
01429         i4[i*MAX_RESTRICTIONS + j] = go_array[i].restrictions[j];
01430       }
01431     }
01432 
01433     msg->put(maxGoChainsSqr, a1);
01434     msg->put(maxGoChainsSqr, a2);
01435     msg->put(maxGoChainsSqr, a3);
01436     msg->put(maxGoChainsSqr, a4);
01437     msg->put(maxGoChainsSqr, i1);
01438     msg->put(maxGoChainsSqr, i2);
01439     msg->put(maxGoChainsSqr, i3);
01440     msg->put(maxGoChainsSqr*MAX_RESTRICTIONS, i4);
01441 
01442     delete [] a1;
01443     delete [] a2;
01444     delete [] a3;
01445     delete [] a4;
01446     delete [] i1;
01447     delete [] i2;
01448     delete [] i3;
01449     delete [] i4;
01450   }
01451 
01452   //Ported JLai
01453   //print_go_sigmas();
01454   if (simParams->goForcesOn) {
01455     switch(simParams->goMethod) {
01456     case 1:
01457       msg->put(numGoAtoms);
01458       msg->put(numAtoms, goSigmaIndices);
01459       msg->put(numGoAtoms, atomChainTypes);
01460       msg->put(numGoAtoms*numGoAtoms, goSigmas);
01461       msg->put(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
01462       // printf("Molecule.C sending atomChainTypes %d %d \n", numGoAtoms, atomChainTypes);
01463       break;
01464     case 2: //GSS
01465       break;
01466     case 3:
01467       msg->put(numGoAtoms);
01468       msg->put(numAtoms, goSigmaIndices);
01469       msg->put(numGoAtoms, atomChainTypes);
01470       //msg->put(numGoAtoms*numGoAtoms, goSigmas);
01471       //msg->put(numGoAtoms*numGoAtoms*sizeof(bool), (char*)goWithinCutoff);
01472       msg->put(numGoAtoms*3, goCoordinates);
01473       msg->put(numGoAtoms, goResids);
01474       break;
01475     }
01476   } 
01477 
01478   msg->end();
01479   delete msg;
01480 }

void Molecule::send_Molecule MOStream  ) 
 

Definition at line 4881 of file Molecule.C.

References SimParameters::alchFepOn, SimParameters::alchThermIntOn, Angle, Aniso, Atom, atomNamePool, atomSigPool, Bond, consForce, consForceIndexes, SimParameters::consForceOn, consTorqueIndexes, SimParameters::consTorqueOn, consTorqueParams, SimParameters::constraintsOn, Crossterm, DebugM, Dihedral, DrudeConst, MOStream::end(), endi(), SimParameters::excludeFromPressure, SimParameters::fixedAtomsOn, Improper, is_drude_psf, is_lonepairs_psf, isBFactorValid, isOccupancyValid, SimParameters::langevinOn, SimParameters::LCPOOn, SimParameters::lesOn, Lphost, maxHydrogenGroupSize, maxMigrationGroupSize, SimParameters::mgridforceOn, SimParameters::movDragOn, numAcceptors, numAngles, numAnisos, numBonds, numCalcAngles, numCalcBonds, numCalcCrossterms, numCalcDihedrals, numCalcExclusions, numCalcImpropers, numConsForce, numConsTorque, numConstraints, numCrossterms, numDihedrals, numDonors, numExclusions, numExPressureAtoms, numFepFinal, numFepInitial, numFixedAtoms, numFixedRigidBonds, numGridforceGrids, numGridforces, numHydrogenGroups, numImpropers, numLphosts, numMigrationGroups, numMovDrag, numRealBonds, numRotDrag, numStirredAtoms, numTotalExclusions, GridforceGrid::pack_grid(), SimParameters::pairInteractionOn, MOStream::put(), SimParameters::rotDragOn, SimParameters::stirOn, and SimParameters::tCoupleOn.

04881                                          {
04882 #ifdef MEM_OPT_VERSION
04883 //in the memory optimized version, only the atom signatures are broadcast
04884 //to other Nodes. --Chao Mei
04885 
04886   msg->put(numAtoms);
04887 
04888   msg->put(massPoolSize);
04889   msg->put(massPoolSize, atomMassPool);
04890 
04891   msg->put(chargePoolSize);
04892   msg->put(chargePoolSize, atomChargePool); 
04893 
04894   //put atoms' signatures
04895   msg->put(atomSigPoolSize);
04896   for(int i=0; i<atomSigPoolSize; i++)
04897       atomSigPool[i].pack(msg);
04898 
04899   //put atom's exclusion signatures
04900   msg->put(exclSigPoolSize);
04901   for(int i=0; i<exclSigPoolSize; i++)
04902       exclSigPool[i].pack(msg);
04903 
04904   msg->put(numHydrogenGroups);      
04905   msg->put(maxHydrogenGroupSize);      
04906   msg->put(numMigrationGroups);      
04907   msg->put(maxMigrationGroupSize);            
04908   msg->put(isOccupancyValid);
04909   msg->put(isBFactorValid);
04910   
04911   //put names for atoms
04912   msg->put(atomNamePoolSize);
04913   for(int i=0; i<atomNamePoolSize;i++) {
04914     int len = strlen(atomNamePool[i]);
04915     msg->put(len);
04916     msg->put(len*sizeof(char), atomNamePool[i]);
04917   } 
04918   
04919   if(simParams->fixedAtomsOn){
04920     int numFixedAtomsSet = fixedAtomsSet->size();
04921     msg->put(numFixedAtoms);
04922     msg->put(numFixedAtomsSet);
04923     msg->put(numFixedAtomsSet*sizeof(AtomSet), (char *)(fixedAtomsSet->begin()));
04924   }
04925     
04926   // Broadcast the message to the other nodes
04927   msg->end();
04928   delete msg;
04929 
04930   build_excl_check_signatures();
04931 
04932   //set num{Calc}Tuples(Bonds,...,Impropers) to 0
04933   numBonds = numCalcBonds = 0;
04934   numAngles = numCalcAngles = 0;
04935   numDihedrals = numCalcDihedrals = 0;
04936   numImpropers = numCalcImpropers = 0;
04937   numCrossterms = numCalcCrossterms = 0;
04938   numTotalExclusions = numCalcExclusions = 0;  
04939 
04940 #else
04941   msg->put(numAtoms);
04942   msg->put(numAtoms*sizeof(Atom), (char*)atoms);
04943   
04944   //  Send the bond information
04945   msg->put(numRealBonds);
04946   msg->put(numBonds);
04947  
04948   if (numBonds)
04949   {
04950     msg->put(numBonds*sizeof(Bond), (char*)bonds);
04951   }
04952 
04953   //  Send the angle information
04954   msg->put(numAngles);  
04955   if (numAngles)
04956   {
04957     msg->put(numAngles*sizeof(Angle), (char*)angles);
04958   }  
04959 
04960   //  Send the dihedral information
04961   msg->put(numDihedrals);
04962   if (numDihedrals)
04963   {
04964     msg->put(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
04965   }  
04966 
04967   //  Send the improper information
04968   msg->put(numImpropers);  
04969   if (numImpropers)
04970   {
04971     msg->put(numImpropers*sizeof(Improper), (char*)impropers);
04972   }
04973 
04974   //  Send the crossterm information
04975   msg->put(numCrossterms);
04976   if (numCrossterms)
04977   {
04978     msg->put(numCrossterms*sizeof(Crossterm), (char*)crossterms);
04979   }
04980 
04981   // send the hydrogen bond donor information
04982   msg->put(numDonors);
04983   if(numDonors)
04984   {
04985     msg->put(numDonors*sizeof(Bond), (char*)donors);
04986   }
04987 
04988   // send the hydrogen bond acceptor information
04989   msg->put(numAcceptors);
04990   if(numAcceptors)
04991   {
04992     msg->put(numAcceptors*sizeof(Bond), (char*)acceptors);
04993   }
04994 
04995   //  Send the exclusion information  
04996   msg->put(numExclusions);
04997   if (numExclusions)
04998   {
04999     msg->put(numExclusions*sizeof(Exclusion), (char*)exclusions);
05000   }      
05001   //  Send the constraint information, if used
05002   if (simParams->constraintsOn)
05003   {
05004      msg->put(numConstraints);
05005      
05006      msg->put(numAtoms, consIndexes);
05007      
05008      if (numConstraints)
05009      {
05010        msg->put(numConstraints*sizeof(ConstraintParams), (char*)consParams);
05011      }
05012   }
05013   
05014   /* BEGIN gf */
05015   // Send the gridforce information, if used
05016   if (simParams->mgridforceOn)
05017   {
05018     DebugM(3, "Sending gridforce info\n" << endi);
05019     msg->put(numGridforceGrids);
05020     
05021     for (int gridnum = 0; gridnum < numGridforceGrids; gridnum++) {
05022       msg->put(numGridforces[gridnum]);
05023       msg->put(numAtoms, gridfrcIndexes[gridnum]);
05024       if (numGridforces[gridnum])
05025       {
05026        msg->put(numGridforces[gridnum]*sizeof(GridforceParams), (char*)gridfrcParams[gridnum]);
05027       }
05028       GridforceGrid::pack_grid(gridfrcGrid[gridnum], msg);
05029     }
05030   }
05031   /* END gf */
05032   
05033   //  Send the stirring information, if used
05034   if (simParams->stirOn)
05035   {
05036      //CkPrintf ("DEBUG: putting numStirredAtoms..\n");
05037      msg->put(numStirredAtoms);
05038      //CkPrintf ("DEBUG: putting numAtoms,stirIndexes.. numAtoms=%d\n",numStirredAtoms);
05039      msg->put(numAtoms, stirIndexes);
05040      //CkPrintf ("DEBUG: if numStirredAtoms..\n");
05041      if (numStirredAtoms)
05042      {
05043        //CkPrintf ("DEBUG: big put, with (char*)stirParams\n");
05044        msg->put(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
05045      }
05046   }
05047   
05048   
05049   //  Send the moving drag information, if used
05050   if (simParams->movDragOn) {
05051      msg->put(numMovDrag);
05052      msg->put(numAtoms, movDragIndexes);
05053      if (numMovDrag)
05054      {
05055        msg->put(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
05056      }
05057   }
05058   
05059   //  Send the rotating drag information, if used
05060   if (simParams->rotDragOn) {
05061      msg->put(numRotDrag);
05062      msg->put(numAtoms, rotDragIndexes);
05063      if (numRotDrag)
05064      {
05065        msg->put(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
05066      }
05067   }
05068   
05069   //  Send the "constant" torque information, if used
05070   if (simParams->consTorqueOn) {
05071      msg->put(numConsTorque);
05072      msg->put(numAtoms, consTorqueIndexes);
05073      if (numConsTorque)
05074      {
05075        msg->put(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
05076      }
05077   }
05078   
05079   // Send the constant force information, if used
05080   if (simParams->consForceOn)
05081   { msg->put(numConsForce);
05082     msg->put(numAtoms, consForceIndexes);
05083     if (numConsForce)
05084       msg->put(numConsForce*sizeof(Vector), (char*)consForce);
05085   }
05086   
05087   //  Send the langevin parameters, if active
05088   if (simParams->langevinOn || simParams->tCoupleOn)
05089   {
05090     msg->put(numAtoms, langevinParams);
05091   }
05092   
05093   //  Send fixed atoms, if active
05094   if (simParams->fixedAtomsOn)
05095   {
05096     msg->put(numFixedAtoms);
05097     msg->put(numAtoms, fixedAtomFlags);
05098   msg->put(numFixedRigidBonds);
05099   }
05100   
05101   if (simParams->excludeFromPressure) {
05102     msg->put(numExPressureAtoms);
05103     msg->put(numAtoms, exPressureAtomFlags);
05104   }
05105   
05106   //fepb
05107   // send fep atom info
05108   if (simParams->alchFepOn || simParams->alchThermIntOn || simParams->lesOn || simParams->pairInteractionOn) {
05109     msg->put(numFepInitial);
05110     msg->put(numFepFinal);
05111     msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
05112   }
05113   //fepe
05114 
05115   #ifdef OPENATOM_VERSION
05116   // needs to be refactored into its own openatom version
05117   if (simParams->openatomOn ) {
05118     msg->put(numFepInitial);
05119     msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
05120   }
05121   #endif //OPENATOM_VERSION
05122   
05123   // DRUDE: send data read from PSF
05124   msg->put(is_lonepairs_psf);
05125   if (is_lonepairs_psf) {
05126     msg->put(numLphosts);
05127     msg->put(numLphosts*sizeof(Lphost), (char*)lphosts);
05128   }
05129   msg->put(is_drude_psf);
05130   if (is_drude_psf) {
05131     msg->put(numAtoms*sizeof(DrudeConst), (char*)drudeConsts);
05132     msg->put(numAnisos);
05133     msg->put(numAnisos*sizeof(Aniso), (char*)anisos);
05134   }
05135   // DRUDE
05136 
05137   //LCPO
05138   if (simParams->LCPOOn) {
05139     msg->put(numAtoms, (int*)lcpoParamType);
05140   }
05141   
05142   // Broadcast the message to the other nodes
05143   msg->end();
05144   delete msg;
05145 
05146   //  Now build arrays of indexes into these arrays by atom      
05147   build_lists_by_atom();
05148 #endif
05149 }

int Molecule::set_gridfrc_grid int  gridnum,
GridforceGrid grid
[inline]
 

Definition at line 950 of file Molecule.h.

Referenced by Node::reloadGridforceGrid().

00951   {
00952       if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
00953           gridfrcGrid[gridnum] = grid;
00954           return 0;
00955       } else {
00956           return -1;
00957       }
00958   }

void Molecule::setBFactorData molfile_atom_t *  atomarray  ) 
 

Definition at line 2778 of file Molecule.C.

Referenced by Molecule().

02778                                                       {
02779     bfactor = new float[numAtoms];
02780     for(int i=0; i<numAtoms; i++) {
02781         bfactor[i] = atomarray[i].bfactor;
02782     }
02783 }

void Molecule::setOccupancyData molfile_atom_t *  atomarray  ) 
 

Definition at line 2771 of file Molecule.C.

Referenced by Molecule().

02771                                                         {
02772     occupancy = new float[numAtoms];
02773     for(int i=0; i<numAtoms; i++) {
02774         occupancy[i] = atomarray[i].occupancy;
02775     }
02776 }


Friends And Related Function Documentation

friend class AngleElem [friend]
 

Definition at line 184 of file Molecule.h.

friend class AnisoElem [friend]
 

Definition at line 188 of file Molecule.h.

friend class BondElem [friend]
 

Definition at line 183 of file Molecule.h.

friend class CrosstermElem [friend]
 

Definition at line 189 of file Molecule.h.

friend class DihedralElem [friend]
 

Definition at line 185 of file Molecule.h.

friend class ExclElem [friend]
 

Definition at line 182 of file Molecule.h.

friend class ImproperElem [friend]
 

Definition at line 186 of file Molecule.h.

friend class TholeElem [friend]
 

Definition at line 187 of file Molecule.h.

friend class WorkDistrib [friend]
 

Definition at line 190 of file Molecule.h.


Member Data Documentation

int Molecule::alchDroppedAngles
 

Definition at line 495 of file Molecule.h.

Referenced by NamdState::configListInit().

int Molecule::alchDroppedDihedrals
 

Definition at line 496 of file Molecule.h.

Referenced by NamdState::configListInit().

int Molecule::alchDroppedImpropers
 

Definition at line 497 of file Molecule.h.

Referenced by NamdState::configListInit().

int32* Molecule::atomChainTypes
 

Definition at line 567 of file Molecule.h.

Referenced by build_go_arrays(), build_go_sigmas(), get_go_energy_new(), get_go_force(), get_go_force_new(), goInit(), receive_GoMolecule(), and send_GoMolecule().

Vector* Molecule::consForce
 

Definition at line 538 of file Molecule.h.

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

int32* Molecule::consForceIndexes
 

Definition at line 537 of file Molecule.h.

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

int32* Molecule::consTorqueIndexes
 

Definition at line 540 of file Molecule.h.

Referenced by ComputeConsTorque::doForce(), receive_Molecule(), and send_Molecule().

ConsTorqueParams* Molecule::consTorqueParams
 

Definition at line 541 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

BigReal Molecule::energyNative
 

Definition at line 575 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

BigReal Molecule::energyNonnative
 

Definition at line 576 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

GoValue Molecule::go_array[MAX_GO_CHAINS *MAX_GO_CHAINS]
 

Definition at line 1188 of file Molecule.h.

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

int Molecule::go_indices[MAX_GO_CHAINS+1]
 

Definition at line 1189 of file Molecule.h.

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

Real* Molecule::goCoordinates
 

Definition at line 571 of file Molecule.h.

Referenced by build_go_arrays(), get_go_energy_new(), get_go_force_new(), goInit(), receive_GoMolecule(), and send_GoMolecule().

PDB* Molecule::goPDB
 

Definition at line 573 of file Molecule.h.

Referenced by build_go_arrays(), and goInit().

int* Molecule::goResids
 

Definition at line 572 of file Molecule.h.

Referenced by build_go_arrays(), get_go_energy_new(), get_go_force_new(), goInit(), receive_GoMolecule(), and send_GoMolecule().

int32* Molecule::goSigmaIndices
 

Definition at line 568 of file Molecule.h.

Referenced by build_go_arrays(), build_go_sigmas(), get_go_energy_new(), get_go_force(), get_go_force_new(), goInit(), print_go_sigmas(), receive_GoMolecule(), and send_GoMolecule().

Real* Molecule::goSigmas
 

Definition at line 569 of file Molecule.h.

Referenced by build_go_sigmas(), get_go_force(), goInit(), print_go_sigmas(), receive_GoMolecule(), and send_GoMolecule().

bool* Molecule::goWithinCutoff
 

Definition at line 570 of file Molecule.h.

Referenced by build_go_sigmas(), get_go_force(), goInit(), receive_GoMolecule(), and send_GoMolecule().

HydrogenGroup Molecule::hydrogenGroup
 

Definition at line 563 of file Molecule.h.

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

int Molecule::is_drude_psf
 

Definition at line 402 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::is_lonepairs_psf
 

Definition at line 403 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::isBFactorValid
 

Definition at line 1069 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::isOccupancyValid
 

Definition at line 1069 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::maxHydrogenGroupSize
 

Definition at line 525 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), outputCompressedFile(), receive_Molecule(), and send_Molecule().

int Molecule::maxMigrationGroupSize
 

Definition at line 527 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), outputCompressedFile(), receive_Molecule(), and send_Molecule().

int Molecule::numAcceptors
 

Definition at line 501 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numAngles
 

Definition at line 492 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), buildAngleData(), NamdState::configListInit(), dumpbench(), Molecule(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numAnisos
 

Definition at line 509 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numAtoms
 

Definition at line 488 of file Molecule.h.

Referenced by GlobalMasterFreeEnergy::addForce(), GlobalMasterEasy::addForce(), WorkDistrib::assignNodeToPatch(), colvarmodule::atom::atom(), ParallelIOMgr::bcastHydroBasedCounter(), build12Excls(), build13Excls(), build14Excls(), ComputeNonbondedCUDA::build_exclusions(), buildAtomData(), buildBondData(), buildExclusions(), Controller::compareChecksums(), ComputeGlobal::ComputeGlobal(), NamdState::configListInit(), ComputeMgr::createComputes(), dumpbench(), GlobalMasterFreeEnergy::getMass(), GlobalMasterEasy::getMass(), GlobalMasterSymmetry::GlobalMasterSymmetry(), GlobalMasterTMD::GlobalMasterTMD(), integrateAllAtomSigs(), loadMolInfo(), Molecule(), outputCompressedFile(), WorkDistrib::patchMapInit(), receive_GoMolecule(), Controller::receivePressure(), ParallelIOMgr::recvAtomsCntPerPatch(), ComputeMgr::recvComputeConsForceMsg(), ComputeMsmSerialMgr::recvCoord(), ComputeGBISserMgr::recvCoord(), ComputeExtMgr::recvCoord(), Node::reloadCharges(), GlobalMasterFreeEnergy::requestAtom(), GlobalMasterEasy::requestAtom(), send_GoMolecule(), Node::startup(), Tcl_centerOfMass(), Tcl_centerOfNumber(), Tcl_loadCoords(), Tcl_radiusOfGyration(), and wrap_coor_int().

int Molecule::numBonds
 

Definition at line 491 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), buildBondData(), NamdState::configListInit(), dumpbench(), Molecule(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcAngles
 

Definition at line 547 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), dumpbench(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcAnisos
 

Definition at line 555 of file Molecule.h.

Referenced by Controller::compareChecksums().

int Molecule::numCalcBonds
 

Definition at line 546 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), dumpbench(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcCrossterms
 

Definition at line 550 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcDihedrals
 

Definition at line 548 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), dumpbench(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcExclusions
 

Definition at line 551 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), dumpbench(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcImpropers
 

Definition at line 549 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), Controller::compareChecksums(), dumpbench(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numCalcTholes
 

Definition at line 554 of file Molecule.h.

Referenced by Controller::compareChecksums().

int Molecule::numConsForce
 

Definition at line 536 of file Molecule.h.

Referenced by NamdState::configListInit(), receive_Molecule(), and send_Molecule().

int Molecule::numConsTorque
 

Definition at line 520 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numConstraints
 

Definition at line 513 of file Molecule.h.

Referenced by NamdState::configListInit(), receive_Molecule(), Controller::receivePressure(), and send_Molecule().

int Molecule::numCrossterms
 

Definition at line 499 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), buildCrosstermData(), NamdState::configListInit(), Molecule(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numDihedrals
 

Definition at line 493 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), buildDihedralData(), NamdState::configListInit(), dumpbench(), Molecule(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numDonors
 

Definition at line 500 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numDrudeAtoms
 

Definition at line 507 of file Molecule.h.

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

int Molecule::numExclusions
 

Definition at line 502 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), receive_Molecule(), and send_Molecule().

int Molecule::numExPressureAtoms
 

Definition at line 523 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numFepFinal
 

Definition at line 533 of file Molecule.h.

Referenced by NamdState::configListInit(), receive_Molecule(), and send_Molecule().

int Molecule::numFepInitial
 

Definition at line 532 of file Molecule.h.

Referenced by NamdState::configListInit(), receive_Molecule(), Controller::receivePressure(), and send_Molecule().

int Molecule::numFixedAtoms
 

Definition at line 521 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), ParallelIOMgr::integrateMigratedAtoms(), receive_Molecule(), Controller::receivePressure(), send_Molecule(), and ParallelIOMgr::updateMolInfo().

int Molecule::numFixedGroups
 

Definition at line 528 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), Controller::receivePressure(), and ParallelIOMgr::recvHydroBasedCounter().

int Molecule::numFixedRigidBonds
 

Definition at line 530 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), receive_Molecule(), Controller::receivePressure(), ParallelIOMgr::recvHydroBasedCounter(), and send_Molecule().

int Molecule::numGoAtoms
 

Definition at line 566 of file Molecule.h.

Referenced by build_go_arrays(), build_go_sigmas(), get_go_force(), goInit(), print_go_sigmas(), receive_GoMolecule(), and send_GoMolecule().

int Molecule::NumGoChains
 

Definition at line 1190 of file Molecule.h.

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

int Molecule::numGridforceGrids
 

Definition at line 515 of file Molecule.h.

Referenced by build_gridforce_params(), NamdState::configListInit(), ComputeGridForce::doForce(), receive_Molecule(), and send_Molecule().

int* Molecule::numGridforces
 

Definition at line 516 of file Molecule.h.

Referenced by build_gridforce_params(), receive_Molecule(), and send_Molecule().

int Molecule::numHydrogenGroups
 

Definition at line 524 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), outputCompressedFile(), receive_Molecule(), Controller::receivePressure(), and send_Molecule().

int Molecule::numImpropers
 

Definition at line 498 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), buildImproperData(), NamdState::configListInit(), dumpbench(), Molecule(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

int Molecule::numLonepairs
 

Definition at line 506 of file Molecule.h.

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

int Molecule::numLphosts
 

Definition at line 510 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numMigrationGroups
 

Definition at line 526 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), NamdState::configListInit(), outputCompressedFile(), receive_Molecule(), and send_Molecule().

int Molecule::numMovDrag
 

Definition at line 518 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numMultipleDihedrals
 

Definition at line 559 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), and NamdState::configListInit().

int Molecule::numMultipleImpropers
 

Definition at line 561 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), and NamdState::configListInit().

int Molecule::numRealBonds
 

Definition at line 490 of file Molecule.h.

Referenced by buildBondData(), Molecule(), receive_Molecule(), and send_Molecule().

int Molecule::numRigidBonds
 

Definition at line 529 of file Molecule.h.

Referenced by ParallelIOMgr::bcastHydroBasedCounter(), ParallelIOMgr::bcastMolInfo(), NamdState::configListInit(), ParallelIOMgr::integrateMigratedAtoms(), Controller::receivePressure(), and ParallelIOMgr::recvMolInfo().

int Molecule::numRotDrag
 

Definition at line 519 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numStirredAtoms
 

Definition at line 522 of file Molecule.h.

Referenced by NamdState::configListInit(), receive_Molecule(), and send_Molecule().

int Molecule::numTholes
 

Definition at line 508 of file Molecule.h.

int Molecule::numTotalExclusions
 

Definition at line 503 of file Molecule.h.

Referenced by ParallelIOMgr::bcastMolInfo(), receive_Molecule(), ParallelIOMgr::recvMolInfo(), and send_Molecule().

Real Molecule::r_ohc
 

Definition at line 408 of file Molecule.h.

Real Molecule::r_om
 

Definition at line 407 of file Molecule.h.

int Molecule::suspiciousAlchBonds
 

Definition at line 494 of file Molecule.h.

Referenced by NamdState::configListInit().

BigReal Molecule::tail_corr_ener
 

Definition at line 411 of file Molecule.h.

Referenced by Controller::printEnergies().

BigReal Molecule::tail_corr_virial
 

Definition at line 412 of file Molecule.h.

Referenced by Controller::receivePressure().


The documentation for this class was generated from the following files:
Generated on Fri May 25 04:07:23 2012 for NAMD by  doxygen 1.3.9.1