Unverified Commit a71eb68c authored by Florian Weik's avatar Florian Weik Committed by GitHub

Merge pull request #2505 from fweik/wca

Fixed soft sphere cutoff calculation
parents 4d458af0 58bad33e
Pipeline #5513 passed with stages
in 61 minutes and 31 seconds
......@@ -70,6 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SOFT_SPHERE
#define INTER_RF
#define OVERLAPPED
#define WCA
#ifdef P3M
#define THOLE
......
......@@ -71,8 +71,10 @@
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/range/algorithm/fill.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include <cstdlib>
#include <cstring>
......@@ -303,8 +305,8 @@ static void recalc_maximal_cutoff_nonbonded() {
#endif
#ifdef SOFT_SPHERE
if (max_cut_current < data->soft_cut)
max_cut_current = data->soft_cut;
if (max_cut_current < (data->soft_cut + data->soft_offset))
max_cut_current = (data->soft_cut + data->soft_offset);
#endif
#ifdef AFFINITY
......@@ -417,6 +419,11 @@ void realloc_ia_params(int nsize) {
std::swap(ia_params, new_params);
}
void reset_ia_params() {
boost::fill(ia_params, IA_parameters{});
mpi_bcast_all_ia_params();
}
bool is_new_particle_type(int type) {
if ((type + 1) <= max_seen_particle_type)
return false;
......
......@@ -410,9 +410,6 @@ extern double dipolar_cutoff;
(through ghosts). */
extern double min_global_cut;
/** Switch for nonbonded interaction exclusion */
extern int ia_excl;
/************************************************
* exported functions
************************************************/
......@@ -474,6 +471,11 @@ void realloc_ia_params(int nsize);
value is used in the Verlet pair list algorithm. */
void recalc_maximal_cutoff();
/**
* @brief Reset all interaction parameters to their defaults.
*/
void reset_ia_params();
/** check whether all force calculation routines are properly initialized. */
int interactions_sanity_checks();
......
......@@ -155,6 +155,7 @@ cdef extern from "nonbonded_interactions/nonbonded_interaction_data.hpp":
cdef IA_parameters * get_ia_param_safe(int i, int j)
cdef string ia_params_get_state()
cdef void ia_params_set_state(string)
cdef void reset_ia_params()
cdef extern from "bonded_interactions/bonded_interaction_data.hpp":
cdef void make_bond_type_exist(int type)
......
......@@ -1820,6 +1820,13 @@ cdef class NonBondedInteractions(object):
cdef string state = core_state
ia_params_set_state(state)
def reset(self):
"""
Reset all interaction parameters to their default
values.
"""
reset_ia_params()
cdef class BondedInteraction(object):
"""Base class for bonded interactions.
......
......@@ -43,7 +43,7 @@ class InteractionsNonBondedTest(ut.TestCase):
self.system.part.add(id=1, pos=self.start_pos, type=0)
def tearDown(self):
self.system.non_bonded_inter.reset()
self.system.part.clear()
# Required, since assertAlmostEqual does NOT check significant places
......@@ -476,7 +476,6 @@ class InteractionsNonBondedTest(ut.TestCase):
@ut.skipIf(not espressomd.has_features("SOFT_SPHERE"),
"Features not available, skipping test!")
def test_soft_sphere(self):
ss_a = 1.92
ss_n = 3.03
ss_cut = 1.123
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment