ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/UseTheForce/DUFF.cpp
Revision: 1890
Committed: Wed Dec 15 21:07:48 2004 UTC (19 years, 9 months ago) by tim
File size: 3821 byte(s)
Log Message:
add EAM Force Field

File Contents

# User Rev Content
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/StickyAtomTypesSectionParser.hpp"
37     #include "io/BondTypesSectionParser.hpp"
38     #include "io/BendTypesSectionParser.hpp"
39     #include "io/TorsionTypesSectionParser.hpp"
40 tim 1837 #include "UseTheForce/ForceFieldCreator.hpp"
41 gezelter 1490
42 tim 1741 namespace oopse {
43 tim 1837
44 tim 1770 DUFF::DUFF(){
45 tim 1757
46 tim 1807 //set default force field filename
47     setForceFieldFileName("DUFF.frc");
48    
49 tim 1770 //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 tim 1783 ffStream = openForceFieldFile(filename);
73 tim 1770
74     spMan_.parse(*ffStream, *this);
75    
76 tim 1783 ForceField::AtomTypeContainer::MapTypeIterator i;
77 tim 1770 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 tim 1741 } //end namespace oopse