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.cpp |
28 |
* @author tlin |
29 |
* @date 11/04/2004 |
30 |
* @time 22:51am |
31 |
* @version 1.0 |
32 |
*/ |
33 |
|
34 |
#include "UseTheForce/ForceField.hpp" |
35 |
namespace oopse { |
36 |
|
37 |
ForceField::ForceField() : hasVariant_(false){ |
38 |
char* tempPath; |
39 |
tempPath = getenv("FORCE_PARAM_PATH"); |
40 |
|
41 |
if (tempPath == NULL) { |
42 |
//convert a macro from compiler to a string in c++ |
43 |
STR_DEFINE(ffPath_, FRC_PATH ); |
44 |
} else { |
45 |
ffPath_ = tempPath; |
46 |
} |
47 |
} |
48 |
|
49 |
AtomType* ForceField::getAtomType(const std::string &at) { |
50 |
std::vector<std::string> keys; |
51 |
keys.push_back(at); |
52 |
return atomTypeCont_.find(keys); |
53 |
} |
54 |
|
55 |
BondType* ForceField::getBondType(const std::string &at1, const std::string &at2) { |
56 |
std::vector<std::string> keys; |
57 |
keys.push_back(at1); |
58 |
keys.push_back(at2); |
59 |
return bondTypeCont_.find(keys, wildCardAtomTypeName_); |
60 |
|
61 |
} |
62 |
|
63 |
BendType* ForceField::getBendType(const std::string &at1, const std::string &at2, |
64 |
const std::string &at3) { |
65 |
std::vector<std::string> keys; |
66 |
keys.push_back(at1); |
67 |
keys.push_back(at2); |
68 |
keys.push_back(at3); |
69 |
return bendTypeCont_.find(keys, wildCardAtomTypeName_); |
70 |
} |
71 |
|
72 |
TorsionType* ForceField::getTorsionType(const std::string &at1, const std::string &at2, |
73 |
const std::string &at3, const std::string &at4) { |
74 |
std::vector<std::string> keys; |
75 |
keys.push_back(at1); |
76 |
keys.push_back(at2); |
77 |
keys.push_back(at3); |
78 |
keys.push_back(at4); |
79 |
return torsionTypeCont_.find(keys, wildCardAtomTypeName_); |
80 |
|
81 |
} |
82 |
|
83 |
void ForceField::addAtomType(const std::string &at, AtomType* atomType) { |
84 |
std::vector<std::string> keys; |
85 |
keys.push_back(at); |
86 |
return atomTypeCont_.add(keys); |
87 |
} |
88 |
|
89 |
void ForceField::addBondType(const std::string &at1, const std::string &at2, BondType* bondType) { |
90 |
std::vector<std::string> keys; |
91 |
keys.push_back(at1); |
92 |
keys.push_back(at2); |
93 |
return bondTypeCont_.add(keys); |
94 |
|
95 |
} |
96 |
|
97 |
void ForceField::addBendType(const std::string &at1, const std::string &at2, |
98 |
const std::string &at3, BendType* bendType) { |
99 |
std::vector<std::string> keys; |
100 |
keys.push_back(at1); |
101 |
keys.push_back(at2); |
102 |
keys.push_back(at3); |
103 |
return bendTypeCont_.add(keys); |
104 |
} |
105 |
|
106 |
void ForceField::addTorsionType(const std::string &at1, const std::string &at2, |
107 |
const std::string &at3, const std::string &at4, TorsionType* torsionType) { |
108 |
std::vector<std::string> keys; |
109 |
keys.push_back(at1); |
110 |
keys.push_back(at2); |
111 |
keys.push_back(at3); |
112 |
keys.push_back(at4); |
113 |
return torsionTypeCont_.add(keys); |
114 |
} |
115 |
|
116 |
double ForceField::getRcutFromAtomType(AtomType* at) { |
117 |
|
118 |
} |
119 |
|
120 |
} //end namespace oopse |