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
00036 #define MAX_GO_CHAINS 10
00037 #define MAX_RESTRICTIONS 10
00038
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;
00057 class AnisoElem;
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
00102 typedef struct go_val
00103 {
00104 Real epsilon;
00105 int exp_a;
00106 int exp_b;
00107 int exp_rep;
00108 Real sigmaRep;
00109 Real epsilonRep;
00110 Real cutoff;
00111 int restrictions[MAX_RESTRICTIONS];
00112 } GoValue;
00113
00114
00115
00116 typedef struct seg_resid
00117 {
00118 char segname[11];
00119 int resid;
00120 }AtomSegResInfo;
00121
00122
00123 class Molecule
00124 {
00125 private:
00126 typedef struct constraint_params
00127 {
00128 Real k;
00129 Vector refPos;
00130 } ConstraintParams;
00131
00132
00133
00134
00135 typedef struct gridfrc_params
00136 {
00137 Real k;
00138 Charge q;
00139 } GridforceParams;
00140
00141
00142
00143 typedef struct stir_params
00144 {
00145 Real startTheta;
00146 Vector refPos;
00147 } StirParams;
00148
00149 typedef struct movdrag_params
00150 {
00151 Vector v;
00152 } MovDragParams;
00153
00154
00155 typedef struct rotdrag_params
00156 {
00157 Real v;
00158 Vector a;
00159 Vector p;
00160 } RotDragParams;
00161
00162 typedef struct constorque_params
00163 {
00164 Real v;
00165 Vector a;
00166 Vector p;
00167 } ConsTorqueParams;
00168
00169 #ifdef MEM_OPT_VERSION
00170
00171 struct AtomSet{
00172 AtomID aid1;
00173 AtomID aid2;
00174
00175 int operator < (const AtomSet &a) const{
00176 return aid1 < a.aid1;
00177 }
00178 };
00179 typedef ResizeArray<AtomSet> AtomSetList;
00180 #endif
00181
00182 friend class ExclElem;
00183 friend class BondElem;
00184 friend class AngleElem;
00185 friend class DihedralElem;
00186 friend class ImproperElem;
00187 friend class TholeElem;
00188 friend class AnisoElem;
00189 friend class CrosstermElem;
00190 friend class WorkDistrib;
00191
00192 private:
00193
00194 #ifndef MEM_OPT_VERSION
00195 Atom *atoms;
00196 ObjectArena<char> *nameArena;
00197 AtomNameInfo *atomNames;
00198
00199 Bond *bonds;
00200 Angle *angles;
00201 Dihedral *dihedrals;
00202 Improper *impropers;
00203 Crossterm *crossterms;
00204
00205
00206 Exclusion *exclusions;
00207 UniqueSet<Exclusion> exclusionSet;
00208
00209 int32 *cluster;
00210
00211 ObjectArena<int32> *tmpArena;
00212 int32 **bondsWithAtom;
00213 ObjectArena<int32> *arena;
00214
00215
00216 int32 **bondsByAtom;
00217 int32 **anglesByAtom;
00218 int32 **dihedralsByAtom;
00219 int32 **impropersByAtom;
00220 int32 **crosstermsByAtom;
00221
00222 int32 **exclusionsByAtom;
00223 int32 **fullExclusionsByAtom;
00224 int32 **modExclusionsByAtom;
00225 ObjectArena<char> *exclArena;
00226 ExclusionCheck *all_exclusions;
00227
00228
00229 int32 **tholesByAtom;
00230 int32 **anisosByAtom;
00231
00232
00233 #else
00234
00235 AtomCstInfo *atoms;
00236 Index *eachAtomMass;
00237 Index *eachAtomCharge;
00238 AtomNameIdx *atomNames;
00239 ObjectArena<char> *nameArena;
00240
00241
00242
00243
00244
00245 int32 *clusterSigs;
00246 int32 numClusters;
00247
00248 AtomSigID *eachAtomSig;
00249 ExclSigID *eachAtomExclSig;
00250
00251 AtomSetList *fixedAtomsSet;
00252 #endif
00253
00254 ResidueLookupElem *resLookup;
00255
00256 AtomSegResInfo *atomSegResids;
00257
00258 Bond *donors;
00259 Bond *acceptors;
00260
00261
00262 DrudeConst *drudeConsts;
00263 Thole *tholes;
00264 Aniso *anisos;
00265 Lphost *lphosts;
00266 int32 *lphostIndexes;
00267
00268
00269 int32 *consIndexes;
00270 ConstraintParams *consParams;
00271
00272
00273 int32 **gridfrcIndexes;
00274 GridforceParams **gridfrcParams;
00275 GridforceGrid **gridfrcGrid;
00276
00277
00278
00279 int32 *stirIndexes;
00280 StirParams *stirParams;
00281
00282 int32 *movDragIndexes;
00283 MovDragParams *movDragParams;
00284
00285 int32 *rotDragIndexes;
00286 RotDragParams *rotDragParams;
00287
00288
00289 Real *langevinParams;
00290 int32 *fixedAtomFlags;
00291 int32 *exPressureAtomFlags;
00292
00293
00294
00295
00296
00297 int32 *clusterSize;
00298
00299 Real *rigidBondLengths;
00300
00301
00302 unsigned char *fepAtomFlags;
00303
00304
00305
00306 float *occupancy;
00307 float *bfactor;
00308
00309
00310
00311 SimParameters *simParams;
00312 Parameters *params;
00313
00314 private:
00315 void initialize(SimParameters *, Parameters *param);
00316
00317
00318
00319 int *lcpoParamType;
00320
00321 #ifndef MEM_OPT_VERSION
00322 void read_psf_file(char *, Parameters *);
00323
00324
00325
00326
00327 void read_atoms(FILE *, Parameters *);
00328
00329 void read_bonds(FILE *, Parameters *);
00330
00331 void read_angles(FILE *, Parameters *);
00332
00333 void read_dihedrals(FILE *, Parameters *);
00334
00335 void read_impropers(FILE *, Parameters *);
00336
00337 void read_crossterms(FILE *, Parameters *);
00338
00339 void read_donors(FILE *);
00340
00341 void read_acceptors(FILE *);
00342
00343 void read_exclusions(FILE *);
00344
00345
00346
00347 void read_lphosts(FILE *);
00348
00349 void read_anisos(FILE *);
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359 void assignLCPOTypes(int inputType);
00360
00361
00362 void plgLoadAtomBasics(molfile_atom_t *atomarray);
00363 void plgLoadBonds(int *from, int *to);
00364 void plgLoadAngles(int *plgAngles);
00365 void plgLoadDihedrals(int *plgDihedrals);
00366 void plgLoadImpropers(int *plgImpropers);
00367 void plgLoadCrossterms(int *plgCterms);
00368
00369
00370
00371
00372
00373 void build_lists_by_atom();
00374
00375
00376 void build12excl(void);
00377 void build13excl(void);
00378 void build14excl(int);
00379
00380
00381 void build_inherited_excl(int);
00382
00383 void stripFepExcl(void);
00384
00385 void build_exclusions();
00386
00387
00388 void build_atom_status(void);
00389
00390 #else
00391
00392
00393 void read_mol_signatures(char *fname, Parameters *params, ConfigList *cfgList=0);
00394 void load_one_inputatom(int aid, OutputAtomRecord *one, InputAtom *fAtom);
00395 void build_excl_check_signatures();
00396 #endif
00397
00398 void read_parm(const GromacsTopFile *);
00399
00400 public:
00401
00402 int is_drude_psf;
00403 int is_lonepairs_psf;
00404
00405
00406
00407 Real r_om;
00408 Real r_ohc;
00409
00410
00411 BigReal tail_corr_ener;
00412 BigReal tail_corr_virial;
00413
00414 int const * getLcpoParamType() {
00415 return lcpoParamType;
00416 }
00417
00418 #ifdef MEM_OPT_VERSION
00419 AtomCstInfo *getAtoms() const { return atoms; }
00420 AtomNameIdx *getAtomNames() const { return atomNames; }
00421 #else
00422 Atom *getAtoms () const { return atoms; }
00423 AtomNameInfo *getAtomNames() const { return atomNames; }
00424 #endif
00425
00426 AtomSegResInfo *getAtomSegResInfo() const { return atomSegResids; }
00427
00428
00429 int num_fixed_atoms() const {
00430
00431 int s_NumFixedAtoms = (simParams->fixedAtomsOn ? numFixedAtoms : 0);
00432 return s_NumFixedAtoms;
00433 }
00434
00435 int num_fixed_groups() const {
00436
00437 int s_NumFixedAtoms = num_fixed_atoms();
00438 int s_NumFixedGroups = (s_NumFixedAtoms ? numFixedGroups : 0);
00439 return s_NumFixedGroups;
00440 }
00441
00442 int num_group_deg_freedom() const {
00443
00444 int s_NumGroupDegFreedom = 3 * numHydrogenGroups;
00445 int s_NumFixedAtoms = num_fixed_atoms();
00446 int s_NumFixedGroups = num_fixed_groups();
00447 if (s_NumFixedGroups) s_NumGroupDegFreedom -= 3 * s_NumFixedGroups;
00448 if ( ! (s_NumFixedAtoms || numConstraints
00449 || simParams->comMove || simParams->langevinOn) ) {
00450 s_NumGroupDegFreedom -= 3;
00451 }
00452 return s_NumGroupDegFreedom;
00453 }
00454
00455 int num_deg_freedom(int isInitialReport = 0) const {
00456
00457 int s_NumDegFreedom = 3 * numAtoms;
00458 int s_NumFixedAtoms = num_fixed_atoms();
00459 if (s_NumFixedAtoms) s_NumDegFreedom -= 3 * s_NumFixedAtoms;
00460 if (numLonepairs) s_NumDegFreedom -= 3 * numLonepairs;
00461 if ( ! (s_NumFixedAtoms || numConstraints
00462 || simParams->comMove || simParams->langevinOn) ) {
00463 s_NumDegFreedom -= 3;
00464 }
00465 if ( ! isInitialReport && simParams->pairInteractionOn) {
00466
00467
00468
00469
00470 s_NumDegFreedom = 3 * numFepInitial;
00471 }
00472 int s_NumFixedRigidBonds =
00473 (simParams->fixedAtomsOn ? numFixedRigidBonds : 0);
00474 if (simParams->watmodel == WAT_TIP4) {
00475
00476
00477 s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds - numLonepairs);
00478 }
00479 else {
00480
00481
00482
00483 s_NumDegFreedom -= (numRigidBonds - s_NumFixedRigidBonds);
00484 }
00485 return s_NumDegFreedom;
00486 }
00487
00488 int numAtoms;
00489
00490 int numRealBonds;
00491 int numBonds;
00492 int numAngles;
00493 int numDihedrals;
00494 int suspiciousAlchBonds;
00495 int alchDroppedAngles;
00496 int alchDroppedDihedrals;
00497 int alchDroppedImpropers;
00498 int numImpropers;
00499 int numCrossterms;
00500 int numDonors;
00501 int numAcceptors;
00502 int numExclusions;
00503 int numTotalExclusions;
00504
00505
00506 int numLonepairs;
00507 int numDrudeAtoms;
00508 int numTholes;
00509 int numAnisos;
00510 int numLphosts;
00511
00512
00513 int numConstraints;
00514
00515 int numGridforceGrids;
00516 int *numGridforces;
00517
00518 int numMovDrag;
00519 int numRotDrag;
00520 int numConsTorque;
00521 int numFixedAtoms;
00522 int numStirredAtoms;
00523 int numExPressureAtoms;
00524 int numHydrogenGroups;
00525 int maxHydrogenGroupSize;
00526 int numMigrationGroups;
00527 int maxMigrationGroupSize;
00528 int numFixedGroups;
00529 int numRigidBonds;
00530 int numFixedRigidBonds;
00531
00532 int numFepInitial;
00533 int numFepFinal;
00534
00535
00536 int numConsForce;
00537 int32 *consForceIndexes;
00538 Vector *consForce;
00539
00540 int32 *consTorqueIndexes;
00541 ConsTorqueParams *consTorqueParams;
00542
00543
00544
00545
00546 int numCalcBonds;
00547 int numCalcAngles;
00548 int numCalcDihedrals;
00549 int numCalcImpropers;
00550 int numCalcCrossterms;
00551 int numCalcExclusions;
00552
00553
00554 int numCalcTholes;
00555 int numCalcAnisos;
00556
00557
00558
00559 int numMultipleDihedrals;
00560
00561 int numMultipleImpropers;
00562
00563 HydrogenGroup hydrogenGroup;
00564
00565
00566 int numGoAtoms;
00567 int32 *atomChainTypes;
00568 int32 *goSigmaIndices;
00569 Real *goSigmas;
00570 bool *goWithinCutoff;
00571 Real *goCoordinates;
00572 int *goResids;
00573 PDB *goPDB;
00574
00575 BigReal energyNative;
00576 BigReal energyNonnative;
00577
00578
00579
00580 Molecule(SimParameters *, Parameters *param);
00581 Molecule(SimParameters *, Parameters *param, char *filename, ConfigList *cfgList=NULL);
00582 Molecule(SimParameters *simParams, Parameters *param, molfile_plugin_t *pIOHdl, void *pIOFileHdl, int natoms);
00583
00584 Molecule(SimParameters *, Parameters *, Ambertoppar *);
00585 void read_parm(Ambertoppar *);
00586
00587 Molecule(SimParameters *, Parameters *, const GromacsTopFile *);
00588
00589 ~Molecule();
00590
00591 void send_Molecule(MOStream *);
00592
00593
00594
00595 void receive_Molecule(MIStream *);
00596
00597
00598
00599 void build_constraint_params(StringList *, StringList *, StringList *,
00600 PDB *, char *);
00601
00602
00603
00604
00605 void build_gridforce_params(StringList *, StringList *, StringList *, StringList *, PDB *, char *);
00606
00607
00608
00609 void build_movdrag_params(StringList *, StringList *, StringList *,
00610 PDB *, char *);
00611
00612
00613 void build_rotdrag_params(StringList *, StringList *, StringList *,
00614 StringList *, StringList *, StringList *,
00615 PDB *, char *);
00616
00617
00618 void build_constorque_params(StringList *, StringList *, StringList *,
00619 StringList *, StringList *, StringList *,
00620 PDB *, char *);
00621
00622
00623
00624 void build_constant_forces(char *);
00625
00626
00627 void build_langevin_params(BigReal coupling, BigReal drudeCoupling,
00628 Bool doHydrogen);
00629 void build_langevin_params(StringList *, StringList *, PDB *, char *);
00630
00631
00632 #ifdef MEM_OPT_VERSION
00633 void load_fixed_atoms(StringList *fixedFile);
00634 #endif
00635
00636 void build_fixed_atoms(StringList *, StringList *, PDB *, char *);
00637
00638
00639 void build_stirred_atoms(StringList *, StringList *, PDB *, char *);
00640
00641
00642 void build_extra_bonds(Parameters *parameters, StringList *file);
00643
00644
00645 void build_fep_flags(StringList *, StringList *, PDB *, char *, const char *);
00646
00647 void delete_alch_bonded(void);
00648
00649
00650 void build_exPressure_atoms(StringList *, StringList *, PDB *, char *);
00651
00652
00653
00654
00655 void print_go_sigmas();
00656 void build_go_sigmas(StringList *, char *);
00657
00658
00659 void build_go_arrays(StringList *, char *);
00660
00661 BigReal get_go_force(BigReal, int, int, BigReal *, BigReal *) const;
00662
00663
00664 BigReal get_go_force_new(BigReal, int, int, BigReal *, BigReal *) const;
00665
00666 BigReal get_go_energy_new(BigReal, int, int) const;
00667
00668 Bool atoms_1to4(unsigned int, unsigned int);
00669
00670
00671 void reloadCharges(float charge[], int n);
00672
00673 Bool is_lp(int);
00674 Bool is_drude(int);
00675 Bool is_hydrogen(int);
00676 Bool is_oxygen(int);
00677 Bool is_hydrogenGroupParent(int);
00678 Bool is_water(int);
00679 int get_groupSize(int);
00680 int get_mother_atom(int);
00681
00682 #ifdef MEM_OPT_VERSION
00683
00684
00685 int get_cluster_size_con(int aid) const { return clusterSigs[aid]; }
00686
00687
00688 int get_cluster_size_uncon(int cIdx) const { return clusterSize[cIdx]; }
00689 int get_cluster_idx(int aid) const { return clusterSigs[aid]; }
00690 int get_num_clusters() const { return numClusters; }
00691 #else
00692 int get_cluster(int anum) const { return cluster[anum]; }
00693 int get_clusterSize(int anum) const { return clusterSize[anum]; }
00694 #endif
00695
00696 #ifndef MEM_OPT_VERSION
00697 const float *getOccupancyData() { return (const float *)occupancy; }
00698 void setOccupancyData(molfile_atom_t *atomarray);
00699 void freeOccupancyData() { delete [] occupancy; occupancy=NULL; }
00700
00701 const float *getBFactorData() { return (const float *)bfactor; }
00702 void setBFactorData(molfile_atom_t *atomarray);
00703 void freeBFactorData() { delete [] bfactor; bfactor=NULL; }
00704 #endif
00705
00706
00707 Real atommass(int anum) const
00708 {
00709 #ifdef MEM_OPT_VERSION
00710 return atomMassPool[eachAtomMass[anum]];
00711 #else
00712 return(atoms[anum].mass);
00713 #endif
00714 }
00715
00716
00717 Real atomcharge(int anum) const
00718 {
00719 #ifdef MEM_OPT_VERSION
00720 return atomChargePool[eachAtomCharge[anum]];
00721 #else
00722 return(atoms[anum].charge);
00723 #endif
00724 }
00725
00726
00727 Index atomvdwtype(int anum) const
00728 {
00729 return(atoms[anum].vdw_type);
00730 }
00731
00732 #ifndef MEM_OPT_VERSION
00733
00734 Bond *get_bond(int bnum) const {return (&(bonds[bnum]));}
00735
00736
00737 Angle *get_angle(int anum) const {return (&(angles[anum]));}
00738
00739
00740 Improper *get_improper(int inum) const {return (&(impropers[inum]));}
00741
00742
00743 Dihedral *get_dihedral(int dnum) const {return (&(dihedrals[dnum]));}
00744
00745
00746 Crossterm *get_crossterm(int inum) const {return (&(crossterms[inum]));}
00747 #endif
00748
00749
00750 Lphost *get_lphost(int atomid) const {
00751
00752
00753 int index = lphostIndexes[atomid];
00754 return (index != -1 ? &(lphosts[index]) : NULL);
00755 }
00756
00757
00758 #ifndef MEM_OPT_VERSION
00759 Bond *getAllBonds() const {return bonds;}
00760 Angle *getAllAngles() const {return angles;}
00761 Improper *getAllImpropers() const {return impropers;}
00762 Dihedral *getAllDihedrals() const {return dihedrals;}
00763 Crossterm *getAllCrossterms() const {return crossterms;}
00764 #endif
00765
00766
00767 Lphost *getAllLphosts() const { return lphosts; }
00768
00769
00770
00771 Bond *get_donor(int dnum) const {return (&(donors[dnum]));}
00772
00773
00774 Bond *get_acceptor(int dnum) const {return (&(acceptors[dnum]));}
00775
00776 Bond *getAllDonors() const {return donors;}
00777 Bond *getAllAcceptors() const {return acceptors;}
00778
00779
00780 #ifndef MEM_OPT_VERSION
00781 Exclusion *get_exclusion(int ex) const {return (&(exclusions[ex]));}
00782 #endif
00783
00784
00785 const char *get_atomtype(int anum) const
00786 {
00787 if (atomNames == NULL)
00788 {
00789 NAMD_die("Tried to find atom type on node other than node 0");
00790 }
00791
00792 #ifdef MEM_OPT_VERSION
00793 return atomTypePool[atomNames[anum].atomtypeIdx];
00794 #else
00795 return(atomNames[anum].atomtype);
00796 #endif
00797 }
00798
00799
00800 int get_atom_from_name(const char *segid, int resid, const char *aname) const;
00801
00802
00803 int get_residue_size(const char *segid, int resid) const;
00804
00805
00806 int get_atom_from_index_in_residue(const char *segid, int resid, int index) const;
00807
00808
00809
00810
00811
00812
00813 #ifndef MEM_OPT_VERSION
00814 int32 *get_bonds_for_atom(int anum)
00815 { return bondsByAtom[anum]; }
00816 int32 *get_angles_for_atom(int anum)
00817 { return anglesByAtom[anum]; }
00818 int32 *get_dihedrals_for_atom(int anum)
00819 { return dihedralsByAtom[anum]; }
00820 int32 *get_impropers_for_atom(int anum)
00821 { return impropersByAtom[anum]; }
00822 int32 *get_crossterms_for_atom(int anum)
00823 { return crosstermsByAtom[anum]; }
00824 int32 *get_exclusions_for_atom(int anum)
00825 { return exclusionsByAtom[anum]; }
00826 const int32 *get_full_exclusions_for_atom(int anum) const
00827 { return fullExclusionsByAtom[anum]; }
00828 const int32 *get_mod_exclusions_for_atom(int anum) const
00829 { return modExclusionsByAtom[anum]; }
00830 #endif
00831
00832
00833
00834 #ifdef MEM_OPT_VERSION
00835 int checkExclByIdx(int idx1, int atom1, int atom2) const;
00836 const ExclusionCheck *get_excl_check_for_idx(int idx) const{
00837 return &exclChkSigPool[idx];
00838 }
00839 #else
00840 int checkexcl(int atom1, int atom2) const;
00841
00842 const ExclusionCheck *get_excl_check_for_atom(int anum) const{
00843 return &all_exclusions[anum];
00844 }
00845 #endif
00846
00847
00848
00849
00850 Bool is_atom_gridforced(int atomnum, int gridnum) const
00851 {
00852 if (numGridforceGrids)
00853 {
00854 return(gridfrcIndexes[gridnum][atomnum] != -1);
00855 }
00856 else
00857 {
00858 return(FALSE);
00859 }
00860 }
00861
00862
00863
00864
00865 Bool is_atom_constrained(int atomnum) const
00866 {
00867 if (numConstraints)
00868 {
00869
00870 return(consIndexes[atomnum] != -1);
00871 }
00872 else
00873 {
00874
00875 return(FALSE);
00876 }
00877 }
00878
00879
00880
00881 Bool is_atom_movdragged(int atomnum) const
00882 {
00883 if (numMovDrag)
00884 {
00885
00886 return(movDragIndexes[atomnum] != -1);
00887 }
00888 else
00889 {
00890
00891 return(FALSE);
00892 }
00893 }
00894
00895
00896
00897 Bool is_atom_rotdragged(int atomnum) const
00898 {
00899 if (numRotDrag)
00900 {
00901
00902 return(rotDragIndexes[atomnum] != -1);
00903 }
00904 else
00905 {
00906
00907 return(FALSE);
00908 }
00909 }
00910
00911
00912
00913 Bool is_atom_constorqued(int atomnum) const
00914 {
00915 if (numConsTorque)
00916 {
00917
00918 return(consTorqueIndexes[atomnum] != -1);
00919 }
00920 else
00921 {
00922
00923 return(FALSE);
00924 }
00925 }
00926
00927
00928 void get_cons_params(Real &k, Vector &refPos, int atomnum) const
00929 {
00930 k = consParams[consIndexes[atomnum]].k;
00931 refPos = consParams[consIndexes[atomnum]].refPos;
00932 }
00933
00934
00935 void get_gridfrc_params(Real &k, Charge &q, int atomnum, int gridnum) const
00936 {
00937 k = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].k;
00938 q = gridfrcParams[gridnum][gridfrcIndexes[gridnum][atomnum]].q;
00939 }
00940
00941 GridforceGrid* get_gridfrc_grid(int gridnum) const
00942 {
00943 GridforceGrid *result = NULL;
00944 if (gridnum >= 0 && gridnum < numGridforceGrids) {
00945 result = gridfrcGrid[gridnum];
00946 }
00947 return result;
00948 }
00949
00950 int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
00951 {
00952 if (grid && gridnum >= 0 && gridnum < numGridforceGrids) {
00953 gridfrcGrid[gridnum] = grid;
00954 return 0;
00955 } else {
00956 return -1;
00957 }
00958 }
00959
00960
00961 Real langevin_param(int atomnum) const
00962 {
00963 return(langevinParams ? langevinParams[atomnum] : 0.);
00964 }
00965
00966
00967 void get_stir_refPos(Vector &refPos, int atomnum) const
00968 {
00969 refPos = stirParams[stirIndexes[atomnum]].refPos;
00970 }
00971
00972
00973 void put_stir_startTheta(Real theta, int atomnum) const
00974 {
00975 stirParams[stirIndexes[atomnum]].startTheta = theta;
00976 }
00977
00978
00979 Real get_stir_startTheta(int atomnum) const
00980 {
00981 return stirParams[stirIndexes[atomnum]].startTheta;
00982 }
00983
00984
00985
00986 void get_movdrag_params(Vector &v, int atomnum) const
00987 {
00988 v = movDragParams[movDragIndexes[atomnum]].v;
00989 }
00990
00991
00992 void get_rotdrag_params(BigReal &v, Vector &a, Vector &p,
00993 int atomnum) const
00994 {
00995 v = rotDragParams[rotDragIndexes[atomnum]].v;
00996 a = rotDragParams[rotDragIndexes[atomnum]].a;
00997 p = rotDragParams[rotDragIndexes[atomnum]].p;
00998 }
00999
01000
01001 void get_constorque_params(BigReal &v, Vector &a, Vector &p,
01002 int atomnum) const
01003 {
01004 v = consTorqueParams[consTorqueIndexes[atomnum]].v;
01005 a = consTorqueParams[consTorqueIndexes[atomnum]].a;
01006 p = consTorqueParams[consTorqueIndexes[atomnum]].p;
01007 }
01008
01009
01010 unsigned char get_fep_type(int anum) const
01011 {
01012 return(fepAtomFlags[anum]);
01013 }
01014
01015
01016 #ifndef MEM_OPT_VERSION
01017 Bool is_atom_fixed(int atomnum) const
01018 {
01019 return (numFixedAtoms && fixedAtomFlags[atomnum]);
01020 }
01021 #else
01022
01023
01024
01025
01026
01027
01028
01029 Bool is_atom_fixed(int aid, int *listIdx=NULL) const;
01030 #endif
01031
01032 Bool is_atom_stirred(int atomnum) const
01033 {
01034 if (numStirredAtoms)
01035 {
01036
01037 return(stirIndexes[atomnum] != -1);
01038 }
01039 else
01040 {
01041
01042 return(FALSE);
01043 }
01044 }
01045
01046
01047 Bool is_group_fixed(int atomnum) const
01048 {
01049 return (numFixedAtoms && (fixedAtomFlags[atomnum] == -1));
01050 }
01051 Bool is_atom_exPressure(int atomnum) const
01052 {
01053 return (numExPressureAtoms && exPressureAtomFlags[atomnum]);
01054 }
01055
01056
01057 Real rigid_bond_length(int atomnum) const
01058 {
01059 return(rigidBondLengths[atomnum]);
01060 }
01061
01062 void print_atoms(Parameters *);
01063
01064 void print_bonds(Parameters *);
01065
01066 void print_exclusions();
01067
01068 public:
01069 int isOccupancyValid, isBFactorValid;
01070
01071 #ifdef MEM_OPT_VERSION
01072
01073
01074
01075 void read_binary_atom_info(int fromAtomID, int toAtomID, InputAtomList &inAtoms);
01076
01077 int getNumCalcExclusions(){return numCalcExclusions;}
01078 void setNumCalcExclusions(int x){numCalcExclusions= x;}
01079
01080 Index getEachAtomMass(int i){return eachAtomMass[i];}
01081 Index getEachAtomCharge(int i){return eachAtomCharge[i];}
01082
01083 ExclSigID getAtomExclSigId(int aid) const {
01084 return eachAtomExclSig[aid];
01085 }
01086
01087 Real *getAtomMassPool(){return atomMassPool;}
01088 Real *getAtomChargePool(){return atomChargePool;}
01089 AtomCstInfo *getAtoms(){return atoms;}
01090
01091 int atomSigPoolSize;
01092 AtomSignature *atomSigPool;
01093
01094
01095
01096 int segNamePoolSize;
01097 char **segNamePool;
01098
01099 int resNamePoolSize;
01100 char **resNamePool;
01101
01102 int atomNamePoolSize;
01103 char **atomNamePool;
01104
01105 int atomTypePoolSize;
01106 char **atomTypePool;
01107
01108 int chargePoolSize;
01109 Real *atomChargePool;
01110
01111 int massPoolSize;
01112 Real *atomMassPool;
01113
01114 AtomSigID getAtomSigId(int aid) {
01115 return eachAtomSig[aid];
01116 }
01117
01118
01119 int exclSigPoolSize;
01120
01121 ExclusionSignature *exclSigPool;
01122
01123 ExclusionCheck *exclChkSigPool;
01124
01125 void addNewExclSigPool(const std::vector<ExclusionSignature>&);
01126
01127 void delEachAtomSigs(){
01128
01129
01130
01131
01132
01133 if(CmiMyRank()) return;
01134
01135 delete [] eachAtomSig;
01136 delete [] eachAtomExclSig;
01137 eachAtomSig = NULL;
01138 eachAtomExclSig = NULL;
01139 }
01140
01141 void delChargeSpace(){
01142 if(CmiMyRank()) return;
01143
01144 delete [] atomChargePool;
01145 delete [] eachAtomCharge;
01146 atomChargePool = NULL;
01147 eachAtomCharge = NULL;
01148 }
01149
01150 void delMassSpace(){
01151 if(CmiMyRank()) return;
01152
01153 delete [] atomMassPool;
01154 delete [] eachAtomMass;
01155 atomMassPool = NULL;
01156 eachAtomMass = NULL;
01157 }
01158
01159 void delClusterSigs() {
01160 if(CmiMyRank()) return;
01161
01162 delete [] clusterSigs;
01163 clusterSigs = NULL;
01164 }
01165
01166 void delAtomNames(){
01167 if(CmiMyRank()) return;
01168 delete [] atomNamePool;
01169 delete [] atomNames;
01170 atomNamePool = NULL;
01171 atomNames = NULL;
01172 }
01173
01174 void delFixedAtoms(){
01175 if(CmiMyRank()) return;
01176 delete fixedAtomsSet;
01177 fixedAtomsSet = NULL;
01178 }
01179
01180 private:
01181 Index insert_new_mass(Real newMass);
01182
01183 #endif
01184
01185
01186 public:
01187
01188 GoValue go_array[MAX_GO_CHAINS*MAX_GO_CHAINS];
01189 int go_indices[MAX_GO_CHAINS+1];
01190 int NumGoChains;
01191
01192
01193 void goInit();
01194
01195
01196 void build_go_params(StringList *);
01197
01198
01199 void read_go_file(char *);
01200
01201
01202 Real get_go_cutoff(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].cutoff; };
01203
01204
01205 Real get_go_epsilonRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilonRep; };
01206
01207
01208 Real get_go_sigmaRep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].sigmaRep; };
01209
01210
01211 Real get_go_epsilon(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].epsilon; };
01212
01213
01214 int get_go_exp_a(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_a; };
01215
01216
01217 int get_go_exp_b(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_b; };
01218
01219
01220 int get_go_exp_rep(int chain1, int chain2) { return go_array[MAX_GO_CHAINS*chain1 + chain2].exp_rep; };
01221
01222
01223 Bool go_restricted(int, int, int);
01224
01225
01226 void print_go_params();
01227
01228 void initialize();
01229
01230 void send_GoMolecule(MOStream *);
01231
01232
01233
01234 void receive_GoMolecule(MIStream *);
01235
01236
01237 };
01238
01239 #endif
01240