From 7603eb850cd74124f586b9fd0de975844844a267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 10 Oct 2019 17:55:24 +0200 Subject: [PATCH 01/10] Fix links in release notes --- NEWS | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index b250d232c8d..edf7c7a4b90 100644 --- a/NEWS +++ b/NEWS @@ -124,13 +124,13 @@ Interface changes number generation. For the following individual methods a random number seed has to be passed using the keyword argument ``seed``: - * [Langevin thermostat](http://espressomd.org/html/doc/espressomd.html?#espressomd.thermostat.Thermostat.set_langevin) - * [DPD thermostat](http://espressomd.org/html/doc/espressomd.html?#espressomd.thermostat.Thermostat.set_dpd) - * [LB Thermostat](http://espressomd.org/html/doc/espressomd.html?#espressomd.thermostat.Thermostat.set_lb) - * [Thermalized bond](http://espressomd.org/html/doc/espressomd.html?#espressomd.interactions.ThermalizedBond) - * [Wang-Landau reaction ensemble](http://espressomd.org/html/doc/espressomd.html?#module-espressomd.reaction_ensemble) - * [Constant pH ensemble](http://espressomd.org/html/doc/espressomd.html?#espressomd.reaction_ensemble.ConstantpHEnsemble) - * [Widom insertion method](http://espressomd.org/html/doc/espressomd.html?#espressomd.reaction_ensemble.WidomInsertion) + * [Langevin thermostat](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.thermostat.Thermostat.set_langevin) + * [DPD thermostat](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.thermostat.Thermostat.set_dpd) + * [LB Thermostat](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.thermostat.Thermostat.set_lb) + * [Thermalized bond](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.interactions.ThermalizedBond) + * [Wang-Landau reaction ensemble](http://espressomd.org/html/doc4.1.0/espressomd.html?#module-espressomd.reaction_ensemble) + * [Constant pH ensemble](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.reaction_ensemble.ConstantpHEnsemble) + * [Widom insertion method](http://espressomd.org/html/doc4.1.0/espressomd.html?#espressomd.reaction_ensemble.WidomInsertion) * Changes in the lattice-Boltzmann (LB) interface: @@ -143,13 +143,13 @@ Interface changes parameter of the LB thermostat. For more detailed information on how to set up a LB fluid and - thermostat, please see http://espressomd.org/html/doc/lb.html. + thermostat, please see http://espressomd.org/html/doc4.1.0/lb.html. * The method for polymer creation has been replaced. Now ``espressomd.polymer.positions()`` can be used to obtain particle positions for one or more polymer chains. Based on these positions, polymers can be created. For an example please see - http://espressomd.org/html/doc/particles.html#setting-up-polymer-chains. + http://espressomd.org/html/doc4.1.0/particles.html#setting-up-polymer-chains. Changed and removed functionality From 1961cabe89b8af85d17bf9d9df2c45ef336dc7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 10 Oct 2019 18:04:08 +0200 Subject: [PATCH 02/10] Remove duplicate argument documentation Argument descriptions already in the docstrings of the linked functions. --- doc/sphinx/system_setup.rst | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/doc/sphinx/system_setup.rst b/doc/sphinx/system_setup.rst index 31e62393fb0..b941d572567 100644 --- a/doc/sphinx/system_setup.rst +++ b/doc/sphinx/system_setup.rst @@ -412,17 +412,7 @@ Isotropic NPT thermostat This feature allows to simulate an (on average) homogeneous and isotropic system in the NPT ensemble. In order to use this feature, ``NPT`` has to be defined in the :file:`myconfig.hpp`. Activate the NPT thermostat with the command :py:func:`~espressomd.thermostat.Thermostat.set_npt` -and set the following parameters: - - * ``kT``: (float) Thermal energy of the heat bath - * ``gamma0``: (float) Friction coefficient of the bath - * ``gammav``: (float) Artificial friction coefficient for the volume fluctuations. - -Also, setup the integrator for the NPT ensemble with :py:func:`~espressomd.integrate.Integrator.set_isotropic_npt` -and the parameters: - - * ``ext_pressure``: (float) The external pressure. - * ``piston``: (float) The mass of the applied piston. +and setup the integrator for the NPT ensemble with :py:func:`~espressomd.integrate.Integrator.set_isotropic_npt`. For example:: From 9fee2b9a0b2d4c938aa7eac735be8db854b94ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 10 Oct 2019 18:07:17 +0200 Subject: [PATCH 03/10] Fix typos --- NEWS | 2 +- doc/sphinx/installation.rst | 10 +++++----- doc/sphinx/lb.rst | 2 +- doc/sphinx/system_setup.rst | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index edf7c7a4b90..7d2ca453635 100644 --- a/NEWS +++ b/NEWS @@ -368,7 +368,7 @@ Physics related corrections: module did not get assigned a random velocity. This was not a problem if you were looking at observables which do not depend on velocity. - * Particles which were created in the Reaction Ensemble module were assigned a random velocity which was not distributed according to the Maxwell-Boltzmann distribution. This was not a problem if you were looking at observables which do not depend on velocity. If you looked at velocity dependent observables but used a thermostat for thermalization before taking a sample you are also fine. (#2377). + * Particles which were created in the Reaction Ensemble module were assigned a random velocity which was not distributed according to the Maxwell-Boltzmann distribution. This was not a problem if you were looking at observables which do not depend on velocity. If you looked at velocity-dependent observables but used a thermostat for thermalization before taking a sample you are also fine. (#2377). * Under some conditions, the torque on self-propelled particles in a lattice-Boltzmann fluid was incorrect due to a sign error in the diff --git a/doc/sphinx/installation.rst b/doc/sphinx/installation.rst index 34876f44cb2..3c7a48061f0 100644 --- a/doc/sphinx/installation.rst +++ b/doc/sphinx/installation.rst @@ -63,9 +63,9 @@ Cython At least version 0.23 is required. -.. _Installing Requirements on Ubuntu Linux: +.. _Installing requirements on Ubuntu Linux: -Installing Requirements on Ubuntu Linux +Installing requirements on Ubuntu Linux ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make |es| run on 18.04 LTS, its dependencies can be installed with: @@ -114,9 +114,9 @@ ROCm SDK to make use of GPU computation: sudo apt update sudo apt install libnuma-dev rocm-dkms rocblas rocfft rocrand rocthrust -.. _Installing Requirements on Mac OS X: +.. _Installing requirements on Mac OS X: -Installing Requirements on Mac OS X +Installing requirements on Mac OS X ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make |es| run on Mac OS X 10.9 or higher, its dependencies can be @@ -281,7 +281,7 @@ different configuration headers: .. code-block:: c++ #define ELECTROSTATICS - #define LENNARD-JONES + #define LENNARD_JONES * :file:`$builddir2/myconfig.hpp`: diff --git a/doc/sphinx/lb.rst b/doc/sphinx/lb.rst index e9dbb8e56fc..7485c656299 100644 --- a/doc/sphinx/lb.rst +++ b/doc/sphinx/lb.rst @@ -288,7 +288,7 @@ Electrohydrodynamics .. note:: This needs the feature ``LB_ELECTROHYDRODYNAMICS``. -If the feature is activated, the Lattice Boltzmann Code can be +If the feature is activated, the lattice-Boltzmann code can be used to implicitly model surrounding salt ions in an external electric field by having the charged particles create flow. diff --git a/doc/sphinx/system_setup.rst b/doc/sphinx/system_setup.rst index b941d572567..c6d6736b728 100644 --- a/doc/sphinx/system_setup.rst +++ b/doc/sphinx/system_setup.rst @@ -280,7 +280,7 @@ at temperature :math:`T` and satisfies In the |es| implementation of the Langevin thermostat, the additional terms only enter in the force calculation. This reduces the accuracy of the Velocity Verlet integrator -by one order in :math:`dt` because forces are now velocity dependent. +by one order in :math:`dt` because forces are now velocity-dependent. The random process :math:`\eta(t)` is discretized by drawing an uncorrelated random number :math:`\overline{\eta}` for each component of all the particle forces. @@ -380,7 +380,7 @@ The friction coefficients and cutoff are controlled via the see there. The friction (dissipative) and noise (random) term are coupled via the -fluctuation- dissipation theorem. The friction term is a function of the +fluctuation-dissipation theorem. The friction term is a function of the relative velocity of particle pairs. The DPD thermostat is better for dynamics than the Langevin thermostat, since it mimics hydrodynamics in the system. From eb68e3afc89886652aa2d11362a89cfc4f46b64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 10 Oct 2019 18:22:56 +0200 Subject: [PATCH 04/10] Provide links to Dockerfiles for other Linux OSes Based on feedback from the ESPResSo summer school's user and developer meeting (@kosovan). --- doc/sphinx/installation.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/sphinx/installation.rst b/doc/sphinx/installation.rst index 3c7a48061f0..c503707f660 100644 --- a/doc/sphinx/installation.rst +++ b/doc/sphinx/installation.rst @@ -114,6 +114,21 @@ ROCm SDK to make use of GPU computation: sudo apt update sudo apt install libnuma-dev rocm-dkms rocblas rocfft rocrand rocthrust + +.. _Installing requirements on other Linux distributions: + +Installing requirements on other Linux distributions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Please refer to the following Dockerfiles to find the minimum set of packages +required to compile |es| on other Linux distributions: + +* `CentOS 7 `_ +* `Fedora 30 `_ +* `Debian 10 `_ +* `OpenSUSE Leap 15.1 `_ + + .. _Installing requirements on Mac OS X: Installing requirements on Mac OS X From 823af52333cb1b8b0ccb0f4bf064e4e6fdf3a0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Fri, 11 Oct 2019 20:17:04 +0200 Subject: [PATCH 05/10] Fix issue in the NPT documentation Fix broken link, incorrect docstrings and copy-paste errors (based on inspection of the C++ code for the NPT integrator and offline discussion with @christophlohrmann). --- doc/sphinx/analysis.rst | 6 +++--- doc/sphinx/running.rst | 20 ++++++++++---------- doc/sphinx/system_setup.rst | 2 +- src/python/espressomd/integrate.pyx | 4 +++- src/python/espressomd/thermostat.pyx | 1 - 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/sphinx/analysis.rst b/doc/sphinx/analysis.rst index e7c90cff07e..055da7877d9 100644 --- a/doc/sphinx/analysis.rst +++ b/doc/sphinx/analysis.rst @@ -394,16 +394,16 @@ The instantaneous pressure is calculated (if there are no electrostatic interact by the volume averaged, direction averaged instantaneous virial pressure .. math:: - p = \frac{2E_{kinetic}}{Vf} + \frac{\sum_{j>i} {F_{ij}r_{ij}}}{3V} + p = \frac{2E_{\text{kinetic}}}{Vf} + \frac{\sum_{j>i} {F_{ij}r_{ij}}}{3V} :label: eqptens where :math:`f=3` is the number of translational degrees of freedom of each particle, :math:`V` is the volume of the system, -:math:`E_{kinetic}` is the kinetic energy, :math:`F_{ij}` the force +:math:`E_{\text{kinetic}}` is the kinetic energy, :math:`F_{ij}` the force between particles i and j, and :math:`r_{ij}` is the distance between them. The kinetic energy divided by the degrees of freedom is -.. math:: \frac{2E_{kinetic}}{f} = \frac{1}{3}\sum_{i} {m_{i}v_{i}^{2}}. +.. math:: \frac{2E_{\text{kinetic}}}{f} = \frac{1}{3}\sum_{i} {m_{i}v_{i}^{2}}. Note that Equation :eq:`eqptens` can only be applied to pair potentials and central forces. Description of how contributions from other interactions diff --git a/doc/sphinx/running.rst b/doc/sphinx/running.rst index b09ba0f92c2..3f910421ee5 100644 --- a/doc/sphinx/running.rst +++ b/doc/sphinx/running.rst @@ -77,9 +77,9 @@ would like to recompute the forces, despite the fact that they are already correctly calculated. To this aim, the option ``recalc_forces`` can be used to enforce force recalculation. -.. _Isotropic NPT thermostat integrator: +.. _Isotropic NPT integrator: -Isotropic NPT thermostat +Isotropic NPT integrator ------------------------ :py:func:`~espressomd.integrate.Integrator.set_isotropic_npt` @@ -90,16 +90,16 @@ discussed here and only a brief summary is given in :ref:`Thermostats`. To activate the NPT integrator, use :py:func:`~espressomd.integrate.Integrator.set_isotropic_npt` with parameters: - * ``ext_pressure``: (float) The external pressure as float variable. - * ``piston``: (float) The mass of the applied piston as float variable. - * ``direction``: [int, int, int] Flags to enable/disable box dimensions to be subject to fluctuations. By default, all directions are enabled. + * ``ext_pressure``: The external pressure + * ``piston``: The mass of the applied piston + * ``direction``: Flags to enable/disable box dimensions to be subject to fluctuations. By default, all directions are enabled. Additionally, a NPT thermostat has to be set by :py:func:`~espressomd.thermostat.Thermostat.set_npt()` with parameters: - * ``kT``: (float) Thermal energy of the heat bath - * ``gamma0``: (float) Friction coefficient of the bath - * ``gammav``: (float) Artificial friction coefficient for the volume fluctuations. + * ``kT``: Thermal energy of the heat bath + * ``gamma0``: Friction coefficient of the bath + * ``gammav``: Artificial friction coefficient for the volume fluctuations. A code snippet would look like:: @@ -129,7 +129,7 @@ where Here :math:`\mathcal{P}` is the instantaneous pressure, :math:`d` the dimension of the system (number of flags set by ``direction``), :math:`f_{ij}` the short range interaction force between particles :math:`i` and :math:`j` and :math:`x_{ij}= x_j - x_i`. In addition to this deterministic force, a friction :math:`-\frac{\gamma^V}{Q}\Pi(t)` and noise :math:`\sqrt{k_B T \gamma^V} \eta(t)` are added for the box -volume dynamics and the particle dynamics. . This introduces three new parameters: +volume dynamics and the particle dynamics. This introduces three new parameters: The friction coefficient for the box :math:`\gamma^V` (parameter ``gammav``), the friction coefficient of the particles :math:`\gamma^0` (parameter ``gamma0``) and the thermal energy :math:`k_BT` (parameter ``kT``). For a discussion of these terms and their discretisation, see :ref:`Langevin thermostat`, which uses the same approach, but only for particles. As a result of box geometry changes, the particle positions and velocities have to be rescaled @@ -172,7 +172,7 @@ Notes: * The NPT algorithm is only tested for all 3 directions enabled for scaling. Usage of ``direction`` is considered an experimental feature. * In step 4, only those coordinates are scaled for which ``direction`` is set. -* The for the instantaneous pressure the same limitations of applicability hold as described in :ref:`Pressure`. +* For the instantaneous pressure, the same limitations of applicability hold as described in :ref:`Pressure`. * The particle forces :math:`F` include interactions as well as a friction and noise term analogous to the terms in the :ref:`Langevin thermostat`. * The particle forces are only calculated in step 5 and then reused in step 1 of the next iteration. See :ref:`Velocity Verlet Algorithm` for the implications of that. diff --git a/doc/sphinx/system_setup.rst b/doc/sphinx/system_setup.rst index c6d6736b728..dd1e2795520 100644 --- a/doc/sphinx/system_setup.rst +++ b/doc/sphinx/system_setup.rst @@ -422,7 +422,7 @@ For example:: system.thermostat.set_npt(kT=1.0, gamma0=1.0, gammav=1.0) system.integrator.set_isotropic_npt(ext_pressure=1.0, piston=1.0) -For an explanation of the algorithm involved, see :ref:`Isotropic NPT thermostat` +For an explanation of the algorithm involved, see :ref:`Isotropic NPT integrator`. Be aware that this feature is neither properly examined for all systems nor is it maintained regularly. If you use it and notice strange diff --git a/src/python/espressomd/integrate.pyx b/src/python/espressomd/integrate.pyx index 3cb2f08523c..8cd6d54235d 100644 --- a/src/python/espressomd/integrate.pyx +++ b/src/python/espressomd/integrate.pyx @@ -140,7 +140,9 @@ cdef class Integrator: piston : :obj:`float` The mass of the applied piston. direction : (3,) array_like of :obj:`int`, optional - Set the box geometry for non-cubic boxes. + Select which dimensions are allowed to fluctuate by assigning + them to ``1``. In the special case where all dimensions are set + to ``0`` (default), they are all set to ``1`` in the core. cubic_box : :obj:`bool`, optional If this optional parameter is true, a cubic box is assumed. diff --git a/src/python/espressomd/thermostat.pyx b/src/python/espressomd/thermostat.pyx index a49a1750c1e..bc5c11ac3a6 100644 --- a/src/python/espressomd/thermostat.pyx +++ b/src/python/espressomd/thermostat.pyx @@ -428,7 +428,6 @@ cdef class Thermostat: Friction coefficient of the bath gammav : :obj:`float` Artificial friction coefficient for the volume fluctuations. - Mass of the artificial piston. """ From 694cc955d0fc7d7b191728a8e0e05cbd66f6e70e Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Mon, 14 Oct 2019 16:16:23 +0200 Subject: [PATCH 06/10] core: virtual_sites: Removed default argument from virtual function --- src/core/event.cpp | 2 +- src/core/integrate.cpp | 4 ++-- src/core/virtual_sites/VirtualSites.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/event.cpp b/src/core/event.cpp index 2a520d45047..744741d3bce 100644 --- a/src/core/event.cpp +++ b/src/core/event.cpp @@ -466,7 +466,7 @@ void on_ghost_flags_change() { void update_dependent_particles() { #ifdef VIRTUAL_SITES - virtual_sites()->update(); + virtual_sites()->update(true); #endif cells_update_ghosts(); diff --git a/src/core/integrate.cpp b/src/core/integrate.cpp index a3018589f9f..30e171bf8e6 100644 --- a/src/core/integrate.cpp +++ b/src/core/integrate.cpp @@ -189,7 +189,7 @@ void integrate_vv(int n_steps, int reuse_forces) { lb_lbcoupling_deactivate(); #ifdef VIRTUAL_SITES - virtual_sites()->update(); + virtual_sites()->update(true); #endif // Communication step: distribute ghost positions @@ -248,7 +248,7 @@ void integrate_vv(int n_steps, int reuse_forces) { // VIRTUAL_SITES pos (and vel for DPD) update for security reason !!! #ifdef VIRTUAL_SITES - virtual_sites()->update(); + virtual_sites()->update(true); #endif // Communication step: distribute ghost positions diff --git a/src/core/virtual_sites/VirtualSites.hpp b/src/core/virtual_sites/VirtualSites.hpp index 632588dc95b..454b416af09 100644 --- a/src/core/virtual_sites/VirtualSites.hpp +++ b/src/core/virtual_sites/VirtualSites.hpp @@ -43,7 +43,7 @@ class VirtualSites { * Velocities are only updated if get_have_velocity() returns true. * @param recalc_positions Skip the recalculation of positions if false. */ - virtual void update(bool recalc_positions = true) const = 0; + virtual void update(bool recalc_positions) const = 0; /** Back-transfer forces (and torques) to non-virtual particles. */ virtual void back_transfer_forces_and_torques() const = 0; /** @brief Called after force calculation (and before rattle/shake) */ From 89c58d20013d74da9e50140668b4ed9a16e5ea28 Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Tue, 15 Oct 2019 10:58:14 +0200 Subject: [PATCH 07/10] core: virtual_site: Removed unused code --- src/core/CMakeLists.txt | 3 +- src/core/virtual_sites/virtual_sites_com.cpp | 147 ------------------- src/core/virtual_sites/virtual_sites_com.hpp | 46 ------ 3 files changed, 1 insertion(+), 195 deletions(-) delete mode 100644 src/core/virtual_sites/virtual_sites_com.cpp delete mode 100644 src/core/virtual_sites/virtual_sites_com.hpp diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 854ff2dae48..5ea1b378720 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -125,11 +125,10 @@ set(EspressoCore_SRC observables/LBVelocityProfile.cpp virtual_sites/lb_inertialess_tracers.cpp virtual_sites/lb_inertialess_tracers_cuda_interface.cpp - virtual_sites/virtual_sites_com.cpp virtual_sites/VirtualSitesInertialessTracers.cpp virtual_sites/VirtualSitesRelative.cpp accumulators/TimeSeries.cpp - observables/PidObservable.cpp) + observables/PidObservable.cpp) if(CUDA) set(EspressoCuda_SRC diff --git a/src/core/virtual_sites/virtual_sites_com.cpp b/src/core/virtual_sites/virtual_sites_com.cpp deleted file mode 100644 index b9caa5bdf21..00000000000 --- a/src/core/virtual_sites/virtual_sites_com.cpp +++ /dev/null @@ -1,147 +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 . - */ -#include "virtual_sites_com.hpp" - -#ifdef VIRTUAL_SITES_COM - -#include "cells.hpp" -#include "errorhandling.hpp" -#include "forces.hpp" -#include "integrate.hpp" -#include "partCfg_global.hpp" -#include "virtual_sites.hpp" - -// forward declarations -Utils::Vector3d calc_mol_vel(Particle *p_com); -Utils::Vector3d calc_mol_pos(Particle *p_com); -void put_mol_force_on_parts(Particle *p_com); - -void update_mol_vel_particle(Particle *p) { - if (p->p.is_virtual) { - p->m.v = calc_mol_vel(p); - } -} - -void update_mol_pos_particle(Particle *p) { - if (p->p.is_virtual) { - p->r.p = calc_mol_pos(p); - } -} - -void distribute_mol_force(const ParticleRange &particles) { - for (auto &p : particles) { - if (p.p.is_virtual) { - if (p.f.f.norm2() != 0) { - put_mol_force_on_parts(&p); - } - } - } -} - -Utils::Vector3d calc_mol_vel(Particle *p_com) { - double M = 0; - Particle *p; - Utils::Vector3d v_com{}; - int const mol_id = p_com->p.mol_id; - for (int i = 0; i < topology[mol_id].part.n; i++) { - p = local_particles[topology[mol_id].part.e[i]]; - if (p->p.is_virtual) - continue; - v_com += p->p.mass * p->m.v; - M += p->p.mass; - } - v_com /= M; - return v_com; -} - -/* this is a local version of center of mass, because ghosts don't have image - * boxes*/ -/* but p_com is a real particle */ -Utils::Vector3d calc_mol_pos(Particle *p_com) { - double M = 0; - Particle *p; - Utils::Vector3d r_com{}; - int const mol_id = p_com->p.mol_id; - for (int i = 0; i < topology[mol_id].part.n; i++) { - p = local_particles[topology[mol_id].part.e[i]]; - if (p->p.is_virtual) - continue; - r_com += p->p.mass * get_mi_vector(p->r.p, p_com->r.p, box_geo); - M += p->p.mass; - } - r_com /= M; - r_com += p_com->r.p; - return r_com; -} - -void put_mol_force_on_parts(Particle *p_com) { - Particle *p; - int const mol_id = p_com->p.mol_id; - auto const force = p_com->f.f; - p_com->f.f = {}; -#ifdef MASS - double M = 0; - for (int i = 0; i < topology[mol_id].part.n; i++) { - p = local_particles[topology[mol_id].part.e[i]]; - if (p->p.is_virtual) - continue; - M += p->p.mass; - } -#else - double M = topology[mol_id].part.n - 1; -#endif - for (int i = 0; i < topology[mol_id].part.n; i++) { - p = local_particles[topology[mol_id].part.e[i]]; - if (!p->p.is_virtual) { - p->f.f += p->p.mass * force / M; - } - } -} - -Particle *get_mol_com_particle(Particle *calling_p) { - int const mol_id = calling_p->p.mol_id; - - if (mol_id < 0) { - runtimeErrorMsg() << "Particle does not have a mol id! pnr= " - << calling_p->p.identity << "\n"; - return nullptr; - } - for (int i = 0; i < topology[mol_id].part.n; i++) { - Particle *p = local_particles[topology[mol_id].part.e[i]]; - - if (p == nullptr) { - runtimeErrorMsg() - << "Particle does not exist in get_mol_com_particle! id= " - << topology[mol_id].part.e[i] << "\n"; - return nullptr; - } - - if (p->p.is_virtual) { - return p; - } - } - - runtimeErrorMsg() << "No COM found in get_mol_com_particle! pnr= " - << calling_p->p.identity << "\n"; - return nullptr; -} - -#endif diff --git a/src/core/virtual_sites/virtual_sites_com.hpp b/src/core/virtual_sites/virtual_sites_com.hpp deleted file mode 100644 index 3d84da64437..00000000000 --- a/src/core/virtual_sites/virtual_sites_com.hpp +++ /dev/null @@ -1,46 +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 _VIRTUAL_SITES_COM_H -#define _VIRTUAL_SITES_COM_H - -#include "config.hpp" - -#ifdef VIRTUAL_SITES_COM -#include "particle_data.hpp" - -// The following three functions have to be provided by all implementations -// of virtual sites -// Update the vel/pos of the given virtual particle as defined by the real -// particles in the same molecule -void update_mol_pos_particle(Particle *); -void update_mol_vel_particle(Particle *); - -// Distribute forces that have accumulated on virtual particles to the -// associated real particles -void distribute_mol_force(const ParticleRange &particles); - -// Gets the (first) virtual particle of the same molecule as the given -// (real) particle -Particle *get_mol_com_particle(Particle *calling_p); - -#endif - -#endif From eeadef1a35c94e4cd42a76f702fbdfd8f38c7b87 Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Tue, 15 Oct 2019 11:25:22 +0200 Subject: [PATCH 08/10] doc: Removed outdated docs --- doc/sphinx/installation.rst | 8 ---- doc/sphinx/particles.rst | 73 ------------------------------------- 2 files changed, 81 deletions(-) diff --git a/doc/sphinx/installation.rst b/doc/sphinx/installation.rst index eb7f9f850ff..edc790babea 100644 --- a/doc/sphinx/installation.rst +++ b/doc/sphinx/installation.rst @@ -421,14 +421,6 @@ General features - ``BOND_CONSTRAINT`` Turns on the RATTLE integrator which allows for fixed lengths bonds between particles. -- ``VIRTUAL_SITES_COM`` Virtual sites are particles, the position and velocity of which is - not obtained by integrating equations of motion. Rather, they are - placed using the position (and orientation) of other particles. The - feature allows to place a virtual particle into the center of mass of - a set of other particles. - - .. seealso:: :ref:`Virtual sites` - - ``VIRTUAL_SITES_RELATIVE`` Virtual sites are particles, the position and velocity of which is not obtained by integrating equations of motion. Rather, they are placed using the position (and orientation) of other particles. The diff --git a/doc/sphinx/particles.rst b/doc/sphinx/particles.rst index a7d15896272..6cbada89f24 100644 --- a/doc/sphinx/particles.rst +++ b/doc/sphinx/particles.rst @@ -436,79 +436,6 @@ For correct results, the LB thermostat has to be deactivated for virtual sites:: Please note that the velocity attribute of the virtual particles does not carry valid information for this virtual sites scheme. -.. - .. _Virtual sites in the center of mass of a molecule: - - Virtual sites in the center of mass of a molecule - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - .. todo:: This is not implemented in Python, yet - - To activate this implementation, enable the feature ``VIRTUAL_SITES_COM`` in :file:`myconfig.hpp`. Virtual sites are then placed in the center of mass of - a set of particles (as defined below). Their velocity will also be that - of the center of mass. Forces accumulating on the virtual sites are - distributed back to the particles which form the molecule. To place a - virtual site at the center of a molecule, perform the following steps in - that order - - #. Create a particle of the desired type for each molecule. It should be - placed at least roughly in the center of the molecule to make sure, - its on the same node as the other particles forming the molecule, in - a simulation with more than one CPU. - - #. Make it a virtual site using - - part virtual 1 - - #. Declare the list of molecules and the particles they consist of: - - analyze set { ...} ... - - The lists of particles in a molecule comprise the non-virtual - particles as well as the virtual site. The id of this molecule is its - index in this list. For example, - - analyze set {0 1 2 3 4} {0 5 6 7 8} {1 9 10 11} - - declares three molecules, of which the first two consist of three - particles and a virtual site each (particles 14 and 58, - respectively). The third molecule has type 1 and consists of two - particles and a virtual site. The virtual sites were determined - before by setting the flag. You can choose freely one out of each - molecule, for example particles 1, 5, and 9. - - #. Assign to all particles that belong to the same molecule the - molecules id - - part mol - - The molid is the index of the particle in the above list, so you - would assign 0 to particles 1-4, 1 to particles 5-8 and 2 to - particles 9-11. Alternatively, you can call - - analyze set topo_part_sync - - to set the s from the molecule declarations. - - #. Update the position of all virtual particles (optional) - - integrate 0 - - The type of the molecule you can choose freely, it is only used in - certain analysis functions, namely ``energy_kinetic_mol``, - ``pressure_mol`` and ``dipmom_mol``, which compute kinetic energy, - pressure and dipole moment per molecule type, respectively. - - .. _Additional features: - - Additional features - ~~~~~~~~~~~~~~~~~~~ - - The behavior of virtual sites can be fine-tuned with the following - switches in :file:`myconfig.hpp`. - - - ``THERMOSTAT_IGNORE_NON_VIRTUAL`` specifies that the thermostat does not act on non-virtual particles - .. _Particle number counting feature: Particle number counting feature From 254f820e93d22ab5a7818620a8e33abec2d5a6aa Mon Sep 17 00:00:00 2001 From: Florian Weik Date: Tue, 15 Oct 2019 11:38:02 +0200 Subject: [PATCH 09/10] core: Removed left-over use of removed THERMOSTAT_IGNORE_NON_VIRTUAL --- src/core/rotation.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/core/rotation.cpp b/src/core/rotation.cpp index aa925da9529..c0af41921b4 100644 --- a/src/core/rotation.cpp +++ b/src/core/rotation.cpp @@ -222,14 +222,9 @@ inline void convert_torque_to_body_frame_apply_fix_and_thermostat(Particle &p) { p.f.torque = Utils::Vector3d{}; if (thermo_switch & THERMO_LANGEVIN) { -#if defined(VIRTUAL_SITES) && defined(THERMOSTAT_IGNORE_NON_VIRTUAL) - if (!p.p.is_virtual) -#endif - { - friction_thermo_langevin_rotation(p); + friction_thermo_langevin_rotation(p); - p.f.torque += t; - } + p.f.torque += t; } else { p.f.torque = t; } From 9d95c399cd6aa4ddc720204a5a2834626cbf2ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Tue, 15 Oct 2019 12:57:33 +0200 Subject: [PATCH 10/10] Typos --- doc/sphinx/installation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sphinx/installation.rst b/doc/sphinx/installation.rst index 7c0cb539eaa..39ed616e3b3 100644 --- a/doc/sphinx/installation.rst +++ b/doc/sphinx/installation.rst @@ -187,7 +187,7 @@ If you want to install Homebrew, use the following commands. sudo xcodebuild -license accept /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -Installing Packages using MacPorts +Installing packages using MacPorts """""""""""""""""""""""""""""""""" Run the following commands: @@ -206,7 +206,7 @@ Run the following commands: sudo port select --set mpi openmpi-mp -Installing Packages using Homebrew +Installing packages using Homebrew """""""""""""""""""""""""""""""""" .. code-block:: bash