mcpele
1.0.0
The Monte Carlo Python Energy Landscape Explorer
|
#include <inversepower.h>
Public Member Functions | |
InversePower_interaction (double pow, double eps, Array< double > const radii) | |
double | energy (double r2, size_t atomi, size_t atomj) const |
double | energy_gradient (double r2, double *gij, size_t atomi, size_t atomj) const |
double | energy_gradient_hessian (double r2, double *gij, double *hij, size_t atomi, size_t atomj) const |
Public Attributes | |
double const | _eps |
double const | _pow |
Array< double > const | _radii |
Pairwise interaction for Inverse power potential eps/pow * (1 - r/r0)^pow the radii array allows for polydispersity The most common exponents are: pow=2 -> Hookean interaction pow=2.5 -> Hertzian interaction
Comments about this implementation:
This implementation is using STL pow for all exponents. Performance wise this may not be the fastest possible implementation, for instance using exp(pow*log) could be faster (twice as fast according to some blogs). Another possibility is to make the power a template parameter and then write template specialisations for the most common exponents, this however makes the interface with python ugly because cython does not deal well with template integer/double parameter yet.
So in the interest of simplicity I would keep the implementation as is for now, maybe we should consider a function that calls exp(pow*log) though, this should be carefully benchmarked though as my guess is that the improvement is going to be marginal and will depend on the architecture (how well pow, exp and log can be optimized on a given architecture).
If you have any experience with pow please suggest any better solution and/or provide a faster implementation.
Definition at line 40 of file inversepower.h.
pele::InversePower_interaction::InversePower_interaction | ( | double | pow, |
double | eps, | ||
Array< double > const | radii | ||
) | [inline] |
Definition at line 45 of file inversepower.h.
double pele::InversePower_interaction::energy | ( | double | r2, |
size_t | atomi, | ||
size_t | atomj | ||
) | const [inline] |
Definition at line 52 of file inversepower.h.
double pele::InversePower_interaction::energy_gradient | ( | double | r2, |
double * | gij, | ||
size_t | atomi, | ||
size_t | atomj | ||
) | const [inline] |
Definition at line 66 of file inversepower.h.
double pele::InversePower_interaction::energy_gradient_hessian | ( | double | r2, |
double * | gij, | ||
double * | hij, | ||
size_t | atomi, | ||
size_t | atomj | ||
) | const [inline] |
Definition at line 84 of file inversepower.h.
double const pele::InversePower_interaction::_eps |
Definition at line 41 of file inversepower.h.
double const pele::InversePower_interaction::_pow |
Definition at line 42 of file inversepower.h.
Array<double> const pele::InversePower_interaction::_radii |
Definition at line 43 of file inversepower.h.