39 |
|
//register createDUFF to ForceFieldFactory |
40 |
|
ForceFieldFactory::getInstance()->registerForceField("DUFF", createDUFF); |
41 |
|
|
42 |
+ |
DUFF::DUFF(){ |
43 |
|
|
44 |
+ |
//the order of adding section parsers are important |
45 |
+ |
//DirectionalAtomTypesSectionParser should be added before AtomTypesSectionParser Since |
46 |
+ |
//These two section parsers will actually create "real" AtomTypes (AtomTypesSectionParser will create |
47 |
+ |
//AtomType and DirectionalAtomTypesSectionParser will creat DirectionalAtomType which is a subclass |
48 |
+ |
//of AtomType, therefore it should come first). Other AtomTypes Section Parser will not create the |
49 |
+ |
//"real" AtomType, they only add and set some attribute of the AtomType. Thus their order are not |
50 |
+ |
//important. AtomTypesSectionParser should be added before other atom type section parsers. |
51 |
+ |
//Make sure they are added after DirectionalAtomTypesSectionParser and AtomTypesSectionParser. |
52 |
+ |
//The order of BondTypesSectionParser, BendTypesSectionParser and TorsionTypesSectionParser are |
53 |
+ |
//not important. |
54 |
+ |
spMan_.push_back(new DirectionalAtomTypesSectionParser()); |
55 |
+ |
spMan_.push_back(new AtomTypesSectionParser()); |
56 |
+ |
spMan_.push_back(new LennardJonesAtomTypesSectionParser()); |
57 |
+ |
spMan_.push_back(new ElectrostaticAtomTypesSectionParser()); |
58 |
+ |
spMan_.push_back(new EAMAtomTypesSectionParser()); |
59 |
+ |
spMan_.push_back(new StickyAtomTypesSectionParser()); |
60 |
+ |
spMan_.push_back(new BondTypesSectionParser()); |
61 |
+ |
spMan_.push_back(new BendTypesSectionParser()); |
62 |
+ |
spMan_.push_back(new TorsionTypesSectionParser()); |
63 |
+ |
|
64 |
+ |
} |
65 |
+ |
|
66 |
+ |
void DUFF::parse(const std::string& filename) { |
67 |
+ |
ifstrstream* ffStream; |
68 |
+ |
ffStream = openForceFiledFile(filename); |
69 |
+ |
|
70 |
+ |
spMan_.parse(*ffStream, *this); |
71 |
+ |
|
72 |
+ |
typename ForceField::AtomTypeContainer::MapTypeIterator i; |
73 |
+ |
AtomType* at; |
74 |
+ |
|
75 |
+ |
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
76 |
+ |
at->makeFortranAtomType(); |
77 |
+ |
} |
78 |
+ |
|
79 |
+ |
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
80 |
+ |
at->complete(); |
81 |
+ |
} |
82 |
+ |
|
83 |
+ |
} |
84 |
+ |
|
85 |
+ |
/* |
86 |
|
ParseState DUFF::getSection(const std::string& section) { |
87 |
|
ParseState result; |
88 |
|
|
685 |
|
addTorsionType(at1, at2, at3, at4, torsionType); |
686 |
|
} |
687 |
|
} |
688 |
< |
|
688 |
> |
*/ |
689 |
|
} //end namespace oopse |