| 64 |
|
//The order of adding section parsers is important. |
| 65 |
|
|
| 66 |
|
spMan_.push_back(new OptionSectionParser(forceFieldOptions_)); |
| 67 |
– |
|
| 67 |
|
spMan_.push_back(new BaseAtomTypesSectionParser()); |
| 68 |
|
spMan_.push_back(new AtomTypesSectionParser()); |
| 69 |
|
spMan_.push_back(new LennardJonesAtomTypesSectionParser(forceFieldOptions_)); |
| 72 |
|
spMan_.push_back(new BendTypesSectionParser(forceFieldOptions_)); |
| 73 |
|
spMan_.push_back(new TorsionTypesSectionParser(forceFieldOptions_)); |
| 74 |
|
spMan_.push_back(new InversionTypesSectionParser(forceFieldOptions_)); |
| 76 |
– |
|
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
void Amber_FF::parse(const std::string& filename) { |
| 78 |
|
ifstrstream* ffStream; |
| 79 |
|
|
| 80 |
|
ffStream = openForceFieldFile(filename); |
| 83 |
– |
|
| 81 |
|
spMan_.parse(*ffStream, *this); |
| 82 |
|
|
| 83 |
|
ForceField::AtomTypeContainer::MapTypeIterator i; |
| 85 |
|
|
| 86 |
|
for (at = atomTypeCont_.beginType(i); at != NULL; |
| 87 |
|
at = atomTypeCont_.nextType(i)) { |
| 88 |
< |
at->makeFortranAtomType(); |
| 88 |
> |
|
| 89 |
> |
// useBase sets the responsibilities, and these have to be done |
| 90 |
> |
// after the atomTypes and Base types have all been scanned: |
| 91 |
> |
|
| 92 |
> |
std::vector<AtomType*> ayb = at->allYourBase(); |
| 93 |
> |
if (ayb.size() > 1) { |
| 94 |
> |
for (int j = ayb.size()-1; j > 0; j--) { |
| 95 |
> |
|
| 96 |
> |
ayb[j-1]->useBase(ayb[j]); |
| 97 |
> |
|
| 98 |
> |
} |
| 99 |
> |
} |
| 100 |
> |
|
| 101 |
> |
at->makeFortranAtomType(); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
for (at = atomTypeCont_.beginType(i); at != NULL; |
| 105 |
|
at = atomTypeCont_.nextType(i)) { |
| 106 |
|
at->complete(); |
| 107 |
|
} |
| 108 |
< |
|
| 108 |
> |
|
| 109 |
|
delete ffStream; |
| 110 |
|
|
| 111 |
|
} |