ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/integrators/LDForceManager.cpp
(Generate patch)

Comparing branches/development/src/integrators/LDForceManager.cpp (file contents):
Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC vs.
Revision 1710 by gezelter, Fri May 18 21:44:02 2012 UTC

# Line 47 | Line 47
47   #include "hydrodynamics/Sphere.hpp"
48   #include "hydrodynamics/Ellipsoid.hpp"
49   #include "utils/ElementsTable.hpp"
50 + #include "types/LennardJonesAdapter.hpp"
51 + #include "types/GayBerneAdapter.hpp"
52  
53   namespace OpenMD {
54  
# Line 157 | Line 159 | namespace OpenMD {
159            if (integrableObject->isAtom()){
160              Atom* atom = static_cast<Atom*>(integrableObject);
161              AtomType* atomType = atom->getAtomType();
162 <            if (atomType->isGayBerne()) {
163 <              DirectionalAtomType* dAtomType = dynamic_cast<DirectionalAtomType*>(atomType);              
164 <              GenericData* data = dAtomType->getPropertyByName("GayBerne");
165 <              if (data != NULL) {
166 <                GayBerneParamGenericData* gayBerneData = dynamic_cast<GayBerneParamGenericData*>(data);
165 <                
166 <                if (gayBerneData != NULL) {  
167 <                  GayBerneParam gayBerneParam = gayBerneData->getData();
168 <                  currShape = new Ellipsoid(V3Zero,
169 <                                            gayBerneParam.GB_l / 2.0,
170 <                                            gayBerneParam.GB_d / 2.0,
171 <                                            Mat3x3d::identity());
172 <                } else {
173 <                  sprintf( painCave.errMsg,
174 <                           "Can not cast GenericData to GayBerneParam\n");
175 <                  painCave.severity = OPENMD_ERROR;
176 <                  painCave.isFatal = 1;
177 <                  simError();  
178 <                }
179 <              } else {
180 <                sprintf( painCave.errMsg, "Can not find Parameters for GayBerne\n");
181 <                painCave.severity = OPENMD_ERROR;
182 <                painCave.isFatal = 1;
183 <                simError();    
184 <              }
162 >            GayBerneAdapter gba = GayBerneAdapter(atomType);
163 >            if (gba.isGayBerne()) {
164 >              currShape = new Ellipsoid(V3Zero, gba.getL() / 2.0,
165 >                                        gba.getD() / 2.0,
166 >                                        Mat3x3d::identity());
167              } else {
168 <              if (atomType->isLennardJones()){
169 <                GenericData* data = atomType->getPropertyByName("LennardJones");
170 <                if (data != NULL) {
189 <                  LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data);
190 <                  if (ljData != NULL) {
191 <                    LJParam ljParam = ljData->getData();
192 <                    currShape = new Sphere(atom->getPos(), ljParam.sigma/2.0);
193 <                  } else {
194 <                    sprintf( painCave.errMsg,
195 <                             "Can not cast GenericData to LJParam\n");
196 <                    painCave.severity = OPENMD_ERROR;
197 <                    painCave.isFatal = 1;
198 <                    simError();          
199 <                  }      
200 <                }
168 >              LennardJonesAdapter lja = LennardJonesAdapter(atomType);
169 >              if (lja.isLennardJones()){
170 >                currShape = new Sphere(atom->getPos(), lja.getSigma()/2.0);
171                } else {
172                  int aNum = etab.GetAtomicNum((atom->getType()).c_str());
173                  if (aNum != 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines