1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
58 |
|
#include "utils/simError.h" |
59 |
|
namespace oopse { |
60 |
|
|
61 |
< |
EAM_FF::EAM_FF(){ |
61 |
> |
EAM_FF::EAM_FF(){ |
62 |
|
|
63 |
|
//set default force field filename |
64 |
|
setForceFieldFileName("EAM.frc"); |
84 |
|
spMan_.push_back(new BendTypesSectionParser()); |
85 |
|
spMan_.push_back(new TorsionTypesSectionParser()); |
86 |
|
|
87 |
< |
} |
87 |
> |
} |
88 |
|
|
89 |
< |
void EAM_FF::parse(const std::string& filename) { |
89 |
> |
void EAM_FF::parse(const std::string& filename) { |
90 |
|
ifstrstream* ffStream; |
91 |
|
ffStream = openForceFieldFile(filename); |
92 |
|
|
96 |
|
AtomType* at; |
97 |
|
|
98 |
|
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
99 |
< |
at->makeFortranAtomType(); |
99 |
> |
at->makeFortranAtomType(); |
100 |
|
} |
101 |
|
|
102 |
|
for (at = atomTypeCont_.beginType(i); at != NULL; at = atomTypeCont_.nextType(i)) { |
103 |
< |
at->complete(); |
103 |
> |
at->complete(); |
104 |
|
} |
105 |
|
|
106 |
|
delete ffStream; |
107 |
< |
} |
107 |
> |
} |
108 |
|
|
109 |
|
|
110 |
< |
double EAM_FF::getRcutFromAtomType(AtomType* at){ |
110 |
> |
double EAM_FF::getRcutFromAtomType(AtomType* at){ |
111 |
|
double rcut = 0.0; |
112 |
|
if (at->isEAM()) { |
113 |
< |
GenericData* data = at->getPropertyByName("EAM"); |
114 |
< |
if (data != NULL) { |
115 |
< |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
113 |
> |
GenericData* data = at->getPropertyByName("EAM"); |
114 |
> |
if (data != NULL) { |
115 |
> |
EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data); |
116 |
|
|
117 |
< |
if (eamData != NULL) { |
117 |
> |
if (eamData != NULL) { |
118 |
|
|
119 |
< |
EAMParam& eamParam = eamData->getData(); |
120 |
< |
rcut = eamParam.rcut; |
121 |
< |
} else { |
122 |
< |
sprintf( painCave.errMsg, |
123 |
< |
"Can not cast GenericData to EAMParam\n"); |
124 |
< |
painCave.severity = OOPSE_ERROR; |
125 |
< |
painCave.isFatal = 1; |
126 |
< |
simError(); |
127 |
< |
} |
128 |
< |
} else { |
129 |
< |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
130 |
< |
painCave.severity = OOPSE_ERROR; |
131 |
< |
painCave.isFatal = 1; |
132 |
< |
simError(); |
133 |
< |
} |
119 |
> |
EAMParam& eamParam = eamData->getData(); |
120 |
> |
rcut = eamParam.rcut; |
121 |
> |
} else { |
122 |
> |
sprintf( painCave.errMsg, |
123 |
> |
"Can not cast GenericData to EAMParam\n"); |
124 |
> |
painCave.severity = OOPSE_ERROR; |
125 |
> |
painCave.isFatal = 1; |
126 |
> |
simError(); |
127 |
> |
} |
128 |
> |
} else { |
129 |
> |
sprintf( painCave.errMsg, "Can not find EAM Parameters\n"); |
130 |
> |
painCave.severity = OOPSE_ERROR; |
131 |
> |
painCave.isFatal = 1; |
132 |
> |
simError(); |
133 |
> |
} |
134 |
|
} else { |
135 |
< |
rcut = ForceField::getRcutFromAtomType(at); |
135 |
> |
rcut = ForceField::getRcutFromAtomType(at); |
136 |
|
} |
137 |
|
|
138 |
|
return rcut; |
139 |
< |
} |
139 |
> |
} |
140 |
|
|
141 |
|
EAM_FF::~EAM_FF(){ |
142 |
|
// We need to clean up the fortran side so we don't have bad things happen if |