mlund / faunus

A Framework for Metropolis Monte Carlo Simulation of Molecular Systems
https://faunus.readthedocs.io
MIT License
65 stars 34 forks source link

Splining of Yukawa fails #301

Closed mlund closed 4 years ago

mlund commented 4 years ago

Using nonbonded_splined with Yukawa potentials fails as the energy doesn't seem to go to zero at the cutoff. In turn this triggers an infinite loop here: https://github.com/mlund/faunus/blob/f94ab0c1036e7b2e54f00ce02243591a40628207/src/potentials.cpp#L556

Under the hood, yukawa is CoulombGalore::Poisson with C=1 and D=-1.

Example:

    - nonbonded_splined:
        default: 
            - lennardjones: {mixing: LB}
            - coulomb: {type: yukawa, epsr: 80, cutoff: 100, debyelength: 100}

Ping @bjornstenqvist

Todo:

bjornstenqvist commented 4 years ago

C=1 and D=-1 gives "plain" Yukawa. So the short-ranged function, and hence the energy, should not go to zero at the cutoff in this case. For a Wolf-like Yukawa then C=1 and D=0 which gives zero energy at the cutoff (but not zero force).