ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/types/AtomType.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/types/AtomType.cpp (file contents):
Revision 3157 by chuckv, Mon Jul 9 21:11:20 2007 UTC vs.
Revision 3172 by gezelter, Fri Jul 13 17:37:25 2007 UTC

# Line 57 | Line 57 | namespace oopse {
57      
58      // initialize to an error:
59      atp.ident = -1;
60 <
60 >    
61      // and mass_less:
62      mass_ = 0.0;
63      
# Line 75 | Line 75 | namespace oopse {
75      atp.is_Shape = 0;
76      atp.is_FLARB = 0;  
77      atp.is_SC = 0;
78    atp.is_MnM = 0;
78    }
79 <    
79 >  
80    void AtomType::makeFortranAtomType() {
81      
82      int status;
83 <
83 >    
84      if (name_.empty()) {
85        sprintf( painCave.errMsg,
86                 "Attempting to complete an AtomType without giving "
# Line 99 | Line 98 | namespace oopse {
98        painCave.isFatal = 1;
99        simError();          
100      }
101 <
101 >    
102      status = 0;
103      
104      makeAtype(&atp, &status);  
# Line 112 | Line 111 | namespace oopse {
111        simError();          
112      }
113    }
114 <
115 <
114 >  
115 >  
116    void AtomType::complete() {
117      int isError;
118      GenericData* data;
# Line 123 | Line 122 | namespace oopse {
122        data = getPropertyByName("LennardJones");
123        if (data != NULL) {
124          LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data);
125 <
125 >        
126          if (ljData != NULL) {
127            LJParam ljParam = ljData->getData();
128 <                
129 <          newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon, &ljParam.soft_pot,
130 <              &isError);
131 <
128 >          
129 >          newLJtype(&atp.ident, &ljParam.sigma, &ljParam.epsilon,
130 >                    &ljParam.soft_pot, &isError);
131 >          
132            if (isError != 0) {
133              sprintf( painCave.errMsg,
134                       "Fortran rejected newLJtype\n");
# Line 137 | Line 136 | namespace oopse {
136              painCave.isFatal = 1;
137              simError();          
138            }
139 <                
139 >          
140          } else {
141            sprintf( painCave.errMsg,
142                     "Can not cast GenericData to LJParam\n");
# Line 152 | Line 151 | namespace oopse {
151          simError();          
152        }
153      }
154 <
154 >    
155      if (isElectrostatic()) {
156        newElectrostaticType(&atp, &isError);
157        if (isError != 0) {
# Line 163 | Line 162 | namespace oopse {
162          simError();          
163        }
164      }
165 <      
165 >    
166      if (isCharge()) {
167        data = getPropertyByName("Charge");
168        if (data != NULL) {
169          DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
170 <
170 >        
171          if (doubleData != NULL) {
172            RealType charge = doubleData->getData();
173            setCharge(&atp.ident, &charge, &isError);
174 <                
174 >          
175            if (isError != 0) {
176              sprintf( painCave.errMsg,
177                       "Fortran rejected setCharge\n");
# Line 194 | Line 193 | namespace oopse {
193          simError();          
194        }
195      }
196 <
196 >    
197      if (isEAM()) {
198        data = getPropertyByName("EAM");
199        if (data != NULL) {
200          EAMParamGenericData* eamData = dynamic_cast<EAMParamGenericData*>(data);
201 <
201 >        
202          if (eamData != NULL) {
203 <
203 >          
204            EAMParam eamParam = eamData->getData();
205 <                
206 <
207 <          newEAMtype(&eamParam.latticeConstant, &eamParam.nrho, &eamParam.drho,  
208 <               &eamParam.nr, &eamParam.dr, &eamParam.rcut, &eamParam.rvals[0],
209 <               &eamParam.rhovals[0], &eamParam.Frhovals[0], &atp.ident,
210 <               &isError );
211 <
205 >          
206 >          
207 >          newEAMtype(&eamParam.latticeConstant, &eamParam.nrho,
208 >                     &eamParam.drho,  &eamParam.nr, &eamParam.dr,
209 >                     &eamParam.rcut, &eamParam.rvals[0], &eamParam.rhovals[0],
210 >                     &eamParam.Frhovals[0], &atp.ident, &isError );
211 >          
212            if (isError != 0) {
213              sprintf( painCave.errMsg,
214                       "Fortran rejected newEAMtype\n");
# Line 231 | Line 230 | namespace oopse {
230          simError();          
231        }
232      }
234
233      
234 +    
235      if (isSC()) {
236        data = getPropertyByName("SC");
237        if (data != NULL) {
# Line 241 | Line 240 | namespace oopse {
240          if (SCData != NULL) {
241            
242            SCParam scParam = SCData->getData();
243 <          
245 <          
243 >                    
244            newSCtype(&atp.ident, &scParam.c, &scParam.m,  
245 <                     &scParam.n, &scParam.alpha, &scParam.epsilon,
246 <                     &isError );
245 >                    &scParam.n, &scParam.alpha, &scParam.epsilon,
246 >                    &isError );
247            
248            if (isError != 0) {
249              sprintf( painCave.errMsg,
# Line 268 | Line 266 | namespace oopse {
266          simError();          
267        }
268      }
271    
272      
273    
269    }
270  
271    void AtomType::addProperty(GenericData* genData) {
272      properties_.addProperty(genData);  
273    }
274 <
274 >  
275    void AtomType::removeProperty(const std::string& propName) {
276      properties_.removeProperty(propName);  
277    }
278 <
278 >  
279    void AtomType::clearProperties() {
280      properties_.clearProperties();
281    }
282 <
282 >  
283    std::vector<std::string> AtomType::getPropertyNames() {
284      return properties_.getPropertyNames();  
285    }
286 <      
286 >  
287    std::vector<GenericData*> AtomType::getProperties() {
288      return properties_.getProperties();
289    }
290 <
290 >  
291    GenericData* AtomType::getPropertyByName(const std::string& propName) {
292      return properties_.getPropertyByName(propName);
293    }  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines