Skip to content

Commit

Permalink
Merge branch 'python' into particle_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Oct 15, 2019
2 parents cd96f74 + 94d51f5 commit aedadef
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 335 deletions.
20 changes: 10 additions & 10 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 23 additions & 16 deletions doc/sphinx/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -117,9 +117,24 @@ ROCm SDK to make use of GPU computation:
After installing the ROCm SDK, please reboot your computer.

.. _Installing Requirements on Mac OS X:

Installing Requirements on Mac OS X
.. _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 <https://github.com/espressomd/docker/blob/master/docker/centos-python3/Dockerfile-7>`_
* `Fedora 30 <https://github.com/espressomd/docker/blob/master/docker/centos-python3/Dockerfile-next>`_
* `Debian 10 <https://github.com/espressomd/docker/blob/master/docker/debian-python3/Dockerfile-10>`_
* `OpenSUSE Leap 15.1 <https://github.com/espressomd/docker/blob/master/docker/opensuse/Dockerfile-15.1>`_


.. _Installing requirements on Mac OS X:

Installing requirements on Mac OS X
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Preparation
Expand Down Expand Up @@ -172,9 +187,9 @@ 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:

.. code-block:: bash
Expand All @@ -191,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
Expand Down Expand Up @@ -312,7 +327,7 @@ different configuration headers:
.. code-block:: c++
#define ELECTROSTATICS
#define LENNARD-JONES
#define LENNARD_JONES
* :file:`$builddir2/myconfig.hpp`:
Expand Down Expand Up @@ -421,14 +436,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
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/lb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
73 changes: 0 additions & 73 deletions doc/sphinx/particles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,79 +444,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
Expand Down
20 changes: 10 additions & 10 deletions doc/sphinx/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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::

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
18 changes: 4 additions & 14 deletions doc/sphinx/system_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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::

Expand All @@ -432,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
Expand Down
3 changes: 1 addition & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/core/integrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions src/core/rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,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;
}
Expand Down
Loading

0 comments on commit aedadef

Please sign in to comment.