Permalink
Browse files

Merge branch 'python' into normr

  • Loading branch information...
fweik committed Dec 4, 2018
2 parents 42b124d + 59f081b commit f14a5e9bc5a575f3f99a9b3a40d3c12dd459b0cb
Showing with 3,709 additions and 3,907 deletions.
  1. +3 −9 CMakeLists.txt
  2. +10 −5 cmake/FindCython.cmake
  3. +10 −0 doc/sphinx/installation.rst
  4. +4 −5 doc/sphinx/io.rst
  5. +3 −3 src/core/CMakeLists.txt
  6. +1 −1 src/core/accumulators/CMakeLists.txt
  7. +2 −2 src/core/actor/CMakeLists.txt
  8. +5 −0 src/core/bonded_interactions/bonded_interaction_data.hpp
  9. +3 −36 src/core/bonded_interactions/fene.hpp
  10. +5 −29 src/core/bonded_interactions/harmonic.hpp
  11. +6 −44 src/core/bonded_interactions/harmonic_dumbbell.hpp
  12. +0 −1 src/core/bonded_interactions/quartic.hpp
  13. +107 −17 src/core/cells.cpp
  14. +2 −5 src/core/cells.hpp
  15. +1 −1 src/core/cluster_analysis/CMakeLists.txt
  16. +1 −0 src/core/collision.cpp
  17. +18 −24 src/core/communication.cpp
  18. +4 −3 src/core/communication.hpp
  19. +1 −1 src/core/constraints/CMakeLists.txt
  20. +3 −0 src/core/constraints/Constraints.hpp
  21. +0 −1 src/core/cuda_interface.cpp
  22. +0 −1 src/core/cuda_wrapper.hpp
  23. +12 −2 src/core/debug.cpp
  24. +141 −287 src/core/domain_decomposition.cpp
  25. +1 −1 src/core/domain_decomposition.hpp
  26. +1 −1 src/core/electrostatics_magnetostatics/CMakeLists.txt
  27. +2 −1 src/core/electrostatics_magnetostatics/maggs.cpp
  28. +0 −1 src/core/electrostatics_magnetostatics/p3m-dipolar.cpp
  29. +0 −1 src/core/electrostatics_magnetostatics/p3m.cpp
  30. +16 −22 src/core/forces_inline.hpp
  31. +69 −67 src/core/ghosts.cpp
  32. +1 −3 src/core/grid.cpp
  33. +11 −8 src/core/grid.hpp
  34. +1 −1 src/core/immersed_boundary/CMakeLists.txt
  35. +4 −0 src/core/immersed_boundary/ImmersedBoundaries.cpp
  36. +1 −0 src/core/immersed_boundary/ImmersedBoundaries.hpp
  37. +11 −1 src/core/initialize.cpp
  38. +1 −1 src/core/io/writer/CMakeLists.txt
  39. +27 −38 src/core/layered.cpp
  40. +2 −13 src/core/layered.hpp
  41. +1 −1 src/core/minimize_energy.cpp
  42. +5 −11 src/core/nsquare.cpp
  43. +1 −13 src/core/nsquare.hpp
  44. +1 −1 src/core/object-in-fluid/CMakeLists.txt
  45. +0 −3 src/core/object-in-fluid/affinity.hpp
  46. +0 −1 src/core/object-in-fluid/membrane_collision.hpp
  47. +1 −1 src/core/observables/CMakeLists.txt
  48. +2 −14 src/core/observables/ParticleAngularVelocities.hpp
  49. +2 −14 src/core/observables/ParticleBodyVelocities.hpp
  50. +30 −56 src/core/particle_data.cpp
  51. +6 −6 src/core/particle_data.hpp
  52. +5 −2 src/core/random.hpp
  53. +9 −3 src/core/reaction_ensemble.cpp
  54. +2 −1 src/core/rotate_system.cpp
  55. +74 −198 src/core/rotation.cpp
  56. +6 −27 src/core/rotation.hpp
  57. +1 −1 src/core/shapes/CMakeLists.txt
  58. +36 −5 src/core/shapes/SimplePore.cpp
  59. +7 −22 src/core/short_range_loop.hpp
  60. +10 −79 src/core/thermostat.hpp
  61. +1 −1 src/core/unit_tests/CMakeLists.txt
  62. +84 −0 src/core/unit_tests/sendrecv_test.cpp
  63. +82 −0 src/core/utils/mpi/sendrecv.hpp
  64. +2 −2 src/core/virtual_sites/CMakeLists.txt
  65. +6 −4 src/core/virtual_sites/VirtualSitesRelative.cpp
  66. +2 −5 src/features.def
  67. +6 −8 src/python/espressomd/particle_data.pxd
  68. +11 −11 src/python/espressomd/particle_data.pyx
  69. +9 −1 src/python/espressomd/reaction_ensemble.pyx
  70. +1 −1 src/python/espressomd/script_interface.pyx
  71. +1 −1 src/script_interface/CMakeLists.txt
  72. +4 −0 src/script_interface/VariantTester.hpp
  73. +1 −1 testsuite/cmake/test_install.sh
  74. +1 −1 testsuite/python/CMakeLists.txt
  75. +1 −1 testsuite/python/collision_detection.py
  76. +1 −1 testsuite/python/constraint_shape_based.py
  77. +1,347 −1,347 testsuite/python/data/engine_lb.vtk
  78. +1,405 −1,405 testsuite/python/data/engine_lbgpu_2pt.vtk
  79. +2 −2 testsuite/python/ek_eof_one_species_base.py
  80. +1 −1 testsuite/python/ek_eof_one_species_x_nonlinear.py
  81. +1 −1 testsuite/python/ek_eof_one_species_y_nonlinear.py
  82. +2 −2 testsuite/python/ek_eof_one_species_z_nonlinear.py
  83. +3 −2 testsuite/python/lb.py
  84. +4 −4 testsuite/python/lb_thermostat.py
  85. +23 −5 testsuite/python/minimize_energy.py
  86. +11 −1 testsuite/python/simple_pore.py
  87. +4 −0 testsuite/python/variant_conversion.py
  88. +1 −1 testsuite/python/virtual_sites_tracers.py
  89. +2 −2 testsuite/python/virtual_sites_tracers_common.py
  90. +1 −1 testsuite/python/virtual_sites_tracers_gpu.py
@@ -375,19 +375,11 @@ endif()
# Paths
#######################################################################
if (NOT DEFINED DATA)
set(DATA "share/espresso")
endif(NOT DEFINED DATA)
if (NOT DEFINED LIBDIR)
set(LIBDIR "lib")
endif(NOT DEFINED LIBDIR)
if (NOT DEFINED BINDIR)
set(BINDIR "bin")
endif(NOT DEFINED BINDIR)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTDIR}/espressomd")
#######################################################################
@@ -409,6 +401,8 @@ endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
endif()
# drop 'lib' prefix from all libraries
set(CMAKE_SHARED_LIBRARY_PREFIX "")
if(WARNINGS_ARE_ERRORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
@@ -41,16 +41,21 @@ else()
endif()
# Check version
if(CYTHON_EXECUTABLE)
execute_process(COMMAND ${CYTHON_EXECUTABLE} -V
ERROR_VARIABLE CYTHON_OUTPUT OUTPUT_QUIET)
string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9]+).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}")
if(NOT CYTHON_EXECUTABLE)
set(CYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} -m cython)
endif()
execute_process(COMMAND ${CYTHON_EXECUTABLE} -V
ERROR_VARIABLE CYTHON_OUTPUT RESULT_VARIABLE CYTHON_STATUS OUTPUT_QUIET)
if(CYTHON_STATUS EQUAL 0)
string(REGEX REPLACE "^Cython version ([0-9]+\\.[0-9\\.]+).*" "\\1" CYTHON_VERSION "${CYTHON_OUTPUT}")
if(${CYTHON_VERSION} VERSION_LESS ${CYTHON_REQUIRED_VERSION})
message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, found verson ${CYTHON_VERSION}")
message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, found version ${CYTHON_VERSION}")
else()
message(STATUS "Found Cython version ${CYTHON_VERSION}")
endif()
else()
message(FATAL_ERROR "Espresso needs at least Cython version ${CYTHON_REQUIRED_VERSION}, but could not find it")
endif()
include( FindPackageHandleStandardArgs )
@@ -95,6 +95,16 @@ On Ubuntu 18.04, you need to modify a file to make CUDA work with the default co
sudo sed -i 's/__GNUC__ > 6/__GNUC__ > 7/g' /usr/include/crt/host_config.h
sudo sed -i 's/than 6/than 7/g' /usr/include/crt/host_config.h
If your computer has an AMD graphics card, you should also download and install the
ROCm SDK to make use of GPU computation:
.. code-block:: bash
wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
sudo apt update
sudo apt install libnuma-dev rocm-dkms rocblas rocfft rocrand
.. _Installing Requirements on Mac OS X:
Installing Requirements on Mac OS X
@@ -327,7 +327,7 @@ a whole simulation in a single file. For more details on the format,
refer to the VTF homepage (https://github.com/olenz/vtfplugin/wiki).
Creating files in these formats from within is supported by the commands :meth:`espressomd.io.writer.vtf.writevsf`
and :meth:`espressomd.io.writer.vtf.writevcf`, that write a structure and coordinate block (respectively ) to the
and :meth:`espressomd.io.writer.vtf.writevcf`, that write a structure and coordinate block (respectively) to the
given file. To create a standalone VTF file, first use ``writevsf`` at the beginning of
the simulation to write the particle definitions as a header, and then ``writevcf``
to generate a timeframe of the simulation state. For example:
@@ -344,7 +344,7 @@ A standalone VTF file can simply be
# ... add particles here
# write structure block as header
vtf.writevtf(system, fp)
vtf.writevsf(system, fp)
# write initial positions as coordinate block
vtf.writevcf(system, fp)
@@ -359,7 +359,7 @@ can easily add further structure lines to the VTF/VSF file after a
structure block has been written to specify further particle properties
for visualization.
Note that the ``ids`` of the particles in and VMD may differ. VMD requires
Note that the ``ids`` of the particles in |es| and VMD may differ. VMD requires
the particle ids to be enumerated continuously without any holes, while
this is not required in |es|. When using ``writevsf``
and ``writevcf``, the particle ids are
@@ -380,8 +380,7 @@ timesteps. This is a restriction of VMD itself, not of the format.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:meth:`espressomd.io.writer.vtf.writevsf`
Writes a structure block describing the system's structure to the given channel.
for example
Writes a structure block describing the system's structure to the given channel, for example:
.. code:: python
@@ -84,13 +84,13 @@ add_custom_command(
add_library(EspressoConfig SHARED config-features.cpp)
add_dependencies(EspressoConfig myconfig check_myconfig generate_config_features)
install(TARGETS EspressoConfig LIBRARY DESTINATION ${LIBDIR})
install(TARGETS EspressoConfig LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(EspressoConfig PROPERTIES SOVERSION ${SOVERSION})
target_include_directories(EspressoConfig PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
add_library(EspressoCore SHARED ${EspressoCore_SRC} config-version.cpp)
add_dependencies(EspressoCore EspressoConfig)
install(TARGETS EspressoCore LIBRARY DESTINATION ${LIBDIR})
install(TARGETS EspressoCore LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(EspressoCore PROPERTIES SOVERSION ${SOVERSION})
target_include_directories(EspressoCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(EspressoCore PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
@@ -130,7 +130,7 @@ if(CUDA)
cuda_include_directories(${CMAKE_CURRENT_BINARY_DIR})
cuda_add_library(EspressoCuda SHARED ${EspressoCuda_SRC})
install(TARGETS EspressoCuda DESTINATION ${LIBDIR})
install(TARGETS EspressoCuda DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(EspressoCuda PROPERTIES SOVERSION ${SOVERSION})
add_dependencies(EspressoCuda EspressoConfig)
@@ -5,7 +5,7 @@ set(Accumulators_SRC
MeanVarianceCalculator.cpp
)
add_library(Accumulators SHARED ${Accumulators_SRC})
install(TARGETS Accumulators LIBRARY DESTINATION ${LIBDIR})
install(TARGETS Accumulators LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(Accumulators PROPERTIES SOVERSION ${SOVERSION})
add_dependencies(Accumulators EspressoConfig)
set_target_properties(Accumulators PROPERTIES MACOSX_RPATH TRUE)
@@ -8,7 +8,7 @@ set(Actor_SRC
)
add_library(Actor SHARED ${Actor_SRC})
install(TARGETS Actor LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR})
install(TARGETS Actor LIBRARY DESTINATION ${PYTHON_INSTDIR}/espressomd ARCHIVE DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(Actor PROPERTIES SOVERSION ${SOVERSION})
add_dependencies(Actor EspressoConfig)
target_include_directories(Actor PRIVATE ${CMAKE_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
@@ -22,7 +22,7 @@ if(CUDA)
Mmm1dgpuForce_cuda.cu
)
cuda_add_library(ActorCuda SHARED ${ActorCuda_SRC})
install(TARGETS ActorCuda DESTINATION ${LIBDIR})
install(TARGETS ActorCuda DESTINATION ${PYTHON_INSTDIR}/espressomd)
set_target_properties(ActorCuda PROPERTIES SOVERSION ${SOVERSION})
add_dependencies(ActorCuda EspressoConfig)
@@ -372,6 +372,11 @@ inline bool pair_bond_exists_on(const Particle *const p,
inline bool pair_bond_enum_exists_on(const Particle *const p_bond,
const Particle *const p_partner,
BondedInteraction bond) {
#ifdef ADDITIONAL_CHECKS
extern int ghosts_have_bonds;
assert(ghosts_have_bonds);
#endif
int i = 0;
while (i < p_bond->bl.n) {
int type_num = p_bond->bl.e[i];
@@ -27,10 +27,7 @@
*/
#include "bonded_interaction_data.hpp"
#include "debug.hpp"
#include "errorhandling.hpp"
#include "particle_data.hpp"
#include "random.hpp"
#include "utils.hpp"
/************************************************************/
@@ -51,8 +48,6 @@ int fene_set_params(int bond_type, double k, double drmax, double r0);
inline int calc_fene_pair_force(Particle *p1, Particle *p2,
Bonded_ia_parameters *iaparams, double dx[3],
double force[3]) {
int i;
const double len2 = sqrlen(dx);
const double len = sqrt(len2);
const double dr = len - iaparams->p.fene.r0;
@@ -62,41 +57,15 @@ inline int calc_fene_pair_force(Particle *p1, Particle *p2,
double fac =
-iaparams->p.fene.k * dr / ((1.0 - dr * dr * iaparams->p.fene.drmax2i));
if (fabs(dr) > ROUND_ERROR_PREC) {
if (len > ROUND_ERROR_PREC) { /* Regular case */
fac /= len;
} else { /* dx[] == 0: the force is undefined. Let's use a random direction
*/
for (int i = 0; i < 3; i++)
dx[i] = d_random() - 0.5;
fac /= sqrt(sqrlen(dx));
}
if (len > ROUND_ERROR_PREC) {
fac /= len;
} else {
fac = 0.0;
}
FENE_TRACE(if (fac > 50)
fprintf(stderr,
"WARNING: FENE force factor between Pair (%d,%d) "
"large: %f at distance %f\n",
p1->p.identity, p2->p.identity, fac, sqrt(len2)));
for (i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
force[i] = fac * dx[i];
ONEPART_TRACE(if (p1->p.identity == check_id)
fprintf(stderr,
"%d: OPT: FENE f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p1->f.f[0], p1->f.f[1], p1->f.f[2],
p2->p.identity, sqrt(len2), fac));
ONEPART_TRACE(if (p2->p.identity == check_id)
fprintf(stderr,
"%d: OPT: FENE f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p2->f.f[0], p2->f.f[1], p2->f.f[2],
p1->p.identity, sqrt(len2), fac));
return 0;
}
@@ -108,8 +77,6 @@ inline int fene_pair_energy(Particle *p1, Particle *p2,
/* check bond stretching */
if (dr >= iaparams->p.fene.drmax) {
runtimeErrorMsg() << "FENE bond broken between particles " << p1->p.identity
<< " and " << p2->p.identity;
return 1;
}
@@ -29,9 +29,7 @@
/************************************************************/
#include "bonded_interaction_data.hpp"
#include "debug.hpp"
#include "particle_data.hpp"
#include "random.hpp"
#include "utils.hpp"
/// set the parameters for the harmonic potential
@@ -50,44 +48,22 @@ int harmonic_set_params(int bond_type, double k, double r, double r_cut);
inline int calc_harmonic_pair_force(Particle *p1, Particle *p2,
Bonded_ia_parameters *iaparams,
double dx[3], double force[3]) {
int i;
double fac;
double dist2 = sqrlen(dx);
double dist = sqrt(dist2);
double dr;
if ((iaparams->p.harmonic.r_cut > 0.0) && (dist > iaparams->p.harmonic.r_cut))
return 1;
dr = dist - iaparams->p.harmonic.r;
fac = -iaparams->p.harmonic.k * dr;
if (fabs(dr) > ROUND_ERROR_PREC) {
if (dist > ROUND_ERROR_PREC) { /* Regular case */
fac /= dist;
} else { /* dx[] == 0: the force is undefined. Let's use a random direction
*/
for (i = 0; i < 3; i++)
dx[i] = d_random() - 0.5;
fac /= sqrt(sqrlen(dx));
}
auto const dr = dist - iaparams->p.harmonic.r;
auto fac = -iaparams->p.harmonic.k * dr;
if (dist > ROUND_ERROR_PREC) { /* Regular case */
fac /= dist;
} else {
fac = 0;
}
for (i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
force[i] = fac * dx[i];
ONEPART_TRACE(if (p1->p.identity == check_id)
fprintf(stderr,
"%d: OPT: HARMONIC f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p1->f.f[0], p1->f.f[1], p1->f.f[2],
p2->p.identity, dist2, fac));
ONEPART_TRACE(if (p2->p.identity == check_id)
fprintf(stderr,
"%d: OPT: HARMONIC f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p2->f.f[0], p2->f.f[1], p2->f.f[2],
p1->p.identity, dist2, fac));
return 0;
}
@@ -29,9 +29,7 @@
/************************************************************/
#include "bonded_interaction_data.hpp"
#include "debug.hpp"
#include "particle_data.hpp"
#include "random.hpp"
#include "utils.hpp"
#ifdef ROTATION
@@ -53,60 +51,24 @@ int harmonic_dumbbell_set_params(int bond_type, double k1, double k2, double r,
inline int calc_harmonic_dumbbell_pair_force(Particle *p1, Particle *p2,
Bonded_ia_parameters *iaparams,
double dx[3], double force[3]) {
double fac;
double dist2 = sqrlen(dx);
double dist = sqrt(dist2);
double dr;
if ((iaparams->p.harmonic_dumbbell.r_cut > 0.0) &&
(dist > iaparams->p.harmonic_dumbbell.r_cut))
return 1;
dr = dist - iaparams->p.harmonic_dumbbell.r;
fac = -iaparams->p.harmonic_dumbbell.k1 * dr;
if (fabs(dr) > ROUND_ERROR_PREC) {
if (dist > ROUND_ERROR_PREC) /* Regular case */
fac /= dist;
else { /* dx[] == 0: the force is undefined. Let's use a random direction */
for (int i = 0; i < 3; i++)
dx[i] = d_random() - 0.5;
fac /= sqrt(sqrlen(dx));
}
} else {
fac = 0;
}
auto const dr = dist - iaparams->p.harmonic_dumbbell.r;
auto const normalizer = (dist > ROUND_ERROR_PREC) ? 1. / dist : 0.0;
auto const fac = -iaparams->p.harmonic_dumbbell.k1 * dr * normalizer;
for (int i = 0; i < 3; i++)
force[i] = fac * dx[i];
double dhat[3];
dhat[0] = dx[0] / dist;
dhat[1] = dx[1] / dist;
dhat[2] = dx[2] / dist;
double da[3];
const Vector3d director1 = p1->r.calc_director();
da[0] = dhat[1] * director1[2] - dhat[2] * director1[1];
da[1] = dhat[2] * director1[0] - dhat[0] * director1[2];
da[2] = dhat[0] * director1[1] - dhat[1] * director1[0];
p1->f.torque[0] += iaparams->p.harmonic_dumbbell.k2 * da[0];
p1->f.torque[1] += iaparams->p.harmonic_dumbbell.k2 * da[1];
p1->f.torque[2] += iaparams->p.harmonic_dumbbell.k2 * da[2];
ONEPART_TRACE(if (p1->p.identity == check_id)
fprintf(stderr,
"%d: OPT: HARMONIC f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p1->f.f[0], p1->f.f[1], p1->f.f[2],
p2->p.identity, dist2, fac));
ONEPART_TRACE(if (p2->p.identity == check_id)
fprintf(stderr,
"%d: OPT: HARMONIC f = (%.3e,%.3e,%.3e) with part "
"id=%d at dist %f fac %.3e\n",
this_node, p2->f.f[0], p2->f.f[1], p2->f.f[2],
p1->p.identity, dist2, fac));
auto const dhat = Vector3d{dx[0], dx[1], dx[2]} * normalizer;
auto const da = dhat.cross(p1->r.calc_director());
p1->f.torque += iaparams->p.harmonic_dumbbell.k2 * da;
return 0;
}
@@ -31,7 +31,6 @@
#include "bonded_interaction_data.hpp"
#include "debug.hpp"
#include "particle_data.hpp"
#include "random.hpp"
#include "utils.hpp"
/// set the parameters for the quartic potential
Oops, something went wrong.

0 comments on commit f14a5e9

Please sign in to comment.