| 52 |
|
#include "UseTheForce/ForceField.hpp" |
| 53 |
|
#include "utils/simError.h" |
| 54 |
|
#include "utils/Tuple.hpp" |
| 55 |
+ |
#include "types/LennardJonesAdapter.hpp" |
| 56 |
+ |
|
| 57 |
|
namespace OpenMD { |
| 58 |
|
|
| 59 |
|
ForceField::ForceField() { |
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
RealType ForceField::getRcutFromAtomType(AtomType* at) { |
| 638 |
– |
/**@todo */ |
| 639 |
– |
GenericData* data; |
| 640 |
|
RealType rcut = 0.0; |
| 641 |
|
|
| 642 |
< |
if (at->isLennardJones()) { |
| 643 |
< |
data = at->getPropertyByName("LennardJones"); |
| 644 |
< |
if (data != NULL) { |
| 645 |
< |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
| 646 |
< |
|
| 647 |
< |
if (ljData != NULL) { |
| 648 |
< |
LJParam ljParam = ljData->getData(); |
| 649 |
< |
|
| 650 |
< |
//by default use 2.5*sigma as cutoff radius |
| 651 |
< |
rcut = 2.5 * ljParam.sigma; |
| 652 |
< |
|
| 653 |
< |
} else { |
| 654 |
< |
sprintf( painCave.errMsg, |
| 655 |
< |
"Can not cast GenericData to LJParam\n"); |
| 656 |
< |
painCave.severity = OPENMD_ERROR; |
| 657 |
< |
painCave.isFatal = 1; |
| 658 |
< |
simError(); |
| 659 |
< |
} |
| 660 |
< |
} else { |
| 661 |
< |
sprintf( painCave.errMsg, "Can not find Parameters for LennardJones\n"); |
| 662 |
< |
painCave.severity = OPENMD_ERROR; |
| 663 |
< |
painCave.isFatal = 1; |
| 664 |
< |
simError(); |
| 665 |
< |
} |
| 642 |
> |
LennardJonesAdapter lja = LennardJonesAdapter(at); |
| 643 |
> |
if (lja.isLennardJones()) { |
| 644 |
> |
rcut = 2.5 * lja.getSigma(); |
| 645 |
|
} |
| 646 |
|
return rcut; |
| 647 |
|
} |