00001
00007
00008
00009
00010
00011
00012
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
00031 #include "GridForceGrid.h"
00032 #include "Tensor.h"
00033
00034
00035 #include "molfile_plugin.h"
00036
00037 #include <vector>
00038 using namespace std;
00039
00040 class SimParameters;
00041 class Parameters;
00042 class ConfigList;
00043 class PDB;
00044 class MIStream;
00045 class MOStream;
00046
00047 class ExclElem;
00048 class BondElem;
00049 class AngleElem;
00050 class DihedralElem;
00051 class ImproperElem;
00052 class CrosstermElem;
00053 class ResidueLookupElem;
00054 template<class Type> class ObjectArena;
00055
00056 class ExclusionCheck {
00057 public:
00058 int32 min,max;
00059 char *flags;
00060
00061 ExclusionCheck(){
00062 min=0;
00063 max=-1;
00064 flags = NULL;
00065 }
00066 ExclusionCheck(const ExclusionCheck& chk){
00067 min = chk.min;
00068 max = chk.max;
00069 if(max>min){
00070 flags = new char[max-min+1];
00071 memcpy(flags, chk.flags, sizeof(char)*(max-min+1));
00072 }
00073 }
00074 ExclusionCheck &operator=(const ExclusionCheck& chk){
00075 min = chk.min;
00076 max = chk.max;
00077 if(flags) delete [] flags;
00078 flags = NULL;
00079 if(max>min){
00080 flags = new char[max-min+1];
00081 memcpy(flags, chk.flags, sizeof(char)*(max-min+1));
00082 }
00083 return *this;
00084 }
00085 ~ExclusionCheck(){
00086 if(flags) delete [] flags;
00087 }
00088 };
00089 #define EXCHCK_FULL 1
00090 #define EXCHCK_MOD 2
00091
00092
00093 typedef struct seg_resid
00094 {
00095 char segname[11];
00096 int resid;
00097 }AtomSegResInfo;
00098
00099
00100 class Molecule
00101 {
00102 typedef struct constraint_params
00103 {
00104 Real k;
00105 Vector refPos;
00106 } ConstraintParams;
00107
00108
00109
00110
00111 typedef struct gridfrc_params
00112 {
00113 Real k;
00114 Charge q;
00115 } GridforceParams;
00116
00117
00118
00119 typedef struct stir_params
00120 {
00121 Real startTheta;
00122 Vector refPos;
00123 } StirParams;
00124
00125 typedef struct movdrag_params
00126 {
00127 Vector v;
00128 } MovDragParams;
00129
00130
00131 typedef struct rotdrag_params
00132 {
00133 Real v;
00134 Vector a;
00135 Vector p;
00136 } RotDragParams;
00137
00138 typedef struct constorque_params
00139 {
00140 Real v;
00141 Vector a;
00142 Vector p;
00143 } ConsTorqueParams;
00144
00145 friend class ExclElem;
00146 friend class BondElem;
00147 friend class AngleElem;
00148 friend class DihedralElem;
00149 friend class ImproperElem;
00150 friend class CrosstermElem;
00151
00152 private:
00153 void initialize(SimParameters *, Parameters *param);
00154
00155
00156 #ifdef MEM_OPT_VERSION
00157
00158 AtomCstInfo *atoms;
00159 Index *eachAtomMass;
00160 Index *eachAtomCharge;
00161 AtomNameIdx *atomNames;
00162 ObjectArena<char> *nameArena;
00163 #else
00164 Atom *atoms;
00165 ObjectArena<char> *nameArena;
00166 AtomNameInfo *atomNames;
00167 #endif
00168
00169 ResidueLookupElem *resLookup;
00170
00171 AtomSegResInfo *atomSegResids;
00172
00173 #ifndef MEM_OPT_VERSION
00174
00175 Bond *bonds;
00176 Angle *angles;
00177 Dihedral *dihedrals;
00178 Improper *impropers;
00179 Crossterm *crossterms;
00180 #endif
00181
00182 Bond *donors;
00183 Bond *acceptors;
00184
00185 #ifndef MEM_OPT_VERSION
00186
00187 Exclusion *exclusions;
00188 UniqueSet<Exclusion> exclusionSet;
00189 #endif
00190
00191
00192 DrudeConst *drudeConsts;
00193 Aniso *anisos;
00194 Lphost *lphosts;
00195 int32 *lphostIndexes;
00196
00197
00198 int32 *consIndexes;
00199 ConstraintParams *consParams;
00200
00201
00202 int32 **gridfrcIndexes;
00203 GridforceParams **gridfrcParams;
00204 GridforceGrid **gridfrcGrid;
00205
00206
00207
00208 int32 *stirIndexes;
00209 StirParams *stirParams;
00210
00211 int32 *movDragIndexes;
00212 MovDragParams *movDragParams;
00213
00214 int32 *rotDragIndexes;
00215 RotDragParams *rotDragParams;
00216
00217
00218 Real *langevinParams;
00219 int32 *fixedAtomFlags;
00220 int32 *exPressureAtomFlags;
00221
00222 #ifdef MEM_OPT_VERSION
00223
00224
00225
00226
00227 int32 *clusterSigs;
00228 int32 numClusters;
00229
00230
00231 int32 isClusterContiguous;
00232 #else
00233 int32 *cluster;
00234 #endif
00235
00236
00237
00238
00239 int32 *clusterSize;
00240
00241 Real *rigidBondLengths;
00242
00243
00244 unsigned char *fepAtomFlags;
00245
00246
00247 #ifndef MEM_OPT_VERSION
00248 ObjectArena<int32> *tmpArena;
00249 int32 **bondsWithAtom;
00250 ObjectArena<int32> *arena;
00251 #endif
00252
00253 #ifdef MEM_OPT_VERSION
00254 Index *eachAtomSig;
00255 Index *eachAtomExclSig;
00256 #else
00257
00258 int32 **bondsByAtom;
00259 int32 **anglesByAtom;
00260 int32 **dihedralsByAtom;
00261 int32 **impropersByAtom;
00262 int32 **crosstermsByAtom;
00263
00264 int32 **exclusionsByAtom;
00265 int32 **fullExclusionsByAtom;
00266 int32 **modExclusionsByAtom;
00267 ObjectArena<char> *exclArena;
00268 ExclusionCheck *all_exclusions;
00269 #endif
00270
00271
00272
00273 float *occupancy;
00274 float *bfactor;
00275
00276
00277
00278
00279
00280
00281 void build_lists_by_atom();
00282
00283
00284
00285 void read_atoms(FILE *, Parameters *);
00286
00287 void read_bonds(FILE *, Parameters *);
00288
00289 void read_angles(FILE *, Parameters *);
00290
00291 void read_dihedrals(FILE *, Parameters *);
00292
00293 void read_impropers(FILE *, Parameters *);
00294
00295 void read_crossterms(FILE *, Parameters *);
00296
00297 void read_donors(FILE *);
00298
00299 void read_acceptors(FILE *);
00300
00301 void read_exclusions(FILE *);
00302
00303
00304
00305 void read_lphosts(FILE *);
00306
00307 void read_anisos(FILE *);
00308
00309
00310
00311
00312 void plgLoadAtomBasics(molfile_atom_t *atomarray);
00313 void plgLoadBonds(int *from, int *to);
00314 void plgLoadAngles(int *plgAngles);
00315 void plgLoadDihedrals(int *plgDihedrals);
00316 void plgLoadImpropers(int *plgImpropers);
00317 void plgLoadCrossterms(int *plgCterms);
00318
00319
00320 void build12excl(void);
00321 void build13excl(void);
00322 void build14excl(int);
00323 void stripHGroupExcl(void);
00324
00325
00326 void build_inherited_excl(void);
00327
00328 #ifdef MEM_OPT_VERSION
00329 void stripFepFixedExcl(void);
00330 #else
00331 void stripFepExcl(void);
00332 #endif
00333
00334 void build_exclusions();
00335
00336
00337
00338 void build_atom_status(void);
00339
00340
00341 SimParameters *simParams;
00342 Parameters *params;
00343
00344 void read_parm(const GromacsTopFile *);
00345
00346 public:
00347
00348 int is_drude_psf;
00349
00350
00351
00352 Real r_om;
00353 Real r_ohc;
00354
00355
00356 BigReal tail_corr_ener;
00357 BigReal tail_corr_virial;
00358
00359
00360
00361 #ifdef MEM_OPT_VERSION
00362 AtomCstInfo *getAtoms() const { return atoms; }
00363 AtomNameIdx *getAtomNames() const { return atomNames; }
00364 #else
00365 Atom *getAtoms () const { return atoms; }
00366 AtomNameInfo *getAtomNames() const { return atomNames; }
00367 #endif
00368
00369 AtomSegResInfo *getAtomSegResInfo() const { return atomSegResids; }
00370
00371
00372 int num_fixed_atoms() const {
00373
00374 int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
00375 return s_NumFixedAtoms;
00376 }
00377
00378 int num_fixed_groups() const {
00379
00380 int s_NumFixedAtoms = num_fixed_atoms();
00381 int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
00382 return s_NumFixedGroups;
00383 }
00384
00385 int num_group_deg_freedom() const {
00386
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 }
00397
00398 int num_deg_freedom(int isInitialReport = 0) const {
00399
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
00411
00412
00413 s_NumDegFreedom = 3 * numFepInitial;
00414 }
00415 int s_NumFixedRigidBonds =
00416 (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
00417
00418
00419 s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
00420 return s_NumDegFreedom;
00421 }
00422
00423 int numAtoms;
00424
00425 int numRealBonds;
00426 int numBonds;
00427 int numAngles;
00428 int numDihedrals;
00429 int suspiciousAlchBonds;
00430 int alchDroppedAngles;
00431 int alchDroppedDihedrals;
00432 int alchDroppedImpropers;
00433 int numImpropers;
00434 int numCrossterms;
00435 int numDonors;
00436 int numAcceptors;
00437 int numExclusions;
00438 int numTotalExclusions;
00439
00440
00441 int numLonepairs;
00442 int numDrudeAtoms;
00443 int numAnisos;
00444 int numLphosts;
00445
00446
00447 int numConstraints;
00448
00449 int numGridforceGrids;
00450 int *numGridforces;
00451
00452 int numMovDrag;
00453 int numRotDrag;
00454 int numConsTorque;
00455 int numFixedAtoms;
00456 int numStirredAtoms;
00457 int numExPressureAtoms;
00458 int numHydrogenGroups;
00459 int numFixedGroups;
00460 int numRigidBonds;
00461 int numFixedRigidBonds;
00462
00463 int numFepInitial;
00464 int numFepFinal;
00465
00466
00467 int numConsForce;
00468 int32 *consForceIndexes;
00469 Vector *consForce;
00470
00471 int32 *consTorqueIndexes;
00472 ConsTorqueParams *consTorqueParams;
00473
00474
00475
00476
00477 int numCalcBonds;
00478 int numCalcAngles;
00479 int numCalcDihedrals;
00480 int numCalcImpropers;
00481 int numCalcCrossterms;
00482 int numCalcExclusions;
00483
00484
00485 int numMultipleDihedrals;
00486
00487 int numMultipleImpropers;
00488
00489 HydrogenGroup hydrogenGroup;
00490 int waterIndex;
00491
00492 Molecule(SimParameters *, Parameters *param);
00493 Molecule(SimParameters *, Parameters *param, char *filename, ConfigList *cfgList=NULL);
00494 Molecule(SimParameters *simParams, Parameters *param, molfile_plugin_t *pIOHdl, void *pIOFileHdl, int natoms);
00495
00496 Molecule(SimParameters *, Parameters *, Ambertoppar *);
00497 void read_parm(Ambertoppar *);
00498
00499 Molecule(SimParameters *, Parameters *, const GromacsTopFile *);
00500
00501 ~Molecule();
00502
00503 void read_psf_file(char *, Parameters *);
00504
00505
00506
00507
00508 void send_Molecule(MOStream *);
00509
00510
00511 void receive_Molecule(MIStream *);
00512
00513
00514
00515 void build_constraint_params(StringList *, StringList *, StringList *,
00516 PDB *, char *);
00517
00518
00519
00520
00521 void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *);
00522
00523
00524
00525 void build_movdrag_params(StringList *, StringList *, StringList *,
00526 PDB *, char *);
00527
00528
00529 void build_rotdrag_params(StringList *, StringList *, StringList *,
00530 StringList *, StringList *, StringList *,
00531 PDB *, char *);
00532
00533
00534 void build_constorque_params(StringList *, StringList *, StringList *,
00535 StringList *, StringList *, StringList *,
00536 PDB *, char *);
00537
00538
00539
00540 void build_constant_forces(char *);
00541
00542
00543 void build_langevin_params(BigReal coupling, Bool doHydrogen);
00544 void build_langevin_params(StringList *, StringList *, PDB *, char *);
00545
00546
00547 void build_fixed_atoms(StringList *, StringList *, PDB *, char *);
00548
00549
00550 void build_stirred_atoms(StringList *, StringList *, PDB *, char *);
00551
00552
00553 void build_extra_bonds(Parameters *parameters, StringList *file);
00554
00555
00556 void build_fep_flags(StringList *, StringList *, PDB *, char *);
00557
00558 void delete_alch_bonded(void);
00559
00560
00561 void build_exPressure_atoms(StringList *, StringList *, PDB *, char *);
00562
00563
00564
00565 void reloadCharges(float charge[], int n);
00566
00567 Bool is_lp(int);
00568 Bool is_drude(int);
00569 Bool is_hydrogen(int);
00570 Bool is_oxygen(int);
00571 Bool is_hydrogenGroupParent(int);
00572 Bool is_water(int);
00573 int get_groupSize(int);
00574 int get_mother_atom(int);
00575
00576 #ifdef MEM_OPT_VERSION
00577
00578
00579 int get_cluster_size_con(int aid) const { return clusterSigs[aid]; }
00580
00581
00582 int get_cluster_size_uncon(int cIdx) const { return clusterSize[cIdx]; }
00583 int get_cluster_idx(int aid) const { return clusterSigs[aid]; }
00584 int get_num_clusters() const { return numClusters; }
00585 int get_cluster_contiguity() { return isClusterContiguous; }
00586 #else
00587 int get_cluster(int anum) const { return cluster[anum]; }
00588 int get_clusterSize(int anum) const { return clusterSize[anum]; }
00589 #endif
00590
00591 const float *getOccupancyData() { return (const float *)occupancy; }
00592 void setOccupancyData(molfile_atom_t *atomarray);
00593 void freeOccupancyData() { delete [] occupancy; occupancy=NULL; }
00594
00595 const float *getBFactorData() { return (const float *)bfactor; }
00596 void setBFactorData(molfile_atom_t *atomarray);
00597 void freeBFactorData() { delete [] bfactor; bfactor=NULL; }
00598
00599 #ifdef CHARMIZE_NAMD
00600 Atom *getAllAtoms() {
00601 return atoms;
00602 }
00603 #endif
00604
00605
00606 Real atommass(int anum) const
00607 {
00608 #ifdef MEM_OPT_VERSION
00609 return atomMassPool[eachAtomMass[anum]];
00610 #else
00611 return(atoms[anum].mass);
00612 #endif
00613 }
00614
00615
00616 Real atomcharge(int anum) const
00617 {
00618 #ifdef MEM_OPT_VERSION
00619 return atomChargePool[eachAtomCharge[anum]];
00620 #else
00621 return(atoms[anum].charge);
00622 #endif
00623 }
00624
00625
00626 Index atomvdwtype(int anum) const
00627 {
00628 return(atoms[anum].vdw_type);
00629 }
00630
00631 #ifndef MEM_OPT_VERSION
00632
00633 Bond *get_bond(int bnum) const {return (&(bonds[bnum]));}
00634
00635
00636 Angle *get_angle(int anum) const {return (&(angles[anum]));}
00637
00638
00639 Improper *get_improper(int inum) const {return (&(impropers[inum]));}
00640
00641
00642 Dihedral *get_dihedral(int dnum) const {return (&(dihedrals[dnum]));}
00643
00644
00645 Crossterm *get_crossterm(int inum) const {return (&(crossterms[inum]));}
00646
00647
00648 Lphost *get_lphost(int atomid) const {
00649 int index = lphostIndexes[atomid];
00650 return (index != -1 ? &(lphosts[index]) : NULL);
00651 }
00652
00653
00654 Bond *getAllBonds() const {return bonds;}
00655 Angle *getAllAngles() const {return angles;}
00656 Improper *getAllImpropers() const {return impropers;}
00657 Dihedral *getAllDihedrals() const {return dihedrals;}
00658 Crossterm *getAllCrossterms() const {return crossterms;}
00659
00660
00661 Lphost *getAllLphosts() const { return lphosts; }
00662
00663 #endif
00664
00665
00666 Bond *get_donor(int dnum) const {return (&(donors[dnum]));}
00667
00668
00669 Bond *get_acceptor(int dnum) const {return (&(acceptors[dnum]));}
00670
00671 Bond *getAllDonors() const {return donors;}
00672 Bond *getAllAcceptors() const {return acceptors;}
00673
00674
00675 #ifndef MEM_OPT_VERSION
00676 Exclusion *get_exclusion(int ex) const {return (&(exclusions[ex]));}
00677 #endif
00678
00679
00680 const char *get_atomtype(int anum) const
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 }
00693
00694
00695 int get_atom_from_name(const char *segid, int resid, const char *aname) const;
00696
00697
00698 int get_residue_size(const char *segid, int resid) const;
00699
00700
00701 int get_atom_from_index_in_residue(const char *segid, int resid, int index) const;
00702
00703
00704
00705
00706
00707
00708 #ifndef MEM_OPT_VERSION
00709 int32 *get_bonds_for_atom(int anum)
00710 { return bondsByAtom[anum]; }
00711 int32 *get_angles_for_atom(int anum)
00712 { return anglesByAtom[anum]; }
00713 int32 *get_dihedrals_for_atom(int anum)
00714 { return dihedralsByAtom[anum]; }
00715 int32 *get_impropers_for_atom(int anum)
00716 { return impropersByAtom[anum]; }
00717 int32 *get_crossterms_for_atom(int anum)
00718 { return crosstermsByAtom[anum]; }
00719 int32 *get_exclusions_for_atom(int anum)
00720 { return exclusionsByAtom[anum]; }
00721 const int32 *get_full_exclusions_for_atom(int anum) const
00722 { return fullExclusionsByAtom[anum]; }
00723 const int32 *get_mod_exclusions_for_atom(int anum) const
00724 { return modExclusionsByAtom[anum]; }
00725 #endif
00726
00727
00728
00729 #ifdef MEM_OPT_VERSION
00730 int checkExclByIdx(int idx1, int atom1, int atom2) const;
00731 const ExclusionCheck *get_excl_check_for_idx(int idx) const{
00732 return &exclChkSigPool[idx];
00733 }
00734 #else
00735 int checkexcl(int atom1, int atom2) const;
00736
00737 const ExclusionCheck *get_excl_check_for_atom(int anum) const{
00738 return &all_exclusions[anum];
00739 }
00740 #endif
00741
00742
00743
00744
00745 Bool is_atom_gridforced(int atomnum, int gridnum) const
00746 {
00747 if (numGridforceGrids)
00748 {
00749 return(gridfrcIndexes[gridnum][atomnum] != -1);
00750 }
00751 else
00752 {
00753 return(FALSE);
00754 }
00755 }
00756
00757
00758
00759
00760 Bool is_atom_constrained(int atomnum) const
00761 {
00762 if (numConstraints)
00763 {
00764
00765 return(consIndexes[atomnum] != -1);
00766 }
00767 else
00768 {
00769
00770 return(FALSE);
00771 }
00772 }
00773
00774
00775
00776 Bool is_atom_movdragged(int atomnum) const
00777 {
00778 if (numMovDrag)
00779 {
00780
00781 return(movDragIndexes[atomnum] != -1);
00782 }
00783 else
00784 {
00785
00786 return(FALSE);
00787 }
00788 }
00789
00790
00791
00792 Bool is_atom_rotdragged(int atomnum) const
00793 {
00794 if (numRotDrag)
00795 {
00796
00797 return(rotDragIndexes[atomnum] != -1);
00798 }
00799 else
00800 {
00801
00802 return(FALSE);
00803 }
00804 }
00805
00806
00807
00808 Bool is_atom_constorqued(int atomnum) const
00809 {
00810 if (numConsTorque)
00811 {
00812
00813 return(consTorqueIndexes[atomnum] != -1);
00814 }
00815 else
00816 {
00817
00818 return(FALSE);
00819 }
00820 }
00821
00822
00823 void get_cons_params(Real &k, Vector &refPos, int atomnum) const
00824 {
00825 k = consParams[consIndexes[atomnum]].k;
00826 refPos = consParams[consIndexes[atomnum]].refPos;
00827 }
00828
00829
00830 void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
00831 {
00832 k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
00833 q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
00834 }
00835
00836 GridforceGrid* get_gridfrc_grid(int gridnum) const
00837 {
00838 return gridfrcGrid[gridnum];
00839 }
00840
00841
00842 Real langevin_param(int atomnum) const
00843 {
00844 return(langevinParams[atomnum]);
00845 }
00846
00847
00848 void get_stir_refPos(Vector &refPos, int atomnum) const
00849 {
00850 refPos = stirParams[stirIndexes[atomnum]].refPos;
00851 }
00852
00853
00854 void put_stir_startTheta(Real theta, int atomnum) const
00855 {
00856 stirParams[stirIndexes[atomnum]].startTheta = theta;
00857 }
00858
00859
00860 Real get_stir_startTheta(int atomnum) const
00861 {
00862 return stirParams[stirIndexes[atomnum]].startTheta;
00863 }
00864
00865
00866
00867 void get_movdrag_params(Vector &v, int atomnum) const
00868 {
00869 v = movDragParams[movDragIndexes[atomnum]].v;
00870 }
00871
00872
00873 void get_rotdrag_params(BigReal &v, Vector &a, Vector &p,
00874 int atomnum) const
00875 {
00876 v = rotDragParams[rotDragIndexes[atomnum]].v;
00877 a = rotDragParams[rotDragIndexes[atomnum]].a;
00878 p = rotDragParams[rotDragIndexes[atomnum]].p;
00879 }
00880
00881
00882 void get_constorque_params(BigReal &v, Vector &a, Vector &p,
00883 int atomnum) const
00884 {
00885 v = consTorqueParams[consTorqueIndexes[atomnum]].v;
00886 a = consTorqueParams[consTorqueIndexes[atomnum]].a;
00887 p = consTorqueParams[consTorqueIndexes[atomnum]].p;
00888 }
00889
00890
00891 unsigned char get_fep_type(int anum) const
00892 {
00893 return(fepAtomFlags[anum]);
00894 }
00895
00896
00897 Bool is_atom_fixed(int atomnum) const
00898 {
00899 return (numFixedAtoms && fixedAtomFlags[atomnum]);
00900 }
00901
00902
00903 Bool is_atom_stirred(int atomnum) const
00904 {
00905 if (numStirredAtoms)
00906 {
00907
00908 return(stirIndexes[atomnum] != -1);
00909 }
00910 else
00911 {
00912
00913 return(FALSE);
00914 }
00915 }
00916
00917
00918 Bool is_group_fixed(int atomnum) const
00919 {
00920 return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
00921 }
00922 Bool is_atom_exPressure(int atomnum) const
00923 {
00924 return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
00925 }
00926
00927
00928 Real rigid_bond_length(int atomnum) const
00929 {
00930 return(rigidBondLengths[atomnum]);
00931 }
00932
00933 void print_atoms(Parameters *);
00934
00935 void print_bonds(Parameters *);
00936
00937 void print_exclusions();
00938
00939 private:
00940
00941
00942 void read_compressed_psf_file(char *, Parameters *, ConfigList *cfgList);
00943
00944 #ifdef MEM_OPT_VERSION
00945 public:
00946 int atomSigPoolSize;
00947 AtomSignature *atomSigPool;
00948
00949
00950
00951 int segNamePoolSize;
00952 char **segNamePool;
00953
00954 int resNamePoolSize;
00955 char **resNamePool;
00956
00957 int atomNamePoolSize;
00958 char **atomNamePool;
00959
00960 int atomTypePoolSize;
00961 char **atomTypePool;
00962
00963 int chargePoolSize;
00964 Real *atomChargePool;
00965
00966 int massPoolSize;
00967 Real *atomMassPool;
00968
00969 AtomSigID getAtomSigId(int aid) {
00970 return eachAtomSig[aid];
00971 }
00972 ExclSigID getAtomExclSigId(int aid) const {
00973 return eachAtomExclSig[aid];
00974 }
00975
00976
00977 int exclSigPoolSize;
00978
00979 ExclusionSignature *exclSigPool;
00980
00981 ExclusionCheck *exclChkSigPool;
00982
00983 void addNewExclSigPool(const vector<ExclusionSignature>&);
00984
00985 void build_excl_check_signatures();
00986
00987 void delEachAtomSigs(){
00988
00989
00990
00991
00992
00993 if(CmiMyRank()) return;
00994
00995 delete [] eachAtomSig;
00996 delete [] eachAtomExclSig;
00997 eachAtomSig = NULL;
00998 eachAtomExclSig = NULL;
00999 }
01000
01001 void delChargeSpace(){
01002 if(CmiMyRank()) return;
01003
01004 delete [] atomChargePool;
01005 delete [] eachAtomCharge;
01006 atomChargePool = NULL;
01007 eachAtomCharge = NULL;
01008 }
01009
01010 void delMassSpace(){
01011 if(CmiMyRank()) return;
01012
01013 delete [] atomMassPool;
01014 delete [] eachAtomMass;
01015 atomMassPool = NULL;
01016 eachAtomMass = NULL;
01017 }
01018
01019 void delClusterSigs() {
01020 if(CmiMyRank()) return;
01021
01022 delete [] clusterSigs;
01023 clusterSigs = NULL;
01024 }
01025
01026 void delOtherEachAtomStructs();
01027
01028
01029 private:
01030 Index insert_new_mass(Real newMass);
01031
01032
01033
01034
01035
01036
01037
01038
01039 int exclStrippedByFepOrFixedAtoms(int atom1, int atom2);
01040 #endif
01041
01042 };
01043
01044 #endif
01045