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

Molecule.h

Go to the documentation of this file.
00001 
00007 /*
00008    This class is used to store all of the structural       
00009    information for a simulation.  It reads in this information 
00010    from a .psf file, cross checks and obtains some information
00011    from the Parameters object that is passed in, and then     
00012    stores all this information for later use. 
00013 */
00014 
00015 
00016 #ifndef MOLECULE_H
00017 
00018 #define MOLECULE_H
00019 
00020 #include "parm.h"
00021 
00022 #include "common.h"
00023 #include "NamdTypes.h"
00024 #include "structures.h"
00025 #include "ConfigList.h"
00026 #include "Vector.h"
00027 #include "UniqueSet.h"
00028 #include "Hydrogen.h"
00029 #include "GromacsTopFile.h"
00030 /* BEGIN gf */
00031 #include "GridForceGrid.h"
00032 #include "Tensor.h"
00033 /* END gf */
00034 
00035 // Go -- JLai
00036 #define MAX_GO_CHAINS          10
00037 #define MAX_RESTRICTIONS       10
00038 // End of Go
00039 
00040 #include "molfile_plugin.h"
00041 
00042 #include <vector>
00043 
00044 class SimParameters;
00045 class Parameters;
00046 class ConfigList;
00047 class PDB;
00048 class MIStream;
00049 class MOStream;
00050 
00051 class ExclElem;
00052 class BondElem;
00053 class AngleElem;
00054 class DihedralElem;
00055 class ImproperElem;
00056 class TholeElem;  // Drude model
00057 class AnisoElem;  // Drude model
00058 class CrosstermElem;
00059 class ResidueLookupElem;
00060 
00061 struct OutputAtomRecord;
00062 
00063 template<class Type> class ObjectArena;
00064 
00065 class ExclusionCheck {
00066 public:
00067   int32 min,max;
00068   char *flags;
00069 
00070   ExclusionCheck(){
00071       min=0;
00072       max=-1;
00073       flags = NULL;
00074   }
00075   ExclusionCheck(const ExclusionCheck& chk){
00076       min = chk.min;
00077       max = chk.max;
00078       if(max>min){ 
00079         flags = new char[max-min+1];
00080         memcpy(flags, chk.flags, sizeof(char)*(max-min+1));
00081       }
00082   }
00083   ExclusionCheck &operator=(const ExclusionCheck& chk){
00084     min = chk.min;
00085     max = chk.max;
00086     if(flags) delete [] flags;
00087     flags = NULL;
00088     if(max>min){
00089         flags = new char[max-min+1];
00090         memcpy(flags, chk.flags, sizeof(char)*(max-min+1));
00091     }
00092     return *this;
00093   }
00094   ~ExclusionCheck(){
00095       if(flags) delete [] flags;
00096   }
00097 };
00098 #define EXCHCK_FULL 1
00099 #define EXCHCK_MOD 2
00100 
00101 // Ported by JLai -- JE
00102 typedef struct go_val
00103 {
00104   Real epsilon;      // Epsilon
00105   int exp_a;         // First exponent for attractive L-J term
00106   int exp_b;         // Second exponent for attractive L-J term
00107   int exp_rep;       // Exponent for repulsive L-J term
00108   Real sigmaRep;     // Sigma for repulsive term
00109   Real epsilonRep;   // Epsilon for replusive term
00110   Real cutoff;       // Cutoff distance for Go calculation
00111   int  restrictions[MAX_RESTRICTIONS];  //  List of residue ID differences to be excluded from Go calculation
00112 } GoValue;
00113 
00114 typedef struct go_pair
00115 {
00116   int goIndxA;       // indexA
00117   int goIndxB;       // indexB
00118   double A;          // double A for the LJ pair
00119   double B;          // double B for the LJ pair
00120 } GoPair;
00121 // End of port - JL
00122 
00123 //only used for compressing the molecule information
00124 typedef struct seg_resid
00125 {
00126     char segname[11];
00127     int resid;
00128 }AtomSegResInfo;
00129 
00130 // List maintaining the global atom indicies sorted by helix groups.
00131 class Molecule
00132 {
00133  private:
00134 typedef struct constraint_params
00135 {
00136    Real k;    //  Force constant
00137    Vector refPos; //  Reference position for restraint
00138 } ConstraintParams;
00139 
00140 
00141 
00142 /* BEGIN gf */
00143 typedef struct gridfrc_params
00144 {
00145     Real k;     // force multiplier
00146     Charge q;   // charge
00147 } GridforceParams;
00148 /* END gf */
00149 
00150 
00151 typedef struct stir_params
00152 {
00153   Real startTheta;
00154   Vector refPos;  //  Reference position for stirring
00155 } StirParams;
00156 
00157 typedef struct movdrag_params
00158 {
00159   Vector v;            //  Linear velocity (A/step)
00160 } MovDragParams;
00161 
00162 
00163 typedef struct rotdrag_params
00164 {
00165    Real v;              //  Angular velocity (deg/step)
00166    Vector a;            //  Rotation axis
00167    Vector p;            //  Rotation pivot point
00168 } RotDragParams;
00169 
00170 typedef struct constorque_params
00171 {
00172    Real v;              //  "Torque" value (Kcal/(mol*A^2))
00173    Vector a;            //  Rotation axis
00174    Vector p;            //  Rotation pivot point
00175 } ConsTorqueParams;
00176 
00177 #ifdef MEM_OPT_VERSION
00178 //indicate a range of atoms from aid1 to aid2
00179 struct AtomSet{
00180     AtomID aid1;
00181     AtomID aid2;
00182 
00183     int operator < (const AtomSet &a) const{
00184                 return aid1 < a.aid1;
00185         }
00186 };
00187 typedef ResizeArray<AtomSet> AtomSetList;
00188 
00189   void load_atom_set(StringList *setfile, const char *setname,
00190         int *numAtomsInSet, Molecule::AtomSetList **atomsSet) const;
00191 
00192 #endif
00193 
00194 friend class ExclElem;
00195 friend class BondElem;
00196 friend class AngleElem;
00197 friend class DihedralElem;
00198 friend class ImproperElem;
00199 friend class TholeElem;  // Drude model
00200 friend class AnisoElem;  // Drude model
00201 friend class CrosstermElem;
00202 friend class WorkDistrib;
00203 
00204 private:
00205 
00206 #ifndef MEM_OPT_VERSION
00207         Atom *atoms;    //  Array of atom structures
00208         ObjectArena<char> *nameArena;
00209         AtomNameInfo *atomNames;//  Array of atom name info.  Only maintained on node 0 for VMD interface
00210         //replaced by atom signatures
00211         Bond *bonds;    //  Array of bond structures
00212         Angle *angles;    //  Array of angle structures
00213         Dihedral *dihedrals;  //  Array of dihedral structures
00214         Improper *impropers;  //  Array of improper structures                          
00215         Crossterm *crossterms;  //  Array of cross-term structures
00216 
00217         //These will be replaced by exclusion signatures
00218         Exclusion *exclusions;  //  Array of exclusion structures
00219         UniqueSet<Exclusion> exclusionSet;  //  Used for building
00220 
00221         int32 *cluster;   //  first atom of connected cluster
00222 
00223         ObjectArena<int32> *tmpArena;
00224         int32 **bondsWithAtom;  //  List of bonds involving each atom
00225         ObjectArena<int32> *arena;
00226 
00227         //function is replaced by atom signatures
00228         int32 **bondsByAtom;  //  List of bonds owned by each atom
00229         int32 **anglesByAtom;     //  List of angles owned by each atom
00230         int32 **dihedralsByAtom;  //  List of dihedrals owned by each atom
00231         int32 **impropersByAtom;  //  List of impropers owned by each atom
00232         int32 **crosstermsByAtom;  //  List of crossterms owned by each atom
00233 
00234         int32 **exclusionsByAtom; //  List of exclusions owned by each atom
00235         int32 **fullExclusionsByAtom; //  List of atoms excluded for each atom
00236         int32 **modExclusionsByAtom; //  List of atoms modified for each atom
00237         ObjectArena<char> *exclArena;
00238         ExclusionCheck *all_exclusions;
00239 
00240         // DRUDE
00241         int32 **tholesByAtom;  // list of Thole correction terms owned by each atom
00242         int32 **anisosByAtom;  // list of anisotropic terms owned by each atom
00243         // DRUDE
00244 
00245 #else
00246         //Indexing to constant pools to save space
00247         AtomCstInfo *atoms;
00248         Index *eachAtomMass; //after initialization, this could be freed (possibly)
00249         Index *eachAtomCharge; //after initialization, this could be freed (possibly)
00250         AtomNameIdx *atomNames;
00251         ObjectArena<char> *nameArena; //the space for names to be allocated  
00252 
00253         //A generally true assumption: all atoms are arranged in the order of clusters. In other words,
00254         //all atoms for a cluster must appear before/after any atoms in other clusters
00255         //The first atom in the cluster (which has the lowest atom id) stores the cluster size
00256         //other atoms in the cluster stores -1
00257         int32 *clusterSigs;
00258         int32 numClusters;
00259         
00260         AtomSigID *eachAtomSig;
00261         ExclSigID *eachAtomExclSig;
00262 
00263     AtomSetList *fixedAtomsSet;    
00264     AtomSetList *constrainedAtomsSet;    
00265 #endif
00266  
00267   ResidueLookupElem *resLookup; // find residues by name
00268 
00269   AtomSegResInfo *atomSegResids; //only used for generating compressed molecule info
00270 
00271   Bond *donors;         //  Array of hydrogen bond donor structures
00272   Bond *acceptors;  //  Array of hydrogen bond acceptor
00273 
00274   // DRUDE
00275   DrudeConst *drudeConsts;  // supplement Atom data (length of Atom array)
00276   Thole *tholes;            // Thole (screened Coulomb) interactions
00277   Aniso *anisos;            // anisotropic terms
00278   Lphost *lphosts;          // lone pair hosts
00279   int32 *lphostIndexes;     // index for each LP into lphosts array
00280   // DRUDE
00281 
00282   int32 *consIndexes; //  Constraint indexes for each atom
00283   ConstraintParams *consParams;
00284 
00285 /* BEGIN gf */
00286   int32 **gridfrcIndexes;
00287   GridforceParams **gridfrcParams;
00288   GridforceGrid **gridfrcGrid;
00289 /* END gf */
00290 
00291         //  Parameters for each atom constrained
00292   int32 *stirIndexes; //Stirring indexes for each atoms
00293   StirParams *stirParams;
00294                           // Paramters for each atoms stirred
00295   int32 *movDragIndexes;  //  Moving drag indexes for each atom
00296   MovDragParams *movDragParams;
00297                                 //  Parameters for each atom moving-dragged
00298   int32 *rotDragIndexes;  //  Rotating drag indexes for each atom
00299   RotDragParams *rotDragParams;
00300                                 //  Parameters for each atom rotation-dragged
00301 
00302   Real *langevinParams;   //  b values for langevin dynamics
00303   int32 *fixedAtomFlags;  //  1 for fixed, -1 for fixed group, else 0
00304   int32 *exPressureAtomFlags; // 1 for excluded, -1 for excluded group.
00305 
00306   //In the memory optimized version: it will be NULL if the general
00307   //true assumption mentioned above holds. If not, its size is numClusters.
00308   //In the ordinary version: its size is numAtoms, and indicates the size
00309   //of connected cluster or 0.
00310   int32 *clusterSize;                            
00311 
00312         Real *rigidBondLengths;  //  if H, length to parent or 0. or
00313         //  if not H, length between children or 0.
00314 //fepb
00315         unsigned char *fepAtomFlags; 
00316 //fepe
00317 
00318   //occupancy and bfactor data from plugin-based IO implementation of loading structures
00319   float *occupancy;
00320   float *bfactor;
00321 
00322 
00323   // added during the trasition from 1x to 2
00324   SimParameters *simParams;
00325   Parameters *params;
00326 
00327 private:
00328         void initialize(SimParameters *, Parameters *param);
00329         // Sets most data to zero
00330 
00331   //LCPO
00332   int *lcpoParamType;
00333 
00334 #ifndef MEM_OPT_VERSION
00335         void read_psf_file(char *, Parameters *);
00336         //  Read in a .psf file given
00337         //  the filename and the parameter
00338         //  object to use          
00339   
00340   void read_atoms(FILE *, Parameters *);
00341         //  Read in atom info from .psf
00342   void read_bonds(FILE *, Parameters *);
00343         //  Read in bond info from .psf
00344   void read_angles(FILE *, Parameters *);
00345         //  Read in angle info from .psf
00346   void read_dihedrals(FILE *, Parameters *);
00347         //  Read in dihedral info from .psf
00348   void read_impropers(FILE *, Parameters *);
00349         //  Read in improper info from .psf
00350   void read_crossterms(FILE *, Parameters *);
00351         //  Read in cross-term info from .psf
00352   void read_donors(FILE *);
00353         //  Read in hydrogen bond donors from .psf
00354   void read_acceptors(FILE *);
00355         //  Read in hydrogen bond acceptors from .psf
00356   void read_exclusions(FILE *);
00357         //  Read in exclusion info from .psf
00358   // JLai August 16th, 2012 Modifications
00359   void read_exclusions(int*, int*, int);
00360   /* Read in exclusion array and sort entries */
00361   static bool goPairCompare (GoPair, GoPair);
00362   // End of JLai August 16th, 2012 Modifications
00363 
00364 
00365   // DRUDE: PSF reading
00366   void read_lphosts(FILE *);
00367         //  Read in lone pair hosts from Drude PSF
00368   void read_anisos(FILE *);
00369         //  Read in anisotropic terms from Drude PSF
00370   // DRUDE
00371 
00372   //LCPO
00373   //input type is Charmm/Amber/other
00374   //0 - Charmm/Xplor
00375   //1 - Amber TODO
00376   //2 - Plugin TODO
00377   //3 - Gromacs TODO
00378   void assignLCPOTypes(int inputType);
00379 
00380   //pluginIO-based loading atoms' structure
00381   void plgLoadAtomBasics(molfile_atom_t *atomarray);
00382   void plgLoadBonds(int *from, int *to); //atom index is 1-based in the parameters
00383   void plgLoadAngles(int *plgAngles);
00384   void plgLoadDihedrals(int *plgDihedrals);
00385   void plgLoadImpropers(int *plgImpropers);
00386   void plgLoadCrossterms(int *plgCterms);
00387 
00388         //  List of all exclusions, including
00389         //  explicit exclusions and those calculated
00390         //  from the bonded structure based on the
00391         //  exclusion policy.  Also includes 1-4's.
00392   void build_lists_by_atom();
00393         //  Build the list of structures by atom
00394 
00395   void build12excl(void);
00396   void build13excl(void);
00397   void build14excl(int);
00398 
00399   // DRUDE: extend exclusions for Drude and LP
00400   void build_inherited_excl(int);
00401   // DRUDE
00402   void stripFepExcl(void);
00403 
00404   void build_exclusions();
00405   // analyze the atoms, and determine which are oxygen, hb donors, etc.
00406   // this is called after a molecule is sent our (or received in)
00407   void build_atom_status(void);
00408 
00409 #else
00410   //the method to load the signatures of atoms etc. (i.e. reading the file in 
00411   //text fomrat of the compressed psf file)
00412   void read_mol_signatures(char *fname, Parameters *params, ConfigList *cfgList=0);     
00413   void load_one_inputatom(int aid, OutputAtomRecord *one, InputAtom *fAtom);
00414   void build_excl_check_signatures();  
00415 #endif
00416 
00417         void read_parm(const GromacsTopFile *);  
00418           
00419 public:
00420   // DRUDE
00421   int is_drude_psf;      // flag for reading Drude PSF
00422   int is_lonepairs_psf;  // flag for reading lone pairs from PSF
00423   // DRUDE
00424 
00425   // data for TIP4P
00426   Real r_om;
00427   Real r_ohc;
00428 
00429   // data for tail corrections
00430   BigReal tail_corr_ener;
00431   BigReal tail_corr_virial;
00432 
00433   int const * getLcpoParamType() {
00434     return lcpoParamType;
00435   }
00436 
00437   BigReal GetAtomAlpha(int i) const {
00438     return drudeConsts[i].alpha;
00439   }
00440 
00441 #ifdef MEM_OPT_VERSION
00442   AtomCstInfo *getAtoms() const { return atoms; }
00443   AtomNameIdx *getAtomNames() const { return atomNames; }
00444 #else
00445   Atom *getAtoms () const { return atoms; }
00446   AtomNameInfo *getAtomNames() const { return atomNames; }
00447 #endif
00448 
00449   AtomSegResInfo *getAtomSegResInfo() const { return atomSegResids; }
00450   
00451   // return number of fixed atoms, guarded by SimParameters
00452   int num_fixed_atoms() const {
00453     // local variables prefixed by s_
00454     int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
00455     return s_NumFixedAtoms;  // value is "turned on" SimParameters
00456   }
00457 
00458   int num_fixed_groups() const {
00459     // local variables prefixed by s_
00460     int s_NumFixedAtoms = num_fixed_atoms();
00461     int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
00462     return s_NumFixedGroups;  // value is "turned on" SimParameters
00463   }
00464 
00465   int num_group_deg_freedom() const {
00466     // local variables prefixed by s_
00467     int s_NumGroupDegFreedom = 3 * numHydrogenGroups;
00468     int s_NumFixedAtoms = num_fixed_atoms();
00469     int s_NumFixedGroups = num_fixed_groups();
00470     if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
00471     if ( ! (s_NumFixedAtoms || numConstraints
00472           || simParams->comMove || simParams->langevinOn) ) {
00473       s_NumGroupDegFreedom -= 3;
00474     }
00475     return s_NumGroupDegFreedom;
00476   }
00477 
00478   int num_deg_freedom(int isInitialReport = 0) const {
00479     // local variables prefixed by s_
00480     int s_NumDegFreedom = 3 * numAtoms;
00481     int s_NumFixedAtoms = num_fixed_atoms();
00482     if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
00483     if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
00484     if ( ! (s_NumFixedAtoms || numConstraints
00485           || simParams->comMove || simParams->langevinOn) ) {
00486       s_NumDegFreedom -= 3;
00487     }
00488     if ( ! isInitialReport && simParams->pairInteractionOn) {
00489       //
00490       // DJH: a kludge?  We want to initially report system degrees of freedom
00491       //
00492       // this doesn't attempt to deal with fixed atoms or constraints
00493       s_NumDegFreedom = 3 * numFepInitial;
00494     }
00495     int s_NumFixedRigidBonds = 
00496       (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
00497     if (simParams->watmodel == WAT_TIP4) {
00498       // numLonepairs is subtracted here because all lonepairs have a rigid bond
00499       // to oxygen, but all of the LP degrees of freedom are dealt with above
00500       s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
00501     }
00502     else {
00503       // Non-polarized systems don't have LPs.
00504       // For Drude model, bonds that attach LPs are not counted as rigid;
00505       // LPs have already been subtracted from degrees of freedom.
00506       s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds);
00507     }
00508     return s_NumDegFreedom;
00509   }
00510 
00511   int numAtoms;   //  Number of atoms                   
00512 
00513   int numRealBonds;   //  Number of bonds for exclusion determination
00514   int numBonds;   //  Number of bonds calculated, including extras
00515   int numAngles;    //  Number of angles
00516   int numDihedrals; //  Number of dihedrals
00517   int suspiciousAlchBonds;    //  angles dropped due to crossing FEP partitions
00518   int alchDroppedAngles;    //  angles dropped due to crossing FEP partitions
00519   int alchDroppedDihedrals; //  dihedrals dropped due to crossing FEP partitions
00520   int alchDroppedImpropers; //  impropers dropped due to crossing FEP partitions
00521   int numImpropers; //  Number of impropers
00522   int numCrossterms; //  Number of cross-terms
00523   int numDonors;          //  Number of hydrogen bond donors
00524   int numAcceptors; //  Number of hydrogen bond acceptors
00525   int numExclusions;  //  Number of exclusions
00526   int numTotalExclusions; //  Real Total Number of Exclusions // hack
00527 
00528   // DRUDE
00529   int numLonepairs; // Number of lone pairs
00530   int numDrudeAtoms;  // Number of Drude particles
00531   int numTholes;  // Number of Thole terms
00532   int numAnisos;  // Number of anisotropic terms
00533   int numLphosts;  // Number of lone pair hosts
00534   // DRUDE
00535   
00536   int numConstraints; //  Number of atoms constrained
00537 /* BEGIN gf */
00538   int numGridforceGrids;//  Number of gridforce grids
00539   int *numGridforces;   //  Number of atoms in gridforce file (array, one per grid)
00540 /* END gf */
00541   int numMovDrag;         //  Number of atoms moving-dragged
00542   int numRotDrag;         //  Number of atoms rotating-dragged
00543   int numConsTorque;  //  Number of atoms "constant"-torqued
00544   int numFixedAtoms;  //  Number of fixed atoms
00545   int numStirredAtoms;  //  Number of stirred atoms
00546   int numExPressureAtoms; //  Number of atoms excluded from pressure
00547   int numHydrogenGroups;  //  Number of hydrogen groups
00548   int maxHydrogenGroupSize;  //  Max atoms per hydrogen group
00549   int numMigrationGroups;  //  Number of migration groups
00550   int maxMigrationGroupSize;  //  Max atoms per migration group
00551   int numFixedGroups; //  Number of totally fixed hydrogen groups
00552   int numRigidBonds;  //  Number of rigid bonds
00553   int numFixedRigidBonds; //  Number of rigid bonds between fixed atoms
00554 //fepb
00555         int numFepInitial;  // no. of fep atoms with initial flag
00556         int numFepFinal;  // no. of fep atoms with final flag
00557 //fepe
00558 
00559   int numConsForce; //  Number of atoms that have constant force applied
00560   int32 *consForceIndexes;//  Constant force indexes for each atom
00561   Vector *consForce;  //  Constant force array
00562 
00563   int32 *consTorqueIndexes; //  "Constant" torque indexes for each atom
00564   ConsTorqueParams *consTorqueParams;
00565                                 //  Parameters for each atom "constant"-torqued
00566 
00567   // The following are needed for error checking because we
00568   // eliminate bonds, etc. which involve only fixed atoms
00569   int numCalcBonds; //  Number of bonds requiring calculation
00570   int numCalcAngles;  //  Number of angles requiring calculation
00571   int numCalcDihedrals; //  Number of dihedrals requiring calculation
00572   int numCalcImpropers; //  Number of impropers requiring calculation
00573   int numCalcCrossterms; //  Number of cross-terms requiring calculation
00574   int numCalcExclusions;  //  Number of exclusions requiring calculation
00575 
00576   // DRUDE
00577   int numCalcTholes;  // Number of Thole correction terms requiring calculation
00578   int numCalcAnisos;  // Number of anisotropic terms requiring calculation
00579   // DRUDE
00580 
00581   //  Number of dihedrals with multiple periodicity
00582   int numMultipleDihedrals; 
00583   //  Number of impropers with multiple periodicity
00584   int numMultipleImpropers; 
00585   // indexes of "atoms" sorted by hydrogen groups
00586   HydrogenGroup hydrogenGroup;
00587 
00588   // Ported by JLai -- JE - Go
00589   int numGoAtoms;         //  Number of atoms subject to Go forces -- ported by JLai/ Original by JE
00590   int32 *atomChainTypes;  //  Go chain type for each atom; from 1 to MAX_GO_CHAINS
00591   int32 *goSigmaIndices;  //  Indices into goSigmas
00592   int32 *goResidIndices;  //  Indices into goSigmas
00593   Real  *goSigmas;        //  Sigma values for Go forces L-J type formula
00594   bool *goWithinCutoff;   //  Whether the reference atom-atom distance is within the Go cutoff
00595   Real  *goCoordinates;   //  Coordinates (x,y,z) for Go atoms in the native structure
00596   int *goResids;          //  Residue ID from PDB
00597   PDB *goPDB;             //  Pointer to PDB object to use
00598   // NAMD-Go2 calculation code
00599   int goNumLJPair;        //  Integer storing the total number of explicit pairs (LJ)
00600   int *goIndxLJA;         //  Pointer to the array of atom indices for LJ atom A
00601   int *goIndxLJB;         //  Pointer to the array of atom indices for LJ atom B
00602   double *goSigmaPairA;  //  Pointer to the array of A LJ parameters
00603   double *goSigmaPairB;  //  Pointer to the array of B LJ parameters
00604   int *pointerToGoBeg;    //  Array of pointers to array
00605   int *pointerToGoEnd;    //  Array of pointers to array
00606   // Gromacs LJ Pair list calculation code
00607   int numPair;            //  Integer storing the total number of explicit pairs (LJ + Gaussian)
00608   int numLJPair;          //  Integer storing the number of explicit LJ pairs
00609   int *pointerToLJBeg;       //  Array of pointers to array 
00610   int *pointerToLJEnd;       //  Array of pointers to array B
00611   int *indxLJA;           //  Pointer to the array of atom indices for LJ atom A
00612   int *indxLJB;           //  Pointer to the array of atom indices for LJ atom B
00613   Real *pairC6;           //  Pointer to the array of C6 LJ parameters
00614   Real *pairC12;          //  Pointer to the array of C12 LJ parameters
00615   // Gromacs Gauss Pair list calculation code
00616   int *pointerToGaussBeg;    //  Array of pointers to array B
00617   int *pointerToGaussEnd;    //  Array of pointers to array B
00618   int numGaussPair;       //  Integer storing the number of explicit Gaussian pairs  
00619   int *indxGaussA;        //  Pointer to the array of atom indices for Gaussian atom A 
00620   int *indxGaussB;        //  Pointer to the array of atom indices for Gaussian atom B 
00621   Real *gA;               //  Pointer to the array of force constants to the Gaussian potential
00622   Real *gMu1;             //  Pointer to the array of mu (shifts Gaussian)
00623   Real *giSigma1;          //  Pointer to the array of sigma (controls spread of Gaussian)
00624   Real *gMu2;             //  Pointer to the array of mu (shifts Gaussian 2)
00625   Real *giSigma2;          //  Pointer to the array of sigma (controls spread of Gaussian 2)
00626   Real *gRepulsive;       //  Pointer to the a LJ-12 repulsive parameter that adds to the Gaussian
00627 
00628   // GO ENERGY CALCULATION CODE
00629   BigReal energyNative;    // Holds the energy value of the native structure
00630   BigReal energyNonnative; // Holds the energy value of the nonnative structure
00631   // GO ENERGY CALCULATION CODE
00632   // End of port - JL
00633 
00634   Molecule(SimParameters *, Parameters *param);
00635   Molecule(SimParameters *, Parameters *param, char *filename, ConfigList *cfgList=NULL);  
00636   Molecule(SimParameters *simParams, Parameters *param, molfile_plugin_t *pIOHdl, void *pIOFileHdl, int natoms);
00637   
00638   Molecule(SimParameters *, Parameters *, Ambertoppar *);
00639   void read_parm(Ambertoppar *);
00640 
00641   Molecule(SimParameters *, Parameters *, const GromacsTopFile *);
00642 
00643   ~Molecule();    //  Destructor
00644 
00645   void send_Molecule(MOStream *);
00646         //  send the molecular structure 
00647         //  from the master to the clients
00648 
00649   void receive_Molecule(MIStream *);
00650         //  receive the molecular structure
00651         //  from the master on a client
00652   
00653   void build_constraint_params(StringList *, StringList *, StringList *,
00654              PDB *, char *);
00655         //  Build the set of harmonic constraint 
00656         // parameters
00657 
00658 /* BEGIN gf */
00659   void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *);
00660         //  Build the set of gridForce-style force pars
00661 /* END gf */
00662 
00663   void build_movdrag_params(StringList *, StringList *, StringList *, 
00664           PDB *, char *);
00665         //  Build the set of moving drag pars
00666 
00667   void build_rotdrag_params(StringList *, StringList *, StringList *,
00668           StringList *, StringList *, StringList *,
00669           PDB *, char *);
00670         //  Build the set of rotating drag pars
00671 
00672   void build_constorque_params(StringList *, StringList *, StringList *,
00673              StringList *, StringList *, StringList *,
00674              PDB *, char *);
00675         //  Build the set of "constant" torque pars
00676 
00677 
00678   void build_constant_forces(char *);
00679         //  Build the set of constant forces
00680 
00681   void build_langevin_params(BigReal coupling, BigReal drudeCoupling,
00682       Bool doHydrogen);
00683   void build_langevin_params(StringList *, StringList *, PDB *, char *);
00684         //  Build the set of langevin dynamics parameters
00685 
00686 #ifdef MEM_OPT_VERSION
00687   void load_fixed_atoms(StringList *fixedFile);
00688   void load_constrained_atoms(StringList *constrainedFile);
00689 #endif
00690 
00691   void build_fixed_atoms(StringList *, StringList *, PDB *, char *);
00692         //  Determine which atoms are fixed (if any)
00693 
00694   void build_stirred_atoms(StringList *, StringList *, PDB *, char *);
00695         //  Determine which atoms are stirred (if any)
00696 
00697   void build_extra_bonds(Parameters *parameters, StringList *file);
00698 
00699 //fepb
00700         void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *);
00701                                // selection of the mutant atoms
00702         void delete_alch_bonded(void);
00703 //fepe
00704 
00705   void build_exPressure_atoms(StringList *, StringList *, PDB *, char *);
00706         //  Determine which atoms are excluded from
00707                                 //  pressure (if any)
00708 
00709   // Ported by JLai -- Original JE - Go -- Change the unsigned int to ints
00710   void print_go_sigmas(); //  Print out Go sigma parameters
00711   void build_go_sigmas(StringList *, char *);
00712         //  Determine which atoms have Go forces applied
00713         //  calculate sigmas from distances between Go atom pairs
00714   void build_go_sigmas2(StringList *, char *);
00715         //  Determine which atoms have Go forces applied
00716         //  calculate sigmas from distances between Go atom pairs
00717   void build_go_arrays(StringList *, char *);
00718         //  Determine which atoms have Go forces applied
00719   BigReal get_gro_force(BigReal, BigReal, BigReal, int, int) const;
00720   BigReal get_gro_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const;
00721   BigReal get_go_force(BigReal, int, int, BigReal *, BigReal *) const;
00722         //  Calculate the go force between a pair of atoms -- Modified to 
00723         //  output Go energies
00724   BigReal get_go_force_new(BigReal, int, int, BigReal *, BigReal *) const;
00725         //  Calculate the go force between a pair of atoms
00726   BigReal get_go_force2(BigReal, BigReal, BigReal, int, int, BigReal *, BigReal *) const;
00727         //  Calculate the go force between a pair of atoms
00728   Bool atoms_1to4(unsigned int, unsigned int);
00729 // End of port -- JL  
00730 
00731   void reloadCharges(float charge[], int n);
00732 
00733         Bool is_lp(int);     // return true if atom is a lone pair
00734         Bool is_drude(int);     // return true if atom is a Drude particle
00735         Bool is_hydrogen(int);     // return true if atom is hydrogen
00736         Bool is_oxygen(int);       // return true if atom is oxygen
00737   Bool is_hydrogenGroupParent(int); // return true if atom is group parent
00738   Bool is_water(int);        // return true if atom is part of water 
00739   int  get_groupSize(int);     // return # atoms in (hydrogen) group
00740         int get_mother_atom(int);  // return mother atom of a hydrogen
00741 
00742   #ifdef MEM_OPT_VERSION
00743   //the way to get the cluster size if the atom ids of the cluster are
00744   //contiguous. The input parameter is the atom id that leads the cluster.
00745   int get_cluster_size_con(int aid) const { return clusterSigs[aid]; }  
00746   //the way to get the cluster size if the atoms ids of the cluster are
00747   //not contiguous. The input parameter is the cluster index.
00748   int get_cluster_size_uncon(int cIdx) const { return clusterSize[cIdx]; }
00749   int get_cluster_idx(int aid) const { return clusterSigs[aid]; }
00750   int get_num_clusters() const { return numClusters; }
00751   #else
00752   int get_cluster(int anum) const { return cluster[anum]; }
00753   int get_clusterSize(int anum) const { return clusterSize[anum]; }
00754   #endif
00755 
00756 #ifndef MEM_OPT_VERSION
00757   const float *getOccupancyData() { return (const float *)occupancy; }
00758   void setOccupancyData(molfile_atom_t *atomarray);
00759   void freeOccupancyData() { delete [] occupancy; occupancy=NULL; }
00760 
00761   const float *getBFactorData() { return (const float *)bfactor; }
00762   void setBFactorData(molfile_atom_t *atomarray);
00763   void freeBFactorData() { delete [] bfactor; bfactor=NULL; }
00764 #endif
00765 
00766   //  Get the mass of an atom
00767   Real atommass(int anum) const
00768   {
00769     #ifdef MEM_OPT_VERSION
00770     return atomMassPool[eachAtomMass[anum]];
00771     #else
00772     return(atoms[anum].mass);
00773     #endif
00774   }
00775 
00776   //  Get the charge of an atom
00777   Real atomcharge(int anum) const
00778   {
00779     #ifdef MEM_OPT_VERSION
00780     return atomChargePool[eachAtomCharge[anum]];
00781     #else
00782     return(atoms[anum].charge);
00783     #endif
00784   }
00785   
00786   //  Get the vdw type of an atom
00787   Index atomvdwtype(int anum) const
00788   {      
00789       return(atoms[anum].vdw_type);
00790   }
00791 
00792   #ifndef MEM_OPT_VERSION
00793   //  Retrieve a bond structure
00794   Bond *get_bond(int bnum) const {return (&(bonds[bnum]));}
00795 
00796   //  Retrieve an angle structure
00797   Angle *get_angle(int anum) const {return (&(angles[anum]));}
00798 
00799   //  Retrieve an improper strutcure
00800   Improper *get_improper(int inum) const {return (&(impropers[inum]));}
00801 
00802   //  Retrieve a dihedral structure
00803   Dihedral *get_dihedral(int dnum) const {return (&(dihedrals[dnum]));}
00804 
00805   //  Retrieve a cross-term strutcure
00806   Crossterm *get_crossterm(int inum) const {return (&(crossterms[inum]));}
00807   #endif
00808 
00809   // DRUDE: retrieve lphost structure
00810   Lphost *get_lphost(int atomid) const {
00811     // don't call unless simParams->drudeOn == TRUE
00812     // otherwise lphostIndexes array doesn't exist!
00813     int index = lphostIndexes[atomid];
00814     return (index != -1 ? &(lphosts[index]) : NULL);
00815   }
00816   // DRUDE
00817 
00818   #ifndef MEM_OPT_VERSION
00819   Bond *getAllBonds() const {return bonds;}
00820   Angle *getAllAngles() const {return angles;}
00821   Improper *getAllImpropers() const {return impropers;}
00822   Dihedral *getAllDihedrals() const {return dihedrals;}
00823   Crossterm *getAllCrossterms() const {return crossterms;}
00824   #endif
00825 
00826   // DRUDE: retrieve entire lphosts array
00827   Lphost *getAllLphosts() const { return lphosts; }
00828   // DRUDE
00829 
00830   //  Retrieve a hydrogen bond donor structure
00831   Bond *get_donor(int dnum) const {return (&(donors[dnum]));}  
00832 
00833   //  Retrieve a hydrogen bond acceptor structure
00834   Bond *get_acceptor(int dnum) const {return (&(acceptors[dnum]));} 
00835 
00836   Bond *getAllDonors() const {return donors;}
00837   Bond *getAllAcceptors() const {return acceptors;}
00838 
00839   //  Retrieve an exclusion structure
00840   #ifndef MEM_OPT_VERSION
00841   Exclusion *get_exclusion(int ex) const {return (&(exclusions[ex]));}
00842   #endif
00843 
00844   //  Retrieve an atom type
00845   const char *get_atomtype(int anum) const
00846   {
00847     if (atomNames == NULL)
00848     {
00849       NAMD_die("Tried to find atom type on node other than node 0");
00850     }
00851 
00852     #ifdef MEM_OPT_VERSION    
00853     return atomTypePool[atomNames[anum].atomtypeIdx];
00854     #else
00855     return(atomNames[anum].atomtype);
00856     #endif
00857   }
00858 
00859   //  Lookup atom id from segment, residue, and name
00860   int get_atom_from_name(const char *segid, int resid, const char *aname) const;
00861 
00862   //  Lookup number of atoms in residue from segment and residue
00863   int get_residue_size(const char *segid, int resid) const;
00864 
00865   //  Lookup atom id from segment, residue, and index in residue
00866   int get_atom_from_index_in_residue(const char *segid, int resid, int index) const;
00867 
00868   
00869   //  The following routines are used to get the list of bonds
00870   //  for a given atom.  This is used when creating the bond lists
00871   //  for the force objects  
00872 
00873   #ifndef MEM_OPT_VERSION
00874   int32 *get_bonds_for_atom(int anum)
00875       { return bondsByAtom[anum]; } 
00876   int32 *get_angles_for_atom(int anum) 
00877       { return anglesByAtom[anum]; }
00878   int32 *get_dihedrals_for_atom(int anum) 
00879       { return dihedralsByAtom[anum]; }
00880   int32 *get_impropers_for_atom(int anum) 
00881       { return impropersByAtom[anum]; }  
00882   int32 *get_crossterms_for_atom(int anum) 
00883       { return crosstermsByAtom[anum]; }  
00884   int32 *get_exclusions_for_atom(int anum)
00885       { return exclusionsByAtom[anum]; }
00886   const int32 *get_full_exclusions_for_atom(int anum) const
00887       { return fullExclusionsByAtom[anum]; }
00888   const int32 *get_mod_exclusions_for_atom(int anum) const
00889       { return modExclusionsByAtom[anum]; }
00890   #endif
00891   
00892   //  Check for exclusions, either explicit or bonded.
00893         //  Returns 1 for full, 2 for 1-4 exclusions.
00894   #ifdef MEM_OPT_VERSION
00895   int checkExclByIdx(int idx1, int atom1, int atom2) const;
00896   const ExclusionCheck *get_excl_check_for_idx(int idx) const{      
00897       return &exclChkSigPool[idx];
00898   }
00899   #else
00900   int checkexcl(int atom1, int atom2) const;
00901 
00902   const ExclusionCheck *get_excl_check_for_atom(int anum) const{      
00903       return &all_exclusions[anum];             
00904   }
00905   #endif
00906 
00907 /* BEGIN gf */
00908   // Return true or false based on whether or not the atom
00909   // is subject to grid force
00910   Bool is_atom_gridforced(int atomnum, int gridnum) const
00911   {
00912       if (numGridforceGrids)
00913       {
00914           return(gridfrcIndexes[gridnum][atomnum] != -1);
00915       }
00916       else
00917       {
00918           return(FALSE);
00919       }
00920   }
00921 /* END gf */
00922 
00923 #ifndef MEM_OPT_VERSION
00924   //  Return true or false based on whether the specified atom
00925   //  is constrained or not.
00926   Bool is_atom_constrained(int atomnum) const
00927   {
00928     if (numConstraints)
00929     {
00930       //  Check the index to see if it is constrained
00931       return(consIndexes[atomnum] != -1);
00932     }
00933     else
00934     {
00935       //  No constraints at all, so just return FALSE
00936       return(FALSE);
00937     }
00938   }
00939 #endif
00940 
00941   //  Return true or false based on whether the specified atom
00942   //  is moving-dragged or not.
00943   Bool is_atom_movdragged(int atomnum) const
00944   {
00945     if (numMovDrag)
00946     {
00947       //  Check the index to see if it is constrained
00948       return(movDragIndexes[atomnum] != -1);
00949     }
00950     else
00951     {
00952       //  No constraints at all, so just return FALSE
00953       return(FALSE);
00954     }
00955   }
00956 
00957   //  Return true or false based on whether the specified atom
00958   //  is rotating-dragged or not.
00959   Bool is_atom_rotdragged(int atomnum) const
00960   {
00961     if (numRotDrag)
00962     {
00963       //  Check the index to see if it is constrained
00964       return(rotDragIndexes[atomnum] != -1);
00965     }
00966     else
00967     {
00968       //  No constraints at all, so just return FALSE
00969       return(FALSE);
00970     }
00971   }
00972 
00973   //  Return true or false based on whether the specified atom
00974   //  is "constant"-torqued or not.
00975   Bool is_atom_constorqued(int atomnum) const
00976   {
00977     if (numConsTorque)
00978     {
00979       //  Check the index to see if it is constrained
00980       return(consTorqueIndexes[atomnum] != -1);
00981     }
00982     else
00983     {
00984       //  No constraints at all, so just return FALSE
00985       return(FALSE);
00986     }
00987   }
00988 
00989 #ifndef MEM_OPT_VERSION
00990   //  Get the harmonic constraints for a specific atom
00991   void get_cons_params(Real &k, Vector &refPos, int atomnum) const
00992   {
00993     k = consParams[consIndexes[atomnum]].k;
00994     refPos = consParams[consIndexes[atomnum]].refPos;
00995   }
00996 #endif
00997 
00998 /* BEGIN gf */
00999   void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
01000   {
01001       k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
01002       q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
01003   }
01004   
01005   GridforceGrid* get_gridfrc_grid(int gridnum) const
01006   {
01007       GridforceGrid *result = NULL;
01008       if (gridnum >= 0 && gridnum < numGridforceGrids) {
01009           result = gridfrcGrid[gridnum];
01010       }
01011       return result;
01012   }
01013   
01014   int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
01015   {
01016       if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
01017           gridfrcGrid[gridnum] = grid;
01018           return 0;
01019       } else {
01020           return -1;
01021       }
01022   }
01023 /* END gf */
01024 
01025   Real langevin_param(int atomnum) const
01026   {
01027     return(langevinParams ? langevinParams[atomnum] : 0.);
01028   }
01029 
01030   //  Get the stirring constraints for a specific atom
01031   void get_stir_refPos(Vector &refPos, int atomnum) const
01032   {
01033     refPos = stirParams[stirIndexes[atomnum]].refPos;
01034   }
01035 
01036 
01037   void put_stir_startTheta(Real theta, int atomnum) const
01038   {
01039     stirParams[stirIndexes[atomnum]].startTheta = theta;
01040   }
01041 
01042 
01043   Real get_stir_startTheta(int atomnum) const
01044   {
01045     return stirParams[stirIndexes[atomnum]].startTheta;
01046   }
01047  
01048 
01049   //  Get the moving drag factor for a specific atom
01050   void get_movdrag_params(Vector &v, int atomnum) const
01051   {
01052     v = movDragParams[movDragIndexes[atomnum]].v;
01053   }
01054 
01055   //  Get the rotating drag pars for a specific atom
01056   void get_rotdrag_params(BigReal &v, Vector &a, Vector &p, 
01057         int atomnum) const
01058   {
01059     v = rotDragParams[rotDragIndexes[atomnum]].v;
01060     a = rotDragParams[rotDragIndexes[atomnum]].a;
01061     p = rotDragParams[rotDragIndexes[atomnum]].p;
01062   }
01063 
01064   //  Get the "constant" torque pars for a specific atom
01065   void get_constorque_params(BigReal &v, Vector &a, Vector &p, 
01066         int atomnum) const
01067   {
01068     v = consTorqueParams[consTorqueIndexes[atomnum]].v;
01069     a = consTorqueParams[consTorqueIndexes[atomnum]].a;
01070     p = consTorqueParams[consTorqueIndexes[atomnum]].p;
01071   }
01072 
01073 //fepb
01074         unsigned char get_fep_type(int anum) const
01075         {
01076                 return(fepAtomFlags[anum]);
01077         }
01078 //fepe
01079 
01080 #ifndef MEM_OPT_VERSION
01081   Bool is_atom_fixed(int atomnum) const
01082   {
01083     return (numFixedAtoms && fixedAtomFlags[atomnum]);
01084   }
01085 #else
01086   //Since binary search is more expensive than direct array access,
01087   //and this function is usually called for consecutive atoms in this context,
01088   //the *listIdx returns the index to the range of atoms [aid1, aid2]
01089   //that are fixed. If the atom aid is fixed, then aid1=<aid<=aid2;
01090   //If the atom aid is not fixed, then aid1 indicates the smallest fixed atom
01091   //id that is larger than aid; so the listIdx could be equal the size of
01092   //fixedAtomsSet. --Chao Mei
01093   Bool is_atom_in_set(AtomSetList *localAtomsSet, int aid, int *listIdx) const;
01094   inline Bool is_atom_fixed(int aid, int *listIdx=NULL) const {
01095     return is_atom_in_set(fixedAtomsSet,aid,listIdx);
01096   }
01097   inline Bool is_atom_constrained(int aid, int *listIdx=NULL) const {
01098     return is_atom_in_set(constrainedAtomsSet,aid,listIdx);
01099   }
01100 #endif
01101         
01102   Bool is_atom_stirred(int atomnum) const
01103   {
01104     if (numStirredAtoms)
01105     {
01106       //  Check the index to see if it is constrained
01107       return(stirIndexes[atomnum] != -1);
01108     }
01109     else
01110     {
01111       //  No constraints at all, so just return FALSE
01112       return(FALSE);
01113     }
01114   }
01115   
01116 
01117   Bool is_group_fixed(int atomnum) const
01118   {
01119     return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
01120   }
01121   Bool is_atom_exPressure(int atomnum) const
01122   {
01123     return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
01124   }
01125   // 0 if not rigid or length to parent, for parent refers to H-H length
01126   // < 0 implies MOLLY but not SHAKE, > 1 implies both if MOLLY is on
01127   Real rigid_bond_length(int atomnum) const
01128   {
01129     return(rigidBondLengths[atomnum]);
01130   }
01131 
01132   void print_atoms(Parameters *); 
01133         //  Print out list of atoms
01134   void print_bonds(Parameters *); 
01135         //  Print out list of bonds
01136   void print_exclusions();//  Print out list of exclusions
01137 
01138 public:  
01139   int isOccupancyValid, isBFactorValid;
01140 
01141 #ifdef MEM_OPT_VERSION
01142   //read the per-atom file for the memory optimized version where the file 
01143   //name already exists the range of atoms to be read are 
01144   //[fromAtomID, toAtomID].
01145   void read_binary_atom_info(int fromAtomID, int toAtomID, InputAtomList &inAtoms);
01146 
01147   int getNumCalcExclusions(){return numCalcExclusions;}
01148   void setNumCalcExclusions(int x){numCalcExclusions= x;}
01149 
01150   Index getEachAtomMass(int i){return eachAtomMass[i];}
01151   Index getEachAtomCharge(int i){return eachAtomCharge[i];}
01152 
01153   ExclSigID getAtomExclSigId(int aid) const {
01154       return eachAtomExclSig[aid];
01155   }
01156 
01157   Real *getAtomMassPool(){return atomMassPool;}
01158   Real *getAtomChargePool(){return atomChargePool;}
01159   AtomCstInfo *getAtoms(){return atoms;}  
01160 
01161   int atomSigPoolSize;
01162   AtomSignature *atomSigPool;
01163 
01164   /* All the following are temporary variables for reading the compressed psf file */
01165   //declarations for atoms' constant information  
01166   int segNamePoolSize; //Its value is usually less than 5
01167   char **segNamePool; //This seems not to be important, but it only occupied very little space.
01168 
01169   int resNamePoolSize;
01170   char **resNamePool;
01171 
01172   int atomNamePoolSize;
01173   char **atomNamePool;
01174 
01175   int atomTypePoolSize;
01176   char **atomTypePool;
01177 
01178   int chargePoolSize;
01179   Real *atomChargePool;
01180 
01181   int massPoolSize;
01182   Real *atomMassPool;
01183 
01184   AtomSigID getAtomSigId(int aid) {
01185       return eachAtomSig[aid]; 
01186   }
01187 
01188   //Indicates the size of both exclSigPool and exclChkSigPool
01189   int exclSigPoolSize;
01190   //this will be deleted after build_lists_by_atom
01191   ExclusionSignature *exclSigPool;
01192   //This is the final data structure we want to store  
01193   ExclusionCheck *exclChkSigPool;
01194 
01195   void addNewExclSigPool(const std::vector<ExclusionSignature>&);  
01196 
01197   void delEachAtomSigs(){    
01198       //for NAMD-smp version, only one Molecule object is held
01199       //on each node, therefore, only one deletion operation should
01200       //be taken on a node, otherwise, there possibly would be some
01201       //wierd memory problems. The same reason applies to other deletion
01202       //operations inside the Molecule object.   
01203       if(CmiMyRank()) return;
01204 
01205       delete [] eachAtomSig;
01206       delete [] eachAtomExclSig;
01207       eachAtomSig = NULL;
01208       eachAtomExclSig = NULL;
01209   }
01210 
01211   void delChargeSpace(){
01212       if(CmiMyRank()) return;
01213 
01214       delete [] atomChargePool;
01215       delete [] eachAtomCharge;
01216       atomChargePool = NULL;
01217       eachAtomCharge = NULL;
01218   }
01219   
01220   void delMassSpace(){
01221       if(CmiMyRank()) return;
01222 
01223       delete [] atomMassPool;
01224       delete [] eachAtomMass;
01225       atomMassPool = NULL;
01226       eachAtomMass = NULL;
01227   }
01228   
01229   void delClusterSigs() {
01230       if(CmiMyRank()) return;      
01231 
01232       delete [] clusterSigs;
01233       clusterSigs = NULL;
01234   }
01235 
01236   void delAtomNames(){
01237       if(CmiMyRank()) return;
01238       delete [] atomNamePool;
01239       delete [] atomNames;
01240       atomNamePool = NULL;
01241       atomNames = NULL;
01242   }
01243 
01244   void delFixedAtoms(){
01245       if(CmiMyRank()) return;
01246       delete fixedAtomsSet;
01247       fixedAtomsSet = NULL;
01248   }
01249 
01250 private:
01251   Index insert_new_mass(Real newMass);
01252 
01253 #endif
01254 
01255 // Go stuff
01256 public:
01257 
01258 GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS];    //  Array of Go params -- JLai
01259 int go_indices[MAX_GO_CHAINS+1];        //  Indices from chainIDS to go array -- JLai
01260 int NumGoChains;                        //  Number of Go chain types -- JLai
01261 
01262 // Declares and initializes Go variables
01263 void goInit();
01264 
01265 // Builds explicit Gromacs pairs
01266 void build_gro_pair();
01267 
01268 // Builds the initial Go parameters 
01269 void build_go_params(StringList *);
01270 
01271 //  Read Go parameter file
01272 void read_go_file(char *);
01273 
01274 //  Get Go cutoff for a given chain type pair
01275 Real get_go_cutoff(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };
01276 
01277 //  Get Go epsilonRep for a given chain type pair
01278 Real get_go_epsilonRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };
01279 
01280 //  Get Go sigmaRep for a given chain type pair
01281 Real get_go_sigmaRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };
01282 
01283 //  Get Go epsilon for a given chain type pair
01284 Real get_go_epsilon(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };
01285 
01286 //  Get Go exp_a for a given chain type pair
01287 int get_go_exp_a(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };
01288 
01289 //  Get Go exp_b for a given chain type pair
01290 int get_go_exp_b(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };
01291 
01292 //  Get Go exp_rep for a given chain type pair
01293 int get_go_exp_rep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };
01294 
01295 //  Whether residue IDs with this difference are restricted
01296 Bool go_restricted(int, int, int);
01297 
01298 // Prints Go Params
01299 void print_go_params();
01300 
01301 void initialize();
01302 
01303 void send_GoMolecule(MOStream *);
01304 //  send the molecular structure 
01305 //  from the master to the clients
01306 
01307 void receive_GoMolecule(MIStream *);
01308 //  receive the molecular structure
01309 //  from the master on a client
01310 };
01311 
01312 #endif
01313 

Generated on Sat May 18 04:07:17 2013 for NAMD by  doxygen 1.3.9.1