Inverse power potential

Implemented an inverse power potential to simulate systems of (polydisperse) soft spheres. This includes for example Hookean interactions (pow=2) and Hertzian interaction (pow=2.5).

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.    
ok I should have fixed all the indentation issues


On Fri, Aug 8, 2014 at 11:53 AM, Jacob Stevenson <notifications@github.com>
wrote:

> In source/pele/inversepower.h:
>
> > +};
> > +
> > +
> > +//
> > +// combine the components (interaction, looping method, distance function) into
> > +// defined classes
> > +//
> > +
> > +/**
> > + * Pairwise Inverse Power potential
> > + */
> > +template <size_t ndim>
> > +class InversePower : public SimplePairwisePotential< InversePower_interaction, cartesian_distance<ndim>> {
> > +public:
> > +    InversePower(double pow, double eps, pele::Array<double> const radii)
> > +    : SimplePairwisePotential< InversePower_interaction, cartesian_distance<ndim>>(
>
> see, e.g.
> https://github.com/pele-python/pele/blob/master/source/pele/lj.h#L118
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/pele-python/pele/pull/59/files#r15987239>.
>