1 |
gezelter |
2094 |
/* |
2 |
gezelter |
1930 |
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
|
* |
4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
|
* redistribute this software in source and binary code form, provided |
7 |
|
|
* that the following conditions are met: |
8 |
|
|
* |
9 |
|
|
* 1. Acknowledgement of the program authors must be made in any |
10 |
|
|
* publication of scientific results based in part on use of the |
11 |
|
|
* program. An acceptable form of acknowledgement is citation of |
12 |
|
|
* the article in which the program was described (Matthew |
13 |
|
|
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
|
|
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
|
|
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
|
|
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
|
|
* |
18 |
|
|
* 2. Redistributions of source code must retain the above copyright |
19 |
|
|
* notice, this list of conditions and the following disclaimer. |
20 |
|
|
* |
21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
23 |
|
|
* documentation and/or other materials provided with the |
24 |
|
|
* distribution. |
25 |
|
|
* |
26 |
|
|
* This software is provided "AS IS," without a warranty of any |
27 |
|
|
* kind. All express or implied conditions, representations and |
28 |
|
|
* warranties, including any implied warranty of merchantability, |
29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
31 |
|
|
* be liable for any damages suffered by licensee as a result of |
32 |
|
|
* using, modifying or distributing the software or its |
33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
36 |
|
|
* damages, however caused and regardless of the theory of liability, |
37 |
|
|
* arising out of the use of or inability to use software, even if the |
38 |
|
|
* University of Notre Dame has been advised of the possibility of |
39 |
|
|
* such damages. |
40 |
|
|
*/ |
41 |
|
|
|
42 |
gezelter |
1631 |
#ifndef TYPES_ATOMTYPE_HPP |
43 |
gezelter |
1930 |
|
44 |
gezelter |
1631 |
#define TYPES_ATOMTYPE_HPP |
45 |
|
|
|
46 |
gezelter |
1652 |
#include <string> |
47 |
tim |
2759 |
#include "config.h" |
48 |
gezelter |
1631 |
#include "utils/PropertyMap.hpp" |
49 |
gezelter |
1930 |
|
50 |
gezelter |
1631 |
#define __C |
51 |
|
|
#include "types/AtomTypeProperties.h" |
52 |
|
|
#include "UseTheForce/DarkSide/atype_interface.h" |
53 |
|
|
|
54 |
|
|
namespace oopse { |
55 |
gezelter |
2204 |
/** |
56 |
|
|
* @class AtomType |
57 |
|
|
* AtomType is what OOPSE looks to for unchanging data about an atom. |
58 |
|
|
* Things that belong to AtomType are universal properties (i.e. does |
59 |
|
|
* this atom have a Charge? What is it's mass_?) Dynamic properties of |
60 |
|
|
* an atom are not intended to be properties of an atom type |
61 |
|
|
*/ |
62 |
|
|
class AtomType { |
63 |
|
|
public: |
64 |
gezelter |
3172 |
|
65 |
gezelter |
2204 |
AtomType(); |
66 |
gezelter |
3172 |
|
67 |
gezelter |
2204 |
virtual ~AtomType() { } ; |
68 |
gezelter |
3172 |
|
69 |
gezelter |
2204 |
virtual void complete(); |
70 |
gezelter |
3172 |
|
71 |
gezelter |
2204 |
/** |
72 |
|
|
* Finishes off the AtomType by communicating the logical portions of the |
73 |
|
|
* structure to the Fortran atype module |
74 |
|
|
*/ |
75 |
|
|
void makeFortranAtomType(); |
76 |
gezelter |
3172 |
|
77 |
tim |
2759 |
void setMass(RealType m) { |
78 |
gezelter |
2204 |
mass_ = m; |
79 |
|
|
} |
80 |
gezelter |
3172 |
|
81 |
tim |
2759 |
RealType getMass(void) { |
82 |
gezelter |
2204 |
return mass_; |
83 |
|
|
} |
84 |
gezelter |
3172 |
|
85 |
gezelter |
2204 |
void setIdent(int id) { |
86 |
|
|
atp.ident = id; |
87 |
|
|
} |
88 |
gezelter |
3172 |
|
89 |
gezelter |
2204 |
int getIdent() { |
90 |
|
|
return atp.ident; |
91 |
|
|
} |
92 |
gezelter |
3172 |
|
93 |
gezelter |
2204 |
void setName(const std::string&name) { |
94 |
|
|
name_ = name; |
95 |
|
|
} |
96 |
gezelter |
3172 |
|
97 |
gezelter |
2204 |
std::string getName() { |
98 |
|
|
return name_; |
99 |
|
|
} |
100 |
gezelter |
3172 |
|
101 |
gezelter |
2204 |
void setLennardJones() { |
102 |
|
|
atp.is_LennardJones = 1; |
103 |
|
|
} |
104 |
gezelter |
3172 |
|
105 |
gezelter |
2204 |
bool isLennardJones() { |
106 |
|
|
return atp.is_LennardJones; |
107 |
|
|
} |
108 |
gezelter |
3172 |
|
109 |
|
|
|
110 |
gezelter |
2204 |
bool isElectrostatic() { |
111 |
|
|
return isCharge() || isMultipole(); |
112 |
|
|
} |
113 |
gezelter |
3172 |
|
114 |
gezelter |
2204 |
void setEAM() { |
115 |
|
|
atp.is_EAM = 1; |
116 |
|
|
} |
117 |
gezelter |
1930 |
|
118 |
gezelter |
2204 |
bool isEAM() { |
119 |
|
|
return atp.is_EAM; |
120 |
|
|
} |
121 |
gezelter |
1930 |
|
122 |
gezelter |
2204 |
void setCharge() { |
123 |
|
|
atp.is_Charge = 1; |
124 |
|
|
} |
125 |
gezelter |
1930 |
|
126 |
gezelter |
2204 |
bool isCharge() { |
127 |
|
|
return atp.is_Charge; |
128 |
|
|
} |
129 |
gezelter |
1930 |
|
130 |
gezelter |
2204 |
bool isDirectional() { |
131 |
|
|
return atp.is_Directional; |
132 |
|
|
} |
133 |
gezelter |
1930 |
|
134 |
gezelter |
2204 |
bool isDipole() { |
135 |
|
|
return atp.is_Dipole; |
136 |
|
|
} |
137 |
gezelter |
1930 |
|
138 |
gezelter |
2204 |
bool isSplitDipole() { |
139 |
|
|
return atp.is_SplitDipole; |
140 |
|
|
} |
141 |
gezelter |
2094 |
|
142 |
gezelter |
2204 |
bool isQuadrupole() { |
143 |
|
|
return atp.is_Quadrupole; |
144 |
|
|
} |
145 |
gezelter |
1930 |
|
146 |
gezelter |
2204 |
bool isMultipole() { |
147 |
|
|
return isDipole() || isQuadrupole(); |
148 |
|
|
} |
149 |
gezelter |
1930 |
|
150 |
gezelter |
2204 |
bool isGayBerne() { |
151 |
|
|
return atp.is_GayBerne; |
152 |
|
|
} |
153 |
gezelter |
1930 |
|
154 |
gezelter |
2204 |
bool isSticky() { |
155 |
|
|
return atp.is_Sticky; |
156 |
|
|
} |
157 |
chrisfen |
2220 |
|
158 |
|
|
bool isStickyPower() { |
159 |
|
|
return atp.is_StickyPower; |
160 |
|
|
} |
161 |
gezelter |
1930 |
|
162 |
gezelter |
2204 |
bool isShape() { |
163 |
|
|
return atp.is_Shape; |
164 |
|
|
} |
165 |
gezelter |
1930 |
|
166 |
chuckv |
2427 |
bool isSC() { |
167 |
|
|
return atp.is_SC; |
168 |
|
|
} |
169 |
|
|
|
170 |
|
|
void setSC() { |
171 |
|
|
atp.is_SC = 1; |
172 |
gezelter |
3172 |
} |
173 |
chuckv |
2427 |
|
174 |
gezelter |
2204 |
//below functions are just forward functions |
175 |
|
|
/** |
176 |
|
|
* Adds property into property map |
177 |
|
|
* @param genData GenericData to be added into PropertyMap |
178 |
|
|
*/ |
179 |
|
|
void addProperty(GenericData* genData); |
180 |
gezelter |
1930 |
|
181 |
gezelter |
2204 |
/** |
182 |
|
|
* Removes property from PropertyMap by name |
183 |
|
|
* @param propName the name of property to be removed |
184 |
|
|
*/ |
185 |
|
|
void removeProperty(const std::string& propName); |
186 |
gezelter |
1930 |
|
187 |
gezelter |
2204 |
/** |
188 |
|
|
* clear all of the properties |
189 |
|
|
*/ |
190 |
|
|
void clearProperties(); |
191 |
gezelter |
1930 |
|
192 |
gezelter |
2204 |
/** |
193 |
|
|
* Returns all names of properties |
194 |
|
|
* @return all names of properties |
195 |
|
|
*/ |
196 |
|
|
std::vector<std::string> getPropertyNames(); |
197 |
gezelter |
1930 |
|
198 |
gezelter |
2204 |
/** |
199 |
|
|
* Returns all of the properties in PropertyMap |
200 |
|
|
* @return all of the properties in PropertyMap |
201 |
|
|
*/ |
202 |
|
|
std::vector<GenericData*> getProperties(); |
203 |
gezelter |
1930 |
|
204 |
gezelter |
2204 |
/** |
205 |
|
|
* Returns property |
206 |
|
|
* @param propName name of property |
207 |
gezelter |
3172 |
* @return a pointer point to property with propName. If no |
208 |
|
|
* property named propName exists, return NULL |
209 |
gezelter |
2204 |
*/ |
210 |
|
|
GenericData* getPropertyByName(const std::string& propName); |
211 |
gezelter |
1930 |
|
212 |
gezelter |
2204 |
protected: |
213 |
gezelter |
3172 |
|
214 |
gezelter |
2204 |
AtomTypeProperties atp; |
215 |
tim |
2759 |
RealType mass_; |
216 |
gezelter |
2204 |
std::string name_; |
217 |
gezelter |
1930 |
|
218 |
gezelter |
2204 |
private: |
219 |
gezelter |
3172 |
//prevent copy construction and copy assignment, since property |
220 |
|
|
//map contains pointers which can not be copied and managered |
221 |
|
|
//safely, except make the generic data at PropertyMap as copy on |
222 |
|
|
//write shared pointer |
223 |
gezelter |
2204 |
AtomType(const AtomType&); |
224 |
|
|
AtomType& operator=(const AtomType& atomType); |
225 |
gezelter |
1930 |
|
226 |
gezelter |
2204 |
PropertyMap properties_; |
227 |
gezelter |
3172 |
|
228 |
gezelter |
2204 |
}; |
229 |
gezelter |
3172 |
|
230 |
gezelter |
2204 |
struct LJParam { |
231 |
tim |
2759 |
RealType epsilon; |
232 |
|
|
RealType sigma; |
233 |
gezelter |
2204 |
int soft_pot; |
234 |
|
|
}; |
235 |
|
|
typedef SimpleTypeData<LJParam> LJParamGenericData; |
236 |
gezelter |
3172 |
|
237 |
gezelter |
2204 |
struct EAMParam { |
238 |
tim |
2759 |
RealType latticeConstant; |
239 |
gezelter |
2204 |
int nrho; |
240 |
tim |
2759 |
RealType drho; |
241 |
gezelter |
2204 |
int nr; |
242 |
tim |
2759 |
RealType dr; |
243 |
|
|
RealType rcut; |
244 |
|
|
std::vector<RealType> rvals; |
245 |
|
|
std::vector<RealType> rhovals; |
246 |
|
|
std::vector<RealType> Frhovals; |
247 |
gezelter |
2204 |
}; |
248 |
gezelter |
3172 |
|
249 |
gezelter |
2204 |
typedef SimpleTypeData<EAMParam> EAMParamGenericData; |
250 |
chuckv |
2427 |
|
251 |
|
|
struct SCParam { |
252 |
tim |
2759 |
RealType c; |
253 |
|
|
RealType m; |
254 |
|
|
RealType n; |
255 |
|
|
RealType alpha; |
256 |
|
|
RealType epsilon; |
257 |
chuckv |
2427 |
}; |
258 |
gezelter |
3172 |
typedef SimpleTypeData<SCParam> SCParamGenericData; |
259 |
gezelter |
1631 |
} |
260 |
gezelter |
1930 |
|
261 |
gezelter |
1631 |
#endif |