| 44 |
|
* |
| 45 |
|
* Created by Charles F. Vardeman II on 11/9/05. |
| 46 |
|
* @author Charles F. Vardeman II |
| 47 |
< |
* @version $Id: SC_FF.cpp,v 1.7 2005-12-30 23:15:59 chuckv Exp $ |
| 47 |
> |
* @version $Id: SC_FF.cpp,v 1.11 2008-07-30 18:11:18 gezelter Exp $ |
| 48 |
|
* |
| 49 |
|
*/ |
| 50 |
|
|
| 54 |
|
#include "UseTheForce/DarkSide/sticky_interface.h" |
| 55 |
|
#include "UseTheForce/DarkSide/suttonchen_interface.h" |
| 56 |
|
#include "UseTheForce/ForceFieldFactory.hpp" |
| 57 |
< |
#include "io/DirectionalAtomTypesSectionParser.hpp" |
| 57 |
> |
#include "io/OptionSectionParser.hpp" |
| 58 |
> |
#include "io/BaseAtomTypesSectionParser.hpp" |
| 59 |
|
#include "io/AtomTypesSectionParser.hpp" |
| 59 |
– |
#include "io/LennardJonesAtomTypesSectionParser.hpp" |
| 60 |
– |
#include "io/ChargeAtomTypesSectionParser.hpp" |
| 61 |
– |
#include "io/MultipoleAtomTypesSectionParser.hpp" |
| 62 |
– |
#include "io/EAMAtomTypesSectionParser.hpp" |
| 63 |
– |
#include "io/StickyAtomTypesSectionParser.hpp" |
| 64 |
– |
#include "io/BondTypesSectionParser.hpp" |
| 65 |
– |
#include "io/BendTypesSectionParser.hpp" |
| 66 |
– |
#include "io/TorsionTypesSectionParser.hpp" |
| 60 |
|
#include "io/SCAtomTypesSectionParser.hpp" |
| 68 |
– |
#include "io/OptionSectionParser.hpp" |
| 61 |
|
#include "UseTheForce/ForceFieldCreator.hpp" |
| 62 |
|
#include "utils/simError.h" |
| 63 |
|
namespace oopse { |
| 65 |
|
SC_FF::SC_FF(){ |
| 66 |
|
|
| 67 |
|
//set default force field filename |
| 68 |
< |
//setForceFieldFileName("SuttonChen.frc"); |
| 69 |
< |
|
| 70 |
< |
//the order of adding section parsers are important |
| 79 |
< |
//OptionSectionParser must come first to set options for other parsers |
| 80 |
< |
//DirectionalAtomTypesSectionParser should be added before AtomTypesSectionParser Since |
| 81 |
< |
//These two section parsers will actually create "real" AtomTypes (AtomTypesSectionParser will create |
| 82 |
< |
//AtomType and DirectionalAtomTypesSectionParser will creat DirectionalAtomType which is a subclass |
| 83 |
< |
//of AtomType, therefore it should come first). Other AtomTypes Section Parser will not create the |
| 84 |
< |
//"real" AtomType, they only add and set some attribute of the AtomType. Thus their order are not |
| 85 |
< |
//important. AtomTypesSectionParser should be added before other atom type section parsers. |
| 86 |
< |
//Make sure they are added after DirectionalAtomTypesSectionParser and AtomTypesSectionParser. |
| 87 |
< |
//The order of BondTypesSectionParser, BendTypesSectionParser and TorsionTypesSectionParser are |
| 88 |
< |
//not important. |
| 89 |
< |
spMan_.push_back(new OptionSectionParser(SCForceFieldOptions_)); |
| 68 |
> |
setForceFieldFileName("SuttonChen.frc"); |
| 69 |
> |
spMan_.push_back(new OptionSectionParser(forceFieldOptions_)); |
| 70 |
> |
spMan_.push_back(new BaseAtomTypesSectionParser()); |
| 71 |
|
spMan_.push_back(new AtomTypesSectionParser()); |
| 72 |
< |
spMan_.push_back(new SCAtomTypesSectionParser(SCForceFieldOptions_)); |
| 92 |
< |
|
| 72 |
> |
spMan_.push_back(new SCAtomTypesSectionParser(forceFieldOptions_)); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
void SC_FF::parse(const std::string& filename) { |
| 84 |
|
// Set forcefield options |
| 85 |
|
|
| 86 |
|
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
| 87 |
+ |
// useBase sets the responsibilities, and these have to be done |
| 88 |
+ |
// after the atomTypes and Base types have all been scanned: |
| 89 |
+ |
|
| 90 |
+ |
std::vector<AtomType*> ayb = at->allYourBase(); |
| 91 |
+ |
if (ayb.size() > 1) { |
| 92 |
+ |
for (int j = ayb.size()-1; j > 0; j--) { |
| 93 |
+ |
|
| 94 |
+ |
ayb[j-1]->useBase(ayb[j]); |
| 95 |
+ |
|
| 96 |
+ |
} |
| 97 |
+ |
} |
| 98 |
|
at->makeFortranAtomType(); |
| 99 |
|
} |
| 100 |
|
|