Molmodel

DuMMForceFieldSubsystem.h

Go to the documentation of this file.
00001 #ifndef SimTK_MOLMODEL_DUMM_FORCE_FIELD_SUBSYSTEM_H_
00002 #define SimTK_MOLMODEL_DUMM_FORCE_FIELD_SUBSYSTEM_H_
00003 
00004 /* -------------------------------------------------------------------------- *
00005  *                             SimTK Molmoldel(tm)                            *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK biosimulation toolkit originating from           *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org/home/molmodel. *
00011  *                                                                            *
00012  * Portions copyright (c) 2007-11 Stanford University and the Authors.        *
00013  * Authors: Michael Sherman                                                   *
00014  * Contributors: Chris Bruns, Peter Eastman, Randy Radmer, Samuel Flores      *
00015  *                                                                            *
00016  * Permission is hereby granted, free of charge, to any person obtaining a    *
00017  * copy of this software and associated documentation files (the "Software"), *
00018  * to deal in the Software without restriction, including without limitation  *
00019  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
00020  * and/or sell copies of the Software, and to permit persons to whom the      *
00021  * Software is furnished to do so, subject to the following conditions:       *
00022  *                                                                            *
00023  * The above copyright notice and this permission notice shall be included in *
00024  * all copies or substantial portions of the Software.                        *
00025  *                                                                            *
00026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
00027  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
00028  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
00029  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
00030  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
00031  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
00032  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
00033  * -------------------------------------------------------------------------- */
00034 
00039 #include "SimTKcommon.h"
00040 #include "simbody/internal/ForceSubsystem.h"
00041 
00042 #include "molmodel/internal/common.h"
00043 #include "molmodel/internal/Biotype.h"
00044 
00045 #include <cassert>
00046 
00047 
00053 namespace SimTK {
00054 
00055 class MolecularMechanicsSystem;
00056 
00060 namespace DuMM {
00064 SimTK_DEFINE_UNIQUE_INDEX_TYPE(AtomIndex);
00070 SimTK_DEFINE_UNIQUE_INDEX_TYPE(IncludedAtomIndex);
00077 SimTK_DEFINE_UNIQUE_INDEX_TYPE(NonbondAtomIndex);
00081 SimTK_DEFINE_UNIQUE_INDEX_TYPE(BondIndex);
00085 SimTK_DEFINE_UNIQUE_INDEX_TYPE(ClusterIndex);
00091 SimTK_DEFINE_UNIQUE_INDEX_TYPE(AtomClassIndex);
00098 SimTK_DEFINE_UNIQUE_INDEX_TYPE(ChargedAtomTypeIndex);
00099 
00100 
00172 
00180 class CustomBondStretch {
00181 public:
00182     virtual ~CustomBondStretch() {}
00183     virtual Real calcEnergy(Real distance) const = 0;
00184     virtual Real calcForce(Real distance) const = 0;
00185 };
00186 
00194 class CustomBondBend {
00195 public:
00196     virtual ~CustomBondBend() {}
00197     virtual Real calcEnergy(Real bendAngle) const = 0;
00198     virtual Real calcTorque(Real bendAngle) const = 0;
00199 };
00200 
00252 class CustomBondTorsion {
00253 public:
00254     virtual ~CustomBondTorsion() {}
00255     virtual Real calcEnergy(Real dihedralAngle) const = 0;
00256     virtual Real calcTorque(Real dihedralAngle) const = 0;
00257 };
00259 
00283 static const Real Ang2Nm  = (Real)0.1L; 
00284 static const Real Nm2Ang  = (Real)10.L; 
00285 static const Real Deg2Rad = (Real)SimTK_DEGREE_TO_RADIAN; 
00286 static const Real Rad2Deg = (Real)SimTK_RADIAN_TO_DEGREE; 
00287 static const Real KJ2Kcal = (Real)SimTK_KJOULE_TO_KCAL;   
00288 static const Real Kcal2KJ = (Real)SimTK_KCAL_TO_KJOULE;   
00289 
00290 static const Real Sigma2Radius = (Real)std::pow(2.L,  1.L/6.L);
00292 static const Real Radius2Sigma = (Real)std::pow(2.L, -1.L/6.L);
00294 
00295 } // namespace DuMM
00296 
00299 
00311 class SimTK_MOLMODEL_EXPORT DuMMForceFieldSubsystem : public ForceSubsystem {
00312 public:
00314 enum VdwMixingRule {
00315     WaldmanHagler       = 1,    
00316     HalgrenHHG          = 2,    
00317     Jorgensen           = 3,    
00318     LorentzBerthelot    = 4,    
00319     Kong                = 5     
00320 };
00321 
00322 DuMMForceFieldSubsystem();
00323 explicit DuMMForceFieldSubsystem(MolecularMechanicsSystem&);
00324 
00325 
00326 
00332 
00333 
00334 
00335 DuMM::AtomIndex addAtom(DuMM::ChargedAtomTypeIndex chargedAtomTypeIx);
00336 
00339 DuMM::BondIndex addBond(DuMM::AtomIndex atom1Ix, DuMM::AtomIndex atom2Ix);
00340 
00345 DuMM::AtomIndex  getBondAtom(DuMM::BondIndex bond, int which) const;
00346 
00348 int getNumAtoms() const;
00350 int getNumBonds() const;
00351 
00354 Real getAtomMass(DuMM::AtomIndex atomIx) const;
00357 int  getAtomElement(DuMM::AtomIndex atomIx) const;
00360 Real getAtomRadius(DuMM::AtomIndex atomIx) const;
00364 MobilizedBodyIndex getAtomBody(DuMM::AtomIndex atomIx) const;
00367 Vec3 getAtomStationOnBody(DuMM::AtomIndex atomIx) const;
00368 
00372 Vec3 getAtomStationInCluster(DuMM::AtomIndex atomIx, DuMM::ClusterIndex clusterIx) const;
00373 
00377 Vec3 getElementDefaultColor(int atomicNumber) const;
00380 Vec3 getAtomDefaultColor(DuMM::AtomIndex atomIx) const;
00381 
00398 DuMM::ClusterIndex createCluster(const char* clusterName);
00399 
00403 void placeAtomInCluster(DuMM::AtomIndex atomIx, DuMM::ClusterIndex clusterIx,
00404                         const Vec3& station);
00405 
00409 void placeClusterInCluster(DuMM::ClusterIndex childClusterIndex, 
00410                            DuMM::ClusterIndex parentClusterIndex, 
00411                            const Transform& X_PC);
00412 
00416 MassProperties calcClusterMassProperties(DuMM::ClusterIndex clusterIx, 
00417                                          const Transform& X_BC = Transform()) const;
00418 
00423 void attachClusterToBody(DuMM::ClusterIndex clusterIx, MobilizedBodyIndex body,
00424                          const Transform& X_BC = Transform());
00425 
00428 void attachAtomToBody(DuMM::AtomIndex atomIx, MobilizedBodyIndex body, 
00429                       const Vec3& station = Vec3(0));
00430 
00432 MobilizedBodyIndex getClusterBody(DuMM::ClusterIndex clusterIx) const;
00433 
00437 Transform getClusterPlacementOnBody(DuMM::ClusterIndex clusterIx) const;
00438 
00441 Transform getClusterPlacementInCluster(DuMM::ClusterIndex childClusterIndex, 
00442                                        DuMM::ClusterIndex parentClusterIndex) const;
00468 void clearIncludedNonbondAtomList();
00469 
00473 void clearIncludedBondList();
00474 
00479 void resetIncludedNonbondAtomListToDefault();
00480 
00485 void resetIncludedBondListToDefault();
00486 
00491 void includeNonbondAtom(DuMM::AtomIndex atom);
00492 
00497 void includeAllNonbondAtomsForOneBody(MobilizedBodyIndex mobod);
00498 
00503 void includeAllInterbodyBondsForOneAtom(DuMM::AtomIndex atom);
00504 
00510 void includeAllInterbodyBondsWithBothAtoms(DuMM::AtomIndex atom1, 
00511                                            DuMM::AtomIndex atom2);
00512 
00517 void includeAllInterbodyBondsWithBothAtoms(DuMM::BondIndex bond);
00518 
00524 void includeAllInterbodyBondsForOneBody(MobilizedBodyIndex mobod);
00525 
00531 void includeAllInterbodyBondsBetweenTwoBodies
00532    (MobilizedBodyIndex mobod1, MobilizedBodyIndex mobod2);
00533 
00538 int getNumIncludedAtoms() const;
00541 DuMM::AtomIndex getAtomIndexOfIncludedAtom
00542    (DuMM::IncludedAtomIndex incAtomIx) const;
00543 
00550 int getNumNonbondAtoms() const;
00554 DuMM::IncludedAtomIndex getIncludedAtomIndexOfNonbondAtom
00555    (DuMM::NonbondAtomIndex nonbondAtomIx) const;
00560 DuMM::AtomIndex getAtomIndexOfNonbondAtom
00561    (DuMM::NonbondAtomIndex nonbondAtomIx) const
00562 {   return getAtomIndexOfIncludedAtom
00563             (getIncludedAtomIndexOfNonbondAtom(nonbondAtomIx)); }
00567     // DEFINE FORCE FIELD PARAMETERS
00568     
00612 void defineAtomClass(DuMM::AtomClassIndex     atomClassIx, 
00613                      const char*              atomClassName,
00614                      int  atomicNumber,  int  expectedValence,
00615                      Real vdwRadiusInNm, Real vdwWellDepthInKJ) 
00616 {   defineIncompleteAtomClass(atomClassIx, atomClassName, atomicNumber, 
00617                               expectedValence);
00618     setAtomClassVdwParameters(atomClassIx, vdwRadiusInNm, vdwWellDepthInKJ); }
00619 
00623 void defineAtomClass_KA(DuMM::AtomClassIndex atomClassIx, 
00624                         const char* atomClassName,
00625                         int element, int valence,
00626                         Real vdwRadiusInAng, Real vdwWellDepthInKcal)
00627 {
00628     defineAtomClass(atomClassIx, atomClassName, element, valence,
00629         vdwRadiusInAng*DuMM::Ang2Nm, vdwWellDepthInKcal*DuMM::Kcal2KJ);
00630 }
00631 
00636 void defineAtomClass_KA(int atomClassIx, const char* atomClassName,
00637                         int element, int valence,
00638                         Real vdwRadiusInAng, Real vdwWellDepthInKcal)
00639 {
00640     defineAtomClass_KA((DuMM::AtomClassIndex)atomClassIx, atomClassName, 
00641                        element, valence, vdwRadiusInAng, vdwWellDepthInKcal);
00642 }
00643 
00645 bool hasAtomClass(DuMM::AtomClassIndex) const;
00647 bool hasAtomClass(const String& atomClassName) const;
00649 DuMM::AtomClassIndex getAtomClassIndex(const String& atomClassName) const;
00652 DuMM::AtomClassIndex getNextUnusedAtomClassIndex() const;
00654 DuMM::AtomClassIndex getAtomClassIndex(DuMM::AtomIndex atomIx) const;
00658 Real getVdwRadius(DuMM::AtomClassIndex atomClassIx) const;
00662 Real getVdwWellDepth(DuMM::AtomClassIndex atomClassIx) const;
00663 
00678 void defineChargedAtomType(DuMM::ChargedAtomTypeIndex atomTypeIx, 
00679                            const char*                atomTypeName,
00680                            DuMM::AtomClassIndex       atomClassIx, 
00681                            Real                       partialChargeInE) 
00682 {   defineIncompleteChargedAtomType(atomTypeIx, atomTypeName, atomClassIx);
00683     setChargedAtomTypeCharge(atomTypeIx, partialChargeInE); }
00684 
00688 void defineChargedAtomType_KA(DuMM::ChargedAtomTypeIndex    atomTypeIx, 
00689                               const char*                   atomTypeName,
00690                               DuMM::AtomClassIndex          atomClassIx, 
00691                               Real                          partialChargeInE)
00692 {   defineChargedAtomType(atomTypeIx, atomTypeName, atomClassIx, 
00693                           partialChargeInE); } // easy!
00699 void defineChargedAtomType_KA(int atomTypeIx, const char* atomTypeName,
00700                               int atomClassIx, Real partialChargeInE) 
00701 {   defineChargedAtomType_KA((DuMM::ChargedAtomTypeIndex)atomTypeIx, 
00702                              atomTypeName, (DuMM::AtomClassIndex)atomClassIx, 
00703                              partialChargeInE); }
00704 
00706 bool hasChargedAtomType(DuMM::ChargedAtomTypeIndex) const;
00708 bool hasChargedAtomType(const String& chargedTypeName) const;
00711 DuMM::ChargedAtomTypeIndex getChargedAtomTypeIndex(const String& chargedTypeName) const; // TODO
00714 DuMM::ChargedAtomTypeIndex getNextUnusedChargedAtomTypeIndex() const; // TODO
00715 
00726 const char* getVdwMixingRuleName(VdwMixingRule) const;
00727 
00729 void setVdwMixingRule(VdwMixingRule);
00732 VdwMixingRule getVdwMixingRule() const;
00733 
00734 void setVdw12ScaleFactor(Real); 
00735 void setVdw13ScaleFactor(Real); 
00736 void setVdw14ScaleFactor(Real); 
00737 void setVdw15ScaleFactor(Real); 
00738 
00739 void setCoulomb12ScaleFactor(Real); 
00740 void setCoulomb13ScaleFactor(Real); 
00741 void setCoulomb14ScaleFactor(Real); 
00742 void setCoulomb15ScaleFactor(Real); 
00743 
00755 void loadAmber99Parameters();
00756 
00759 void populateFromTinkerParameterFile(
00760     std::istream& 
00761     );
00762 
00766 void setBiotypeChargedAtomType(
00767     DuMM::ChargedAtomTypeIndex chargedAtomTypeIndex, 
00768     BiotypeIndex biotypeIx 
00769     );
00770 
00773 DuMM::ChargedAtomTypeIndex getBiotypeChargedAtomType(BiotypeIndex biotypeIx) const;
00774 
00777 std::ostream& generateBiotypeChargedAtomTypeSelfCode(std::ostream& os) const;
00803 void defineBondStretch(DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2,
00804                         Real stiffnessInKJperNmSq, Real nominalLengthInNm);
00805 
00816 void defineBondStretch_KA(DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2,
00817                             Real stiffnessInKcalPerAngSq, Real nominalLengthInAng)
00818 {
00819     defineBondStretch(class1, class2, 
00820                         stiffnessInKcalPerAngSq * DuMM::Kcal2KJ/square(DuMM::Ang2Nm),
00821                         nominalLengthInAng      * DuMM::Ang2Nm);
00822 }
00825 void defineBondStretch_KA(int class1, int class2,
00826                           Real stiffnessInKcalPerAngSq, Real nominalLengthInAng)
00827 {   defineBondStretch_KA((DuMM::AtomClassIndex)class1, (DuMM::AtomClassIndex)class2,
00828                          stiffnessInKcalPerAngSq, nominalLengthInAng); }
00829 
00841 void defineCustomBondStretch(DuMM::AtomClassIndex       class1, 
00842                                 DuMM::AtomClassIndex       class2,
00843                                 DuMM::CustomBondStretch*   bondStretchTerm);
00873 void defineBondBend(DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3,
00874                     Real stiffnessInKJPerRadSq, Real nominalAngleInDeg);
00875 
00887 void defineBondBend_KA(DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3,
00888                         Real stiffnessInKcalPerRadSq, Real nominalAngleInDeg) 
00889 {
00890     defineBondBend(class1,class2,class3,
00891                     stiffnessInKcalPerRadSq * DuMM::Kcal2KJ,
00892                     nominalAngleInDeg);
00893 }
00896 void defineBondBend_KA(int class1, int class2, int class3,
00897                        Real stiffnessInKcalPerRadSq, Real nominalAngleInDeg)
00898 {   defineBondBend_KA((DuMM::AtomClassIndex)class1,(DuMM::AtomClassIndex)class2,(DuMM::AtomClassIndex)class3,
00899                       stiffnessInKcalPerRadSq,nominalAngleInDeg); }
00900 
00913 void defineCustomBondBend(DuMM::AtomClassIndex      class1, 
00914                             DuMM::AtomClassIndex      class2, 
00915                             DuMM::AtomClassIndex      class3,
00916                             DuMM::CustomBondBend*     bondBendTerm);
01002 void defineBondTorsion
01003     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4, 
01004     int periodicity, Real ampInKJ, Real phaseInDegrees);
01007 void defineBondTorsion
01008     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,  
01009     int periodicity1, Real amp1InKJ, Real phase1InDegrees,
01010     int periodicity2, Real amp2InKJ, Real phase2InDegrees);
01013 void defineBondTorsion
01014     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4, 
01015     int periodicity1, Real amp1InKJ, Real phase1InDegrees,
01016     int periodicity2, Real amp2InKJ, Real phase2InDegrees,
01017     int periodicity3, Real amp3InKJ, Real phase3InDegrees);
01018 
01022 void defineBondTorsion_KA
01023     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4, 
01024     int periodicity1, Real amp1InKcal, Real phase1InDegrees)
01025 { 
01026     defineBondTorsion(class1,class2,class3,class4,
01027                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees);
01028 }
01031 void defineBondTorsion_KA
01032     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,  
01033     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01034     int periodicity2, Real amp2InKcal, Real phase2InDegrees)
01035 {
01036     defineBondTorsion(class1,class2,class3,class4,
01037                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees,
01038                         periodicity2, amp2InKcal * DuMM::Kcal2KJ, phase2InDegrees);
01039 }
01042 void defineBondTorsion_KA
01043     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4, 
01044     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01045     int periodicity2, Real amp2InKcal, Real phase2InDegrees,
01046     int periodicity3, Real amp3InKcal, Real phase3InDegrees)
01047 {
01048     defineBondTorsion(class1,class2,class3,class4,
01049                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees,
01050                         periodicity2, amp2InKcal * DuMM::Kcal2KJ, phase2InDegrees,
01051                         periodicity3, amp3InKcal * DuMM::Kcal2KJ, phase3InDegrees);
01052 }
01055 void defineBondTorsion_KA
01056     (int class1, int class2, int class3, int class4, 
01057     int periodicity1, Real amp1InKcal, Real phase1InDegrees)
01058 {
01059     defineBondTorsion_KA
01060             ((DuMM::AtomClassIndex)class1, (DuMM::AtomClassIndex)class2, (DuMM::AtomClassIndex)class3, (DuMM::AtomClassIndex)class4, 
01061             periodicity1, amp1InKcal, phase1InDegrees);
01062 }
01065 void defineBondTorsion_KA
01066     (int class1, int class2, int class3, int class4, 
01067     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01068     int periodicity2, Real amp2InKcal, Real phase2InDegrees)
01069 {
01070     defineBondTorsion_KA
01071             ((DuMM::AtomClassIndex)class1, (DuMM::AtomClassIndex)class2, (DuMM::AtomClassIndex)class3, (DuMM::AtomClassIndex)class4, 
01072             periodicity1, amp1InKcal, phase1InDegrees,
01073             periodicity2, amp2InKcal, phase2InDegrees);
01074 }
01077 void defineBondTorsion_KA
01078     (int class1, int class2, int class3, int class4, 
01079     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01080     int periodicity2, Real amp2InKcal, Real phase2InDegrees,
01081     int periodicity3, Real amp3InKcal, Real phase3InDegrees)
01082 {
01083     defineBondTorsion_KA
01084             ((DuMM::AtomClassIndex)class1, (DuMM::AtomClassIndex)class2, (DuMM::AtomClassIndex)class3, (DuMM::AtomClassIndex)class4, 
01085             periodicity1, amp1InKcal, phase1InDegrees,
01086             periodicity2, amp2InKcal, phase2InDegrees,
01087             periodicity3, amp3InKcal, phase3InDegrees);
01088 }
01089 
01090 
01103 void defineCustomBondTorsion(DuMM::AtomClassIndex       class1, 
01104                                 DuMM::AtomClassIndex       class2, 
01105                                 DuMM::AtomClassIndex       class3,
01106                                 DuMM::AtomClassIndex       class4,
01107                                 DuMM::CustomBondTorsion*   bondTorsionTerm);
01120 void defineAmberImproperTorsion
01121     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01122     int periodicity, Real ampInKJ, Real phaseInDegrees);
01125 void defineAmberImproperTorsion
01126     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01127     int periodicity1, Real amp1InKJ, Real phase1InDegrees,
01128     int periodicity2, Real amp2InKJ, Real phase2InDegrees);
01131 void defineAmberImproperTorsion
01132     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01133     int periodicity1, Real amp1InKJ, Real phase1InDegrees,
01134     int periodicity2, Real amp2InKJ, Real phase2InDegrees,
01135     int periodicity3, Real amp3InKJ, Real phase3InDegrees);
01136 
01139 void defineAmberImproperTorsion_KA
01140     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01141     int periodicity1, Real amp1InKcal, Real phase1InDegrees)
01142 {
01143     defineAmberImproperTorsion(class1,class2,class3,class4,
01144                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees);
01145 }
01148 void defineAmberImproperTorsion_KA
01149     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01150     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01151     int periodicity2, Real amp2InKcal, Real phase2InDegrees)
01152 {
01153     defineAmberImproperTorsion(class1,class2,class3,class4,
01154                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees,
01155                         periodicity2, amp2InKcal * DuMM::Kcal2KJ, phase2InDegrees);
01156 }
01159 void defineAmberImproperTorsion_KA
01160     (DuMM::AtomClassIndex class1, DuMM::AtomClassIndex class2, DuMM::AtomClassIndex class3, DuMM::AtomClassIndex class4,
01161     int periodicity1, Real amp1InKcal, Real phase1InDegrees,
01162     int periodicity2, Real amp2InKcal, Real phase2InDegrees,
01163     int periodicity3, Real amp3InKcal, Real phase3InDegrees)
01164 {
01165     defineAmberImproperTorsion(class1,class2,class3,class4,
01166                         periodicity1, amp1InKcal * DuMM::Kcal2KJ, phase1InDegrees,
01167                         periodicity2, amp2InKcal * DuMM::Kcal2KJ, phase2InDegrees,
01168                         periodicity3, amp3InKcal * DuMM::Kcal2KJ, phase3InDegrees);
01169 }
01176 void setSolventDielectric(Real);    // typically 80 for water
01177 void setSoluteDielectric(Real);     // typically 1 or 2 for protein
01178 Real getSolventDielectric() const;
01179 Real getSoluteDielectric() const;
01180 
01181 void setGbsaIncludeAceApproximation(bool);
01182 void setGbsaIncludeAceApproximationOn()  {setGbsaIncludeAceApproximation(true );}
01183 void setGbsaIncludeAceApproximationOff() {setGbsaIncludeAceApproximation(false);}
01193 void setVdwGlobalScaleFactor(Real);                 
01194 void setCoulombGlobalScaleFactor(Real);             
01195 void setGbsaGlobalScaleFactor(Real);                
01196 void setBondStretchGlobalScaleFactor(Real);         
01197 void setBondBendGlobalScaleFactor(Real);            
01198 void setBondTorsionGlobalScaleFactor(Real);         
01199 void setAmberImproperTorsionGlobalScaleFactor(Real);
01200 void setCustomBondStretchGlobalScaleFactor(Real);   
01201 void setCustomBondBendGlobalScaleFactor(Real);      
01202 void setCustomBondTorsionGlobalScaleFactor(Real);   
01203 
01204 Real getVdwGlobalScaleFactor() const;                   
01205 Real getCoulombGlobalScaleFactor() const;               
01206 Real getGbsaGlobalScaleFactor() const;                  
01207 Real getBondStretchGlobalScaleFactor() const;           
01208 Real getBondBendGlobalScaleFactor() const;              
01209 Real getBondTorsionGlobalScaleFactor() const;           
01210 Real getAmberImproperTorsionGlobalScaleFactor() const;  
01211 Real getCustomBondStretchGlobalScaleFactor() const;     
01212 Real getCustomBondBendGlobalScaleFactor() const;        
01213 Real getCustomBondTorsionGlobalScaleFactor() const;     
01214 
01218 void setAllGlobalScaleFactors(Real s) {
01219     setVdwGlobalScaleFactor(s);
01220     setCoulombGlobalScaleFactor(s);
01221     setGbsaGlobalScaleFactor(s);
01222     setBondStretchGlobalScaleFactor(s);
01223     setBondBendGlobalScaleFactor(s);
01224     setBondTorsionGlobalScaleFactor(s);
01225     setAmberImproperTorsionGlobalScaleFactor(s);
01226     setCustomBondStretchGlobalScaleFactor(s);
01227     setCustomBondBendGlobalScaleFactor(s);
01228     setCustomBondTorsionGlobalScaleFactor(s);
01229 }
01241 void setTracing(bool);
01242 
01244 void setUseMultithreadedComputation(bool);
01246 bool getUseMultithreadedComputation() const;
01247 
01253 void setNumThreadsRequested(int);
01257 int getNumThreadsRequested() const;
01258 
01261 bool isUsingMultithreadedComputation() const;
01262 
01265 int getNumThreadsInUse() const;
01266 
01273 void setUseOpenMMAcceleration(bool);
01275 bool getUseOpenMMAcceleration() const;
01276 
01277 
01282 void setAllowOpenMMReference(bool);
01284 bool getAllowOpenMMReference() const;
01285 
01287 bool isUsingOpenMM() const;
01290 std::string getOpenMMPlatformInUse() const;
01298 long long getForceEvaluationCount() const;
01299 
01302 void dump() const;
01303 
01306 void dumpCForceFieldParameters
01307    (std::ostream& os, const String& methodName = "loadParameters") const;
01308 
01310 void loadTestMoleculeParameters();
01311 
01314 
01315 void setTraceOpenMM(bool shouldTrace) {setTracing(shouldTrace);}
01316 protected: // don't let doxygen see these
01318 SimTK_PIMPL_DOWNCAST(DuMMForceFieldSubsystem, ForceSubsystem);
01319 SimTK_PIMPL_DOWNCAST(DuMMForceFieldSubsystem, Subsystem);
01322 void defineIncompleteAtomClass(
01323     DuMM::AtomClassIndex classIx, 
01324     const char* name, 
01325     int elementNumber, 
01326     int valence);
01327 
01328 void defineIncompleteAtomClass_KA(
01329     DuMM::AtomClassIndex classIx, 
01330     const char* name, 
01331     int elementNumber, 
01332     int valence) 
01333 {
01334     defineIncompleteAtomClass(
01335         classIx, 
01336         name, 
01337         elementNumber, 
01338         valence
01339         );
01340 }
01341 
01342 void setAtomClassVdwParameters(DuMM::AtomClassIndex atomClassIx, Real vdwRadiusInNm, Real vdwWellDepthInKJPerMol);
01343 void setAtomClassVdwParameters_KA(DuMM::AtomClassIndex atomClassIx, Real radiusInAng, Real wellDepthInKcal) {
01344     setAtomClassVdwParameters(atomClassIx, radiusInAng*DuMM::Ang2Nm, wellDepthInKcal*DuMM::Kcal2KJ);
01345 }
01346 
01347 bool isValidAtomClass(DuMM::AtomClassIndex) const;
01348     
01349 void defineIncompleteChargedAtomType(
01350     DuMM::ChargedAtomTypeIndex typeIx, 
01351     const char* name,
01352     DuMM::AtomClassIndex classIx);
01353 
01354 void defineIncompleteChargedAtomType_KA(
01355     DuMM::ChargedAtomTypeIndex typeIx, 
01356     const char* name,
01357     DuMM::AtomClassIndex classIx) 
01358 {
01359     defineIncompleteChargedAtomType(typeIx, name, classIx);
01360 }
01361 
01362 void setChargedAtomTypeCharge(DuMM::ChargedAtomTypeIndex, Real charge);
01363 void setChargedAtomTypeCharge_KA(DuMM::ChargedAtomTypeIndex chargedAtomTypeIx, Real charge) {
01364     setChargedAtomTypeCharge(chargedAtomTypeIx, charge);
01365 }
01366 
01367 private:
01368 class DuMMForceFieldSubsystemRep& updRep();
01369 const DuMMForceFieldSubsystemRep& getRep() const;
01370 
01371 friend class MolecularMechanicsSystem;
01372 };
01373 
01376 class Amber99ForceSubsystem : public DuMMForceFieldSubsystem {
01377 public:
01378     explicit Amber99ForceSubsystem(MolecularMechanicsSystem& system) 
01379         : DuMMForceFieldSubsystem(system)
01380     {
01381         loadAmber99Parameters();
01382     }
01383 };
01384 
01385 
01386 } // namespace SimTK
01387 
01388  // End of MolecularMechanics module
01390 
01391 #endif // SimTK_MOLMODEL_DUMM_FORCE_FIELD_SUBSYSTEM_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines