37 |
|
#define MK_STR(s) # s |
38 |
|
#define STR_DEFINE(t, s) t = MK_STR(s) |
39 |
|
|
40 |
< |
#include <utilities> |
40 |
> |
#include <string> |
41 |
> |
#include <utility> |
42 |
|
|
42 |
– |
#include "utils/Tuple.hpp" |
43 |
– |
#include "types/ShapeAtomType.hpp" |
43 |
|
#include "io/basic_ifstrstream.hpp" |
44 |
|
#include "utils/TypeContainer.hpp" |
45 |
+ |
#include "types/AtomType.hpp" |
46 |
+ |
#include "types/BondType.hpp" |
47 |
+ |
#include "types/BendType.hpp" |
48 |
+ |
#include "types/TorsionType.hpp" |
49 |
|
|
50 |
|
namespace oopse { |
51 |
|
|
52 |
|
/** |
53 |
< |
* @class ForceFiled ForceField.hpp ''UseTheForce/ForceField.hpp" |
53 |
> |
* @class ForceField ForceField.hpp ''UseTheForce/ForceField.hpp" |
54 |
|
* @brief |
55 |
|
*/ |
56 |
|
class ForceField{ |
57 |
|
|
58 |
|
public: |
59 |
|
|
60 |
+ |
typedef TypeContainer<AtomType, 1> AtomTypeContainer; |
61 |
+ |
typedef TypeContainer<BondType, 2> BondTypeContainer; |
62 |
+ |
typedef TypeContainer<BendType, 3> BendTypeContainer; |
63 |
+ |
typedef TypeContainer<TorsionType, 4> TorsionTypeContainer; |
64 |
+ |
|
65 |
|
ForceField(); |
66 |
|
|
67 |
< |
virtual ~ForceFields(){} |
67 |
> |
virtual ~ForceField(){} |
68 |
|
|
69 |
< |
void setVariant(const std::string &variant) { |
70 |
< |
hasVariant_ = true; |
63 |
< |
variant_ = variant; |
69 |
> |
std::string getForceFieldFileName() { |
70 |
> |
return forceFieldFileName_; |
71 |
|
} |
65 |
– |
virtual void readParams() = 0; |
72 |
|
|
73 |
+ |
void setForceFieldFileName(const std::string& filename) { |
74 |
+ |
forceFieldFileName_ = filename; |
75 |
+ |
} |
76 |
+ |
|
77 |
+ |
virtual void parse(const std::string& filename) = 0; |
78 |
+ |
|
79 |
|
AtomType* getAtomType(const std::string &at); |
80 |
|
BondType* getBondType(const std::string &at1, const std::string &at2); |
81 |
|
BendType* getBendType(const std::string &at1, const std::string &at2, |
83 |
|
TorsionType* getTorsionType(const std::string &at1, const std::string &at2, |
84 |
|
const std::string &at3, const std::string &at4); |
85 |
|
|
86 |
< |
double getRcutForAtomType(AtomType* at); |
86 |
> |
BondType* getExactBondType(const std::string &at1, const std::string &at2); |
87 |
> |
BendType* getExactBendType(const std::string &at1, const std::string &at2, |
88 |
> |
const std::string &at3); |
89 |
> |
TorsionType* getExactTorsionType(const std::string &at1, const std::string &at2, |
90 |
> |
const std::string &at3, const std::string &at4); |
91 |
|
|
92 |
+ |
|
93 |
+ |
//avoid make virtual function public |
94 |
+ |
//Herb Sutter and Andrei Alexandrescu, C++ coding Standards, Addision-Wesley |
95 |
+ |
virtual double getRcutFromAtomType(AtomType* at); |
96 |
+ |
|
97 |
|
std::string getWildCard() { |
98 |
|
return wildCardAtomTypeName_; |
99 |
|
} |
102 |
|
wildCardAtomTypeName_ = wildCard; |
103 |
|
} |
104 |
|
|
105 |
< |
protected: |
105 |
> |
|
106 |
> |
unsigned int getNAtomType() { |
107 |
> |
return atomTypeCont_.size(); |
108 |
> |
} |
109 |
|
|
110 |
< |
void addAtomType(const std::string &at, AtomType* atomType); |
111 |
< |
void addBondType(const std::string &at1, const std::string &at2, BondType* bondType); |
112 |
< |
void addBendType(const std::string &at1, const std::string &at2, |
110 |
> |
bool addAtomType(const std::string &at, AtomType* atomType); |
111 |
> |
|
112 |
> |
bool addBondType(const std::string &at1, const std::string &at2, BondType* bondType); |
113 |
> |
|
114 |
> |
bool addBendType(const std::string &at1, const std::string &at2, |
115 |
|
const std::string &at3, BendType* bendType); |
116 |
< |
void addTorsionType(const std::string &at1, const std::string &at2, |
116 |
> |
|
117 |
> |
bool addTorsionType(const std::string &at1, const std::string &at2, |
118 |
|
const std::string &at3, const std::string &at4, TorsionType* torsionType); |
119 |
|
|
120 |
< |
private: |
94 |
< |
std::string ffPath_; |
95 |
< |
ifstrstream forceFile_; |
96 |
< |
bool hasVariant_; |
97 |
< |
std::string variant_; |
120 |
> |
ifstrstream* openForceFieldFile(const std::string& filename); |
121 |
|
|
122 |
< |
std::string wildCardAtomTypeName_; |
122 |
> |
protected: |
123 |
|
|
101 |
– |
typedef TypeContainer<AtomType, 1> AtomTypeContainer; |
102 |
– |
typedef TypeContainer<BondType, 2> BondTypeContainer; |
103 |
– |
typedef TypeContainer<BendType, 3> BendTypeContainer; |
104 |
– |
typedef TypeContainer<TorsionType, 4> TorsionTypeContainer; |
105 |
– |
|
124 |
|
AtomTypeContainer atomTypeCont_; |
125 |
|
BondTypeContainer bondTypeCont_; |
126 |
|
BendTypeContainer bendTypeCont_; |
127 |
|
TorsionTypeContainer torsionTypeCont_; |
128 |
+ |
|
129 |
+ |
private: |
130 |
+ |
std::string ffPath_; |
131 |
+ |
|
132 |
+ |
std::string wildCardAtomTypeName_; |
133 |
+ |
|
134 |
+ |
std::string forceFieldFileName_; |
135 |
|
}; |
136 |
|
|
112 |
– |
typedef GenericFactory<ForceField> ForceFieldFactory; |
137 |
|
|
138 |
|
}//end namespace oopse |
139 |
|
#endif |