1 |
gezelter |
1632 |
#include <stdlib.h> |
2 |
|
|
#include <stdio.h> |
3 |
|
|
#include <string.h> |
4 |
|
|
#include <iostream> |
5 |
|
|
|
6 |
|
|
#include "types/AtomType.hpp" |
7 |
|
|
#include "utils/simError.h" |
8 |
|
|
#define __C |
9 |
|
|
#include "UseTheForce/DarkSide/atype_interface.h" |
10 |
|
|
|
11 |
tim |
1740 |
name_space oopse { |
12 |
gezelter |
1632 |
AtomType::AtomType(){ |
13 |
|
|
|
14 |
|
|
// initialize to an error: |
15 |
tim |
1740 |
atp_.ident = -1; |
16 |
gezelter |
1652 |
|
17 |
tim |
1740 |
// and mass_less: |
18 |
|
|
mass_ = 0.0; |
19 |
gezelter |
1632 |
|
20 |
|
|
// atom type is a Tabula Rasa: |
21 |
tim |
1740 |
atp_.is_Directional = 0; |
22 |
|
|
atp_.is_LennardJones = 0; |
23 |
|
|
atp_.is_Electrostatic = 0; |
24 |
|
|
atp_.is_Charge = 0; |
25 |
|
|
atp_.is_Dipole = 0; |
26 |
|
|
atp_.is_Sticky = 0; |
27 |
|
|
atp_.is_GayBerne = 0; |
28 |
|
|
atp_.is_EAM = 0; |
29 |
|
|
atp_.is_Shape = 0; |
30 |
|
|
atp_.is_FLARB = 0; |
31 |
gezelter |
1632 |
} |
32 |
|
|
|
33 |
|
|
void AtomType::complete() { |
34 |
|
|
|
35 |
|
|
int status; |
36 |
|
|
|
37 |
tim |
1740 |
if (name_.empty()) { |
38 |
gezelter |
1632 |
sprintf( painCave.errMsg, |
39 |
|
|
"Attempting to complete an AtomType without giving " |
40 |
tim |
1740 |
"it a name_!\n"); |
41 |
gezelter |
1632 |
painCave.severity = OOPSE_ERROR; |
42 |
|
|
painCave.isFatal = 1; |
43 |
|
|
simError(); |
44 |
|
|
} |
45 |
|
|
|
46 |
tim |
1740 |
if (atp_.ident == -1) { |
47 |
gezelter |
1632 |
sprintf( painCave.errMsg, |
48 |
|
|
"Attempting to complete AtomType %s without setting the" |
49 |
tim |
1740 |
" ident!/n", name_.c_str()); |
50 |
gezelter |
1632 |
painCave.severity = OOPSE_ERROR; |
51 |
|
|
painCave.isFatal = 1; |
52 |
|
|
simError(); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
status = 0; |
56 |
|
|
|
57 |
tim |
1740 |
makeAtype(&atp_, &status); |
58 |
gezelter |
1632 |
|
59 |
|
|
if (status != 0) { |
60 |
|
|
sprintf( painCave.errMsg, |
61 |
tim |
1740 |
"Fortran rejected AtomType %s!\n", name_.c_str()); |
62 |
gezelter |
1632 |
painCave.severity = OOPSE_ERROR; |
63 |
|
|
painCave.isFatal = 1; |
64 |
|
|
simError(); |
65 |
|
|
} |
66 |
|
|
} |
67 |
tim |
1740 |
|
68 |
|
|
void AtomType::addProperty(GenericData* genData) { |
69 |
|
|
properties_.addProperty(genData); |
70 |
gezelter |
1632 |
} |
71 |
tim |
1740 |
|
72 |
|
|
void AtomType::removeProperty(const std::string& propName) { |
73 |
|
|
properties_.removeProperty(propName); |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
void AtomType::clearProperties() { |
77 |
|
|
properties_.clearProperties(); |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
std::vector<std::string> AtomType::getPropertyNames() { |
81 |
|
|
return properties_.getPropertyNames(); |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
std::vector<GenericData*> AtomType::getProperties() { |
85 |
|
|
return properties_.getProperties(); |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
GenericData* AtomType::getPropertyByName(const std::string& propName) { |
89 |
|
|
return properties_.getPropertyByName(propName); |
90 |
|
|
} |
91 |
|
|
} |