Skip to content

Commit

Permalink
Merge branch 'python' of git://github.com/espressomd/espresso into ch…
Browse files Browse the repository at this point in the history
…eckpointing
  • Loading branch information
RudolfWeeber committed Jun 17, 2019
2 parents 292c298 + f5dade5 commit f93ff25
Show file tree
Hide file tree
Showing 48 changed files with 646 additions and 522 deletions.
2 changes: 1 addition & 1 deletion doc/sphinx/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ For example, ::

Momentum of the System
~~~~~~~~~~~~~~~~~~~~~~
:meth:`espressomd.analyze.Analysis.analyze_linear_momentum`
:meth:`espressomd.analyze.Analysis.linear_momentum`

This command returns the total linear momentum of the particles and the
lattice Boltzmann (LB) fluid, if one exists. Giving the optional
Expand Down
37 changes: 27 additions & 10 deletions doc/sphinx/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ C++ Compiler

Boost
A number of advanced C++ features used by ESPResSo is provided by Boost.
We strongly recommend to use at least boost 1.67.

FFTW
For some algorithms (P\ :math:`^3`\ M), ESPResSo needs the FFTW library
Expand All @@ -55,24 +56,31 @@ MPI
environment that implements the MPI standard version 1.2.

Python
ESPResSo's main user interface is via the Python scripting interface. Both, Python 2 and 3 are supported.
ESPResSo's main user interface is via the Python scripting interface.
We strongly recommend Python 3. Python 2 support is about to be removed.

Cython
Cython is used for connecting the C++ core to Python
Cython is used for connecting the C++ core to Python.
At least version 0.23 is required.


.. _Installing Requirements on Ubuntu Linux:

Installing Requirements on Ubuntu Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These instructions pertain to Python 3. If you need to use the deprecated
Python 2 support, leave out the `3` in the Python package names.
I.e., use `python-numpy` rather than `python3-numpy`.


To make ESPResSo run on Ubuntu 16.04 LTS or 18.04 LTS, its dependencies can be
To make ESPResSo run on 18.04 LTS, its dependencies can be
installed with:

.. code-block:: bash
sudo apt install build-essential cmake cython python-numpy \
sudo apt install build-essential cmake cython python3-numpy \
libboost-all-dev openmpi-common fftw3-dev libhdf5-dev libhdf5-openmpi-dev \
doxygen python-opengl python-sphinx python-pip libgsl-dev
doxygen python3-opengl python3-sphinx python3-pip libgsl-dev
Optionally the ccmake utility can be installed for easier configuration:
Expand Down Expand Up @@ -166,9 +174,9 @@ command in |es| 's source directory:
.. code-block:: bash
pip install -r requirements.txt --user --upgrade
pip3 install -r requirements.txt --user --upgrade
Please note that on some systems, ``pip`` has to be replaced by ``pip2`` to install Python 2 versions of the packages.
Please note that on some systems, ``pip3`` has to be replaced by ``pip`` or ``pip2`` to install Python 2 versions of the packages.
.. _Quick installation:
Expand All @@ -178,15 +186,24 @@ Quick installation
If you have installed the requirements (see section :ref:`Requirements
<requirements>` ) in standard locations, to compile, it is usually enough to
create a build directory and call ``cmake`` and ``make`` (optional steps
which modify the build process are commented out):
which modify the build process are commented out).
To chose the correct Python version, run
.. code-block:: bash
python -V
python3 -V
This shows which Python version the binaries are for. Then pass the one you'd like to use in the cmake command line, below.
.. code-block:: bash
mkdir build
cd build
#cp myconfig-default.hpp myconfig.hpp # use the default configuration as template
#nano myconfig.hpp # edit to add/remove features as desired
cmake ..
cmake -DPYTHON_EXECUTABLE=`which python3` ..
#ccmake . // in order to add/remove features like SCAFACOS or CUDA
make
Expand Down Expand Up @@ -219,7 +236,7 @@ command:
./pypresso <SCRIPT>
where is ``<SCRIPT>`` is a ``python`` script which has to
where ``<SCRIPT>`` is a ``python`` script which has to
be written by the user. You can find some examples in the :file:`samples`
folder of the source code directory. If you want to run in parallel, you should
have compiled with *Open MPI*, and need to tell MPI to run in parallel. The actual
Expand Down
25 changes: 14 additions & 11 deletions doc/sphinx/magnetostatics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ completely unphysical simulations.
Dipolar P3M
~~~~~~~~~~~
This is the dipolar version of the P3M algorithm, described in :cite:`cerda08d`.
It is interfaced via :class:`espressomd.magnetostatics.DipolarP3M`.
It is interfaced via :class:`~espressomd.magnetostatics.DipolarP3M`.

Make sure that you know the relevance of the P3M parameters before using
P3M! If you are not sure, read the following references
Expand Down Expand Up @@ -94,7 +94,7 @@ The method is used as follows::



.. _Dipolar direct sum on gpu:
.. _Dipolar direct sum:

Dipolar direct sum
------------------
Expand All @@ -111,31 +111,34 @@ Due to the long-range nature of dipolar interactions, Direct summation with mini

Two methods are available:

* :class:`espressomd.magnetostatics.DipolarDirectSumCpu`
* :class:`~espressomd.magnetostatics.DipolarDirectSumCpu`
performs the calculation in double precision on the Cpu.


* :class:`espressomd.magnetostatics.DipolarDirectSumGpu`
* :class:`~espressomd.magnetostatics.DipolarDirectSumGpu`
performs the calculations in single precision on a Cuda-capable graphics card.
The implementation is optimized for large systems of several thousand
particles. It makes use of one thread per particle. When there are fewer
particles than the number of threads the gpu can execute simultaneously,
the rest of the gpu remains idle. Hence, the method will perform poorly
for small systems.

To use the methods, create an instance of either :class:`espressomd.magnetostatics.DipolarDirectSumCpu` or :class:`espressomd.magnetostatics.DipolarDirectSumGpu` and add it to the system's list of active actors. The only required parameter is the Prefactor :eq:`dipolar_prefactor`::
To use the methods, create an instance of either :class:`~espressomd.magnetostatics.DipolarDirectSumCpu` or :class:`~espressomd.magnetostatics.DipolarDirectSumGpu` and add it to the system's list of active actors. The only required parameter is the Prefactor :eq:`dipolar_prefactor`::

from espressomd.magnetostatics import DipolarDirectSumGpu
dds = DipolarDirectSumGpu(bjerrum_length=1)
system.actors.add(dds)


For testing purposes, a variant of the dipolar direct sum is available which adds periodic copies to the system in periodic directions (:class:`espressomd.magnetostatics.DipolarDirectSumWithReplicaCpu`).

For testing purposes, a variant of the dipolar direct sum is available which
adds periodic copies to the system in periodic directions:
:class:`~espressomd.magnetostatics.DipolarDirectSumWithReplicaCpu`.
As it is very slow, this method is not intended to do simulations, but
rather to check the results you get from more efficient methods like
P3M.
rather to check the results you get from more efficient methods like P3M.

:class:`~espressomd.magnetostatics.DipolarDirectSumCpu` and
:class:`~espressomd.magnetostatics.DipolarDirectSumWithReplicaCpu`
do not support MPI parallelization.



Expand All @@ -154,7 +157,7 @@ an additive distance respectively. For the detailed description of the
Barnes-Hut method application to the dipole-dipole interactions, please
refer to :cite:`Polyakov2013`.

To use the method, create an instance of :class:`espressomd.magnetostatics.DipolarBarnesHutGpu` and add it to the system's list of active actors::
To use the method, create an instance of :class:`~espressomd.magnetostatics.DipolarBarnesHutGpu` and add it to the system's list of active actors::

from espressomd.magnetostatics import DipolarBarnesHutGpu
bh = DipolarBarnesHutGpu(prefactor=pf_dds_gpu, epssq=200.0, itolsq=8.0)
Expand All @@ -171,7 +174,7 @@ library for dipoles, if the methods support dipolar calculations. The feature
feature. Dipolar calculations are only included in the ``dipolar`` branch of
the Scafacos code.

To use SCAFACOS, create an instance of :class:`espressomd.magnetostatics.Scafacos`
To use SCAFACOS, create an instance of :class:`~espressomd.magnetostatics.Scafacos`
and add it to the list of active actors. Three parameters have to be specified:

* ``method_name``: name of the SCAFACOS method being used.
Expand Down
17 changes: 14 additions & 3 deletions maintainer/CI/doc_warnings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
regex_sphinx_broken_link='<code class=\"xref py py-[a-z]+ docutils literal notranslate\"><span class=\"pre\">(?!(int|float|bool|str|object|list|tuple|dict)<)[^<>]+?</span></code>(?!</a>)'

# list of espresso modules not compiled in CI (visualization, scafacos)
regex_ignored_es_features_ci='(visualization|[a-z]+\.[sS]cafacos)'
regex_ignored_es_features_ci='^(espressomd\.)?(visualization|([a-z]+\.)?[sS]cafacos)'

if [ ! -f doc/sphinx/html/index.html ]; then
echo "Please run Sphinx first."
Expand All @@ -57,7 +57,7 @@ if [ $? = "0" ]; then
# skip espresso modules not compiled in CI (visualization, scafacos)
is_es_feature_skipped="false"
if [ "${CI}" != "" ]; then
grep -Pq "^espressomd\.${regex_ignored_es_features_ci}" <<< "${reference}"
grep -Pq "${regex_ignored_es_features_ci}" <<< "${reference}"
[ "$?" = "0" ] && is_es_feature_skipped="true"
fi
# private objects are not documented and cannot be linked
Expand All @@ -77,11 +77,22 @@ if [ $? = "0" ]; then
filepath_rst=$(echo "${filepath_html}" | sed 's|/html/|/|')
filepath_rst="${filepath_rst%.html}.rst"
if [ -f "${filepath_rst}" ]; then
# look for the reference
grep -q -F "\`${reference}\`" "${filepath_rst}"
if [ $? = "0" ]; then
grep --color -FnHo -m 1 "\`${reference}\`" "${filepath_rst}" | tee -a doc_warnings.log~
continue
fi
# if not found, check if reference was shortened, for example
# :class:`~espressomd.system.System` outputs a link named `System`
grep -q -P "^[a-zA-Z0-9_]+$" <<< "${reference}"
if [ $? = "0" ]; then
grep -q -P "\`~.+${reference}\`" "${filepath_rst}"
if [ $? = "0" ]; then
grep --color -PnHo -m 1 "\`~.+${reference}\`" "${filepath_rst}" | tee -a doc_warnings.log~
continue
fi
fi
fi
# if not in a .rst file, show the .html file without line number
echo "${filepath_html}:\`${reference}\`" | tee -a doc_warnings.log~
Expand All @@ -92,7 +103,7 @@ if [ $? = "0" ]; then
cat doc_warnings.log~ >> doc_warnings.log
rm doc_warnings.log~
# warn user about ignored features in CI
grep -Pq "espressomd\.${regex_ignored_es_features_ci}" doc_warnings.log
grep -Pq "${regex_ignored_es_features_ci}" doc_warnings.log
if [ "$?" = "0" ] && [ "${CI}" = "" ]; then
echo "(Note that features visualization and Scafacos are ignored in CI)"
fi
Expand Down
2 changes: 1 addition & 1 deletion samples/lj_liquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
energies = system.analysis.energy()
print(energies)
obs_file.write('{ time %s } %s\n' % (system.time, energies))
linear_momentum = system.analysis.analyze_linear_momentum()
linear_momentum = system.analysis.linear_momentum()
print(linear_momentum)

# write observables
Expand Down
2 changes: 1 addition & 1 deletion samples/lj_liquid_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
energies = system.analysis.energy()
print(energies)
obs_file.write('{ time %s } %s\n' % (system.time, energies))
linear_momentum = system.analysis.analyze_linear_momentum()
linear_momentum = system.analysis.linear_momentum()
print(linear_momentum)

# write observables
Expand Down
2 changes: 1 addition & 1 deletion samples/lj_liquid_structurefactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
energies = system.analysis.energy()
print(energies)
obs_file.write('{ time %s } %s\n' % (system.time, energies))
linear_momentum = system.analysis.analyze_linear_momentum()
linear_momentum = system.analysis.linear_momentum()
print(linear_momentum)


Expand Down
10 changes: 5 additions & 5 deletions src/core/cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ void cells_resort_particles(int global_flag) {
resort_particles = Cells::RESORT_GLOBAL;
append_indexed_particle(local_cells.cell[0], std::move(part));
}
}

} else {
#ifdef ADDITIONAL_CHECKS
/* at the end of the day, everything should be consistent again */
check_particle_consistency();
check_particle_sorting();
/* at the end of the day, everything should be consistent again */
check_particle_consistency();
check_particle_sorting();
#endif
}

ghost_communicator(&cell_structure.ghost_cells_comm);
ghost_communicator(&cell_structure.exchange_ghosts_comm);
Expand Down
Loading

0 comments on commit f93ff25

Please sign in to comment.