Skip to content

Commit

Permalink
Merge branch 'python' into cph-tutorial-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Jul 21, 2021
2 parents 21afcc8 + 79cd94e commit b0e3b57
Show file tree
Hide file tree
Showing 358 changed files with 6,795 additions and 13,368 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Expand Up @@ -47,6 +47,7 @@ ignore:
- "libs"
- "doc/tutorials"
- "samples"
- "maintainer/benchmarks"
fixes:
- "testsuite/python/save_checkpoint*::testsuite/python/save_checkpoint.py"
- "testsuite/python/test_checkpoint*::testsuite/python/test_checkpoint.py"
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Expand Up @@ -290,7 +290,7 @@ tutorials-samples-maxset:
make_check_python: 'false'
make_check_tutorials: 'true'
make_check_samples: 'true'
make_check_benchmarks: 'false'
make_check_benchmarks: 'true'
test_timeout: '1200'
script:
- bash maintainer/CI/build_cmake.sh
Expand All @@ -313,7 +313,7 @@ tutorials-samples-default:
make_check_python: 'false'
make_check_tutorials: 'true'
make_check_samples: 'true'
make_check_benchmarks: 'false'
make_check_benchmarks: 'true'
test_timeout: '1200'
script:
- bash maintainer/CI/build_cmake.sh
Expand All @@ -338,7 +338,7 @@ tutorials-samples-empty:
make_check_python: 'false'
make_check_tutorials: 'true'
make_check_samples: 'true'
make_check_benchmarks: 'false'
make_check_benchmarks: 'true'
test_timeout: '1200'
with_scafacos: 'false'
script:
Expand All @@ -364,7 +364,7 @@ tutorials-samples-no-gpu:
make_check_python: 'false'
make_check_tutorials: 'true'
make_check_samples: 'true'
make_check_benchmarks: 'false'
make_check_benchmarks: 'true'
test_timeout: '1200'
hide_gpu: 'true'
script:
Expand Down
10 changes: 0 additions & 10 deletions .lgtm.yml

This file was deleted.

2 changes: 2 additions & 0 deletions AUTHORS
Expand Up @@ -75,6 +75,7 @@ Jonas Landsgesell
Jon Halverson
Joost de Graaf
Josh Berryman
Julian Hoßbach
Julius Herb
Kai Grass
Kai Kratzer
Expand Down Expand Up @@ -102,6 +103,7 @@ Nils Binz
Nishchay Suri
Oleg V. Rud
Owen A. Hickey-Moriarty
Pablo Miguel Blanco Andrés
Pascal Hebbeker
Patrick Diggins
Patrick Kreissl
Expand Down
22 changes: 0 additions & 22 deletions doc/doxygen/bibliography.bib
Expand Up @@ -589,17 +589,6 @@ @Article{tironi95a
doi = {10.1063/1.469273},
}

@Article{troester05a,
title = {{Wang-Landau sampling with self-adaptive range}},
author = {Tr\"{o}ster, Andreas and Dellago, Christoph},
journal = {Physical Review E},
volume = {71},
number = {6},
pages = {066705},
year = {2005},
doi = {10.1103/PhysRevE.71.066705},
}

@Article{tyagi10a,
author = {Tyagi, Sandeep and S\"{u}zen, Mehmet and Sega, Marcello and Barbosa, Marcia C. and Kantorovich, Sofia S. and Holm, Christian},
title = {{An iterative, fast, linear-scaling method for computing induced charges on arbitrary dielectric boundaries}},
Expand Down Expand Up @@ -630,17 +619,6 @@ @Article{wang01a
doi = {10.1063/1.1398588},
}

@Article{yan02b,
author = {Yan, Qiliang and Faller, Roland and {de Pablo}, Juan J.},
title = {{Density-of-states Monte Carlo method for simulation of fluids}},
journal = {The Journal of Chemical Physics},
volume = {116},
number = {20},
pages = {8745-8749},
year = {2002},
doi = {10.1063/1.1463055},
}

@Article{yeh99a,
title = {{Ewald summation for systems with slab geometry}},
author = {Yeh, In-Chul and Berkowitz, Max L.},
Expand Down
44 changes: 11 additions & 33 deletions doc/sphinx/advanced_methods.rst
Expand Up @@ -26,10 +26,10 @@ Several modes are available for different types of binding.
* ``"bind_centers"``: adds a pair-bond between two particles at their first collision. By making the bonded interaction *stiff* enough, the particles can be held together after the collision. Note that the particles can still slide on each others' surface, as the pair bond is not directional. This mode is set up as follows::

import espressomd
from espressomd.interactions import HarmonicBond
import espressomd.interactions

system = espressomd.System(box_l=[1, 1, 1])
bond_centers = HarmonicBond(k=1000, r_0=<CUTOFF>)
bond_centers = espressomd.interactions.HarmonicBond(k=1000, r_0=<CUTOFF>)
system.bonded_inter.add(bond_centers)
system.collision_detection.set_params(mode="bind_centers", distance=<CUTOFF>,
bond_centers=bond_centers)
Expand Down Expand Up @@ -100,7 +100,7 @@ Several modes are available for different types of binding.

n_angle_bonds = 181 # 0 to 180 degrees in one degree steps
for i in range(0, res, 1):
self.system.bonded_inter[i] = Angle_Harmonic(
self.system.bonded_inter[i] = espressomd.interactions.Angle_Harmonic(
bend=1, phi0=float(i) / (res - 1) * np.pi)

# Create the bond passed to bond_centers here and add it to the system
Expand Down Expand Up @@ -454,9 +454,8 @@ end:

for i in range(1, 101):
system.integrator.run(steps=500)
cell.output_vtk_pos_folded(filename="output/sim1/cell_"
+ str(i) + ".vtk")
print("time: ", str(i * time_step))
cell.output_vtk_pos_folded(filename=f"output/sim1/cell_{i}.vtk")
print(f"time: {i * time_step}")
print("Simulation completed.")

This simulation runs for 100 cycles. In each cycle, 500 integration
Expand Down Expand Up @@ -510,7 +509,7 @@ In the script, we have used the commands such as

::

cell.output_vtk_pos_folded(filename="output/sim1/cell_" + str(i) + ".vtk")
cell.output_vtk_pos_folded(filename=f"output/sim1/cell_{i}.vtk")

to output the information about cell in every pass of the simulation
loop. These files can then be used for inspection in ParaView and
Expand Down Expand Up @@ -1531,8 +1530,8 @@ and can be used to conveniently add a Drude particle to a given core particle.
As it also adds the first two bonds between Drude and core, these bonds have to
be created beforehand::

from drude_functions import *
add_drude_particle_to_core(<system>, <harmonic_bond>, <thermalized_bond>,
import espressomd.drude_helpers
espressomd.drude_helpers(<system>, <harmonic_bond>, <thermalized_bond>,
<core particle>, <id drude>, <type drude>, <alpha>, <mass drude>,
<coulomb_prefactor>, <thole damping>, <verbose>)

Expand Down Expand Up @@ -1562,7 +1561,7 @@ One bond type of this kind is needed per Drude type. The above helper function a
tracks particle types, ids and charges of Drude and core particles, so a simple call of
another helper function::

drude_helpers.setup_and_add_drude_exclusion_bonds(S)
espressomd.drude_helpers.setup_and_add_drude_exclusion_bonds(S)

will use this data to create a :ref:`Subtract P3M short-range bond` per Drude type
and set it up it between all Drude and core particles collected in calls of :meth:`~espressomd.drude_helpers.add_drude_particle_to_core`.
Expand All @@ -1588,7 +1587,7 @@ long-range part of the electrostatic interaction. Two helper methods assist
with setting up this exclusion. If used, they have to be called
after all Drude particles are added to the system::

setup_intramol_exclusion_bonds(<system>, <molecule drude types>,
espressomd.drude_helpers.setup_intramol_exclusion_bonds(<system>, <molecule drude types>,
<molecule core types>, <molecule core partial charges>, <verbose>)

This function creates the requires number of bonds which are later added to the
Expand All @@ -1605,7 +1604,7 @@ Parameters are:
After setting up the bonds, one has to add them to each molecule with the
following method::

add_intramol_exclusion_bonds(<system>, <drude ids>, <core ids>, <verbose>)
espressomd.drude_helpers.add_intramol_exclusion_bonds(<system>, <drude ids>, <core ids>, <verbose>)

This method has to be called for all molecules and needs the following parameters:

Expand Down Expand Up @@ -1770,27 +1769,6 @@ be converted to :math:`K_c` as
where :math:`p^{\ominus}=1\,\mathrm{atm}` is the standard pressure.
Consider using the python module pint for unit conversion.

.. _Wang-Landau Reaction Ensemble:

Wang-Landau Reaction Ensemble
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Combination of the Reaction Ensemble with the Wang-Landau algorithm
:cite:`wang01a`. Allows for enhanced sampling of the reacting system
and for the determination of the density of states with respect
to the reaction coordinate or with respect to some other collective
variable :cite:`landsgesell17a`. Here the 1/t Wang-Landau
algorithm :cite:`belardinelli07a` is implemented since it
does not suffer from systematic errors.

Multiple reactions and multiple collective variables can be set.

An example script can be found here:

* `Wang-Landau reaction ensemble <https://github.com/espressomd/espresso/blob/python/samples/wang_landau_reaction_ensemble.py>`__

For a description of the available methods, see :class:`espressomd.reaction_ensemble.ReactionEnsemble`.

.. _Grand canonical ensemble simulation using the Reaction Ensemble:

Grand canonical ensemble simulation
Expand Down
12 changes: 6 additions & 6 deletions doc/sphinx/analysis.rst
Expand Up @@ -366,8 +366,8 @@ follows

::

from espressomd.observables import ParticlePositions
part_pos = ParticlePositions(ids=(1, 2, 3, 4, 5))
import espressomd.observables
part_pos = espressomd.observables.ParticlePositions(ids=(1, 2, 3, 4, 5))

Here, the keyword argument ``ids`` specifies the ids of the particles,
which the observable should take into account.
Expand Down Expand Up @@ -768,14 +768,14 @@ The cluster analysis is available in parallel simulations, but the analysis is c
Whether or not two particles are neighbors is defined by a pair criterion. The available criteria can be found in :mod:`espressomd.pair_criteria`.
For example, a distance criterion which will consider particles as neighbors if they are closer than 0.11 is created as follows::

from espressomd.pair_criteria import DistanceCriterion
dc = DistanceCriterion(cut_off=0.11)
import espressomd.pair_criteria
dc = espressomd.pair_criteria.DistanceCriterion(cut_off=0.11)

To obtain the cluster structure of a system, an instance of :class:`espressomd.cluster_analysis.ClusterStructure` has to be created.
To to create a cluster structure with above criterion::

from espressomd.cluster_analysis import ClusterStructure
cs = ClusterStructure(distance_criterion=dc)
import espressomd.cluster_analysis
cs = espressomd.cluster_analysis.ClusterStructure(distance_criterion=dc)

In most cases, the cluster analysis is carried out by calling the :any:`espressomd.cluster_analysis.ClusterStructure.run_for_all_pairs` method. When the pair criterion is purely based on bonds, :any:`espressomd.cluster_analysis.ClusterStructure.run_for_bonded_particles` can be used.

Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx/constraints.rst
Expand Up @@ -173,8 +173,8 @@ Available shapes

Python syntax::

import espressomd from espressomd.shapes import <SHAPE>
system = espressomd.System(box_l=[1, 1, 1])
import espressomd.shapes
shape = espressomd.shapes.<SHAPE>

``<SHAPE>`` can be any of the available shapes.

Expand Down
30 changes: 16 additions & 14 deletions doc/sphinx/electrostatics.rst
Expand Up @@ -189,8 +189,8 @@ surface. ICC relies on a Coulomb solver that is already initialized. So far, it
is implemented and well tested with the Coulomb solver P3M. ICC is an |es|
actor and can be activated via::

from espressomd.electrostatic_extensions import ICC
icc = ICC(...)
import espressomd.electrostatic_extensions
icc = espressomd.electrostatic_extensions.ICC(...)
system.actors.add(icc)

The ICC particles are setup as normal |es| particles. Note that they should
Expand Down Expand Up @@ -336,10 +336,10 @@ the details.

MMM1D is used with::

from espressomd.electrostatics import MMM1D
mmm1d = MMM1D(prefactor=C, far_switch_radius=fr, maxPWerror=err, tune=False,
bessel_cutoff=bc)
mmm1d = MMM1D(prefactor=C, maxPWerror=err)
import espressomd.electrostatics
mmm1d = espressomd.electrostatics.MMM1D(prefactor=C, far_switch_radius=fr,
maxPWerror=err, tune=False, bessel_cutoff=bc)
mmm1d = espressomd.electrostatics.MMM1D(prefactor=C, maxPWerror=err)

where the prefactor :math:`C` is defined in Eqn. :eq:`coulomb_prefactor`.
MMM1D Coulomb method for systems with periodicity (0 0 1). Needs the
Expand All @@ -350,7 +350,8 @@ does not need to be specified as it is automatically determined from the
particle distances and maximal pairwise error. The second tuning form
just takes the maximal pairwise error and tries out a lot of switching
radii to find out the fastest one. If this takes too long, you can
change the value of the property :attr:`espressomd.system.System.timings`,
change the value of the ``timings`` argument of the
:class:`~espressomd.electrostatics.MMM1D` class,
which controls the number of test force calculations.

.. _MMM1D on GPU:
Expand All @@ -365,10 +366,10 @@ counterpart, it does not need the N-squared cell system.

::

from espressomd.electrostatics import MMM1DGPU
mmm1d_gpu = MMM1DGPU(prefactor=C, far_switch_radius=fr, maxPWerror=err,
tune=False, bessel_cutoff=bc)
mmm1d_gpu = MMM1DGPU(prefactor=C, maxPWerror=err)
import espressomd.electrostatics
mmm1d = espressomd.electrostatics.MMM1DGPU(prefactor=C, far_switch_radius=fr,
maxPWerror=err, tune=False, bessel_cutoff=bc)
mmm1d = espressomd.electrostatics.MMM1DGPU(prefactor=C, maxPWerror=err)

The first form sets parameters manually. The switch radius determines at which
xy-distance the force calculation switches from the near to the far
Expand Down Expand Up @@ -404,9 +405,10 @@ To use a specific electrostatics solver from ScaFaCoS for your system,
e.g. ``ewald``, set its cutoff to :math:`1.5` and tune the other parameters
for an accuracy of :math:`10^{-3}`::

from espressomd.electrostatics import Scafacos
scafacos = Scafacos(prefactor=1, method_name="ewald",
method_params={"ewald_r_cut": 1.5, "tolerance_field": 1e-3})
import espressomd.electrostatics
scafacos = espressomd.electrostatics.Scafacos(
prefactor=1, method_name="ewald",
method_params={"ewald_r_cut": 1.5, "tolerance_field": 1e-3})
system.actors.add(scafacos)

For details of the various methods and their parameters please refer to
Expand Down

0 comments on commit b0e3b57

Please sign in to comment.