1 |
gezelter |
206 |
#include "UseTheForce/ForceField.hpp" |
2 |
|
|
|
3 |
|
|
AtomType* ForceField::getMatchingAtomType(const string &at) { |
4 |
|
|
|
5 |
|
|
map<string, AtomType*>::iterator iter; |
6 |
|
|
|
7 |
|
|
iter = atomTypeMap.find(at); |
8 |
|
|
if (iter != atomTypeMap.end()) { |
9 |
|
|
return iter->second; |
10 |
|
|
} else { |
11 |
|
|
return NULL; |
12 |
|
|
} |
13 |
|
|
} |
14 |
|
|
|
15 |
|
|
BondType* ForceField::getMatchingBondType(const string &at1, |
16 |
|
|
const string &at2) { |
17 |
|
|
|
18 |
|
|
map<pair<string,string>, BondType*>::iterator iter; |
19 |
|
|
vector<BondType*> foundTypes; |
20 |
|
|
|
21 |
|
|
iter = bondTypeMap.find(pair<at1, at2>); |
22 |
|
|
if (iter != bondTypeMap.end()) { |
23 |
|
|
// exact match, so just return it |
24 |
|
|
return iter->second; |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
iter = bondTypeMap.find(pair<at2, at1>); |
28 |
|
|
if (iter != bondTypeMap.end()) { |
29 |
|
|
// exact match in reverse order, so just return it |
30 |
|
|
return iter->second; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
iter = bondTypeMap.find(pair<at1, wildCardAtomTypeName>); |
34 |
|
|
if (iter != bondTypeMap.end()) { |
35 |
|
|
foundTypes.push_back(iter->second); |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
iter = bondTypeMap.find(pair<at2, wildCardAtomTypeName>); |
39 |
|
|
if (iter != bondTypeMap.end()) { |
40 |
|
|
foundTypes.push_back(iter->second); |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
iter = bondTypeMap.find(pair<wildCardAtomTypeName, at1>); |
44 |
|
|
if (iter != bondTypeMap.end()) { |
45 |
|
|
foundTypes.push_back(iter->second); |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
iter = bondTypeMap.find(pair<wildCardAtomTypeName, at2>); |
49 |
|
|
if (iter != bondTypeMap.end()) { |
50 |
|
|
foundTypes.push_back(iter->second); |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
if (foundTypes.empty()) { |
54 |
|
|
return NULL; |
55 |
|
|
} else { |
56 |
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
BendType* ForceField::getMatchingBendType(const string &at1, const string &at2, |
66 |
|
|
const string &at3); |
67 |
|
|
TorsionType* ForceField::getMatchingTorsionType(const string &at1, const string &at2, |
68 |
|
|
const string &at3, const string &at4); |
69 |
|
|
|
70 |
|
|
double ForceField::getRcutForAtomType(AtomType* at); |
71 |
|
|
|
72 |
|
|
|
73 |
|
|
vector<vector<string> > generateWildcardSequence(const vector<string> atomTypes) { |
74 |
|
|
|
75 |
|
|
vector<vector<string> > results; |
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
vector<vector< string> > getAllWildcardPermutations(const vector<string> myAts) { |
81 |
|
|
|
82 |
|
|
int nStrings; |
83 |
|
|
vector<string> oneResult; |
84 |
|
|
vector<vector<string> > allResults; |
85 |
|
|
|
86 |
|
|
nStrings = myAts.size(); |
87 |
|
|
|
88 |
|
|
if (nStrings == 1) { |
89 |
|
|
oneResult.push_back(wildcardCharacter); |
90 |
|
|
allResults.push_back(oneResult); |
91 |
|
|
return allResults; |
92 |
|
|
} else { |
93 |
|
|
|
94 |
|
|
for (i=0; i < nStrings; i++) { |
95 |
|
|
oneResult = myAts; |
96 |
|
|
replace(oneResult.begin(), oneResult.end(), |