Skip to content

Commit 994e699

Browse files
authored
Merge branch 'python' into cells
2 parents 66c7a94 + 748e9d0 commit 994e699

File tree

201 files changed

+4122
-3685
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+4122
-3685
lines changed

.gitlab-ci.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:8a7d258889d87dcc9c96a200784b30b532d45b33
1+
image: docker.pkg.github.com/espressomd/docker/ubuntu-20.04:e583d4b2eb8eedd10068957f952bd67008475ee5
22

33
stages:
44
- prepare
@@ -114,7 +114,7 @@ no_rotation:
114114
ubuntu:wo-dependencies:
115115
<<: *global_job_definition
116116
stage: build
117-
image: docker.pkg.github.com/espressomd/docker/ubuntu-wo-dependencies:fc7628d32de0fce605976ba9edebe7eff186e618
117+
image: docker.pkg.github.com/espressomd/docker/ubuntu-wo-dependencies:e583d4b2eb8eedd10068957f952bd67008475ee5
118118
script:
119119
- export myconfig=maxset with_cuda=false make_check_unit_tests=false make_check_python=false
120120
- bash maintainer/CI/build_cmake.sh
@@ -199,6 +199,24 @@ clang-sanitizer:
199199
- linux
200200
- cuda
201201

202+
cuda11-maxset:
203+
<<: *global_job_definition
204+
stage: build
205+
image: docker.pkg.github.com/espressomd/docker/cuda:e583d4b2eb8eedd10068957f952bd67008475ee5
206+
variables:
207+
CC: 'gcc-9'
208+
CXX: 'g++-9'
209+
script:
210+
- export myconfig=maxset with_cuda=true with_coverage=false test_timeout=900 srcdir=${CI_PROJECT_DIR}
211+
- export with_scafacos=true with_stokesian_dynamics=true
212+
- bash maintainer/CI/build_cmake.sh
213+
tags:
214+
- docker
215+
- linux
216+
- cuda
217+
only:
218+
- schedules
219+
202220
cuda10-maxset:
203221
<<: *global_job_definition
204222
stage: build
@@ -230,11 +248,6 @@ cuda9-maxset:
230248
- export myconfig=maxset with_cuda=true with_coverage=true test_timeout=900 srcdir=${CI_PROJECT_DIR}
231249
- export with_scafacos=true with_stokesian_dynamics=true
232250
- bash maintainer/CI/build_cmake.sh
233-
artifacts:
234-
paths:
235-
- build/
236-
expire_in: 1 week
237-
when: on_success
238251
tags:
239252
- docker
240253
- linux
@@ -354,7 +367,7 @@ empty:
354367
rocm-maxset:
355368
<<: *global_job_definition
356369
stage: build
357-
image: docker.pkg.github.com/espressomd/docker/rocm:d496478230db4e5c286680e3bdc1621af1fccffc
370+
image: docker.pkg.github.com/espressomd/docker/rocm:cb775a82f49a7f6d4a806f17358caec797f48f73
358371
script:
359372
- export myconfig=maxset with_cuda=true with_cuda_compiler=hip
360373
- export with_stokesian_dynamics=false
@@ -457,7 +470,7 @@ check_cuda_maxset_no_gpu:
457470
<<: *global_job_definition
458471
stage: additional_checks
459472
when: on_success
460-
needs:
473+
needs:
461474
- cuda10-maxset
462475
script:
463476
- export CUDA_VISIBLE_DEVICES=""
@@ -470,9 +483,9 @@ check_cuda_maxset_no_gpu:
470483

471484
check_with_odd_no_of_processors:
472485
<<: *global_job_definition
473-
stage: additional_checks
486+
stage: additional_checks
474487
when: on_success
475-
needs:
488+
needs:
476489
- cuda10-maxset
477490
script:
478491
- cd ${CI_PROJECT_DIR}/build
@@ -507,7 +520,7 @@ deploy_sphinx_documentation:
507520
dependencies:
508521
- check_sphinx
509522
script:
510-
- cd ${CI_PROJECT_DIR}/build/doc/sphinx/html &&
523+
- cd ${CI_PROJECT_DIR}/build/doc/sphinx/html &&
511524
rsync -avz --delete -e "ssh -i ${HOME}/.ssh/espresso_rsa" ./ [email protected]:/home/espresso/public_html/html/doc
512525

513526
deploy_doxygen_documentation:

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
#
2020

21-
cmake_minimum_required(VERSION 3.10)
21+
cmake_minimum_required(VERSION 3.11)
2222
message(STATUS "CMake version: ${CMAKE_VERSION}")
2323
if(POLICY CMP0076)
2424
# make target_sources() convert relative paths to absolute
@@ -166,7 +166,7 @@ if(WITH_CUDA)
166166
endif()
167167
endif(WITH_CUDA)
168168

169-
find_package(PythonInterp 3.5 REQUIRED)
169+
find_package(PythonInterp 3.6 REQUIRED)
170170

171171
if(WITH_PYTHON)
172172
find_package(Cython 0.26 REQUIRED)
@@ -278,7 +278,6 @@ endif(WITH_STOKESIAN_DYNAMICS)
278278
if(WITH_STOKESIAN_DYNAMICS)
279279
set(CMAKE_INSTALL_LIBDIR
280280
"${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
281-
cmake_minimum_required(VERSION 3.11)
282281
include(FetchContent)
283282
FetchContent_Declare(
284283
stokesian_dynamics
@@ -485,6 +484,9 @@ if(WITH_TESTS)
485484
if(WITH_PYTHON)
486485
add_subdirectory(testsuite)
487486
endif(WITH_PYTHON)
487+
set(CTEST_ARGS ""
488+
CACHE STRING
489+
"Extra arguments to give to ctest calls (separated by semicolons)")
488490
endif(WITH_TESTS)
489491

490492
if(WITH_BENCHMARKS)

cmake/FindCUDACompilerHIP.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,26 @@ find_package(HIP ${CUDACompilerHIP_FIND_VERSION} MODULE REQUIRED)
2727
# patch HCC_PATH environment variable and reload HIP
2828
if(HIP_VERSION VERSION_LESS 3.1)
2929
set(HCC_PATH "${HIP_ROOT_DIR}")
30-
else()
30+
elseif(HIP_VERSION VERSION_LESS 3.5)
3131
set(HCC_PATH "${ROCM_HOME}/hcc")
32+
else()
33+
set(HIP_HIPCC_CMAKE_LINKER_HELPER "${HIP_HIPCC_EXECUTABLE}")
34+
unset(HCC_PATH)
3235
endif()
3336
find_package(HIP ${CUDACompilerHIP_FIND_VERSION} MODULE REQUIRED)
3437

3538
set(CUDA 1)
3639
set(HIP 1)
3740

38-
list(APPEND HIP_HCC_FLAGS
41+
list(APPEND HIP_HIPCC_FLAGS
3942
-std=c++${CMAKE_CUDA_STANDARD} -pedantic -Wall -Wextra
4043
-Wno-sign-compare -Wno-unused-function -Wno-unused-variable
4144
-Wno-unused-parameter -Wno-missing-braces -Wno-gnu-anonymous-struct
4245
-Wno-nested-anon-types -Wno-gnu-zero-variadic-macro-arguments
4346
-Wno-c99-designator -Wno-macro-redefined -Wno-duplicate-decl-specifier
4447
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.3>:-Wno-deprecated-copy>
48+
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.7>:-Wno-c++17-extensions>
49+
$<$<VERSION_GREATER_EQUAL:${HIP_VERSION},3.7>:-Wno-unused-command-line-argument>
4550
$<$<BOOL:${WARNINGS_ARE_ERRORS}>:-Werror>)
4651

4752
list(APPEND HIP_HIPCC_FLAGS_DEBUG -g)

cmake/FindCUDACompilerNVCC.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,11 @@ list(APPEND CUDA_NVCC_FLAGS_MINSIZEREL -O2 -Xptxas=-O2 -Xcompiler=-Os -DNDEBUG)
5050
list(APPEND CUDA_NVCC_FLAGS_RELWITHDEBINFO -O2 -g -Xptxas=-O2 -Xcompiler=-O2,-g -DNDEBUG)
5151
list(APPEND CUDA_NVCC_FLAGS_COVERAGE -O3 -g -Xptxas=-O3 -Xcompiler=-Og,-g)
5252
list(APPEND CUDA_NVCC_FLAGS_RELWITHASSERT -O3 -g -Xptxas=-O3 -Xcompiler=-O3,-g)
53+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11)
54+
list(APPEND CUDA_NVCC_FLAGS -gencode=arch=compute_30,code=sm_30)
55+
endif()
5356
list(APPEND CUDA_NVCC_FLAGS
54-
-gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_52,code=sm_52
57+
-gencode=arch=compute_52,code=sm_52
5558
-gencode=arch=compute_52,code=compute_52 -std=c++${CMAKE_CUDA_STANDARD}
5659
$<$<BOOL:${WARNINGS_ARE_ERRORS}>:-Xcompiler=-Werror;-Xptxas=-Werror>
5760
$<$<BOOL:${CMAKE_OSX_SYSROOT}>:-Xcompiler=-isysroot;-Xcompiler=${CMAKE_OSX_SYSROOT}>)
@@ -60,6 +63,7 @@ function(find_gpu_library)
6063
cmake_parse_arguments(LIBRARY "REQUIRED" "NAMES;VARNAME" "" ${ARGN})
6164
list(APPEND LIBRARY_PATHS
6265
${CUDA_TOOLKIT_ROOT_DIR}/lib64 ${CUDA_TOOLKIT_ROOT_DIR}/lib
66+
${CUDA_TOOLKIT_ROOT_DIR}/compat
6367
/usr/local/nvidia/lib /usr/lib/x86_64-linux-gnu)
6468
if(LIBRARY_REQUIRED)
6569
find_library(${LIBRARY_VARNAME} NAMES ${LIBRARY_NAMES} PATHS ${LIBRARY_PATHS} NO_DEFAULT_PATH REQUIRED)

cmake/FindFFTW3.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ if(FFTW3_INCLUDE_DIR)
2828
endif(FFTW3_INCLUDE_DIR)
2929

3030
find_path(FFTW3_INCLUDE_DIR fftw3.h)
31-
3231
find_library(FFTW3_LIBRARIES NAMES fftw3)
3332

3433
# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if all
@@ -38,3 +37,9 @@ find_package_handle_standard_args(FFTW3 DEFAULT_MSG FFTW3_LIBRARIES
3837
FFTW3_INCLUDE_DIR)
3938

4039
mark_as_advanced(FFTW3_LIBRARIES FFTW3_INCLUDE_DIR)
40+
41+
if(FFTW3_FOUND AND NOT TARGET FFTW3::FFTW3)
42+
add_library(FFTW3::FFTW3 INTERFACE IMPORTED)
43+
target_include_directories(FFTW3::FFTW3 INTERFACE "${FFTW3_INCLUDE_DIR}")
44+
target_link_libraries(FFTW3::FFTW3 INTERFACE "${FFTW3_LIBRARIES}")
45+
endif()

doc/sphinx/advanced_methods.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Several modes are available for different types of binding.
2828
import espressomd
2929
from espressomd.interactions import HarmonicBond
3030

31-
system = espressomd.System()
31+
system = espressomd.System(box_l=[1, 1, 1])
3232
bond_centers = HarmonicBond(k=1000, r_0=<CUTOFF>)
3333
system.bonded_inter.add(bond_centers)
3434
system.collision_detection.set_params(mode="bind_centers", distance=<CUTOFF>,

doc/sphinx/constraints.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Available shapes
167167
Python syntax::
168168

169169
import espressomd from espressomd.shapes import <SHAPE>
170-
system = espressomd.System()
170+
system = espressomd.System(box_l=[1, 1, 1])
171171

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

doc/sphinx/electrostatics.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@ Note that using the electrostatic interaction also requires assigning charges to
3535
the particles via the particle property
3636
:py:attr:`espressomd.particle_data.ParticleHandle.q`.
3737

38-
This example shows the general usage of an electrostatic method ``<SOLVER>``.
39-
All of them need the Bjerrum length and a set of other required parameters.
40-
First, an instance of the solver is created and only after adding it to the actors
41-
list, it is activated. Internally the method calls a tuning routine on
42-
activation to achieve the given accuracy::
38+
All solvers need a prefactor and a set of other required parameters.
39+
This example shows the general usage of the electrostatic method ``P3M``.
40+
An instance of the solver is created and added to the actors list, at which
41+
point it will be automatically activated. This activation will internally
42+
call a tuning function to achieve the requested accuracy::
4343

4444
import espressomd
45-
from espressomd import electrostatics
45+
import espressomd.electrostatics
4646

47-
system = espressomd.System()
48-
solver = electrostatics.<SOLVER>(prefactor=C, <ADDITIONAL REQUIRED PARAMETERS>)
47+
system = espressomd.System(box_l=[10, 10, 10])
48+
system.time_step = 0.01
49+
system.part.add(pos=[[0, 0, 0], [1, 1, 1]], q=[-1, 1])
50+
solver = espressomd.electrostatics.P3M(prefactor=2, accuracy=1e-3)
4951
system.actors.add(solver)
5052

51-
where the prefactor :math:`C` is defined as in Eqn. :eq:`coulomb_prefactor`
53+
where the prefactor is defined as :math:`C` in Eqn. :eq:`coulomb_prefactor`.
5254

5355
.. _Coulomb P3M:
5456

@@ -60,9 +62,10 @@ Coulomb P3M
6062
For this feature to work, you need to have the ``fftw3`` library
6163
installed on your system. In |es|, you can check if it is compiled in by
6264
checking for the feature ``FFTW`` with ``espressomd.features``.
63-
P3M requires full periodicity (1 1 1). Make sure that you know the relevance of the
64-
P3M parameters before using P3M! If you are not sure, read the following
65-
references:
65+
P3M requires full periodicity (1 1 1). When using a non-metallic dielectric
66+
constant (``epsilon != 0.0``), the box must be cubic.
67+
Make sure that you know the relevance of the P3M parameters before using P3M!
68+
If you are not sure, read the following references:
6669
:cite:`ewald21,hockney88,kolafa92,deserno98a,deserno98b,deserno00,deserno00a,cerda08d`.
6770

6871
.. _Tuning Coulomb P3M:

doc/sphinx/installation.rst

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ are required:
8989
.. code-block:: bash
9090
9191
sudo apt install python3-matplotlib python3-scipy ipython3 jupyter-notebook
92-
sudo pip3 install 'pint>=0.9'
92+
pip3 install --user 'pint>=0.9' 'jupyter_contrib_nbextensions==0.5.1' \
93+
'sphinx>=1.6.7,!=2.1.0,!=3.0.0' 'sphinxcontrib-bibtex>=0.3.5'
94+
jupyter contrib nbextension install --user
95+
jupyter nbextension enable rubberband/main
96+
jupyter nbextension enable exercise2/main
9397
9498
Nvidia GPU acceleration
9599
"""""""""""""""""""""""
@@ -829,10 +833,10 @@ to actually write a simulation script for |es|.
829833
Running an interactive notebook
830834
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
831835
832-
Running the Jupyter interpreter requires using the ``ipypresso`` script, which
836+
Running a Jupyter session requires using the ``ipypresso`` script, which
833837
is also located in the build directory (its name comes from the IPython
834838
interpreter, today known as Jupyter). To run the tutorials, you will need
835-
to start the Jupyter interpreter in notebook mode:
839+
to start a Jupyter session:
836840
837841
.. code-block:: bash
838842
@@ -858,11 +862,16 @@ will exit the Python interpreter and Jupyter will notify you that the current
858862
Python kernel stopped. If a cell takes too long to execute, you may interrupt
859863
it with the stop button.
860864
861-
To close the Jupyter notebook, go to the terminal where it was started and use
865+
Solutions cells are created using the ``exercise2`` plugin from nbextensions.
866+
To prevent solution code cells from running when clicking on "Run All", these
867+
code cells need to be converted to Markdown cells and fenced with `````python``
868+
and ```````.
869+
870+
To close the Jupyter session, go to the terminal where it was started and use
862871
the keyboard shortcut Ctrl+C twice.
863872
864-
When starting the Jupyter interpreter in notebook mode, you may see the
865-
following warning in the terminal:
873+
When starting a Jupyter session, you may see the following warning in the
874+
terminal:
866875
867876
.. code-block:: none
868877

doc/sphinx/inter_non-bonded.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ that the Thole correction acts between all dipoles, intra- and intermolecular.
620620
Again, the accuracy is related to the P3M accuracy and the split between
621621
short-range and long-range electrostatics interaction. It is configured by::
622622

623-
system = espressomd.System()
623+
system = espressomd.System(box_l=[1, 1, 1])
624624
system.non_bonded_inter[type_1,type_2].thole.set_params(scaling_coeff=<float>, q1q2=<float>)
625625

626626
with parameters:

doc/sphinx/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ capabilities. The usage is quite simple:
211211
.. code:: python
212212
213213
from espressomd.io.mppiio import mpiio
214-
system = espressomd.System()
214+
system = espressomd.System(box_l=[1, 1, 1])
215215
# ... add particles here
216216
mpiio.write("/tmp/mydata", positions=True, velocities=True, types=True, bonds=True)
217217

doc/sphinx/magnetostatics.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ relative permittivity of the background material, respectively.
2727

2828
Magnetostatic interactions are activated via the actor framework::
2929

30-
from espressomd.magnetostatics import DipolarDirectSumCpu
30+
import espressomd
31+
import espressomd.magnetostatics
3132

32-
direct_sum = DipolarDirectSumCpu(prefactor=1)
33+
system = espressomd.System(box_l=[10, 10, 10])
34+
system.time_step = 0.01
35+
system.part.add(pos=[[0, 0, 0], [1, 1, 1]],
36+
rotation=2 * [(1, 1, 1)], dip=2 * [(1, 0, 0)])
37+
38+
direct_sum = espressomd.magnetostatics.DipolarDirectSumCpu(prefactor=1)
3339
system.actors.add(direct_sum)
3440
# ...
3541
system.actors.remove(direct_sum)
@@ -49,7 +55,8 @@ Dipolar P3M
4955
This is the dipolar version of the P3M algorithm, described in :cite:`cerda08d`.
5056

5157
Make sure that you know the relevance of the P3M parameters before using
52-
P3M! If you are not sure, read the following references
58+
P3M! If you are not sure, read the following references:
59+
:cite:`ewald21,hockney88,kolafa92,deserno98a,deserno98b,deserno00,deserno00a,cerda08d`.
5360

5461
Note that dipolar P3M does not work with non-cubic boxes.
5562

0 commit comments

Comments
 (0)