80 |
|
|
81 |
|
} |
82 |
|
|
83 |
< |
void ForceField::addAtomType(const std::string &at, AtomType* atomType) { |
83 |
> |
BondType* getExactBondType(const std::string &at1, const std::string &at2){ |
84 |
|
std::vector<std::string> keys; |
85 |
+ |
keys.push_back(at1); |
86 |
+ |
keys.push_back(at2); |
87 |
+ |
return bondTypeCont_.find(keys); |
88 |
+ |
} |
89 |
+ |
|
90 |
+ |
BendType* getExactBendType(const std::string &at1, const std::string &at2, |
91 |
+ |
const std::string &at3){ |
92 |
+ |
std::vector<std::string> keys; |
93 |
+ |
keys.push_back(at1); |
94 |
+ |
keys.push_back(at2); |
95 |
+ |
keys.push_back(at3); |
96 |
+ |
return bendTypeCont_.find(keys); |
97 |
+ |
} |
98 |
+ |
|
99 |
+ |
TorsionType* getExactTorsionType(const std::string &at1, const std::string &at2, |
100 |
+ |
const std::string &at3, const std::string &at4){ |
101 |
+ |
std::vector<std::string> keys; |
102 |
+ |
keys.push_back(at1); |
103 |
+ |
keys.push_back(at2); |
104 |
+ |
keys.push_back(at3); |
105 |
+ |
keys.push_back(at4); |
106 |
+ |
return torsionTypeCont_.find(keys); |
107 |
+ |
} |
108 |
+ |
bool ForceField::addAtomType(const std::string &at, AtomType* atomType) { |
109 |
+ |
std::vector<std::string> keys; |
110 |
|
keys.push_back(at); |
111 |
|
return atomTypeCont_.add(keys); |
112 |
|
} |
113 |
|
|
114 |
< |
void ForceField::addBondType(const std::string &at1, const std::string &at2, BondType* bondType) { |
114 |
> |
bool ForceField::addBondType(const std::string &at1, const std::string &at2, BondType* bondType) { |
115 |
|
std::vector<std::string> keys; |
116 |
|
keys.push_back(at1); |
117 |
|
keys.push_back(at2); |
119 |
|
|
120 |
|
} |
121 |
|
|
122 |
< |
void ForceField::addBendType(const std::string &at1, const std::string &at2, |
122 |
> |
bool ForceField::addBendType(const std::string &at1, const std::string &at2, |
123 |
|
const std::string &at3, BendType* bendType) { |
124 |
|
std::vector<std::string> keys; |
125 |
|
keys.push_back(at1); |
128 |
|
return bendTypeCont_.add(keys); |
129 |
|
} |
130 |
|
|
131 |
< |
void ForceField::addTorsionType(const std::string &at1, const std::string &at2, |
131 |
> |
bool ForceField::addTorsionType(const std::string &at1, const std::string &at2, |
132 |
|
const std::string &at3, const std::string &at4, TorsionType* torsionType) { |
133 |
|
std::vector<std::string> keys; |
134 |
|
keys.push_back(at1); |
142 |
|
|
143 |
|
} |
144 |
|
|
145 |
+ |
|
146 |
+ |
ifstrstream* ForceField::openForceFiledFile(const std::string& filename) { |
147 |
+ |
std::string forceFieldFilename(filename); |
148 |
+ |
ifstrstream* ffStream = new ifstrstream(); |
149 |
+ |
|
150 |
+ |
//try to open the force filed file in current directory first |
151 |
+ |
ffStream.open(forceFieldFilename.c_str()); |
152 |
+ |
if(!ffStream.is_open()){ |
153 |
+ |
|
154 |
+ |
forceFieldFilename = ffPath_ + "/" + forceFieldFilename; |
155 |
+ |
ffStream.open( forceFieldFilename.c_str() ); |
156 |
+ |
|
157 |
+ |
//if current directory does not contain the force field file, |
158 |
+ |
//try to open it in the path |
159 |
+ |
if(!ffStream.is_open()){ |
160 |
+ |
|
161 |
+ |
sprintf( painCave.errMsg, |
162 |
+ |
"Error opening the force field parameter file:\n" |
163 |
+ |
"\t%s\n" |
164 |
+ |
"\tHave you tried setting the FORCE_PARAM_PATH environment " |
165 |
+ |
"variable?\n", |
166 |
+ |
forceFieldFilename.c_str() ); |
167 |
+ |
painCave.severity = OOPSE_ERROR; |
168 |
+ |
painCave.isFatal = 1; |
169 |
+ |
simError(); |
170 |
+ |
} |
171 |
+ |
} |
172 |
+ |
|
173 |
+ |
return ffStream; |
174 |
+ |
|
175 |
+ |
} |
176 |
+ |
|
177 |
|
} //end namespace oopse |