From 72f1b874d1905e0f2d7f721fde9d320e88f8c221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 30 Dec 2020 10:36:46 +0100 Subject: [PATCH 1/3] core: Remove harmonic dumbbell bond The bond was removed in 12e4de8580739030fe34db3ba8f077aa6ae36042 --- .../bonded_interaction_data.hpp | 14 -------------- src/python/espressomd/interactions.pxd | 14 -------------- 2 files changed, 28 deletions(-) diff --git a/src/core/bonded_interactions/bonded_interaction_data.hpp b/src/core/bonded_interactions/bonded_interaction_data.hpp index 1157c9af55e..1eef0c32ce5 100644 --- a/src/core/bonded_interactions/bonded_interaction_data.hpp +++ b/src/core/bonded_interactions/bonded_interaction_data.hpp @@ -178,20 +178,6 @@ struct Thermalized_bond_parameters { double cutoff() const { return r_cut; } }; -/** Parameters for harmonic dumbbell bond Potential */ -struct Harmonic_dumbbell_bond_parameters { - /** spring constant */ - double k1; - /** rotation constant */ - double k2; - /** equilibrium bond length */ - double r; - /** cutoff bond length */ - double r_cut; - - double cutoff() const { return r_cut; } -}; - /** Parameters for quartic bond Potential */ struct Quartic_bond_parameters { double k0, k1; diff --git a/src/python/espressomd/interactions.pxd b/src/python/espressomd/interactions.pxd index 765fa702529..260aa2cc2e1 100644 --- a/src/python/espressomd/interactions.pxd +++ b/src/python/espressomd/interactions.pxd @@ -304,20 +304,6 @@ IF TABULATED: double min, double max, vector[double] energy, vector[double] force) -IF ROTATION: - cdef extern from "bonded_interactions/bonded_interaction_data.hpp": - #* Parameters for the harmonic dumbbell bond potential */ - cdef struct Harmonic_dumbbell_bond_parameters: - double k1 - double k2 - double r - double r_cut -ELSE: - cdef struct Harmonic_dumbbell_bond_parameters: - double k1 - double k2 - double r - double r_cut cdef extern from "bonded_interactions/bonded_interaction_data.hpp": #* Parameters for n-body tabulated potential (n=2,3,4). */ From 2100ecc0205e577076d83d0914dd51562640781e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 30 Dec 2020 10:58:33 +0100 Subject: [PATCH 2/3] core: Remove umbrella bond The umbrella force/energy kernels are untested, have no Python interface and no documentation. --- src/core/bonded_interactions/CMakeLists.txt | 3 +- .../bonded_interaction_data.cpp | 2 - .../bonded_interaction_data.hpp | 13 --- src/core/bonded_interactions/umbrella.cpp | 50 ------------ src/core/bonded_interactions/umbrella.hpp | 81 ------------------- src/core/energy_inline.hpp | 3 - src/core/forces_inline.hpp | 3 - src/python/espressomd/interactions.pxd | 7 -- 8 files changed, 1 insertion(+), 161 deletions(-) delete mode 100644 src/core/bonded_interactions/umbrella.cpp delete mode 100644 src/core/bonded_interactions/umbrella.hpp diff --git a/src/core/bonded_interactions/CMakeLists.txt b/src/core/bonded_interactions/CMakeLists.txt index 364998ba22b..acff1e20ca1 100644 --- a/src/core/bonded_interactions/CMakeLists.txt +++ b/src/core/bonded_interactions/CMakeLists.txt @@ -11,5 +11,4 @@ target_sources( ${CMAKE_CURRENT_SOURCE_DIR}/fene.cpp ${CMAKE_CURRENT_SOURCE_DIR}/harmonic.cpp ${CMAKE_CURRENT_SOURCE_DIR}/quartic.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/thermalized_bond.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/umbrella.cpp) + ${CMAKE_CURRENT_SOURCE_DIR}/thermalized_bond.cpp) diff --git a/src/core/bonded_interactions/bonded_interaction_data.cpp b/src/core/bonded_interactions/bonded_interaction_data.cpp index 996f246cef8..ed749a7e3aa 100644 --- a/src/core/bonded_interactions/bonded_interaction_data.cpp +++ b/src/core/bonded_interactions/bonded_interaction_data.cpp @@ -68,8 +68,6 @@ auto cutoff(int type, Bond_parameters const &bp) { return bp.ibmVolConsParameters.cutoff(); case BONDED_IA_IBM_TRIBEND: return bp.ibm_tribend.cutoff(); - case BONDED_IA_UMBRELLA: - return bp.umbrella.cutoff(); case BONDED_IA_THERMALIZED_DIST: return bp.thermalized_bond.cutoff(); default: diff --git a/src/core/bonded_interactions/bonded_interaction_data.hpp b/src/core/bonded_interactions/bonded_interaction_data.hpp index 1eef0c32ce5..c4577e89cef 100644 --- a/src/core/bonded_interactions/bonded_interaction_data.hpp +++ b/src/core/bonded_interactions/bonded_interaction_data.hpp @@ -27,7 +27,6 @@ #include #include -#include #include /** Type codes of bonded interactions. */ @@ -76,8 +75,6 @@ enum BondedInteraction : int { BONDED_IA_IBM_VOLUME_CONSERVATION, /** Type of bonded interaction is bending force (immersed boundary). */ BONDED_IA_IBM_TRIBEND, - /** Type of bonded interaction is umbrella. */ - BONDED_IA_UMBRELLA, /** Type of bonded interaction is thermalized distance bond. */ BONDED_IA_THERMALIZED_DIST, }; @@ -263,15 +260,6 @@ struct Tabulated_bond_parameters { } }; -/** Parameters for umbrella potential */ -struct Umbrella_bond_parameters { - double k; - int dir; - double r; - - double cutoff() const { return std::numeric_limits::infinity(); } -}; - /** Parameters for the rigid_bond/SHAKE/RATTLE ALGORITHM */ struct Rigid_bond_parameters { /** Square of the length of Constrained Bond */ @@ -358,7 +346,6 @@ union Bond_parameters { Angle_cossquare_bond_parameters angle_cossquare; Dihedral_bond_parameters dihedral; Tabulated_bond_parameters tab; - Umbrella_bond_parameters umbrella; Thermalized_bond_parameters thermalized_bond; Rigid_bond_parameters rigid_bond; IBM_Triel_Parameters ibm_triel; diff --git a/src/core/bonded_interactions/umbrella.cpp b/src/core/bonded_interactions/umbrella.cpp deleted file mode 100644 index e001a0ef075..00000000000 --- a/src/core/bonded_interactions/umbrella.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2010-2019 The ESPResSo project - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 - * Max-Planck-Institute for Polymer Research, Theory Group - * - * This file is part of ESPResSo. - * - * ESPResSo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ESPResSo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -/** \file - * - * Implementation of \ref umbrella.hpp - */ - -#include "config.hpp" - -#include "umbrella.hpp" - -#include "interactions.hpp" - -#include - -int umbrella_set_params(int bond_type, double k, int dir, double r) { - if (bond_type < 0) - return ES_ERROR; - - make_bond_type_exist(bond_type); - - bonded_ia_params[bond_type].p.umbrella.k = k; - bonded_ia_params[bond_type].p.umbrella.dir = dir; - bonded_ia_params[bond_type].p.umbrella.r = r; - bonded_ia_params[bond_type].type = BONDED_IA_UMBRELLA; - bonded_ia_params[bond_type].num = 1; - - /* broadcast interaction parameters */ - mpi_bcast_ia_params(bond_type, -1); - - return ES_OK; -} diff --git a/src/core/bonded_interactions/umbrella.hpp b/src/core/bonded_interactions/umbrella.hpp deleted file mode 100644 index 57fab960746..00000000000 --- a/src/core/bonded_interactions/umbrella.hpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2010-2019 The ESPResSo project - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 - * Max-Planck-Institute for Polymer Research, Theory Group - * - * This file is part of ESPResSo. - * - * ESPResSo is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ESPResSo is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef umbrella_H -#define umbrella_H - -/** \file - * Routines to calculate the umbrella potential (harmonic interaction in only - * one Cartesian direction) between particle pairs. Useful for umbrella - * sampling simulations. - * - * Implementation in \ref umbrella.cpp. - */ - -#include "config.hpp" - -#include "bonded_interactions/bonded_interaction_data.hpp" -#include "nonbonded_interactions/nonbonded_interaction_data.hpp" - -#include -#include - -#include - -/** Set the parameters of an umbrella bond - * - * @retval ES_OK on success - * @retval ES_ERROR on error - */ -int umbrella_set_params(int bond_type, double k, int dir, double r); - -/** Resultant force due to an umbrella potential */ -inline double umbrella_force_r(double k, int dir, double r, double distn) { - return -k * (distn - r); -} - -/** Compute the umbrella bond length force. - * @param[in] ia_params Bonded parameters for the pair interaction. - * @param[in] d %Distance between the particles. - */ -inline boost::optional -umbrella_pair_force(Bonded_ia_parameters const &ia_params, - Utils::Vector3d const &d) { - auto const distn = d[ia_params.p.umbrella.dir]; - auto const fac = -ia_params.p.umbrella.k * (distn - ia_params.p.umbrella.r); - Utils::Vector3d force{}; - force[ia_params.p.umbrella.dir] = fac; - - return force; -} - -/** Compute the umbrella bond length energy. - * @param[in] ia_params Bonded parameters for the pair interaction. - * @param[in] d %Distance between the particles. - */ -inline boost::optional -umbrella_pair_energy(Bonded_ia_parameters const &ia_params, - Utils::Vector3d const &d) { - auto const distn = d[ia_params.p.umbrella.dir]; - return 0.5 * ia_params.p.umbrella.k * - Utils::sqr(distn - ia_params.p.umbrella.r); -} - -#endif diff --git a/src/core/energy_inline.hpp b/src/core/energy_inline.hpp index 8422eff781a..2a9da8a74a8 100644 --- a/src/core/energy_inline.hpp +++ b/src/core/energy_inline.hpp @@ -37,7 +37,6 @@ #include "bonded_interactions/fene.hpp" #include "bonded_interactions/harmonic.hpp" #include "bonded_interactions/quartic.hpp" -#include "bonded_interactions/umbrella.hpp" #include "nonbonded_interactions/bmhtf-nacl.hpp" #include "nonbonded_interactions/buckingham.hpp" #include "nonbonded_interactions/gaussian.hpp" @@ -242,8 +241,6 @@ calc_bonded_energy(Bonded_ia_parameters const &iaparams, Particle const &p1, #endif case BONDED_IA_TABULATED_DISTANCE: return tab_bond_energy(iaparams, dx); - case BONDED_IA_UMBRELLA: - return umbrella_pair_energy(iaparams, dx); case BONDED_IA_VIRTUAL_BOND: return boost::optional(0); default: diff --git a/src/core/forces_inline.hpp b/src/core/forces_inline.hpp index 6f1dee902d1..50292f92592 100644 --- a/src/core/forces_inline.hpp +++ b/src/core/forces_inline.hpp @@ -35,7 +35,6 @@ #include "bonded_interactions/harmonic.hpp" #include "bonded_interactions/quartic.hpp" #include "bonded_interactions/thermalized_bond.hpp" -#include "bonded_interactions/umbrella.hpp" #include "immersed_boundary/ibm_tribend.hpp" #include "immersed_boundary/ibm_triel.hpp" #include "nonbonded_interactions/bmhtf-nacl.hpp" @@ -333,8 +332,6 @@ calc_bond_pair_force(Particle const &p1, Particle const &p2, #endif case BONDED_IA_TABULATED_DISTANCE: return tab_bond_force(iaparams, dx); - case BONDED_IA_UMBRELLA: - return umbrella_pair_force(iaparams, dx); case BONDED_IA_VIRTUAL_BOND: case BONDED_IA_RIGID_BOND: return Utils::Vector3d{}; diff --git a/src/python/espressomd/interactions.pxd b/src/python/espressomd/interactions.pxd index 260aa2cc2e1..fac547d839b 100644 --- a/src/python/espressomd/interactions.pxd +++ b/src/python/espressomd/interactions.pxd @@ -399,12 +399,6 @@ cdef extern from "bonded_interactions/bonded_interaction_data.hpp": double * para_b double * para_c - #* Parameters for one-directional harmonic potential */ - cdef struct Umbrella_bond_parameters: - double k - int dir - double r - #* Parameters for subt-LJ potential */ cdef struct Subt_lj_bond_parameters: double k @@ -574,6 +568,5 @@ cdef extern from "bonded_interactions/bonded_interaction_data.hpp": BONDED_IA_IBM_TRIEL, BONDED_IA_IBM_TRIBEND, BONDED_IA_IBM_VOLUME_CONSERVATION, - BONDED_IA_UMBRELLA, BONDED_IA_THERMALIZED_DIST BONDED_IA_QUARTIC From 2565a369af54d049a6f2e377208f5fd4e4ec56d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 7 Jan 2021 19:22:28 +0100 Subject: [PATCH 3/3] core: Remove unused thermostat update function The feature was removed in 2e4f50d048721251c3563bc07f9949b49085a129 --- src/core/bonded_interactions/thermalized_bond.cpp | 11 ----------- src/core/bonded_interactions/thermalized_bond.hpp | 1 - 2 files changed, 12 deletions(-) diff --git a/src/core/bonded_interactions/thermalized_bond.cpp b/src/core/bonded_interactions/thermalized_bond.cpp index ca10469e751..8960d391a16 100644 --- a/src/core/bonded_interactions/thermalized_bond.cpp +++ b/src/core/bonded_interactions/thermalized_bond.cpp @@ -79,14 +79,3 @@ void thermalized_bond_init() { } } } - -void thermalized_bond_update_params(double pref_scale) { - - for (auto &bonded_ia_param : bonded_ia_params) { - if (bonded_ia_param.type == BONDED_IA_THERMALIZED_DIST) { - Thermalized_bond_parameters &t = bonded_ia_param.p.thermalized_bond; - t.pref2_com *= pref_scale; - t.pref2_dist *= pref_scale; - } - } -} diff --git a/src/core/bonded_interactions/thermalized_bond.hpp b/src/core/bonded_interactions/thermalized_bond.hpp index 5caaf6e5d7b..35001dd5963 100644 --- a/src/core/bonded_interactions/thermalized_bond.hpp +++ b/src/core/bonded_interactions/thermalized_bond.hpp @@ -52,7 +52,6 @@ int thermalized_bond_set_params(int bond_type, double temp_com, double gamma_com, double temp_distance, double gamma_distance, double r_cut); -void thermalized_bond_update_params(double pref_scale); void thermalized_bond_init(); /** Separately thermalizes the com and distance of a particle pair.