| 1 |
tim |
1741 |
/* |
| 2 |
|
|
* Copyright (C) 2000-2004 Object Oriented Parallel Simulation Engine (OOPSE) project |
| 3 |
|
|
* |
| 4 |
|
|
* Contact: oopse@oopse.org |
| 5 |
|
|
* |
| 6 |
|
|
* This program is free software; you can redistribute it and/or |
| 7 |
|
|
* modify it under the terms of the GNU Lesser General Public License |
| 8 |
|
|
* as published by the Free Software Foundation; either version 2.1 |
| 9 |
|
|
* of the License, or (at your option) any later version. |
| 10 |
|
|
* All we ask is that proper credit is given for our work, which includes |
| 11 |
|
|
* - but is not limited to - adding the above copyright notice to the beginning |
| 12 |
|
|
* of your source code files, and to any copyright notice that you may distribute |
| 13 |
|
|
* with programs based on this work. |
| 14 |
|
|
* |
| 15 |
|
|
* This program is distributed in the hope that it will be useful, |
| 16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
|
|
* GNU Lesser General Public License for more details. |
| 19 |
|
|
* |
| 20 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
| 21 |
|
|
* along with this program; if not, write to the Free Software |
| 22 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 23 |
|
|
* |
| 24 |
|
|
*/ |
| 25 |
gezelter |
1490 |
|
| 26 |
tim |
1741 |
#include "UseTheForce/DUFF.hpp" |
| 27 |
gezelter |
1634 |
#include "UseTheForce/DarkSide/lj_interface.h" |
| 28 |
tim |
1758 |
#include "UseTheForce/DarkSide/charge_interface.h" |
| 29 |
|
|
#include "UseTheForce/DarkSide/dipole_interface.h" |
| 30 |
|
|
#include "UseTheForce/DarkSide/sticky_interface.h" |
| 31 |
tim |
1783 |
#include "UseTheForce/ForceFieldFactory.hpp" |
| 32 |
|
|
#include "io/DirectionalAtomTypesSectionParser.hpp" |
| 33 |
|
|
#include "io/AtomTypesSectionParser.hpp" |
| 34 |
|
|
#include "io/LennardJonesAtomTypesSectionParser.hpp" |
| 35 |
|
|
#include "io/ElectrostaticAtomTypesSectionParser.hpp" |
| 36 |
|
|
#include "io/EAMAtomTypesSectionParser.hpp" |
| 37 |
|
|
#include "io/StickyAtomTypesSectionParser.hpp" |
| 38 |
|
|
#include "io/BondTypesSectionParser.hpp" |
| 39 |
|
|
#include "io/BendTypesSectionParser.hpp" |
| 40 |
|
|
#include "io/TorsionTypesSectionParser.hpp" |
| 41 |
tim |
1837 |
#include "UseTheForce/ForceFieldCreator.hpp" |
| 42 |
gezelter |
1490 |
|
| 43 |
tim |
1741 |
namespace oopse { |
| 44 |
gezelter |
1490 |
|
| 45 |
tim |
1840 |
//static ForceFieldBuilder<DUFF>* DUFFCreator = new ForceFieldBuilder<DUFF>("DUFF"); |
| 46 |
tim |
1837 |
|
| 47 |
tim |
1770 |
DUFF::DUFF(){ |
| 48 |
tim |
1757 |
|
| 49 |
tim |
1807 |
//set default force field filename |
| 50 |
|
|
setForceFieldFileName("DUFF.frc"); |
| 51 |
|
|
|
| 52 |
tim |
1770 |
//the order of adding section parsers are important |
| 53 |
|
|
//DirectionalAtomTypesSectionParser should be added before AtomTypesSectionParser Since |
| 54 |
|
|
//These two section parsers will actually create "real" AtomTypes (AtomTypesSectionParser will create |
| 55 |
|
|
//AtomType and DirectionalAtomTypesSectionParser will creat DirectionalAtomType which is a subclass |
| 56 |
|
|
//of AtomType, therefore it should come first). Other AtomTypes Section Parser will not create the |
| 57 |
|
|
//"real" AtomType, they only add and set some attribute of the AtomType. Thus their order are not |
| 58 |
|
|
//important. AtomTypesSectionParser should be added before other atom type section parsers. |
| 59 |
|
|
//Make sure they are added after DirectionalAtomTypesSectionParser and AtomTypesSectionParser. |
| 60 |
|
|
//The order of BondTypesSectionParser, BendTypesSectionParser and TorsionTypesSectionParser are |
| 61 |
|
|
//not important. |
| 62 |
|
|
spMan_.push_back(new DirectionalAtomTypesSectionParser()); |
| 63 |
|
|
spMan_.push_back(new AtomTypesSectionParser()); |
| 64 |
|
|
spMan_.push_back(new LennardJonesAtomTypesSectionParser()); |
| 65 |
|
|
spMan_.push_back(new ElectrostaticAtomTypesSectionParser()); |
| 66 |
|
|
spMan_.push_back(new EAMAtomTypesSectionParser()); |
| 67 |
|
|
spMan_.push_back(new StickyAtomTypesSectionParser()); |
| 68 |
|
|
spMan_.push_back(new BondTypesSectionParser()); |
| 69 |
|
|
spMan_.push_back(new BendTypesSectionParser()); |
| 70 |
|
|
spMan_.push_back(new TorsionTypesSectionParser()); |
| 71 |
|
|
|
| 72 |
|
|
} |
| 73 |
|
|
|
| 74 |
|
|
void DUFF::parse(const std::string& filename) { |
| 75 |
|
|
ifstrstream* ffStream; |
| 76 |
tim |
1783 |
ffStream = openForceFieldFile(filename); |
| 77 |
tim |
1770 |
|
| 78 |
|
|
spMan_.parse(*ffStream, *this); |
| 79 |
|
|
|
| 80 |
tim |
1783 |
ForceField::AtomTypeContainer::MapTypeIterator i; |
| 81 |
tim |
1770 |
AtomType* at; |
| 82 |
|
|
|
| 83 |
|
|
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
| 84 |
|
|
at->makeFortranAtomType(); |
| 85 |
|
|
} |
| 86 |
|
|
|
| 87 |
|
|
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
| 88 |
|
|
at->complete(); |
| 89 |
|
|
} |
| 90 |
|
|
|
| 91 |
|
|
} |
| 92 |
|
|
|
| 93 |
tim |
1741 |
} //end namespace oopse |