ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/UseTheForce/DUFF.cpp
Revision: 1922
Committed: Tue Jan 11 16:24:37 2005 UTC (19 years, 6 months ago) by tim
File size: 3822 byte(s)
Log Message:
change default name of DUFF force field to DUFF2.frc

File Contents

# Content
1 /*
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
26 #include "UseTheForce/DUFF.hpp"
27 #include "UseTheForce/DarkSide/lj_interface.h"
28 #include "UseTheForce/DarkSide/charge_interface.h"
29 #include "UseTheForce/DarkSide/dipole_interface.h"
30 #include "UseTheForce/DarkSide/sticky_interface.h"
31 #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/StickyAtomTypesSectionParser.hpp"
37 #include "io/BondTypesSectionParser.hpp"
38 #include "io/BendTypesSectionParser.hpp"
39 #include "io/TorsionTypesSectionParser.hpp"
40 #include "UseTheForce/ForceFieldCreator.hpp"
41
42 namespace oopse {
43
44 DUFF::DUFF(){
45
46 //set default force field filename
47 setForceFieldFileName("DUFF2.frc");
48
49 //the order of adding section parsers are important
50 //DirectionalAtomTypesSectionParser should be added before AtomTypesSectionParser Since
51 //These two section parsers will actually create "real" AtomTypes (AtomTypesSectionParser will create
52 //AtomType and DirectionalAtomTypesSectionParser will creat DirectionalAtomType which is a subclass
53 //of AtomType, therefore it should come first). Other AtomTypes Section Parser will not create the
54 //"real" AtomType, they only add and set some attribute of the AtomType. Thus their order are not
55 //important. AtomTypesSectionParser should be added before other atom type section parsers.
56 //Make sure they are added after DirectionalAtomTypesSectionParser and AtomTypesSectionParser.
57 //The order of BondTypesSectionParser, BendTypesSectionParser and TorsionTypesSectionParser are
58 //not important.
59 spMan_.push_back(new DirectionalAtomTypesSectionParser());
60 spMan_.push_back(new AtomTypesSectionParser());
61 spMan_.push_back(new LennardJonesAtomTypesSectionParser());
62 spMan_.push_back(new ElectrostaticAtomTypesSectionParser());
63 spMan_.push_back(new StickyAtomTypesSectionParser());
64 spMan_.push_back(new BondTypesSectionParser());
65 spMan_.push_back(new BendTypesSectionParser());
66 spMan_.push_back(new TorsionTypesSectionParser());
67
68 }
69
70 void DUFF::parse(const std::string& filename) {
71 ifstrstream* ffStream;
72 ffStream = openForceFieldFile(filename);
73
74 spMan_.parse(*ffStream, *this);
75
76 ForceField::AtomTypeContainer::MapTypeIterator i;
77 AtomType* at;
78
79 for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
80 at->makeFortranAtomType();
81 }
82
83 for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) {
84 at->complete();
85 }
86
87 }
88
89 } //end namespace oopse