ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/UseTheForce/ForceField.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-4/src/UseTheForce/ForceField.hpp (file contents):
Revision 1716, Fri Nov 5 21:04:13 2004 UTC vs.
Revision 1720 by tim, Sat Nov 6 05:21:55 2004 UTC

# Line 1 | Line 1
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 + /**
27 +  * @file ForceField.hpp
28 +  * @author tlin
29 +  * @date 11/04/2004
30 +  * @time 22:51am
31 +  * @version 1.0
32 +  */
33 +  
34   #ifndef USETHEFORCE_FORCEFIELD_HPP
35   #define USETHEFORCE_FORCEFIELD_HPP
36  
# Line 9 | Line 42
42   #include "utils/Tuple.hpp"
43   #include "types/ShapeAtomType.hpp"
44   #include "io/basic_ifstrstream.hpp"
45 + #include "utils/TypeContainer.hpp"
46  
47 < using namespace std;
14 < using namespace oopse;
47 > namespace oopse {
48  
49 + /**
50 + * @class ForceFiled ForceField.hpp ''UseTheForce/ForceField.hpp"
51 + * @brief
52 + */
53   class ForceField{
54  
55 < public:
55 >    public:
56  
57 <  ForceField(){
21 <    hasVariant=false;
22 <    ffPath = getenv("FORCE_PARAM_PATH");
23 <    if( ffPath.empty() ) {
24 <      STR_DEFINE(ffPath, FRC_PATH );
25 <    }  
26 <  }
57 >        ForceField();
58  
59 <  virtual ~ForceFields(){}
59 >        virtual ~ForceFields(){}
60  
61 <  void setVariant(const string &variant) { hasVariant = true; theVariant = variant; }
62 <  virtual void readParams( void ) = 0;  
63 <  
64 <  AtomType* getMatchingAtomType(const string &at);
65 <  BondType* getMatchingBondType(const string &at1, const string &at2);
35 <  BendType* getMatchingBendType(const string &at1, const string &at2,
36 <                                const string &at3);
37 <  TorsionType* getMatchingTorsionType(const string &at1, const string &at2,
38 <                                      const string &at3, const string &at4);
61 >        void setVariant(const std::string &variant) {
62 >            hasVariant_ = true;
63 >            variant_ = variant;
64 >        }
65 >        virtual void readParams() = 0;  
66  
67 <  double getRcutForAtomType(AtomType* at);
68 <  
69 < protected:
70 <  
71 <  string ffPath;
72 <  ifstrstream forceFile;
46 <  bool hasVariant;
47 <  string variant;
48 <  map<string, AtomType*> atomTypeMap;
49 <  map<pair<string,string>, BondType*> bondTypeMap;
50 <  map<tuple3<string,string,string>, BendType*> bendTypeMap;
51 <  map<tuple4<string,string,string,string>, TorsionType*> torsionTypeMap;
52 <  string wildCardAtomTypeName;
67 >        AtomType* getAtomType(const std::string &at);
68 >        BondType* getBondType(const std::string &at1, const std::string &at2);
69 >        BendType* getBendType(const std::string &at1, const std::string &at2,
70 >                                    const std::string &at3);
71 >        TorsionType* getTorsionType(const std::string &at1, const std::string &at2,
72 >                                          const std::string &at3, const std::string &at4);
73  
74 < };
74 >        double getRcutForAtomType(AtomType* at);
75  
76 +        std::string getWildCard() {
77 +            return wildCardAtomTypeName_;
78 +        }
79  
80 +        void setWildCard(const std::string& wildCard) {
81 +            wildCardAtomTypeName_ = wildCard;
82 +        }
83 +
84 +    protected:
85 +        
86 +        void addAtomType(const std::string &at, AtomType* atomType);
87 +        void addBondType(const std::string &at1, const std::string &at2, BondType* bondType);
88 +        void addBendType(const std::string &at1, const std::string &at2,
89 +                                    const std::string &at3, BendType* bendType);
90 +        void addTorsionType(const std::string &at1, const std::string &at2,
91 +                                          const std::string &at3, const std::string &at4, TorsionType* torsionType);
92 +
93 +    private:  
94 +        std::string ffPath_;
95 +        ifstrstream forceFile_;
96 +        bool hasVariant_;
97 +        std::string variant_;
98 +
99 +        std::string wildCardAtomTypeName_;
100 +
101 +        typedef TypeContainer<AtomType, 1> AtomTypeContainer;
102 +        typedef TypeContainer<BondType, 2> BondTypeContainer;
103 +        typedef TypeContainer<BendType, 3> BendTypeContainer;
104 +        typedef TypeContainer<TorsionType, 4> TorsionTypeContainer;
105 +
106 +        AtomTypeContainer atomTypeCont_;    
107 +        BondTypeContainer bondTypeCont_;
108 +        BendTypeContainer bendTypeCont_;
109 +        TorsionTypeContainer torsionTypeCont_;
110 + };
111 +
112 + typedef GenericFactory<ForceField> ForceFieldFactory;
113 +
114 + }//end namespace oopse
115   #endif
116  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines