Skip to content

Commit

Permalink
Merge branch 'python' into fix-3907
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Oct 29, 2020
2 parents 4a651c5 + dc0dfa1 commit 7bc2336
Show file tree
Hide file tree
Showing 35 changed files with 71 additions and 475 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ target_compile_options(
$<$<BOOL:${WARNINGS_ARE_ERRORS}>:-Werror>
# add extra warnings
$<$<CXX_COMPILER_ID:Clang>:-Wextern-initializer>
$<$<CXX_COMPILER_ID:Clang>:-Wrange-loop-analysis>
-Wfloat-conversion
# disable warnings from -Wextra
-Wno-sign-compare
-Wno-unused-function
Expand Down
2 changes: 0 additions & 2 deletions doc/sphinx/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@ documentation for all available observables in :mod:`espressomd.observables`.

- Observables working on a given set of particles and returning reduced quantities:

- :class:`~espressomd.observables.Current`: Total current of the system

- :class:`~espressomd.observables.DipoleMoment`: Total electric dipole moment of the system obtained based on unfolded positions

- :class:`~espressomd.observables.MagneticDipoleMoment`: Total magnetic dipole moment of the system based on the :attr:`espressomd.particle_data.ParticleHandle.dip` property.
Expand Down
28 changes: 0 additions & 28 deletions doc/sphinx/inter_bonded.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,6 @@ The third, optional parameter defines a cutoff radius. Whenever a
harmonic bond gets longer than :math:`r_\mathrm{cut}`, the bond will be reported as broken,
and a background error will be raised.

.. _Harmonic Dumbbell Bond:

Harmonic Dumbbell Bond
~~~~~~~~~~~~~~~~~~~~~~

.. note::

Requires ``ROTATION`` feature.


A harmonic Dumbbell bond can be instantiated via
:class:`espressomd.interactions.HarmonicDumbbellBond`::

from espressomd.interactions import HarmonicDumbbellBond
hdb = HarmonicDumbbellBond(k1=<float>, k2=<float>, r_0=<float>, r_cut=<float>)


This bond is similar to the normal harmonic bond in such a way that it
sets up a harmonic potential, i.e. a spring, between the two particles.
Additionally the orientation of the first particle in the bond will be aligned along
the distance vector between both particles. This alignment can be
controlled by the second harmonic constant :math:`k_2`. Keep in mind that orientation will
oscillate around the distance vector and some kind of
friction needs to be present for it to relax.

The roles of the parameters :math:`k_1, r_0, r_\mathrm{cut}` are exactly the same as for the
harmonic bond.

.. _Quartic bond:

Quartic bond
Expand Down
3 changes: 2 additions & 1 deletion src/core/DomainDecomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ void DomainDecomposition::create_cell_grid(double range) {

if (range <= 0.) {
/* this is the non-interacting case */
const int cells_per_dir = std::ceil(std::pow(min_num_cells, 1. / 3.));
auto const cells_per_dir =
static_cast<int>(std::ceil(std::pow(min_num_cells, 1. / 3.)));

cell_grid[0] = cells_per_dir;
cell_grid[1] = cells_per_dir;
Expand Down
8 changes: 4 additions & 4 deletions src/core/actor/DipolarBarnesHut_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ __global__ __launch_bounds__(THREADS2, FACTOR2) void treeBuildingKernel() {
j = 0;
for (l = 0; l < 3; l++)
if (root[l] < p[l])
j += pow(2, l);
j += static_cast<int>(pow(2, l));
}

// Follow path to leaf cell. Should not happen at the first iteration of
Expand Down Expand Up @@ -283,7 +283,7 @@ __global__ __launch_bounds__(THREADS2, FACTOR2) void treeBuildingKernel() {
// j=0..7 determines the octant in a binary representations.
for (l = 0; l < 3; l++)
if (bhpara->r[3 * n + l] < p[l])
j += pow(2, l);
j += static_cast<int>(pow(2, l));
ch = bhpara->child[n * 8 + j];
}
// Now we are deep enough in the tree, passed all levels of cells and
Expand Down Expand Up @@ -390,7 +390,7 @@ __global__ __launch_bounds__(THREADS2, FACTOR2) void treeBuildingKernel() {
j = 0;
for (l = 0; l < 3; l++)
if (pos[l] < bhpara->r[3 * ch + l])
j += pow(2, l);
j += static_cast<int>(pow(2, l));
// New element just appeared in the chain of cells. Hence, that what
// supposed to be a child ("ch") before entering the present
// iteration, now will be a child of the new cell (after this
Expand All @@ -406,7 +406,7 @@ __global__ __launch_bounds__(THREADS2, FACTOR2) void treeBuildingKernel() {
// given thread and block against new octant cell (pos[l]):
for (l = 0; l < 3; l++)
if (pos[l] < p[l])
j += pow(2, l);
j += static_cast<int>(pow(2, l));

// Now the current cell's child should be considering in the new
// particle new octant:
Expand Down
4 changes: 2 additions & 2 deletions src/core/actor/DipolarDirectSum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DipolarDirectSum : public Actor {
dds_float box[3];
int per[3];
for (int i = 0; i < 3; i++) {
box[i] = s.box()[i];
box[i] = static_cast<dds_float>(s.box()[i]);
per[i] = (box_geo.periodic(i));
}
DipolarDirectSum_kernel_wrapper_force(
Expand All @@ -72,7 +72,7 @@ class DipolarDirectSum : public Actor {
dds_float box[3];
int per[3];
for (int i = 0; i < 3; i++) {
box[i] = s.box()[i];
box[i] = static_cast<dds_float>(s.box()[i]);
per[i] = (box_geo.periodic(i));
}
DipolarDirectSum_kernel_wrapper_energy(
Expand Down
1 change: 0 additions & 1 deletion src/core/bonded_interactions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/dihedral.cpp
${CMAKE_CURRENT_SOURCE_DIR}/fene.cpp
${CMAKE_CURRENT_SOURCE_DIR}/harmonic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/harmonic_dumbbell.cpp
${CMAKE_CURRENT_SOURCE_DIR}/quartic.cpp
${CMAKE_CURRENT_SOURCE_DIR}/thermalized_bond.cpp
${CMAKE_CURRENT_SOURCE_DIR}/umbrella.cpp)
2 changes: 0 additions & 2 deletions src/core/bonded_interactions/bonded_interaction_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ auto cutoff(int type, Bond_parameters const &bp) {
return bp.fene.cutoff();
case BONDED_IA_HARMONIC:
return bp.harmonic.cutoff();
case BONDED_IA_HARMONIC_DUMBBELL:
return bp.harmonic_dumbbell.cutoff();
case BONDED_IA_QUARTIC:
return bp.quartic.cutoff();
case BONDED_IA_BONDED_COULOMB:
Expand Down
1 change: 0 additions & 1 deletion src/core/bonded_interactions/bonded_interaction_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ union Bond_parameters {
Oif_global_forces_bond_parameters oif_global_forces;
Oif_local_forces_bond_parameters oif_local_forces;
Harmonic_bond_parameters harmonic;
Harmonic_dumbbell_bond_parameters harmonic_dumbbell;
Quartic_bond_parameters quartic;
Bonded_coulomb_bond_parameters bonded_coulomb;
Bonded_coulomb_sr_bond_parameters bonded_coulomb_sr;
Expand Down
52 changes: 0 additions & 52 deletions src/core/bonded_interactions/harmonic_dumbbell.cpp

This file was deleted.

102 changes: 0 additions & 102 deletions src/core/bonded_interactions/harmonic_dumbbell.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/cluster_analysis/ClusterStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ClusterStructure::run_for_all_pairs() {
void ClusterStructure::run_for_bonded_particles() {
clear();
for (const auto &p : partCfg()) {
for (auto const &bond : p.bonds()) {
for (auto const bond : p.bonds()) {
if (bond.partner_ids().size() == 1) {
add_pair(p, get_particle_data(bond.partner_ids()[0]));
}
Expand Down
5 changes: 0 additions & 5 deletions src/core/energy_inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "bonded_interactions/dihedral.hpp"
#include "bonded_interactions/fene.hpp"
#include "bonded_interactions/harmonic.hpp"
#include "bonded_interactions/harmonic_dumbbell.hpp"
#include "bonded_interactions/quartic.hpp"
#include "bonded_interactions/umbrella.hpp"
#include "errorhandling.hpp"
Expand Down Expand Up @@ -219,10 +218,6 @@ calc_bonded_energy(Bonded_ia_parameters const &iaparams, Particle const &p1,
switch (type) {
case BONDED_IA_FENE:
return fene_pair_energy(iaparams, dx);
#ifdef ROTATION
case BONDED_IA_HARMONIC_DUMBBELL:
return harmonic_dumbbell_pair_energy(p1.r.calc_director(), iaparams, dx);
#endif
case BONDED_IA_HARMONIC:
return harmonic_pair_energy(iaparams, dx);
case BONDED_IA_QUARTIC:
Expand Down
23 changes: 2 additions & 21 deletions src/core/forces_inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "bonded_interactions/dihedral.hpp"
#include "bonded_interactions/fene.hpp"
#include "bonded_interactions/harmonic.hpp"
#include "bonded_interactions/harmonic_dumbbell.hpp"
#include "bonded_interactions/quartic.hpp"
#include "bonded_interactions/thermalized_bond.hpp"
#include "bonded_interactions/umbrella.hpp"
Expand Down Expand Up @@ -302,27 +301,14 @@ inline void add_non_bonded_pair_force(Particle &p1, Particle &p2,
* @param[in] p2 Second particle.
* @param[in] iaparams Bonded parameters for the interaction.
* @param[in] dx Vector between @p p1 and @p p2.
* @param[out] torque Torque on @p p1.
*/
inline boost::optional<Utils::Vector3d>
calc_bond_pair_force(Particle const &p1, Particle const &p2,
Bonded_ia_parameters const &iaparams,
Utils::Vector3d const &dx, Utils::Vector3d &torque) {
Utils::Vector3d const &dx) {
switch (iaparams.type) {
case BONDED_IA_FENE:
return fene_pair_force(iaparams, dx);
#ifdef ROTATION
case BONDED_IA_HARMONIC_DUMBBELL: {
auto values =
harmonic_dumbbell_pair_force(p1.r.calc_director(), iaparams, dx);
if (values) {
torque = std::get<1>(values.get());
return boost::optional<Utils::Vector3d>(std::get<0>(values.get()));
}

return {};
}
#endif
case BONDED_IA_HARMONIC:
return harmonic_pair_force(iaparams, dx);
case BONDED_IA_QUARTIC:
Expand Down Expand Up @@ -363,16 +349,11 @@ inline bool add_bonded_two_body_force(Bonded_ia_parameters const &iaparams,
}
}
default: {
Utils::Vector3d torque1{};
auto result = calc_bond_pair_force(p1, p2, iaparams, dx, torque1);
auto result = calc_bond_pair_force(p1, p2, iaparams, dx);
if (result) {
p1.f.f += result.get();
p2.f.f -= result.get();

#ifdef ROTATION
p1.f.torque += torque1;
#endif

#ifdef NPT
npt_add_virial_contribution(result.get(), dx);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/core/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int map_position_node_array(const Utils::Vector3d &pos) {

Utils::Vector3i im;
for (int i = 0; i < 3; i++) {
im[i] = std::floor(f_pos[i] / local_geo.length()[i]);
im[i] = static_cast<int>(std::floor(f_pos[i] / local_geo.length()[i]));
im[i] = boost::algorithm::clamp(im[i], 0, node_grid[i] - 1);
}

Expand Down
Loading

0 comments on commit 7bc2336

Please sign in to comment.