1
/**********************************************************************
2
forcefieldghemical.h - Ghemical force field.
4
Copyright (C) 2006 by Tim Vandermeersch <tim.vandermeersch@gmail.com>
6
This file is part of the Open Babel project.
7
For more information, see <http://openbabel.sourceforge.net/>
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.
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
***********************************************************************/
23
#include <openbabel/forcefield.h>
24
#include <openbabel/base.h>
25
#include <openbabel/mol.h>
29
class OBFFBondCalculationGhemical : public OBFFCalculation
32
double kb, r0, rab, delta;
35
void Compute(bool gradients = true);
38
class OBFFAngleCalculationGhemical : public OBFFCalculation
41
double ka, theta0, theta, delta;
43
void Compute(bool gradients = true);
46
class OBFFTorsionCalculationGhemical : public OBFFCalculation
53
void Compute(bool gradients = true);
56
class OBFFVDWCalculationGhemical : public OBFFCalculation
59
double ka, Ra, kb, Rb, kab, rab;
62
void Compute(bool gradients = true);
65
class OBFFElectrostaticCalculationGhemical : public OBFFCalculation
70
void Compute(bool gradients = true);
73
// Class OBForceFieldGhemical
74
// class introduction in forcefieldghemical.cpp
75
class OBAPI OBForceFieldGhemical: public OBForceField
78
//! Parses the parameter file
79
bool ParseParamFile();
80
//! Sets atomtypes to Ghemical types in _mol
81
bool SetGhemicalTypes();
82
//! Sets partial charges to Ghemical charges in _mol
83
bool SetGhemicalCharges();
84
//! fill OBFFXXXCalculation vectors
85
bool SetupCalculations();
86
//! Same as OBForceField::GetParameter, but takes (bond/angle/torsion) type in account.
87
OBFFParameter* GetParameterGhemical(int type, const char* a, const char* b, const char* c, const char* d, std::vector<OBFFParameter> ¶meter);
88
//! Returns the negative gradient (force) on atom a
89
vector3 GetGradient(OBAtom *a, int terms = OBFF_ENERGY);
91
// OBFFParameter vectors to contain the parameters
92
std::vector<OBFFParameter> _ffbondparams;
93
std::vector<OBFFParameter> _ffangleparams;
94
std::vector<OBFFParameter> _fftorsionparams;
95
std::vector<OBFFParameter> _ffvdwparams;
96
std::vector<OBFFParameter> _ffchargeparams;
98
// OBFFXXXCalculationYYY vectors to contain the calculations
99
std::vector<OBFFBondCalculationGhemical> _bondcalculations;
100
std::vector<OBFFAngleCalculationGhemical> _anglecalculations;
101
std::vector<OBFFTorsionCalculationGhemical> _torsioncalculations;
102
std::vector<OBFFVDWCalculationGhemical> _vdwcalculations;
103
std::vector<OBFFElectrostaticCalculationGhemical> _electrostaticcalculations;
107
OBForceFieldGhemical(std::string ID, bool IsDefault=true) : OBForceField(ID, IsDefault)
113
virtual ~OBForceFieldGhemical();
116
OBForceFieldGhemical &operator = (OBForceFieldGhemical &);
118
//! Get the description for this force field
119
std::string Description()
121
return "Ghemical force field.";
124
//! Get the unit in wich the energy is expressed
125
std::string GetUnit()
127
return std::string("kJ/mol");
131
bool Setup(OBMol &mol);
133
//! Returns total energy
134
double Energy(bool gradients = true);
135
//! Returns the bond stretching energy
136
double E_Bond(bool gradients = true);
137
//! Returns the angle bending energy
138
double E_Angle(bool gradients = true);
139
//! Returns the torsional energy
140
double E_Torsion(bool gradients = true);
141
//! Returns energy due to Van der Waals interactions
142
double E_VDW(bool gradients = true);
143
//! Returns energy due to electrostatic interactions
144
double E_Electrostatic(bool gradients = true);
146
//! Compare and print the numerical and analytical gradients
147
bool ValidateGradients();
149
}; // class OBForceFieldGhemical
151
}// namespace OpenBabel
153
//! \file forcefieldghemical.h
154
//! \brief Ghemical force field