- Main Page
- Related Pages
- Classes
- Files

- File List

# AmoebaMultipoleForce.h

    00001 #ifndef OPENMM_AMOEBA_MULTIPOLE_FORCE_H_
    00002 #define OPENMM_AMOEBA_MULTIPOLE_FORCE_H_
    00003
    00004 /* -------------------------------------------------------------------------- *
    00005  *                              OpenMMAmoeba                                  *
    00006  * -------------------------------------------------------------------------- *
    00007  * This is part of the OpenMM molecular simulation 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.               *
    00011  *                                                                            *
    00012  * Portions copyright (c) 2008-2012 Stanford University and the Authors.      *
    00013  * Authors: Mark Friedrichs, Peter Eastman                                    *
    00014  * Contributors:                                                              *
    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
    00035 #include "openmm/Force.h"
    00036 #include "openmm/OpenMMException.h"
    00037 #include "internal/windowsExportAmoeba.h"
    00038 #include "openmm/Vec3.h"
    00039
    00040 #include <sstream>
    00041 #include <vector>
    00042
    00043 namespace OpenMM {
    00044
    00053 class OPENMM_EXPORT_AMOEBA AmoebaMultipoleForce : public Force {
    00054
    00055 public:
    00056
    00057     enum NonbondedMethod {
    00058
    00063         NoCutoff = 0,
    00064
    00069         PME = 1
    00070     };
    00071
    00072     enum PolarizationType {
    00073
    00077         Mutual = 0,
    00078
    00082         Direct = 1
    00083     };
    00084
    00085     enum MultipoleAxisTypes { ZThenX = 0, Bisector = 1, ZBisect = 2, ThreeFold = 3, ZOnly = 4, NoAxisType = 5, LastAxisTypeIndex = 6 };
    00086
    00087     enum CovalentType {
    00088                           Covalent12 = 0, Covalent13 = 1, Covalent14 = 2, Covalent15 = 3,
    00089                           PolarizationCovalent11 = 4, PolarizationCovalent12 = 5, PolarizationCovalent13 = 6, PolarizationCovalent14 = 7, CovalentEnd = 8 };
    00090
    00094     AmoebaMultipoleForce();
    00095
    00099     int getNumMultipoles() const {
    00100         return multipoles.size();
    00101     }
    00102
    00106     NonbondedMethod getNonbondedMethod() const;
    00107
    00111     void setNonbondedMethod(NonbondedMethod method);
    00112
    00116     PolarizationType getPolarizationType() const;
    00117
    00121     void setPolarizationType(PolarizationType type);
    00122
    00129     double getCutoffDistance() const;
    00130
    00137     void setCutoffDistance(double distance);
    00138
    00145     double getAEwald() const;
    00146
    00153     void setAEwald(double aewald);
    00154
    00160     int getPmeBSplineOrder() const;
    00161
    00168     void getPmeGridDimensions(std::vector<int>& gridDimension) const;
    00169
    00176     void setPmeGridDimensions(const std::vector<int>& gridDimension);
    00177
    00194     int addMultipole(double charge, const std::vector<double>& molecularDipole, const std::vector<double>& molecularQuadrupole, int axisType,
    00195                      int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity);
    00196
    00212     void getMultipoleParameters(int index, double& charge, std::vector<double>& molecularDipole, std::vector<double>& molecularQuadrupole,
    00213                                 int& axisType, int& multipoleAtomZ, int& multipoleAtomX, int& multipoleAtomY, double& thole, double& dampingFactor, double& polarity) const;
    00214
    00228     void setMultipoleParameters(int index, double charge, const std::vector<double>& molecularDipole, const std::vector<double>& molecularQuadrupole,
    00229                                 int axisType, int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity);
    00230
    00238     void setCovalentMap(int index, CovalentType typeId, const std::vector<int>& covalentAtoms);
    00239
    00247     void getCovalentMap(int index, CovalentType typeId, std::vector<int>& covalentAtoms) const;
    00248
    00255     void getCovalentMaps(int index, std::vector < std::vector<int> >& covalentLists) const;
    00256
    00262     int getMutualInducedMaxIterations(void) const;
    00263
    00269     void setMutualInducedMaxIterations(int inputMutualInducedMaxIterations);
    00270
    00276     double getMutualInducedTargetEpsilon(void) const;
    00277
    00283     void setMutualInducedTargetEpsilon(double inputMutualInducedTargetEpsilon);
    00284
    00293     double getEwaldErrorTolerance() const;
    00302     void setEwaldErrorTolerance(double tol);
    00303
    00310     void getInducedDipoles(Context& context, std::vector<Vec3>& dipoles);
    00311
    00320     void getElectrostaticPotential(const std::vector< Vec3 >& inputGrid,
    00321                                     Context& context, std::vector< double >& outputElectrostaticPotential);
    00322
    00339     void getSystemMultipoleMoments(Context& context, std::vector< double >& outputMultipoleMoments);
    00351     void updateParametersInContext(Context& context);
    00352
    00353 protected:
    00354     ForceImpl* createImpl() const;
    00355 private:
    00356     NonbondedMethod nonbondedMethod;
    00357     PolarizationType polarizationType;
    00358     double cutoffDistance;
    00359     double aewald;
    00360     int pmeBSplineOrder;
    00361     std::vector<int> pmeGridDimension;
    00362     int mutualInducedMaxIterations;
    00363     double mutualInducedTargetEpsilon;
    00364     double scalingDistanceCutoff;
    00365     double electricConstant;
    00366     double ewaldErrorTol;
    00367     class MultipoleInfo;
    00368     std::vector<MultipoleInfo> multipoles;
    00369 };
    00370
    00375 class AmoebaMultipoleForce::MultipoleInfo {
    00376 public:
    00377
    00378     int axisType, multipoleAtomZ, multipoleAtomX, multipoleAtomY;
    00379     double charge, thole, dampingFactor, polarity;
    00380
    00381     std::vector<double> molecularDipole;
    00382     std::vector<double> molecularQuadrupole;
    00383     std::vector< std::vector<int> > covalentInfo;
    00384
    00385     MultipoleInfo() {
    00386         axisType = multipoleAtomZ = multipoleAtomX = multipoleAtomY = -1;
    00387         charge   = thole          = dampingFactor  = 0.0;
    00388
    00389         molecularDipole.resize(3);
    00390         molecularQuadrupole.resize(9);
    00391
    00392     }
    00393
    00394     MultipoleInfo(double charge, const std::vector<double>& inputMolecularDipole, const std::vector<double>& inputMolecularQuadrupole,
    00395                    int axisType, int multipoleAtomZ, int multipoleAtomX, int multipoleAtomY, double thole, double dampingFactor, double polarity) :
    00396         charge(charge), axisType(axisType), multipoleAtomZ(multipoleAtomZ), multipoleAtomX(multipoleAtomX), multipoleAtomY(multipoleAtomY),
    00397         thole(thole), dampingFactor(dampingFactor), polarity(polarity) {
    00398
    00399        covalentInfo.resize(CovalentEnd);
    00400
    00401        molecularDipole.resize(3);
    00402        molecularDipole[0]          = inputMolecularDipole[0];
    00403        molecularDipole[1]          = inputMolecularDipole[1];
    00404        molecularDipole[2]          = inputMolecularDipole[2];
    00405
    00406        molecularQuadrupole.resize(9);
    00407        molecularQuadrupole[0]      = inputMolecularQuadrupole[0];
    00408        molecularQuadrupole[1]      = inputMolecularQuadrupole[1];
    00409        molecularQuadrupole[2]      = inputMolecularQuadrupole[2];
    00410        molecularQuadrupole[3]      = inputMolecularQuadrupole[3];
    00411        molecularQuadrupole[4]      = inputMolecularQuadrupole[4];
    00412        molecularQuadrupole[5]      = inputMolecularQuadrupole[5];
    00413        molecularQuadrupole[6]      = inputMolecularQuadrupole[6];
    00414        molecularQuadrupole[7]      = inputMolecularQuadrupole[7];
    00415        molecularQuadrupole[8]      = inputMolecularQuadrupole[8];
    00416     }
    00417 };
    00418
    00419 } // namespace OpenMM
    00420
    00421 #endif /*OPENMM_AMOEBA_MULTIPOLE_FORCE_H_*/