1 |
|
#ifndef TYPES_ATOMTYPE_HPP |
2 |
+ |
|
3 |
|
#define TYPES_ATOMTYPE_HPP |
4 |
|
|
5 |
+ |
#include <string> |
6 |
+ |
|
7 |
|
#include "utils/PropertyMap.hpp" |
8 |
+ |
|
9 |
|
#define __C |
10 |
|
#include "types/AtomTypeProperties.h" |
11 |
|
#include "UseTheForce/DarkSide/atype_interface.h" |
12 |
|
|
13 |
+ |
using namespace std; |
14 |
+ |
|
15 |
|
namespace oopse { |
10 |
– |
/** |
11 |
– |
* @class AtomType |
12 |
– |
* AtomType is what OOPSE looks to for unchanging data about an atom. |
13 |
– |
* Things that belong to AtomType are universal properties (i.e. does |
14 |
– |
* this atom have a Charge? What is it's mass?) Dynamic properties of |
15 |
– |
* an atom are not intended to be properties of an atom type |
16 |
– |
*/ |
17 |
– |
class AtomType{ |
18 |
– |
|
19 |
– |
public: |
20 |
– |
|
21 |
– |
AtomType(); |
22 |
– |
~AtomType(); |
16 |
|
/** |
17 |
< |
* Finishes off the AtomType by communicating the logical portions of the |
18 |
< |
* structure to the Fortran atype module |
17 |
> |
* @class AtomType |
18 |
> |
* AtomType is what OOPSE looks to for unchanging data about an atom. |
19 |
> |
* Things that belong to AtomType are universal properties (i.e. does |
20 |
> |
* this atom have a Charge? What is it's mass_?) Dynamic properties of |
21 |
> |
* an atom are not intended to be properties of an atom type |
22 |
|
*/ |
23 |
< |
void complete(); |
24 |
< |
|
29 |
< |
void setMass(double m) { mass = m; } |
30 |
< |
double getMass(void) { return mass; } |
23 |
> |
class AtomType { |
24 |
> |
public: |
25 |
|
|
26 |
< |
void setIdent(int id) {atp.ident = id;} |
33 |
< |
int getIdent() {return atp.ident;} |
26 |
> |
AtomType(); |
27 |
|
|
28 |
< |
void setName(char* n) {strcpy(name, n);} |
29 |
< |
char* getName() {return name;} |
30 |
< |
|
31 |
< |
void setLennardJones() { atp.is_LennardJones = 1; } |
32 |
< |
bool isLennardJones() { return atp.is_LennardJones; } |
33 |
< |
|
34 |
< |
void setElectrostatic() { atp.is_Electrostatic = 1; } |
35 |
< |
bool isElectrostatic() { return atp.is_Electrostatic; } |
28 |
> |
virtual ~AtomType() { } ; |
29 |
> |
|
30 |
> |
virtual void complete(); |
31 |
> |
|
32 |
> |
/** |
33 |
> |
* Finishes off the AtomType by communicating the logical portions of the |
34 |
> |
* structure to the Fortran atype module |
35 |
> |
*/ |
36 |
> |
void makeFortranAtomType(); |
37 |
> |
|
38 |
> |
void setMass(double m) { |
39 |
> |
mass_ = m; |
40 |
> |
} |
41 |
> |
|
42 |
> |
double getMass(void) { |
43 |
> |
return mass_; |
44 |
> |
} |
45 |
> |
|
46 |
> |
void setIdent(int id) { |
47 |
> |
atp.ident = id; |
48 |
> |
} |
49 |
> |
|
50 |
> |
int getIdent() { |
51 |
> |
return atp.ident; |
52 |
> |
} |
53 |
> |
|
54 |
> |
void setName(const std::string&name) { |
55 |
> |
name_ = name; |
56 |
> |
} |
57 |
> |
|
58 |
> |
std::string getName() { |
59 |
> |
return name_; |
60 |
> |
} |
61 |
> |
|
62 |
> |
void setLennardJones() { |
63 |
> |
atp.is_LennardJones = 1; |
64 |
> |
} |
65 |
> |
|
66 |
> |
bool isLennardJones() { |
67 |
> |
return atp.is_LennardJones; |
68 |
> |
} |
69 |
> |
|
70 |
> |
void setElectrostatic() { |
71 |
> |
atp.is_Electrostatic = 1; |
72 |
> |
} |
73 |
> |
|
74 |
> |
bool isElectrostatic() { |
75 |
> |
return atp.is_Electrostatic; |
76 |
> |
} |
77 |
> |
|
78 |
> |
void setEAM() { |
79 |
> |
atp.is_EAM = 1; |
80 |
> |
} |
81 |
> |
|
82 |
> |
bool isEAM() { |
83 |
> |
return atp.is_EAM; |
84 |
> |
} |
85 |
> |
|
86 |
> |
void setCharge() { |
87 |
> |
atp.is_Charge = 1; |
88 |
> |
atp.is_Electrostatic = 1; |
89 |
> |
} |
90 |
> |
|
91 |
> |
bool isCharge() { |
92 |
> |
return atp.is_Charge; |
93 |
> |
} |
94 |
> |
|
95 |
> |
bool isDirectional() { |
96 |
> |
return atp.is_Directional; |
97 |
> |
} |
98 |
> |
|
99 |
> |
bool isDipole() { |
100 |
> |
return atp.is_Dipole; |
101 |
> |
} |
102 |
> |
|
103 |
> |
bool isGayBerne() { |
104 |
> |
return atp.is_GayBerne; |
105 |
> |
} |
106 |
> |
|
107 |
> |
bool isSticky() { |
108 |
> |
return atp.is_Sticky; |
109 |
> |
} |
110 |
> |
|
111 |
> |
bool isShape() { |
112 |
> |
return atp.is_Shape; |
113 |
> |
} |
114 |
> |
|
115 |
> |
//below functions are just forward functions |
116 |
> |
/** |
117 |
> |
* Adds property into property map |
118 |
> |
* @param genData GenericData to be added into PropertyMap |
119 |
> |
*/ |
120 |
> |
void addProperty(GenericData* genData); |
121 |
> |
|
122 |
> |
/** |
123 |
> |
* Removes property from PropertyMap by name |
124 |
> |
* @param propName the name of property to be removed |
125 |
> |
*/ |
126 |
> |
void removeProperty(const std::string& propName); |
127 |
> |
|
128 |
> |
/** |
129 |
> |
* clear all of the properties |
130 |
> |
*/ |
131 |
> |
void clearProperties(); |
132 |
> |
|
133 |
> |
/** |
134 |
> |
* Returns all names of properties |
135 |
> |
* @return all names of properties |
136 |
> |
*/ |
137 |
> |
std::vector<std::string> getPropertyNames(); |
138 |
> |
|
139 |
> |
/** |
140 |
> |
* Returns all of the properties in PropertyMap |
141 |
> |
* @return all of the properties in PropertyMap |
142 |
> |
*/ |
143 |
> |
std::vector<GenericData*> getProperties(); |
144 |
> |
|
145 |
> |
/** |
146 |
> |
* Returns property |
147 |
> |
* @param propName name of property |
148 |
> |
* @return a pointer point to property with propName. If no property named propName |
149 |
> |
* exists, return NULL |
150 |
> |
*/ |
151 |
> |
GenericData* getPropertyByName(const std::string& propName); |
152 |
> |
|
153 |
> |
protected: |
154 |
> |
|
155 |
> |
AtomTypeProperties atp; |
156 |
> |
double mass_; |
157 |
> |
std::string name_; |
158 |
> |
|
159 |
> |
private: |
160 |
> |
//prevent copy construction and copy assignment, since property map contains |
161 |
> |
//pointers which can not be copied and managered safely, except make the generic data |
162 |
> |
//at PropertyMap as copy on write shared pointer |
163 |
> |
AtomType(const AtomType&); |
164 |
> |
AtomType& operator=(const AtomType& atomType); |
165 |
> |
|
166 |
> |
|
167 |
> |
PropertyMap properties_; |
168 |
|
|
169 |
< |
void setEAM() { atp.is_EAM = 1; } |
45 |
< |
bool isEAM() { return atp.is_EAM; } |
46 |
< |
|
47 |
< |
void setCharge() { atp.is_Charge = 1; atp.is_Electrostatic = 1;} |
48 |
< |
bool isCharge() { return atp.is_Charge; } |
169 |
> |
}; |
170 |
|
|
171 |
< |
PropertyMap properties; |
172 |
< |
|
173 |
< |
private: |
174 |
< |
|
175 |
< |
AtomTypeProperties atp; |
176 |
< |
double mass; |
177 |
< |
char* name; |
178 |
< |
|
179 |
< |
}; |
171 |
> |
struct LJParam { |
172 |
> |
double epsilon; |
173 |
> |
double sigma; |
174 |
> |
}; |
175 |
> |
typedef SimpleTypeData<LJParam> LJParamGenericData; |
176 |
> |
|
177 |
> |
struct EAMParam { |
178 |
> |
double latticeConstant; |
179 |
> |
int nrho; |
180 |
> |
double drho; |
181 |
> |
int nr; |
182 |
> |
double dr; |
183 |
> |
double rcut; |
184 |
> |
std::vector<double> rvals; |
185 |
> |
std::vector<double> rhovals; |
186 |
> |
std::vector<double> Frhovals; |
187 |
> |
}; |
188 |
> |
|
189 |
> |
typedef SimpleTypeData<EAMParam> EAMParamGenericData; |
190 |
|
} |
191 |
+ |
|
192 |
|
#endif |