1 /********************************************************************** 2 forcefieldmm2.h - MM2 force field. 3 4 Copyright (C) 2006 by Tim Vandermeersch <tim.vandermeersch@gmail.com> 5 6 This file is part of the Open Babel project. 7 For more information, see <http://openbabel.org/> 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation version 2 of the License. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 ***********************************************************************/ 18 19 #include <vector> 20 #include <string> 21 #include <map> 22 23 #include <openbabel/forcefield.h> 24 #include <openbabel/base.h> 25 #include <openbabel/mol.h> 26 27 namespace OpenBabel 28 { 29 // Class OBForceFieldMM2 30 // class introduction in forcefield.cpp 31 class OBForceFieldMM2: public OBForceField 32 { 33 protected: 34 35 bool _init; //!< Used to only initialize and read parameters once 36 37 //! \return Parses the parameter file 38 bool ParseParamFile(); 39 //! \return Sets atomtypes to MM2 in _mol 40 bool SetMM2Types(); 41 42 double bondunit, bond_cubic, bond_quartic; 43 double angleunit, angle_sextic; 44 double stretchbendunit; 45 double torsionunit; 46 double outplanebendunit; 47 double a_expterm, b_expterm, c_expterm; 48 double dielectric; 49 std::vector<OBFFParameter> _ffbondparams; // a = atom 1 of bond 50 // b = atom 2 of bond 51 // dpar1 = length 52 // dpar2 = force 53 std::vector<OBFFParameter> _ffangleparams; // a = atom 1 of angle abc 54 // b = atom 2 of angle abc 55 // c = atom 3 of angle abc 56 // dpar1 = angle 57 // dpar2 = force 58 std::vector<OBFFParameter> _ffstretchbendparams; // a = atom 59 // dpar1 = force 60 std::vector<OBFFParameter> _fftorsionparams; // a = atom 1 of torsion 61 // b = atom 2 of torsion 62 // c = atom 3 of torsion 63 // d = atom 4 of torsion 64 // dpar1 = v1 65 // dpar2 = v2 66 // dpar3 = v3 67 std::vector<OBFFParameter> _ffoutplanebendparams; // a = atom b a 68 // b = atom d \ 69 // dpar1 = force b---d 70 // / 71 // c 72 std::vector<OBFFParameter> _ffvdwprparams; // a = atom 1 of pair 73 // b = atom 2 of pair 74 // dpar1 = sum of vdw radii 75 // dpar2 = energy parameter 76 std::vector<OBFFParameter> _ffvdwparams; // a = atom 1 77 // dpar1 = vdw radii 78 // dpar2 = energy parameter 79 // dpar3 = reduction 80 std::vector<OBFFParameter> _ffdipoleparams; // a = atom 1 81 // b = atom 2 82 // dpar1 = dipole 83 // dpar2 = position 84 85 std::vector<vector3> forces; // used to hold forces on each atom 86 87 public: 88 //! Setup 89 bool Setup(OBMol &mol); 90 //! Constructor OBForceField(ID,IsDefault)91 explicit OBForceFieldMM2(const char* ID, bool IsDefault=true) : OBForceField(ID, IsDefault), _init(false) 92 { 93 // ParseParamFile only called when needed 94 } 95 96 //!Clone the current instance. May be desirable in multithreaded environments MakeNewInstance()97 virtual OBForceFieldMM2* MakeNewInstance(){ return new OBForceFieldMM2(*this); } 98 99 Description()100 virtual const char* Description() 101 { return "MM2 force field.";}; 102 103 104 //! Destructor 105 virtual ~OBForceFieldMM2(); 106 //! Assignment 107 OBForceFieldMM2 &operator = (OBForceFieldMM2 &); 108 //! Returns total energy 109 double Energy(); 110 //! Returns the bond stretching energy 111 double E_Bond(); 112 //! Returns the angle bending energy 113 double E_Angle(); 114 //! Returns the stretch-bend energy 115 double E_StrBnd(); 116 //! Returns the torsional energy 117 double E_Torsion(); 118 //! Returns the out-of-plane bending energy 119 double E_OOP(); 120 //! Returns the Van der Waals energy (Buckingham potential) 121 double E_VDW(); 122 //! Returns the dipole-dipole interaction energy 123 double E_Electrostatic(); 124 125 126 }; // class OBForceFieldMM2 127 128 }// namespace OpenBabel 129 130 //! \file forcefieldmm2.h 131 //! \brief MM2 force field 132