00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: MMFF94.h,v 1.1.8.3 2007/06/15 09:24:20 amoll Exp $ 00005 // 00006 00007 // Molecular Mechanics: MMFF94 force field class 00008 00009 #ifndef BALL_MOLMEC_MMFF94_MMFF94_H 00010 #define BALL_MOLMEC_MMFF94_MMFF94_H 00011 00012 #ifndef BALL_COMMON_H 00013 # include <BALL/common.h> 00014 #endif 00015 00016 #ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H 00017 # include <BALL/MOLMEC/COMMON/forceField.h> 00018 #endif 00019 00020 #ifndef BALL_KERNEL_SYSTEM_H 00021 # include <BALL/KERNEL/system.h> 00022 #endif 00023 00024 #ifndef BALL_MOLMEC_MMFF94_MMFF94PARAMETERS_H 00025 # include <BALL/MOLMEC/MMFF94/MMFF94Parameters.h> 00026 #endif 00027 00028 #ifndef BALL_MOLMEC_MMFF94_MMFF94PROCESSORS_H 00029 # include <BALL/MOLMEC/MMFF94/MMFF94Processors.h> 00030 #endif 00031 00032 #ifndef BALL_DATATYPE_HASHSET_H 00033 # include <BALL/DATATYPE/hashSet.h> 00034 #endif 00035 00036 #ifndef BALL_STRUCTURE_KEKULIZER_H 00037 # include <BALL/STRUCTURE/kekulizer.h> 00038 #endif 00039 00040 #include <vector> 00041 00042 namespace BALL 00043 { 00044 using std::vector; 00045 00049 class BALL_EXPORT MMFF94 00050 : public ForceField 00051 { 00052 public: 00053 00057 00060 struct BALL_EXPORT Option 00061 { 00064 static const char* FOLDER; 00065 00068 static const char* ASSIGN_CHARGES; 00069 00072 static const char* ASSIGN_TYPENAMES; 00073 00076 static const char* ASSIGN_TYPES; 00077 00080 static const char* OVERWRITE_CHARGES; 00081 00084 static const char* OVERWRITE_TYPENAMES; 00085 00090 static const char* NONBONDED_CUTOFF; 00091 00095 static const char* VDW_CUTOFF; 00096 00100 static const char* VDW_CUTON; 00101 00104 static const char* ELECTROSTATIC_CUTOFF; 00105 00108 static const char* ELECTROSTATIC_CUTON; 00109 00111 static const char* DISTANCE_DEPENDENT_DIELECTRIC; 00112 }; 00113 00116 struct BALL_EXPORT Default 00117 { 00120 static const char* FOLDER; 00121 00124 static const bool ASSIGN_CHARGES; 00125 00128 static const bool ASSIGN_TYPENAMES; 00129 00132 static const bool ASSIGN_TYPES; 00133 00136 static const bool OVERWRITE_CHARGES; 00137 00140 static const bool OVERWRITE_TYPENAMES; 00141 00144 static const float NONBONDED_CUTOFF; 00145 00148 static const float VDW_CUTOFF; 00149 00152 static const float VDW_CUTON; 00153 00156 static const float ELECTROSTATIC_CUTOFF; 00157 00160 static const float ELECTROSTATIC_CUTON; 00161 00163 static const bool DISTANCE_DEPENDENT_DIELECTRIC; 00164 }; 00165 00167 00170 00171 BALL_CREATE(MMFF94) 00172 00173 00175 MMFF94(); 00176 00179 MMFF94(System& system); 00180 00183 MMFF94(System& system, const Options& options); 00184 00187 MMFF94(const MMFF94& force_field); 00188 00191 virtual ~MMFF94(); 00192 00194 00197 00200 const MMFF94& operator = (const MMFF94& force_field) 00201 ; 00202 00205 virtual void clear() 00206 ; 00207 00209 00212 00215 virtual bool specificSetup() 00216 throw(Exception::TooManyErrors); 00217 00219 00222 00225 double getStretchEnergy() const; 00226 00229 double getBendEnergy() const; 00230 00232 double getStretchBendEnergy() const; 00233 00237 double getTorsionEnergy() const; 00238 00242 double getNonbondedEnergy() const; 00243 00246 double getESEnergy() const; 00247 00250 double getVdWEnergy() const; 00251 00253 double getPlaneEnergy() const; 00254 00257 bool hasInitializedParameters() const; 00258 00262 Size getUpdateFrequency() const; 00263 00265 virtual String getResults() const 00266 ; 00267 00269 const vector<Bond*> getBonds() const { return bonds_;} 00270 00272 const vector<HashSet<Atom*> >& getRings() const { return rings_;} 00273 00275 const vector<HashSet<Atom*> >& getAromaticRings() const { return aromatic_rings_;} 00276 00278 bool isInOneAromaticRing(const Bond& bond) const; 00279 00281 bool assignMMFF94BondType(Bond& bond) const; 00282 00284 const vector<MMFF94AtomType>& getAtomTypes() const { return atom_types_.getAtomTypes();} 00285 00287 const MMFF94StretchParameters& getStretchParameters() const { return bond_parameters_;} 00288 00290 const MMFF94AtomTypeEquivalences & getEquivalences() const { return equivalences_;} 00291 00293 bool areInOneRing(vector<Atom*> v, Size ring_size = 0) const; 00294 00296 bool areInOneAromaticRing(const vector<Atom*>& v, Size ring_size = 0) const; 00297 00301 bool checkAtomType(Atom& atom); 00302 00304 00305 protected: 00306 00307 void insertComponents_(); 00308 00309 void transformAromaticBonds_(); 00310 void collectBonds_(); 00311 void assignBondTypes_(); 00312 void collectRings_(); 00313 00314 String folder_; 00315 MMFF94AtomTypes atom_types_; 00316 MMFF94StretchParameters bond_parameters_; 00317 MMFF94AtomTypeEquivalences equivalences_; 00318 MMFF94ESParameters es_parameters_; 00319 vector<HashSet<Atom*> > rings_; 00320 vector<HashSet<Atom*> > aromatic_rings_; 00321 bool parameters_initialized_; 00322 vector<Bond*> bonds_; 00323 MMFF94AtomTyper atom_typer_; 00324 MMFF94ChargeProcessor charge_processor_; 00325 Kekuliser kekuliser_; 00326 HashSet<Bond*> aromatic_bonds_; 00327 }; 00328 00329 } // namespace BALL 00330 00331 #endif // BALL_MOLMEC_MMFF94_H