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

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 read_psf_file (char *, Parameters *)
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, 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 *)
void delete_alch_bonded (void)
void build_exPressure_atoms (StringList *, StringList *, PDB *, char *)
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
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 ()

Public Attributes

int is_drude_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 numAnisos
int numLphosts
int numConstraints
int numGridforceGrids
int * numGridforces
int numMovDrag
int numRotDrag
int numConsTorque
int numFixedAtoms
int numStirredAtoms
int numExPressureAtoms
int numHydrogenGroups
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 numMultipleDihedrals
int numMultipleImpropers
HydrogenGroup hydrogenGroup
int waterIndex

Friends

class ExclElem
class BondElem
class AngleElem
class DihedralElem
class ImproperElem
class CrosstermElem


Constructor & Destructor Documentation

Molecule::Molecule SimParameters ,
Parameters param
 

Definition at line 360 of file Molecule.C.

References simParams.

00361 {
00362   initialize(simParams,param);
00363 }

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

Definition at line 373 of file Molecule.C.

References read_psf_file(), simParams, and SimParameters::useCompressedPsf.

00374 {
00375   initialize(simParams,param);
00376 
00377   if(simParams->useCompressedPsf)
00378       read_compressed_psf_file(filename, param, cfgList);
00379   /*else if(simParams->genCompressedPsf){      
00380       compress_psf_file(this, filename, param, simParams, cfgList);
00381   }*/      
00382   else
00383       read_psf_file(filename, param);
00384 }

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

Definition at line 393 of file Molecule.C.

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

00394 {
00395 #ifdef MEM_OPT_VERSION
00396   NAMD_die("Sorry, plugin IO is not supported in the memory optimized version.");
00397 #endif
00398     initialize(simParams, param);
00399     numAtoms = natoms;
00400     int optflags = MOLFILE_BADOPTIONS;
00401     molfile_atom_t *atomarray = (molfile_atom_t *) malloc(natoms*sizeof(molfile_atom_t));
00402     memset(atomarray, 0, natoms*sizeof(molfile_atom_t));
00403 
00404     //1a. read basic atoms information
00405     int rc = pIOHdl->read_structure(pIOFileHdl, &optflags, atomarray);
00406     if (rc != MOLFILE_SUCCESS && rc != MOLFILE_NOSTRUCTUREDATA) {
00407         free(atomarray);
00408         NAMD_die("ERROR: plugin failed reading structure data");
00409     }
00410     if(optflags == MOLFILE_BADOPTIONS) {
00411         free(atomarray);
00412         NAMD_die("ERROR: plugin didn't initialize optional data flags");
00413     }
00414     if(optflags & MOLFILE_OCCUPANCY) {
00415         setOccupancyData(atomarray);
00416     }
00417     if(optflags & MOLFILE_BFACTOR) {
00418         setBFactorData(atomarray);
00419     }
00420     //1b. load basic atoms information to the molecule object
00421     plgLoadAtomBasics(atomarray);    
00422     free(atomarray);
00423 
00424     //2a. read bonds
00425     //indices are one-based in read_bonds
00426     int *from, *to;
00427     float *bondorder;
00428     if(pIOHdl->read_bonds!=NULL) {
00429         if(pIOHdl->read_bonds(pIOFileHdl, &numBonds, &from, &to, &bondorder)){
00430             NAMD_die("ERROR: failed reading bond information.");
00431         }
00432     }    
00433     //2b. load bonds information to the molecule object
00434     if(numBonds!=0) {
00435         plgLoadBonds(from,to);
00436     }
00437 
00438     //3a. read other bonded structures
00439     int *plgAngles, *plgDihedrals, *plgImpropers, *plgCterms;
00440     int ctermcols, ctermrows;
00441     double *angleforces,  *dihedralforces, *improperforces, *ctermforces;
00442 
00443     plgAngles=plgDihedrals=plgImpropers=plgCterms=NULL;
00444     if(pIOHdl->read_angles!=NULL) {
00445         if(pIOHdl->read_angles(pIOFileHdl,
00446                                &numAngles, &plgAngles, &angleforces,
00447                                &numDihedrals, &plgDihedrals, &dihedralforces,
00448                                &numImpropers, &plgImpropers, &improperforces,
00449                                &numCrossterms, &plgCterms, &ctermcols, &ctermrows,
00450                                &ctermforces)) {
00451             NAMD_die("ERROR: failed reading angle information.");
00452         }
00453     }
00454     //3b. load other bonded structures to the molecule object
00455     if(numAngles!=0) plgLoadAngles(plgAngles);
00456     if(numDihedrals!=0) plgLoadDihedrals(plgDihedrals);
00457     if(numImpropers!=0) plgLoadImpropers(plgImpropers);
00458     if(numCrossterms!=0) plgLoadCrossterms(plgCterms);
00459 
00460   numRealBonds = numBonds;
00461   build_atom_status();
00462 
00463 }

Molecule::Molecule SimParameters ,
Parameters ,
Ambertoppar
 

Molecule::Molecule SimParameters ,
Parameters ,
const GromacsTopFile
 

Molecule::~Molecule  ) 
 

Definition at line 477 of file Molecule.C.

00478 {
00479   /*  Check to see if each array was ever allocated.  If it was   */
00480   /*  then free it            */
00481   if (atoms != NULL)
00482     delete [] atoms;
00483 
00484   if (atomNames != NULL)
00485   {
00486     // subarrarys allocated from arena - automatically deleted
00487     delete [] atomNames;
00488   }
00489   delete nameArena;
00490 
00491   if (resLookup != NULL)
00492     delete resLookup;
00493 
00494   // DRUDE: free arrays read from PSF
00495   if (drudeConsts != NULL) delete [] drudeConsts;
00496   if (lphosts != NULL) delete [] lphosts;
00497   if (anisos != NULL) delete [] anisos;
00498   if (lphostIndexes != NULL) delete [] lphostIndexes;
00499   // DRUDE
00500 
00501   #ifdef MEM_OPT_VERSION
00502   if(eachAtomSig) delete [] eachAtomSig;
00503   if(atomSigPool) delete [] atomSigPool;
00504   #else
00505   if (bonds != NULL)
00506     delete [] bonds;
00507 
00508   if (angles != NULL)
00509     delete [] angles;
00510 
00511   if (dihedrals != NULL)
00512     delete [] dihedrals;
00513 
00514   if (impropers != NULL)
00515     delete [] impropers;
00516 
00517   if (crossterms != NULL)
00518     delete [] crossterms;
00519 
00520   if (exclusions != NULL)
00521     delete [] exclusions;
00522   #endif
00523 
00524   if (donors != NULL)
00525     delete [] donors;
00526 
00527   if (acceptors != NULL)
00528     delete [] acceptors;  
00529 
00530   #ifdef MEM_OPT_VERSION
00531   if(exclSigPool) delete [] exclSigPool;
00532   if(exclChkSigPool) delete [] exclChkSigPool;
00533   if(eachAtomExclSig) delete [] eachAtomExclSig;
00534   #else
00535   if (bondsByAtom != NULL)
00536        delete [] bondsByAtom;
00537   
00538   if (anglesByAtom != NULL)
00539        delete [] anglesByAtom;
00540   
00541   if (dihedralsByAtom != NULL)
00542        delete [] dihedralsByAtom;
00543   
00544   if (impropersByAtom != NULL)
00545        delete [] impropersByAtom;
00546   
00547   if (crosstermsByAtom != NULL)
00548        delete [] crosstermsByAtom;  
00549 
00550   if (exclusionsByAtom != NULL)
00551        delete [] exclusionsByAtom;
00552   
00553   if (fullExclusionsByAtom != NULL)
00554        delete [] fullExclusionsByAtom;
00555   
00556   if (modExclusionsByAtom != NULL)
00557        delete [] modExclusionsByAtom;
00558   
00559   if (all_exclusions != NULL)
00560        delete [] all_exclusions;
00561   #endif
00562 
00563 
00564   if (fixedAtomFlags != NULL)
00565        delete [] fixedAtomFlags;
00566 
00567   if (stirIndexes != NULL)
00568     delete [] stirIndexes;
00569 
00570 
00571   #ifdef MEM_OPT_VERSION
00572   if(clusterSigs != NULL){      
00573       delete [] clusterSigs;
00574   }  
00575   #else
00576   if (cluster != NULL)
00577        delete [] cluster;  
00578   #endif
00579   if (clusterSize != NULL)
00580        delete [] clusterSize;
00581 
00582   if (exPressureAtomFlags != NULL)
00583        delete [] exPressureAtomFlags;
00584 
00585   if (rigidBondLengths != NULL)
00586        delete [] rigidBondLengths;
00587 
00588 //fepb
00589   if (fepAtomFlags != NULL)
00590        delete [] fepAtomFlags;
00591 //fepe
00592 
00593 
00594   #ifndef MEM_OPT_VERSION
00595   delete arena;
00596   delete exclArena;
00597   #endif
00598 }


Member Function Documentation

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

Definition at line 616 of file Molecule.h.

References atom_constants::charge, and Real.

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

00617   {
00618     #ifdef MEM_OPT_VERSION
00619     return atomChargePool[eachAtomCharge[anum]];
00620     #else
00621     return(atoms[anum].charge);
00622     #endif
00623   }

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

Definition at line 606 of file Molecule.h.

References atom_constants::mass, and Real.

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

00607   {
00608     #ifdef MEM_OPT_VERSION
00609     return atomMassPool[eachAtomMass[anum]];
00610     #else
00611     return(atoms[anum].mass);
00612     #endif
00613   }

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

Definition at line 626 of file Molecule.h.

References Index, and atom_constants::vdw_type.

Referenced by WorkDistrib::createAtomLists(), ComputeNonbondedCUDA::doWork(), dumpbench(), and WorkDistrib::fillOnePatchAtoms().

00627   {      
00628       return(atoms[anum].vdw_type);
00629   }

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 * 
 

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

Referenced by NamdState::configListInit().

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

void Molecule::build_langevin_params BigReal  coupling,
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 597 of file Molecule.h.

Referenced by NamdState::configListInit().

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

void Molecule::freeOccupancyData  )  [inline]
 

Definition at line 593 of file Molecule.h.

Referenced by NamdState::configListInit().

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

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

Definition at line 669 of file Molecule.h.

References Bond.

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

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

Definition at line 636 of file Molecule.h.

References Angle.

Referenced by dumpbench().

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

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

Definition at line 711 of file Molecule.h.

References int32.

Referenced by dumpbench().

00712       { return anglesByAtom[anum]; }

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

Definition at line 162 of file Molecule.C.

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

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

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

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

Definition at line 125 of file Molecule.C.

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

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

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

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

Definition at line 680 of file Molecule.h.

References atomTypePool, and NAMD_die().

Referenced by print_bonds().

00681   {
00682     if (atomNames == NULL)
00683     {
00684       NAMD_die("Tried to find atom type on node other than node 0");
00685     }
00686 
00687     #ifdef MEM_OPT_VERSION    
00688     return atomTypePool[atomNames[anum].atomtypeIdx];
00689     #else
00690     return(atomNames[anum].atomtype);
00691     #endif
00692   }

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

Definition at line 633 of file Molecule.h.

References Bond.

Referenced by dumpbench().

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

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

Definition at line 709 of file Molecule.h.

References int32.

Referenced by dumpbench().

00710       { return bondsByAtom[anum]; } 

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

Definition at line 587 of file Molecule.h.

Referenced by wrap_coor_int().

00587 { return cluster[anum]; }

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

Definition at line 588 of file Molecule.h.

Referenced by wrap_coor_int().

00588 { return clusterSize[anum]; }

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

Definition at line 823 of file Molecule.h.

Referenced by ComputeRestraints::doForce().

00824   {
00825     k = consParams[consIndexes[atomnum]].k;
00826     refPos = consParams[consIndexes[atomnum]].refPos;
00827   }

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

Definition at line 882 of file Molecule.h.

Referenced by ComputeConsTorque::doForce().

00884   {
00885     v = consTorqueParams[consTorqueIndexes[atomnum]].v;
00886     a = consTorqueParams[consTorqueIndexes[atomnum]].a;
00887     p = consTorqueParams[consTorqueIndexes[atomnum]].p;
00888   }

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

Definition at line 645 of file Molecule.h.

References Crossterm.

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

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

Definition at line 717 of file Molecule.h.

References int32.

00718       { return crosstermsByAtom[anum]; }  

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

Definition at line 642 of file Molecule.h.

References Dihedral.

Referenced by dumpbench().

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

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

Definition at line 713 of file Molecule.h.

References int32.

Referenced by dumpbench().

00714       { return dihedralsByAtom[anum]; }

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

Definition at line 666 of file Molecule.h.

References Bond.

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

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

Definition at line 737 of file Molecule.h.

Referenced by dumpbench(), and SELF().

00737                                                                {      
00738       return &all_exclusions[anum];             
00739   }

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

Definition at line 676 of file Molecule.h.

References exclusions.

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

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

Definition at line 719 of file Molecule.h.

References int32.

00720       { return exclusionsByAtom[anum]; }

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

Definition at line 891 of file Molecule.h.

Referenced by WorkDistrib::createAtomLists(), WorkDistrib::fillOnePatchAtoms(), and ComputeHomeTuples< ExclElem, Exclusion, int >::loadTuples().

00892         {
00893                 return(fepAtomFlags[anum]);
00894         }

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

Definition at line 721 of file Molecule.h.

References int32.

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

00722       { return fullExclusionsByAtom[anum]; }

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

Definition at line 836 of file Molecule.h.

Referenced by ComputeGridForce::doForce(), ComputeGridForce::finishForce(), and GridforceGrid::getGridIndices().

00837   {
00838       return gridfrcGrid[gridnum];
00839   }

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

Definition at line 830 of file Molecule.h.

Referenced by ComputeGridForce::finishForce().

00831   {
00832       k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
00833       q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
00834   }

int Molecule::get_groupSize int   ) 
 

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

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

Definition at line 639 of file Molecule.h.

References Improper.

Referenced by dumpbench().

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

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

Definition at line 715 of file Molecule.h.

References int32.

Referenced by dumpbench().

00716       { return impropersByAtom[anum]; }  

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

Definition at line 648 of file Molecule.h.

References Lphost.

00648                                        {
00649     int index = lphostIndexes[atomid];
00650     return (index != -1 ? &(lphosts[index]) : NULL);
00651   }

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

Definition at line 723 of file Molecule.h.

References int32.

Referenced by SELF().

00724       { return modExclusionsByAtom[anum]; }

int Molecule::get_mother_atom int   ) 
 

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

Definition at line 867 of file Molecule.h.

Referenced by Sequencer::addMovDragToPosition().

00868   {
00869     v = movDragParams[movDragIndexes[atomnum]].v;
00870   }

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

Definition at line 148 of file Molecule.C.

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

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

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

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

Definition at line 873 of file Molecule.h.

Referenced by Sequencer::addRotDragToPosition().

00875   {
00876     v = rotDragParams[rotDragIndexes[atomnum]].v;
00877     a = rotDragParams[rotDragIndexes[atomnum]].a;
00878     p = rotDragParams[rotDragIndexes[atomnum]].p;
00879   }

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

Definition at line 848 of file Molecule.h.

00849   {
00850     refPos = stirParams[stirIndexes[atomnum]].refPos;
00851   }

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

Definition at line 860 of file Molecule.h.

References Real.

Referenced by ComputeStir::doForce().

00861   {
00862     return stirParams[stirIndexes[atomnum]].startTheta;
00863   }

Bond* Molecule::getAllAcceptors  )  const [inline]
 

Definition at line 672 of file Molecule.h.

References Bond.

00672 {return acceptors;}

Angle* Molecule::getAllAngles  )  const [inline]
 

Definition at line 655 of file Molecule.h.

References Angle.

Referenced by buildAngleData().

00655 {return angles;}

Bond* Molecule::getAllBonds  )  const [inline]
 

Definition at line 654 of file Molecule.h.

References Bond.

Referenced by buildBondData().

00654 {return bonds;}

Crossterm* Molecule::getAllCrossterms  )  const [inline]
 

Definition at line 658 of file Molecule.h.

References Crossterm.

Referenced by buildCrosstermData().

00658 {return crossterms;}

Dihedral* Molecule::getAllDihedrals  )  const [inline]
 

Definition at line 657 of file Molecule.h.

References Dihedral.

Referenced by buildDihedralData().

00657 {return dihedrals;}

Bond* Molecule::getAllDonors  )  const [inline]
 

Definition at line 671 of file Molecule.h.

References Bond.

00671 {return donors;}

Improper* Molecule::getAllImpropers  )  const [inline]
 

Definition at line 656 of file Molecule.h.

References Improper.

Referenced by buildImproperData().

00656 {return impropers;}

Lphost* Molecule::getAllLphosts  )  const [inline]
 

Definition at line 661 of file Molecule.h.

References Lphost.

00661 { return lphosts; }

AtomNameInfo* Molecule::getAtomNames  )  const [inline]
 

Definition at line 366 of file Molecule.h.

References AtomNameInfo.

Referenced by buildAtomData().

00366 { return atomNames; }

Atom* Molecule::getAtoms  )  const [inline]
 

Definition at line 365 of file Molecule.h.

References Atom.

Referenced by buildAtomData(), and outputCompressedFile().

00365 { return atoms; }

AtomSegResInfo* Molecule::getAtomSegResInfo  )  const [inline]
 

Definition at line 369 of file Molecule.h.

References AtomSegResInfo.

Referenced by buildAtomData().

00369 { return atomSegResids; }

const float* Molecule::getBFactorData  )  [inline]
 

Definition at line 595 of file Molecule.h.

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

00595 { return (const float *)bfactor; }

const float* Molecule::getOccupancyData  )  [inline]
 

Definition at line 591 of file Molecule.h.

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

00591 { return (const float *)occupancy; }

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

Definition at line 808 of file Molecule.h.

References Bool.

00809   {
00810     if (numConsTorque)
00811     {
00812       //  Check the index to see if it is constrained
00813       return(consTorqueIndexes[atomnum] != -1);
00814     }
00815     else
00816     {
00817       //  No constraints at all, so just return FALSE
00818       return(FALSE);
00819     }
00820   }

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

Definition at line 760 of file Molecule.h.

References Bool.

Referenced by ComputeRestraints::doForce().

00761   {
00762     if (numConstraints)
00763     {
00764       //  Check the index to see if it is constrained
00765       return(consIndexes[atomnum] != -1);
00766     }
00767     else
00768     {
00769       //  No constraints at all, so just return FALSE
00770       return(FALSE);
00771     }
00772   }

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

Definition at line 922 of file Molecule.h.

References Bool.

Referenced by Sequencer::langevinPiston().

00923   {
00924     return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
00925   }

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

Definition at line 897 of file Molecule.h.

References Bool.

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

00898   {
00899     return (numFixedAtoms && fixedAtomFlags[atomnum]);
00900   }

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

Definition at line 745 of file Molecule.h.

References Bool.

Referenced by ComputeGridForce::doForce(), and ComputeGridForce::finishForce().

00746   {
00747       if (numGridforceGrids)
00748       {
00749           return(gridfrcIndexes[gridnum][atomnum] != -1);
00750       }
00751       else
00752       {
00753           return(FALSE);
00754       }
00755   }

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

Definition at line 776 of file Molecule.h.

References Bool.

Referenced by Sequencer::addMovDragToPosition().

00777   {
00778     if (numMovDrag)
00779     {
00780       //  Check the index to see if it is constrained
00781       return(movDragIndexes[atomnum] != -1);
00782     }
00783     else
00784     {
00785       //  No constraints at all, so just return FALSE
00786       return(FALSE);
00787     }
00788   }

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

Definition at line 792 of file Molecule.h.

References Bool.

Referenced by Sequencer::addRotDragToPosition().

00793   {
00794     if (numRotDrag)
00795     {
00796       //  Check the index to see if it is constrained
00797       return(rotDragIndexes[atomnum] != -1);
00798     }
00799     else
00800     {
00801       //  No constraints at all, so just return FALSE
00802       return(FALSE);
00803     }
00804   }

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

Definition at line 903 of file Molecule.h.

References Bool.

Referenced by ComputeStir::doForce().

00904   {
00905     if (numStirredAtoms)
00906     {
00907       //  Check the index to see if it is constrained
00908       return(stirIndexes[atomnum] != -1);
00909     }
00910     else
00911     {
00912       //  No constraints at all, so just return FALSE
00913       return(FALSE);
00914     }
00915   }

Bool Molecule::is_drude int   ) 
 

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

Definition at line 918 of file Molecule.h.

References Bool.

00919   {
00920     return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
00921   }

Bool Molecule::is_hydrogen int   ) 
 

Bool Molecule::is_hydrogenGroupParent int   ) 
 

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

Bool Molecule::is_lp int   ) 
 

Bool Molecule::is_oxygen int   ) 
 

Bool Molecule::is_water int   ) 
 

Referenced by wrap_coor_int().

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

Definition at line 842 of file Molecule.h.

References Real.

Referenced by Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), and Sequencer::tcoupleVelocities().

00843   {
00844     return(langevinParams[atomnum]);
00845   }

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

Definition at line 398 of file Molecule.h.

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

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

00398                                                      {
00399     // local variables prefixed by s_
00400     int s_NumDegFreedom = 3 * numAtoms;
00401     int s_NumFixedAtoms = num_fixed_atoms();
00402     if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
00403     if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
00404     if ( ! (s_NumFixedAtoms || numConstraints
00405           || simParams->comMove || simParams->langevinOn) ) {
00406       s_NumDegFreedom -= 3;
00407     }
00408     if ( ! isInitialReport && simParams->pairInteractionOn) {
00409       //
00410       // DJH: a kludge?  We want to initially report system degrees of freedom
00411       //
00412       // this doesn't attempt to deal with fixed atoms or constraints
00413       s_NumDegFreedom = 3 * numFepInitial;
00414     }
00415     int s_NumFixedRigidBonds = 
00416       (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
00417     // numLonepairs is subtracted here because all lonepairs have a rigid bond
00418     // to oxygen, but all of the LP degrees of freedom are dealt with above
00419     s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
00420     return s_NumDegFreedom;
00421   }

int Molecule::num_fixed_atoms  )  const [inline]
 

Definition at line 372 of file Molecule.h.

References SimParameters::fixedAtomsOn, and simParams.

Referenced by Controller::receivePressure().

00372                               {
00373     // local variables prefixed by s_
00374     int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
00375     return s_NumFixedAtoms;  // value is "turned on" SimParameters
00376   }

int Molecule::num_fixed_groups  )  const [inline]
 

Definition at line 378 of file Molecule.h.

Referenced by Controller::receivePressure().

00378                                {
00379     // local variables prefixed by s_
00380     int s_NumFixedAtoms = num_fixed_atoms();
00381     int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
00382     return s_NumFixedGroups;  // value is "turned on" SimParameters
00383   }

int Molecule::num_group_deg_freedom  )  const [inline]
 

Definition at line 385 of file Molecule.h.

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

Referenced by Controller::receivePressure().

00385                                     {
00386     // local variables prefixed by s_
00387     int s_NumGroupDegFreedom = 3 * numHydrogenGroups;
00388     int s_NumFixedAtoms = num_fixed_atoms();
00389     int s_NumFixedGroups = num_fixed_groups();
00390     if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
00391     if ( ! (s_NumFixedAtoms || numConstraints
00392           || simParams->comMove || simParams->langevinOn) ) {
00393       s_NumGroupDegFreedom -= 3;
00394     }
00395     return s_NumGroupDegFreedom;
00396   }

void Molecule::print_atoms Parameters  ) 
 

Definition at line 3090 of file Molecule.C.

References atomcharge(), atommass(), atomNamePool, atomTypePool, DebugM, endi(), Parameters::get_vdw_params(), Real, and resNamePool.

Referenced by NamdState::configListInit().

03092 {
03093   register int i;
03094   Real sigma;
03095   Real epsilon;
03096   Real sigma14;
03097   Real epsilon14;
03098 
03099   DebugM(2,"ATOM LIST\n" \
03100       << "******************************************\n" \
03101                   << "NUM  NAME TYPE RES  MASS    CHARGE CHARGE   FEP-CHARGE"  \
03102       << "SIGMA   EPSILON SIGMA14 EPSILON14\n" \
03103         << endi);
03104 
03105   for (i=0; i<numAtoms; i++)
03106   {
03107     params->get_vdw_params(&sigma, &epsilon, &sigma14, &epsilon14, 
03108         atoms[i].vdw_type);
03109 
03110 #ifdef MEM_OPT_VERSION
03111      DebugM(2,i+1 << " " << atomNamePool[atomNames[i].atomnameIdx]  \
03112               << " " << atomTypePool[atomNames[i].atomtypeIdx] << " " \
03113               << resNamePool[atomNames[i].resnameIdx]  << " "  \
03114             << atommass(i)  \
03115         << " " << atomcharge(i) << " " << sigma \
03116         << " " << epsilon << " " << sigma14 \
03117         << " " << epsilon14 << "\n" \
03118         << endi);
03119 #else
03120     DebugM(2,i+1 << " " << atomNames[i].atomname  \
03121               << " " << atomNames[i].atomtype << " " \
03122               << atomNames[i].resname  << " " << atoms[i].mass  \
03123         << " " << atoms[i].charge << " " << sigma \
03124         << " " << epsilon << " " << sigma14 \
03125         << " " << epsilon14 << "\n" \
03126         << endi);
03127 #endif
03128   }
03129 }

void Molecule::print_bonds Parameters  ) 
 

Definition at line 3141 of file Molecule.C.

References bond::atom1, bond::atom2, atomSigPool, Bond, bond::bond_type, AtomSignature::bondCnt, AtomSignature::bondSigs, DebugM, endi(), get_atomtype(), Parameters::get_bond_params(), j, TupleSignature::offset, Real, and TupleSignature::tupleParamType.

Referenced by NamdState::configListInit().

03143 {
03144   register int i;
03145   Real k;
03146   Real x0;
03147 
03148   DebugM(2,"BOND LIST\n" << "********************************\n" \
03149       << "ATOM1 ATOM2 TYPE1 TYPE2      k        x0" \
03150       << endi);
03151 
03152   #ifdef MEM_OPT_VERSION
03153   for(i=0; i<numAtoms; i++){
03154       AtomSignature *sig = &atomSigPool[eachAtomSig[i]];
03155       int bCnt = sig->bondCnt;
03156       TupleSignature *bSigs = sig->bondSigs;
03157       for(int j=0; j<bCnt; j++){
03158           Bond aBond;
03159           aBond.atom1 = i;
03160           aBond.atom2 = i+bSigs[j].offset[0];
03161           aBond.bond_type = bSigs[j].tupleParamType;
03162           params->get_bond_params(&k, &x0, aBond.bond_type);
03163 
03164           DebugM(2,aBond.atom1+1 << " " \
03165              << aBond.atom2+1 << " "   \
03166              << get_atomtype(aBond.atom1) << " "  \
03167              << get_atomtype(aBond.atom2) << " " << k \
03168              << " " << x0 << endi);
03169       }
03170   }
03171   #else
03172   for (i=0; i<numBonds; i++)
03173   {
03174     params->get_bond_params(&k, &x0, bonds[i].bond_type);
03175 
03176     DebugM(2,bonds[i].atom1+1 << " " \
03177        << bonds[i].atom2+1 << " "   \
03178        << atomNames[bonds[i].atom1].atomtype << " "  \
03179        << atomNames[bonds[i].atom2].atomtype << " " << k \
03180        << " " << x0 << endi);
03181   }
03182   #endif
03183 }

void Molecule::print_exclusions  ) 
 

Definition at line 3195 of file Molecule.C.

References DebugM, and endi().

Referenced by NamdState::configListInit().

03196 {
03197 #ifdef MEM_OPT_VERSION
03198     DebugM(2, "WARNING: this function is not availabe in memory optimized version!\n" << endi);
03199 #else
03200   register int i;
03201 
03202   DebugM(2,"EXPLICIT EXCLUSION LIST\n" \
03203       << "********************************\n" \
03204             << "ATOM1 ATOM2 " \
03205       << endi);
03206 
03207   for (i=0; i<numExclusions; i++)
03208   {
03209     DebugM(2,exclusions[i].atom1+1 << "  " \
03210        << exclusions[i].atom2+1 << endi);
03211   }
03212 #endif
03213 }

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

Definition at line 854 of file Molecule.h.

00855   {
00856     stirParams[stirIndexes[atomnum]].startTheta = theta;
00857   }

void Molecule::read_parm Ambertoppar  ) 
 

void Molecule::read_psf_file char *  ,
Parameters
 

Definition at line 618 of file Molecule.C.

References Fclose(), Fopen(), is_drude_psf, NAMD_blank_string(), NAMD_die(), NAMD_find_word(), NAMD_read_line(), numAcceptors, numAngles, numAnisos, numAtoms, numBonds, numCrossterms, numDihedrals, numDonors, numExclusions, numImpropers, numLphosts, and numRealBonds.

Referenced by Molecule().

00620 {
00621 #ifdef MEM_OPT_VERSION
00622     return;
00623 #else
00624   char err_msg[512];  //  Error message for NAMD_die
00625   char buffer[512];  //  Buffer for file reading
00626   int i;      //  Loop counter
00627   int NumTitle;    //  Number of Title lines in .psf file
00628   FILE *psf_file;    //  pointer to .psf file
00629   int ret_code;    //  ret_code from NAMD_read_line calls
00630 
00631   /* Try and open the .psf file           */
00632   if ( (psf_file = Fopen(fname, "r")) == NULL)
00633   {
00634     sprintf(err_msg, "UNABLE TO OPEN .psf FILE %s", fname);
00635     NAMD_die(err_msg);
00636   }
00637 
00638   /*  Read till we have the first non-blank line of file    */
00639   ret_code = NAMD_read_line(psf_file, buffer);
00640 
00641   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00642   {
00643     ret_code = NAMD_read_line(psf_file, buffer);
00644   }
00645 
00646   /*  Check to see if we dropped out of the loop because of a     */
00647   /*  read error.  This shouldn't happen unless the file is empty */
00648   if (ret_code!=0)
00649   {
00650     sprintf(err_msg, "EMPTY .psf FILE %s", fname);
00651     NAMD_die(err_msg);
00652   }
00653 
00654   /*  The first non-blank line should contain the word "psf".    */
00655   /*  If we can't find it, die.               */
00656   if (!NAMD_find_word(buffer, "psf"))
00657   {
00658     sprintf(err_msg, "UNABLE TO FIND \"PSF\" STRING IN PSF FILE %s",
00659        fname);
00660     NAMD_die(err_msg);
00661   }
00662 
00663   // DRUDE: set flag if we discover Drude PSF
00664   if (NAMD_find_word(buffer, "drude"))
00665   {
00666     is_drude_psf = 1;
00667   }
00668   // DRUDE
00669 
00670   /*  Read until we find the next non-blank line      */
00671   ret_code = NAMD_read_line(psf_file, buffer);
00672 
00673   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00674   {
00675     ret_code = NAMD_read_line(psf_file, buffer);
00676   }
00677 
00678   /*  Check to see if we dropped out of the loop because of a     */
00679   /*  read error.  This shouldn't happen unless there is nothing  */
00680   /*  but the PSF line in the file        */
00681   if (ret_code!=0)
00682   {
00683     sprintf(err_msg, "MISSING EVERYTHING BUT PSF FROM %s", fname);
00684     NAMD_die(err_msg);
00685   }
00686 
00687   /*  This line should have the word "NTITLE" in it specifying    */
00688   /*  how many title lines there are        */
00689   if (!NAMD_find_word(buffer, "NTITLE"))
00690   {
00691     sprintf(err_msg,"CAN NOT FIND \"NTITLE\" STRING IN PSF FILE %s",
00692        fname);
00693     NAMD_die(err_msg);
00694   }
00695 
00696   sscanf(buffer, "%d", &NumTitle);
00697 
00698   /*  Now skip the next NTITLE non-blank lines and then read in the*/
00699   /*  line which should contain NATOM        */
00700   i=0;
00701 
00702   while ( ((ret_code=NAMD_read_line(psf_file, buffer)) == 0) && 
00703     (i<NumTitle) )
00704   {
00705     if (!NAMD_blank_string(buffer))
00706       i++;
00707   }
00708 
00709   /*  Make sure we didn't exit because of a read error    */
00710   if (ret_code!=0)
00711   {
00712     sprintf(err_msg, "FOUND EOF INSTEAD OF NATOM IN PSF FILE %s", 
00713        fname);
00714     NAMD_die(err_msg);
00715   }
00716 
00717   while (NAMD_blank_string(buffer))
00718   {
00719     NAMD_read_line(psf_file, buffer);
00720   }
00721 
00722   /*  Check to make sure we have the line we want      */
00723   if (!NAMD_find_word(buffer, "NATOM"))
00724   {
00725     sprintf(err_msg, "DIDN'T FIND \"NATOM\" IN PSF FILE %s",
00726        fname);
00727     NAMD_die(err_msg);
00728   }
00729 
00730   /*  Read in the number of atoms, and then the atoms themselves  */
00731   sscanf(buffer, "%d", &numAtoms);
00732 
00733   read_atoms(psf_file, params);
00734 
00735   /*  Read until we find the next non-blank line      */
00736   ret_code = NAMD_read_line(psf_file, buffer);
00737 
00738   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00739   {
00740     ret_code = NAMD_read_line(psf_file, buffer);
00741   }
00742 
00743   /*  Check to make sure we didn't hit the EOF      */
00744   if (ret_code != 0)
00745   {
00746     NAMD_die("EOF ENCOUNTERED LOOKING FOR NBONDS IN PSF");
00747   }
00748 
00749   /*  Look for the string "NBOND"          */
00750   if (!NAMD_find_word(buffer, "NBOND"))
00751   {
00752     NAMD_die("DID NOT FIND NBOND AFTER ATOM LIST IN PSF");
00753   }
00754 
00755   /*  Read in the number of bonds and then the bonds themselves  */
00756   sscanf(buffer, "%d", &numBonds);
00757 
00758   if (numBonds)
00759     read_bonds(psf_file, params);
00760 
00761   /*  Read until we find the next non-blank line      */
00762   ret_code = NAMD_read_line(psf_file, buffer);
00763 
00764   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00765   {
00766     ret_code = NAMD_read_line(psf_file, buffer);
00767   }
00768 
00769   /*  Check to make sure we didn't hit the EOF      */
00770   if (ret_code != 0)
00771   {
00772     NAMD_die("EOF ENCOUNTERED LOOKING FOR NTHETA IN PSF");
00773   }
00774 
00775   /*  Look for the string "NTHETA"        */
00776   if (!NAMD_find_word(buffer, "NTHETA"))
00777   {
00778     NAMD_die("DID NOT FIND NTHETA AFTER BOND LIST IN PSF");
00779   }
00780 
00781   /*  Read in the number of angles and then the angles themselves */
00782   sscanf(buffer, "%d", &numAngles);
00783 
00784   if (numAngles)
00785     read_angles(psf_file, params);
00786 
00787   /*  Read until we find the next non-blank line      */
00788   ret_code = NAMD_read_line(psf_file, buffer);
00789 
00790   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00791   {
00792     ret_code = NAMD_read_line(psf_file, buffer);
00793   }
00794 
00795   /*  Check to make sure we didn't hit the EOF      */
00796   if (ret_code != 0)
00797   {
00798     NAMD_die("EOF ENCOUNTERED LOOKING FOR NPHI IN PSF");
00799   }
00800 
00801   /*  Look for the string "NPHI"          */
00802   if (!NAMD_find_word(buffer, "NPHI"))
00803   {
00804     NAMD_die("DID NOT FIND NPHI AFTER ANGLE LIST IN PSF");
00805   }
00806 
00807   /*  Read in the number of dihedrals and then the dihedrals      */
00808   sscanf(buffer, "%d", &numDihedrals);
00809 
00810   if (numDihedrals)
00811     read_dihedrals(psf_file, params);
00812 
00813   /*  Read until we find the next non-blank line      */
00814   ret_code = NAMD_read_line(psf_file, buffer);
00815 
00816   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00817   {
00818     ret_code = NAMD_read_line(psf_file, buffer);
00819   }
00820 
00821   /*  Check to make sure we didn't hit the EOF      */
00822   if (ret_code != 0)
00823   {
00824     NAMD_die("EOF ENCOUNTERED LOOKING FOR NIMPHI IN PSF");
00825   }
00826 
00827   /*  Look for the string "NIMPHI"        */
00828   if (!NAMD_find_word(buffer, "NIMPHI"))
00829   {
00830     NAMD_die("DID NOT FIND NIMPHI AFTER ATOM LIST IN PSF");
00831   }
00832 
00833   /*  Read in the number of Impropers and then the impropers  */
00834   sscanf(buffer, "%d", &numImpropers);
00835 
00836   if (numImpropers)
00837     read_impropers(psf_file, params);
00838 
00839   /*  Read until we find the next non-blank line      */
00840   ret_code = NAMD_read_line(psf_file, buffer);
00841 
00842   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00843   {
00844     ret_code = NAMD_read_line(psf_file, buffer);
00845   }
00846 
00847   /*  Check to make sure we didn't hit the EOF      */
00848   if (ret_code != 0)
00849   {
00850     NAMD_die("EOF ENCOUNTERED LOOKING FOR NDON IN PSF");
00851   }
00852 
00853   /*  Look for the string "NDON"        */
00854   if (!NAMD_find_word(buffer, "NDON"))
00855   {
00856     NAMD_die("DID NOT FIND NDON AFTER ATOM LIST IN PSF");
00857   }
00858 
00859   /*  Read in the number of hydrogen bond donors and then the donors */
00860   sscanf(buffer, "%d", &numDonors);
00861 
00862   if (numDonors)
00863     read_donors(psf_file);
00864 
00865   /*  Read until we find the next non-blank line      */
00866   ret_code = NAMD_read_line(psf_file, buffer);
00867 
00868   while ( (ret_code==0) && (NAMD_blank_string(buffer)) )
00869   {
00870     ret_code = NAMD_read_line(psf_file, buffer);
00871   }
00872 
00873   /*  Check to make sure we didn't hit the EOF      */
00874   if (ret_code != 0)
00875   {
00876     NAMD_die("EOF ENCOUNTERED LOOKING FOR NACC IN PSF");
00877   }
00878 
00879   /*  Look for the string "NACC"        */
00880   if (!NAMD_find_word(buffer, "NACC"))
00881   {
00882     NAMD_die("DID NOT FIND NACC AFTER ATOM LIST IN PSF");
00883   }
00884 
00885   /*  Read in the number of hydrogen bond donors and then the donors */
00886   sscanf(buffer, "%d", &numAcceptors);
00887 
00888   if (numAcceptors)
00889     read_acceptors(psf_file);
00890 
00891   /*  look for the explicit non-bonded exclusion section.     */
00892   while (!NAMD_find_word(buffer, "NNB"))
00893   {
00894     ret_code = NAMD_read_line(psf_file, buffer);
00895 
00896     if (ret_code != 0)
00897     {
00898       NAMD_die("EOF ENCOUNTERED LOOKING FOR NNB IN PSF FILE");
00899     }
00900   }
00901 
00902   /*  Read in the number of exclusions and then the exclusions    */
00903   sscanf(buffer, "%d", &numExclusions);
00904 
00905   if (numExclusions)
00906     read_exclusions(psf_file);
00907 
00908   // DRUDE: read lone pair hosts and anisotropic terms from PSF
00909   if (is_drude_psf)
00910   {
00911     while (!NAMD_find_word(buffer, "NUMLP"))
00912     {
00913       ret_code = NAMD_read_line(psf_file, buffer);
00914       if (ret_code != 0)
00915       {
00916         NAMD_die("EOF ENCOUNTERED LOOKING FOR NUMLP IN DRUDE PSF FILE");
00917       }
00918     }
00919     sscanf(buffer, "%d", &numLphosts);
00920     if (numLphosts) read_lphosts(psf_file);
00921 
00922     while (!NAMD_find_word(buffer, "NUMANISO"))
00923     {
00924       ret_code = NAMD_read_line(psf_file, buffer);
00925       if (ret_code != 0)
00926       {
00927         NAMD_die("EOF ENCOUNTERED LOOKING FOR NUMANISO IN DRUDE PSF FILE");
00928       }
00929     }
00930     sscanf(buffer, "%d", &numAnisos);
00931     if (numAnisos) read_anisos(psf_file);
00932 
00933   }
00934   // DRUDE
00935 
00936   /*  look for the cross-term section.     */
00937   int crossterms_present = 1;
00938   while (!NAMD_find_word(buffer, "NCRTERM"))
00939   {
00940     ret_code = NAMD_read_line(psf_file, buffer);
00941 
00942     if (ret_code != 0)
00943     {
00944       // hit EOF before finding cross-term section
00945       crossterms_present = 0;
00946       break;
00947     }
00948   }
00949 
00950   if ( crossterms_present) {
00951 
00952     /*  Read in the number of cross-terms and then the cross-terms*/
00953     sscanf(buffer, "%d", &numCrossterms);
00954 
00955     if (numCrossterms)
00956       read_crossterms(psf_file, params);
00957 
00958   }
00959 
00960   /*  Close the .psf file.  */
00961   Fclose(psf_file);
00962 
00963   //  analyze the data and find the status of each atom
00964   numRealBonds = numBonds;
00965   build_atom_status();
00966 
00967   return;
00968 #endif
00969 }

void Molecule::receive_Molecule MIStream  ) 
 

Definition at line 3503 of file Molecule.C.

References SimParameters::alchFepOn, SimParameters::alchThermIntOn, Angle, Atom, atomSigPool, ResizeArray< Elem >::begin(), Bond, consForce, consForceIndexes, SimParameters::consForceOn, consTorqueIndexes, SimParameters::consTorqueOn, consTorqueParams, SimParameters::constraintsOn, Crossterm, DebugM, Dihedral, SimParameters::excludeFromPressure, SimParameters::fixedAtomsOn, MIStream::get(), GridDepositMsg::grid, GridDepositMsg::gridnum, hydrogenGroup, Improper, Index, int32, SimParameters::langevinOn, SimParameters::lesOn, SimParameters::mgridforceOn, SimParameters::movDragOn, GridDepositMsg::num_grids, numAcceptors, numAngles, numBonds, numConsForce, numConsTorque, numConstraints, numCrossterms, numDihedrals, numDonors, numExclusions, numExPressureAtoms, numFepFinal, numFepInitial, numFixedAtoms, numFixedRigidBonds, numGridforceGrids, numGridforces, numHydrogenGroups, numImpropers, numMovDrag, numRealBonds, numRotDrag, numStirredAtoms, SimParameters::pairInteractionOn, Real, ResizeArray< Elem >::resize(), SimParameters::rotDragOn, SimParameters::stirOn, SimParameters::tCoupleOn, and GridforceGrid::unpack().

03504 {
03505       //  Get the atom information
03506       msg->get(numAtoms);
03507 
03508   #ifdef MEM_OPT_VERSION   
03509       //are mass and charge pool needed to be sent to other processors???
03510       msg->get(massPoolSize);
03511       if(atomMassPool) delete [] atomMassPool;
03512       atomMassPool = new Real[massPoolSize];
03513       msg->get(massPoolSize, atomMassPool);
03514       if(eachAtomMass) delete [] eachAtomMass;
03515       eachAtomMass = new Index[numAtoms];
03516       msg->get(numAtoms*sizeof(Index), (char *)eachAtomMass);
03517       
03518       msg->get(chargePoolSize);
03519       if(atomChargePool) delete [] atomChargePool;
03520       atomChargePool = new Real[chargePoolSize];
03521       msg->get(chargePoolSize, atomChargePool);
03522       if(eachAtomCharge) delete [] eachAtomCharge;
03523       eachAtomCharge = new Index[numAtoms];
03524       msg->get(numAtoms*sizeof(Index), (char *)eachAtomCharge);
03525 
03526       //vdw_type, partner etc.
03527       if(atoms) delete [] atoms;
03528       atoms = new AtomCstInfo[numAtoms];
03529       msg->get(numAtoms*sizeof(AtomCstInfo), (char *)atoms);
03530 
03531       //get atoms' signatures
03532       msg->get(atomSigPoolSize);
03533       if(atomSigPool) delete [] atomSigPool;
03534       atomSigPool = new AtomSignature[atomSigPoolSize];
03535       for(int i=0; i<atomSigPoolSize; i++)
03536           atomSigPool[i].unpack(msg);
03537 
03538       //get exclusions' signatures
03539       msg->get(exclSigPoolSize);
03540       if(exclSigPool) delete [] exclSigPool;
03541       exclSigPool = new ExclusionSignature[exclSigPoolSize];
03542       for(int i=0; i<exclSigPoolSize; i++)
03543           exclSigPool[i].unpack(msg);
03544 
03545       //get eachAtomSig and eachAtomExclSig
03546       if(eachAtomSig) delete [] eachAtomSig;
03547       eachAtomSig = new Index[numAtoms];
03548       msg->get(numAtoms*sizeof(Index), (char *)eachAtomSig);
03549       if(eachAtomExclSig) delete [] eachAtomExclSig;
03550       eachAtomExclSig = new Index[numAtoms];
03551       msg->get(numAtoms*sizeof(Index), (char *)eachAtomExclSig);
03552 
03553       if(clusterSigs) delete [] clusterSigs;
03554       clusterSigs = new int32[numAtoms];
03555       msg->get(numAtoms*sizeof(int32), (char *)clusterSigs); 
03556   #else
03557       delete [] atoms;
03558       atoms= new Atom[numAtoms];
03559 
03560       msg->get(numAtoms*sizeof(Atom), (char*)atoms);
03561   #endif
03562 
03563       //  Get the bond information
03564       msg->get(numRealBonds);
03565       msg->get(numBonds);
03566 
03567       #ifndef MEM_OPT_VERSION
03568       if (numBonds)
03569       {
03570         delete [] bonds;
03571         bonds=new Bond[numBonds];
03572 
03573         msg->get(numBonds*sizeof(Bond), (char*)bonds);
03574       }
03575       #endif
03576 
03577       //  Get the angle information
03578       msg->get(numAngles);
03579 
03580       #ifndef MEM_OPT_VERSION
03581       if (numAngles)
03582       {
03583         delete [] angles;
03584         angles=new Angle[numAngles];
03585 
03586         msg->get(numAngles*sizeof(Angle), (char*)angles);
03587       }
03588       #endif
03589 
03590       //  Get the dihedral information
03591       msg->get(numDihedrals);
03592 
03593       #ifndef MEM_OPT_VERSION
03594       if (numDihedrals)
03595       {
03596         delete [] dihedrals;
03597         dihedrals=new Dihedral[numDihedrals];
03598 
03599         msg->get(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
03600       }
03601       #endif
03602 
03603       //  Get the improper information
03604       msg->get(numImpropers);
03605 
03606       #ifndef MEM_OPT_VERSION
03607       if (numImpropers)
03608       {
03609         delete [] impropers;
03610         impropers=new Improper[numImpropers];
03611 
03612         msg->get(numImpropers*sizeof(Improper), (char*)impropers);
03613       }
03614       #endif
03615 
03616       //  Get the crossterm information
03617       msg->get(numCrossterms);
03618 
03619       #ifndef MEM_OPT_VERSION
03620       if (numCrossterms)
03621       {
03622         delete [] crossterms;
03623         crossterms=new Crossterm[numCrossterms];
03624 
03625         msg->get(numCrossterms*sizeof(Crossterm), (char*)crossterms);
03626       }
03627       #endif
03628 
03629       //  Get the hydrogen bond donors
03630       msg->get(numDonors);
03631 
03632       if (numDonors)
03633       {
03634         delete [] donors;
03635         donors=new Bond[numDonors];
03636 
03637         msg->get(numDonors*sizeof(Bond), (char*)donors);
03638       }
03639 
03640       //  Get the hydrogen bond acceptors
03641       msg->get(numAcceptors);
03642 
03643       if (numAcceptors)
03644       {
03645         delete [] acceptors;
03646         acceptors=new Bond[numAcceptors];
03647 
03648         msg->get(numAcceptors*sizeof(Bond), (char*)acceptors);
03649       }
03650 
03651       //  Get the exclusion information
03652       #ifndef MEM_OPT_VERSION
03653       msg->get(numExclusions);
03654 
03655       if (numExclusions)
03656       {
03657         delete [] exclusions;
03658         exclusions=new Exclusion[numExclusions];
03659 
03660         msg->get(numExclusions*sizeof(Exclusion), (char*)exclusions);
03661       }
03662       #endif
03663 
03664       #ifdef MEM_OPT_VERSION
03665       msg->get(numHydrogenGroups);      
03666       hydrogenGroup.resize(numAtoms);
03667       msg->get(numAtoms*sizeof(HydrogenGroupID), (char *)hydrogenGroup.begin());     
03668       #endif
03669       
03670       //  Get the constraint information, if they are active
03671       if (simParams->constraintsOn)
03672       {
03673          msg->get(numConstraints);
03674 
03675          delete [] consIndexes;
03676          consIndexes = new int32[numAtoms];
03677          
03678          msg->get(numAtoms, consIndexes);
03679          
03680          if (numConstraints)
03681          {
03682            delete [] consParams;
03683            consParams = new ConstraintParams[numConstraints];
03684       
03685            msg->get(numConstraints*sizeof(ConstraintParams), (char*)consParams);
03686          }
03687       }
03688 
03689       /* BEGIN gf */
03690       if (simParams->mgridforceOn)
03691       {
03692          DebugM(3, "Receiving gridforce info\n");
03693          
03694          msg->get(numGridforceGrids);
03695          
03696          delete [] numGridforces;
03697          numGridforces = new int[numGridforceGrids];
03698          
03699          delete [] gridfrcIndexes;      // Should I be deleting elements of these first?
03700          delete [] gridfrcParams;
03701          delete [] gridfrcGrid;
03702          gridfrcIndexes = new int32*[numGridforceGrids];
03703          gridfrcParams = new GridforceParams*[numGridforceGrids];
03704          gridfrcGrid = new GridforceGrid*[numGridforceGrids];
03705          
03706          for (int grid = 0; grid < numGridforceGrids; grid++) {
03707              msg->get(numGridforces[grid]);
03708              
03709              gridfrcIndexes[grid] = new int32[numAtoms];
03710              msg->get(numAtoms, gridfrcIndexes[grid]);
03711          
03712              if (numGridforces[grid])
03713              {
03714                  gridfrcParams[grid] = new GridforceParams[numGridforces[grid]];
03715                  msg->get(numGridforces[grid]*sizeof(GridforceParams), (char*)gridfrcParams[grid]);
03716              }
03717              
03718              gridfrcGrid[grid] = new GridforceGrid(grid);
03719              gridfrcGrid[grid]->unpack(msg);
03720              CProxy_ComputeGridForceNodeMgr 
03721                mgr(CkpvAccess(BOCclass_group).computeGridForceNodeMgr);
03722              GridDepositMsg *outmsg = new GridDepositMsg;
03723              outmsg->gridnum = grid;
03724              outmsg->grid = gridfrcGrid[grid];
03725              outmsg->num_grids = numGridforceGrids;
03726              mgr[CkMyNode()].depositInitialGrid(outmsg);
03727          }
03728       }
03729       /* END gf */
03730       
03731       //  Get the stirring information, if stirring is  active
03732       if (simParams->stirOn)
03733       {
03734          msg->get(numStirredAtoms);
03735 
03736          delete [] stirIndexes;
03737          stirIndexes = new int32[numAtoms];
03738          
03739          msg->get(numAtoms, stirIndexes);
03740          
03741          if (numStirredAtoms)
03742          {
03743            delete [] stirParams;
03744            stirParams = new StirParams[numStirredAtoms];
03745       
03746            msg->get(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
03747          }
03748       }
03749       
03750       //  Get the moving drag information, if it is active
03751       if (simParams->movDragOn) {
03752          msg->get(numMovDrag);
03753          delete [] movDragIndexes;
03754          movDragIndexes = new int32[numAtoms];
03755          msg->get(numAtoms, movDragIndexes);
03756          if (numMovDrag)
03757          {
03758            delete [] movDragParams;
03759            movDragParams = new MovDragParams[numMovDrag];
03760            msg->get(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
03761          }
03762       }
03763       
03764       //  Get the rotating drag information, if it is active
03765       if (simParams->rotDragOn) {
03766          msg->get(numRotDrag);
03767          delete [] rotDragIndexes;
03768          rotDragIndexes = new int32[numAtoms];
03769          msg->get(numAtoms, rotDragIndexes);
03770          if (numRotDrag)
03771          {
03772            delete [] rotDragParams;
03773            rotDragParams = new RotDragParams[numRotDrag];
03774            msg->get(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
03775          }
03776       }
03777       
03778       //  Get the "constant" torque information, if it is active
03779       if (simParams->consTorqueOn) {
03780          msg->get(numConsTorque);
03781          delete [] consTorqueIndexes;
03782          consTorqueIndexes = new int32[numAtoms];
03783          msg->get(numAtoms, consTorqueIndexes);
03784          if (numConsTorque)
03785          {
03786            delete [] consTorqueParams;
03787            consTorqueParams = new ConsTorqueParams[numConsTorque];
03788            msg->get(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
03789          }
03790       }
03791       
03792       // Get the constant force information, if it's active
03793       if (simParams->consForceOn)
03794       { msg->get(numConsForce);
03795         delete [] consForceIndexes;
03796         consForceIndexes = new int32[numAtoms];
03797         msg->get(numAtoms, consForceIndexes);
03798         if (numConsForce)
03799         { delete [] consForce;
03800           consForce = new Vector[numConsForce];
03801           msg->get(numConsForce*sizeof(Vector), (char*)consForce);
03802         }
03803       }
03804 
03805       //  Get the langevin parameters, if they are active
03806       if (simParams->langevinOn || simParams->tCoupleOn)
03807       {
03808         delete [] langevinParams;
03809         langevinParams = new Real[numAtoms];
03810 
03811         msg->get(numAtoms, langevinParams);
03812       }
03813 
03814       //  Get the fixed atoms, if they are active
03815       if (simParams->fixedAtomsOn)
03816       {
03817         delete [] fixedAtomFlags;
03818         fixedAtomFlags = new int32[numAtoms];
03819 
03820         msg->get(numFixedAtoms);
03821         msg->get(numAtoms, fixedAtomFlags);
03822         msg->get(numFixedRigidBonds);
03823       }
03824 
03825       if (simParams->excludeFromPressure) {
03826         exPressureAtomFlags = new int32[numAtoms];
03827         msg->get(numExPressureAtoms);
03828         msg->get(numAtoms, exPressureAtomFlags);
03829       }
03830 
03831 //fepb
03832       //receive fep atom info
03833       if (simParams->alchFepOn || simParams->lesOn || simParams->alchThermIntOn || simParams->pairInteractionOn) {
03834         delete [] fepAtomFlags;
03835         fepAtomFlags = new unsigned char[numAtoms];
03836 
03837         msg->get(numFepInitial);
03838         msg->get(numFepFinal);
03839         msg->get(numAtoms*sizeof(unsigned char), (char*)fepAtomFlags);
03840       }
03841 //fepe
03842 
03843       //  Now free the message 
03844       delete msg;
03845       
03846       //  analyze the data and find the status of each atom
03847       build_atom_status();
03848 
03849       //  Now build arrays of indexes into these arrays by atom
03850       #ifdef MEM_OPT_VERSION
03851       build_excl_check_signatures();
03852       #else
03853       build_lists_by_atom();      
03854       #endif
03855 
03856       #ifdef MEM_OPT_VERSION
03857       delEachAtomSigs();
03858       delChargeSpace();
03859       delMassSpace();
03860       delOtherEachAtomStructs();
03861       #endif
03862     }

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

Referenced by Node::reloadCharges().

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

Definition at line 928 of file Molecule.h.

References Real.

Referenced by HomePatch::mollyAverage(), HomePatch::mollyMollify(), HomePatch::rattle1(), and HomePatch::rattle2().

00929   {
00930     return(rigidBondLengths[atomnum]);
00931   }

void Molecule::send_Molecule MOStream  ) 
 

Definition at line 3227 of file Molecule.C.

References SimParameters::alchFepOn, SimParameters::alchThermIntOn, Angle, Atom, atomSigPool, ResizeArray< Elem >::begin(), Bond, consForce, consForceIndexes, SimParameters::consForceOn, consTorqueIndexes, SimParameters::consTorqueOn, consTorqueParams, SimParameters::constraintsOn, Crossterm, DebugM, Dihedral, MOStream::end(), SimParameters::excludeFromPressure, SimParameters::fixedAtomsOn, hydrogenGroup, Improper, Index, int32, SimParameters::langevinOn, SimParameters::lesOn, SimParameters::mgridforceOn, SimParameters::movDragOn, numAcceptors, numAngles, numBonds, numConsForce, numConsTorque, numConstraints, numCrossterms, numDihedrals, numDonors, numExclusions, numExPressureAtoms, numFepFinal, numFepInitial, numFixedAtoms, numFixedRigidBonds, numGridforceGrids, numGridforces, numHydrogenGroups, numImpropers, numMovDrag, numRealBonds, numRotDrag, numStirredAtoms, GridforceGrid::pack(), SimParameters::pairInteractionOn, MOStream::put(), SimParameters::rotDragOn, SimParameters::stirOn, and SimParameters::tCoupleOn.

03229 {
03230     #ifdef MEM_OPT_VERSION
03231     //  Now build arrays of indexes into these arrays by atom      
03232     //generating all the new atom signatures and exclusion signatures only on pe0
03233     build_lists_by_atom();
03234     #endif
03235       
03236   /*//  Message to send to clients
03237   int bufSize = BUFSIZE;
03238   // When the simulation system is very large, then the buffer size should be expanded to reduce the number of one-to-all broadcasts.
03239   if(numAtoms>=1000000) bufSize=16*BUFSIZE;
03240   MOStream *msg=com_obj->newOutputStream(ALLBUTME, MOLECULETAG, bufSize);
03241   if ( msg == NULL )
03242   {
03243     NAMD_die("Memory allocation failed in Molecule::send_Molecule");
03244   }*/
03245 
03246   #ifdef MEM_OPT_VERSION
03247       msg->put(numAtoms);
03248       //mass and charge pool needed to be sent to other processors
03249       //for the sake of function call: build_atom_status
03250       msg->put(massPoolSize);
03251       msg->put(massPoolSize, atomMassPool);
03252       msg->put(numAtoms*sizeof(Index), (char *)eachAtomMass);
03253 
03254       msg->put(chargePoolSize);
03255       msg->put(chargePoolSize, atomChargePool);
03256       msg->put(numAtoms*sizeof(Index), (char *)eachAtomCharge);
03257 
03258       //vdw_type, partner etc.
03259       msg->put(numAtoms*sizeof(AtomCstInfo), (char *)atoms);
03260 
03261       //put atoms' signatures
03262       msg->put(atomSigPoolSize);
03263       for(int i=0; i<atomSigPoolSize; i++)
03264           atomSigPool[i].pack(msg);
03265 
03266       //put atom's exclusion signatures
03267       msg->put(exclSigPoolSize);
03268       for(int i=0; i<exclSigPoolSize; i++)
03269           exclSigPool[i].pack(msg);
03270 
03271       //put eachAtomSig and eachAtomExclSig
03272       msg->put(numAtoms*sizeof(Index), (char *)eachAtomSig);
03273       msg->put(numAtoms*sizeof(Index), (char *)eachAtomExclSig);
03274 
03275       msg->put(numAtoms*sizeof(int32), (char *)clusterSigs);
03276   #else
03277       msg->put(numAtoms);
03278       msg->put(numAtoms*sizeof(Atom), (char*)atoms);
03279   #endif
03280       //  Send the bond information
03281       msg->put(numRealBonds);
03282       msg->put(numBonds);
03283 
03284       #ifndef MEM_OPT_VERSION
03285       if (numBonds)
03286       {
03287         msg->put(numBonds*sizeof(Bond), (char*)bonds);
03288       }
03289       #endif
03290 
03291       //  Send the angle information
03292       msg->put(numAngles);
03293 
03294       #ifndef MEM_OPT_VERSION
03295       if (numAngles)
03296       {
03297         msg->put(numAngles*sizeof(Angle), (char*)angles);
03298       }
03299       #endif
03300 
03301       //  Send the dihedral information
03302       msg->put(numDihedrals);
03303 
03304       #ifndef MEM_OPT_VERSION
03305       if (numDihedrals)
03306       {
03307         msg->put(numDihedrals*sizeof(Dihedral), (char*)dihedrals);
03308       }
03309       #endif
03310 
03311       //  Send the improper information
03312       msg->put(numImpropers);
03313 
03314       #ifndef MEM_OPT_VERSION
03315       if (numImpropers)
03316       {
03317         msg->put(numImpropers*sizeof(Improper), (char*)impropers);
03318       }
03319       #endif
03320 
03321       //  Send the crossterm information
03322       msg->put(numCrossterms);
03323 
03324       #ifndef MEM_OPT_VERSION
03325       if (numCrossterms)
03326       {
03327         msg->put(numCrossterms*sizeof(Crossterm), (char*)crossterms);
03328       }
03329       #endif
03330 
03331       // send the hydrogen bond donor information
03332       msg->put(numDonors);
03333 
03334       if(numDonors)
03335       {
03336         msg->put(numDonors*sizeof(Bond), (char*)donors);
03337       }
03338 
03339       // send the hydrogen bond acceptor information
03340       msg->put(numAcceptors);
03341 
03342       if(numAcceptors)
03343       {
03344         msg->put(numAcceptors*sizeof(Bond), (char*)acceptors);
03345       }
03346 
03347       //  Send the exclusion information
03348       #ifndef MEM_OPT_VERSION
03349       msg->put(numExclusions);
03350 
03351       if (numExclusions)
03352       {
03353         msg->put(numExclusions*sizeof(Exclusion), (char*)exclusions);
03354       }
03355       #endif
03356 
03357       //hydrogen group info is calculated when generating the compressed molecule
03358       //information, so this has to be distributed to other nodes instead of
03359       //being recalculated in build_atom_status in receive_Molecule function
03360       #ifdef MEM_OPT_VERSION
03361       msg->put(numHydrogenGroups);      
03362       msg->put(numAtoms*sizeof(HydrogenGroupID), (char *)hydrogenGroup.begin());      
03363       #endif
03364       
03365       //  Send the constraint information, if used
03366       if (simParams->constraintsOn)
03367       {
03368          msg->put(numConstraints);
03369          
03370          msg->put(numAtoms, consIndexes);
03371          
03372          if (numConstraints)
03373          {
03374            msg->put(numConstraints*sizeof(ConstraintParams), (char*)consParams);
03375          }
03376       }
03377       
03378       /* BEGIN gf */
03379       // Send the gridforce information, if used
03380       if (simParams->mgridforceOn)
03381       {
03382          DebugM(3, "Sending gridforce info\n");
03383          msg->put(numGridforceGrids);
03384          
03385          for (int grid = 0; grid < numGridforceGrids; grid++) {
03386              msg->put(numGridforces[grid]);
03387              msg->put(numAtoms, gridfrcIndexes[grid]);
03388              if (numGridforces[grid])
03389              {
03390                  msg->put(numGridforces[grid]*sizeof(GridforceParams), (char*)gridfrcParams[grid]);
03391              }
03392              gridfrcGrid[grid]->pack(msg);      // grid object writes its private data to message itself
03393          }
03394       }
03395       /* END gf */
03396 
03397       //  Send the stirring information, if used
03398       if (simParams->stirOn)
03399       {
03400                //CkPrintf ("DEBUG: putting numStirredAtoms..\n");
03401          msg->put(numStirredAtoms);
03402                //CkPrintf ("DEBUG: putting numAtoms,stirIndexes.. numAtoms=%d\n",numStirredAtoms);
03403          msg->put(numAtoms, stirIndexes);
03404                //CkPrintf ("DEBUG: if numStirredAtoms..\n");
03405          if (numStirredAtoms)
03406          {
03407            //CkPrintf ("DEBUG: big put, with (char*)stirParams\n");
03408            msg->put(numStirredAtoms*sizeof(StirParams), (char*)stirParams);
03409          }
03410       }
03411       
03412       
03413       //  Send the moving drag information, if used
03414       if (simParams->movDragOn) {
03415          msg->put(numMovDrag);
03416          msg->put(numAtoms, movDragIndexes);
03417          if (numMovDrag)
03418          {
03419            msg->put(numMovDrag*sizeof(MovDragParams), (char*)movDragParams);
03420          }
03421       }
03422       
03423       //  Send the rotating drag information, if used
03424       if (simParams->rotDragOn) {
03425          msg->put(numRotDrag);
03426          msg->put(numAtoms, rotDragIndexes);
03427          if (numRotDrag)
03428          {
03429            msg->put(numRotDrag*sizeof(RotDragParams), (char*)rotDragParams);
03430          }
03431       }
03432       
03433       //  Send the "constant" torque information, if used
03434       if (simParams->consTorqueOn) {
03435          msg->put(numConsTorque);
03436          msg->put(numAtoms, consTorqueIndexes);
03437          if (numConsTorque)
03438          {
03439            msg->put(numConsTorque*sizeof(ConsTorqueParams), (char*)consTorqueParams);
03440          }
03441       }
03442       
03443       // Send the constant force information, if used
03444       if (simParams->consForceOn)
03445       { msg->put(numConsForce);
03446         msg->put(numAtoms, consForceIndexes);
03447         if (numConsForce)
03448           msg->put(numConsForce*sizeof(Vector), (char*)consForce);
03449       }
03450 
03451       //  Send the langevin parameters, if active
03452       if (simParams->langevinOn || simParams->tCoupleOn)
03453       {
03454         msg->put(numAtoms, langevinParams);
03455       }
03456 
03457       //  Send fixed atoms, if active
03458       if (simParams->fixedAtomsOn)
03459       {
03460         msg->put(numFixedAtoms);
03461         msg->put(numAtoms, fixedAtomFlags);
03462         msg->put(numFixedRigidBonds);
03463       }
03464 
03465       if (simParams->excludeFromPressure) {
03466         msg->put(numExPressureAtoms);
03467         msg->put(numAtoms, exPressureAtomFlags);
03468       }
03469 
03470 //fepb
03471       // send fep atom info
03472       if (simParams->alchFepOn || simParams->alchThermIntOn || simParams->lesOn || simParams->pairInteractionOn) {
03473         msg->put(numFepInitial);
03474         msg->put(numFepFinal);
03475         msg->put(numAtoms*sizeof(char), (char*)fepAtomFlags);
03476       }
03477 //fepe
03478 
03479       // Broadcast the message to the other nodes
03480       msg->end();
03481       delete msg;
03482 
03483       #ifdef MEM_OPT_VERSION
03484       build_excl_check_signatures();
03485       #else      
03486       //  Now build arrays of indexes into these arrays by atom      
03487       build_lists_by_atom();
03488       #endif
03489 
03490 }

void Molecule::setBFactorData molfile_atom_t *  atomarray  ) 
 

Definition at line 2763 of file Molecule.C.

Referenced by Molecule().

02763                                                       {
02764     bfactor = new float[numAtoms];
02765     for(int i=0; i<numAtoms; i++) {
02766         bfactor[i] = atomarray[i].bfactor;
02767     }
02768 }

void Molecule::setOccupancyData molfile_atom_t *  atomarray  ) 
 

Definition at line 2756 of file Molecule.C.

Referenced by Molecule().

02756                                                         {
02757     occupancy = new float[numAtoms];
02758     for(int i=0; i<numAtoms; i++) {
02759         occupancy[i] = atomarray[i].occupancy;
02760     }
02761 }


Friends And Related Function Documentation

friend class AngleElem [friend]
 

Definition at line 147 of file Molecule.h.

friend class BondElem [friend]
 

Definition at line 146 of file Molecule.h.

friend class CrosstermElem [friend]
 

Definition at line 150 of file Molecule.h.

friend class DihedralElem [friend]
 

Definition at line 148 of file Molecule.h.

friend class ExclElem [friend]
 

Definition at line 145 of file Molecule.h.

friend class ImproperElem [friend]
 

Definition at line 149 of file Molecule.h.


Member Data Documentation

int Molecule::alchDroppedAngles
 

Definition at line 430 of file Molecule.h.

Referenced by NamdState::configListInit().

int Molecule::alchDroppedDihedrals
 

Definition at line 431 of file Molecule.h.

Referenced by NamdState::configListInit().

int Molecule::alchDroppedImpropers
 

Definition at line 432 of file Molecule.h.

Referenced by NamdState::configListInit().

Vector* Molecule::consForce
 

Definition at line 469 of file Molecule.h.

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

int32* Molecule::consForceIndexes
 

Definition at line 468 of file Molecule.h.

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

int32* Molecule::consTorqueIndexes
 

Definition at line 471 of file Molecule.h.

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

ConsTorqueParams* Molecule::consTorqueParams
 

Definition at line 472 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

HydrogenGroup Molecule::hydrogenGroup
 

Definition at line 489 of file Molecule.h.

Referenced by WorkDistrib::caclNumAtomsInEachPatch(), WorkDistrib::createAtomLists(), outputCompressedFile(), receive_Molecule(), and send_Molecule().

int Molecule::is_drude_psf
 

Definition at line 348 of file Molecule.h.

Referenced by read_psf_file().

int Molecule::numAcceptors
 

Definition at line 436 of file Molecule.h.

Referenced by getAcceptorData(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numAngles
 

Definition at line 427 of file Molecule.h.

Referenced by buildAngleData(), NamdState::configListInit(), dumpbench(), getAngleData(), loadMolInfo(), Molecule(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numAnisos
 

Definition at line 443 of file Molecule.h.

Referenced by read_psf_file().

int Molecule::numAtoms
 

Definition at line 423 of file Molecule.h.

Referenced by GlobalMasterFreeEnergy::addForce(), GlobalMasterEasy::addForce(), WorkDistrib::assignNodeToPatch(), colvarmodule::atom::atom(), build12Excls(), build13Excls(), build14Excls(), ComputeNonbondedCUDA::build_exclusions(), buildAtomData(), buildBondData(), buildExclusions(), Controller::compareChecksums(), ComputeGlobal::ComputeGlobal(), NamdState::configListInit(), ComputeMgr::createComputes(), dumpbench(), getAcceptorData(), getAngleData(), getAtomData(), getBondData(), getCrosstermData(), getDihedralData(), getDonorData(), getExtraBonds(), getImproperData(), GlobalMasterFreeEnergy::getMass(), GlobalMasterEasy::getMass(), GlobalMasterTMD::GlobalMasterTMD(), integrateAllAtomSigs(), loadMolInfo(), Molecule(), outputCompressedFile(), outputPsfFile(), read_psf_file(), readPsfFile(), Controller::receivePressure(), ComputeMgr::recvComputeConsForceMsg(), ComputeExtMgr::recvCoord(), Node::reloadCharges(), GlobalMasterFreeEnergy::requestAtom(), GlobalMasterEasy::requestAtom(), SELF(), Node::startup(), Tcl_centerOfMass(), Tcl_centerOfNumber(), Tcl_loadCoords(), Tcl_radiusOfGyration(), and wrap_coor_int().

int Molecule::numBonds
 

Definition at line 426 of file Molecule.h.

Referenced by buildBondData(), NamdState::configListInit(), dumpbench(), getBondData(), loadMolInfo(), Molecule(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numCalcAngles
 

Definition at line 478 of file Molecule.h.

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

int Molecule::numCalcBonds
 

Definition at line 477 of file Molecule.h.

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

int Molecule::numCalcCrossterms
 

Definition at line 481 of file Molecule.h.

Referenced by Controller::compareChecksums().

int Molecule::numCalcDihedrals
 

Definition at line 479 of file Molecule.h.

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

int Molecule::numCalcExclusions
 

Definition at line 482 of file Molecule.h.

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

int Molecule::numCalcImpropers
 

Definition at line 480 of file Molecule.h.

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

int Molecule::numConsForce
 

Definition at line 467 of file Molecule.h.

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

int Molecule::numConsTorque
 

Definition at line 454 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numConstraints
 

Definition at line 447 of file Molecule.h.

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

int Molecule::numCrossterms
 

Definition at line 434 of file Molecule.h.

Referenced by buildCrosstermData(), NamdState::configListInit(), getCrosstermData(), loadMolInfo(), Molecule(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numDihedrals
 

Definition at line 428 of file Molecule.h.

Referenced by buildDihedralData(), NamdState::configListInit(), dumpbench(), getDihedralData(), loadMolInfo(), Molecule(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numDonors
 

Definition at line 435 of file Molecule.h.

Referenced by getDonorData(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numDrudeAtoms
 

Definition at line 442 of file Molecule.h.

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

int Molecule::numExclusions
 

Definition at line 437 of file Molecule.h.

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

int Molecule::numExPressureAtoms
 

Definition at line 457 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numFepFinal
 

Definition at line 464 of file Molecule.h.

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

int Molecule::numFepInitial
 

Definition at line 463 of file Molecule.h.

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

int Molecule::numFixedAtoms
 

Definition at line 455 of file Molecule.h.

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

int Molecule::numFixedGroups
 

Definition at line 459 of file Molecule.h.

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

int Molecule::numFixedRigidBonds
 

Definition at line 461 of file Molecule.h.

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

int Molecule::numGridforceGrids
 

Definition at line 449 of file Molecule.h.

Referenced by NamdState::configListInit(), ComputeGridForce::doForce(), ComputeGridForce::finishForce(), GridforceGrid::getGridIndices(), receive_Molecule(), and send_Molecule().

int* Molecule::numGridforces
 

Definition at line 450 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numHydrogenGroups
 

Definition at line 458 of file Molecule.h.

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

int Molecule::numImpropers
 

Definition at line 433 of file Molecule.h.

Referenced by buildImproperData(), NamdState::configListInit(), dumpbench(), getImproperData(), loadMolInfo(), Molecule(), read_psf_file(), readPsfFile(), receive_Molecule(), and send_Molecule().

int Molecule::numLonepairs
 

Definition at line 441 of file Molecule.h.

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

int Molecule::numLphosts
 

Definition at line 444 of file Molecule.h.

Referenced by read_psf_file().

int Molecule::numMovDrag
 

Definition at line 452 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numMultipleDihedrals
 

Definition at line 485 of file Molecule.h.

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

int Molecule::numMultipleImpropers
 

Definition at line 487 of file Molecule.h.

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

int Molecule::numRealBonds
 

Definition at line 425 of file Molecule.h.

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

int Molecule::numRigidBonds
 

Definition at line 460 of file Molecule.h.

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

int Molecule::numRotDrag
 

Definition at line 453 of file Molecule.h.

Referenced by receive_Molecule(), and send_Molecule().

int Molecule::numStirredAtoms
 

Definition at line 456 of file Molecule.h.

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

int Molecule::numTotalExclusions
 

Definition at line 438 of file Molecule.h.

Real Molecule::r_ohc
 

Definition at line 353 of file Molecule.h.

Real Molecule::r_om
 

Definition at line 352 of file Molecule.h.

int Molecule::suspiciousAlchBonds
 

Definition at line 429 of file Molecule.h.

Referenced by NamdState::configListInit().

BigReal Molecule::tail_corr_ener
 

Definition at line 356 of file Molecule.h.

Referenced by Controller::printEnergies().

BigReal Molecule::tail_corr_virial
 

Definition at line 357 of file Molecule.h.

Referenced by Controller::receivePressure().

int Molecule::waterIndex
 

Definition at line 490 of file Molecule.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 05:00:00 2009 for NAMD by  doxygen 1.3.9.1