Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Feb 4, 2025
1 parent d7e14b0 commit fec0d24
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/core/lb/LBWalberla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void LBWalberla::veto_kT(double kT) const {
auto const energy_conversion =
Utils::int_pow<2>(lb_params->get_agrid() / lb_params->get_tau());
auto const lb_kT = lb_fluid->get_kT() * energy_conversion;
if (not ::Thermostat::are_kT_equal(lb_kT, kT)) {
if (not(::Thermostat::are_kT_equal(lb_kT, kT))) {
throw std::runtime_error("Temperature change not supported by LB");
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/unit_tests/Verlet_list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ struct IntegratorHelper : public ParticleFactory {
/** Set particle to move along the x-axis. */
virtual void set_particle_properties(int) const = 0;
virtual char const *name() const = 0;
friend auto operator<<(std::ostream &os,
IntegratorHelper const &obj) -> std::ostream & {
friend auto operator<<(std::ostream &os, IntegratorHelper const &obj)
-> std::ostream & {
return os << obj.name();
}
};
Expand Down
7 changes: 4 additions & 3 deletions src/python/espressomd/code_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from . import code_info
from . import utils


class FeaturesError(Exception):

Expand All @@ -33,6 +30,8 @@ def has_features(*args):
Check whether a list of features is a subset of the compiled-in features.
"""

from . import code_info
from . import utils
lvl = utils.nesting_level(args)
assert lvl in [1, 2], "has_features() takes strings as argument"
if lvl == 2:
Expand All @@ -53,6 +52,8 @@ def missing_features(*args):
Return a list of the missing features in the arguments.
"""

from . import code_info
from . import utils
lvl = utils.nesting_level(args)
assert lvl in [1, 2], "missing_features() takes strings as argument"
if lvl == 2:
Expand Down
10 changes: 5 additions & 5 deletions src/utils/include/utils/mask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ auto mask_impl(Integral mask, T t, std::index_sequence<I...>) {
* @return t partially zeroed out according to mask
*/
template <class T, class Integral>
auto mask(Integral mask,
T t) -> std::enable_if_t<std::is_unsigned_v<Integral> &&
(size_in_bits<Integral>::value >=
tuple_size<T>::value),
T> {
auto mask(Integral mask, T t)
-> std::enable_if_t<std::is_unsigned_v<Integral> &&
(size_in_bits<Integral>::value >=
tuple_size<T>::value),
T> {
return detail::mask_impl(mask, t,
std::make_index_sequence<tuple_size<T>::value>{});
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/include/utils/math/bspline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
namespace Utils {
/** @brief Formula of the B-spline. */
template <int order, typename T>
DEVICE_QUALIFIER auto
bspline(int i, T x) -> std::enable_if_t<(order > 0) && (order <= 7), T> {
DEVICE_QUALIFIER auto bspline(int i, T x)
-> std::enable_if_t<(order > 0) && (order <= 7), T> {
DEVICE_ASSERT(i < order);
DEVICE_ASSERT(x >= T(-0.5));
DEVICE_ASSERT(x <= T(0.5));
Expand Down Expand Up @@ -206,8 +206,8 @@ template <class T> auto bspline(int i, T x, int k) {

/** @brief Derivative of the B-spline. */
template <int order, typename T = double>
DEVICE_QUALIFIER auto
bspline_d(int i, T x) -> std::enable_if_t<(order > 0) && (order <= 7), T> {
DEVICE_QUALIFIER auto bspline_d(int i, T x)
-> std::enable_if_t<(order > 0) && (order <= 7), T> {
DEVICE_ASSERT(i < order);
DEVICE_ASSERT(x >= T(-0.5));
DEVICE_ASSERT(x <= T(0.5));
Expand Down
8 changes: 4 additions & 4 deletions src/utils/include/utils/serialization/memcpy_archive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ template <class Derived> class BasicMemcpyArchive {

public:
template <class T>
auto
operator>>(T &value) -> std::enable_if_t<detail::use_serialize<T>::value> {
auto operator>>(T &value)
-> std::enable_if_t<detail::use_serialize<T>::value> {
process(value);
}

template <class T>
auto
operator<<(T &value) -> std::enable_if_t<detail::use_serialize<T>::value> {
auto operator<<(T &value)
-> std::enable_if_t<detail::use_serialize<T>::value> {
process(value);
}

Expand Down
3 changes: 1 addition & 2 deletions src/utils/tests/Vector_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
using Utils::Vector;

/* Number of nontrivial Baxter permutations of length 2n-1. (A001185) */
#define TEST_NUMBERS \
{ 0, 1, 1, 7, 21, 112, 456, 2603, 13203 }
#define TEST_NUMBERS {0, 1, 1, 7, 21, 112, 456, 2603, 13203}

constexpr int test_numbers[] = TEST_NUMBERS;
constexpr std::size_t n_test_numbers = sizeof(test_numbers) / sizeof(int);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ReactionKernelIndexed_1_double_precision {
double rate_coefficient,
double stoech_0)
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), order_0_(order_0),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0){};
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ReactionKernelIndexed_1_single_precision {
float rate_coefficient,
float stoech_0)
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), order_0_(order_0),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0){};
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ReactionKernelIndexed_2_double_precision {
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), rho_1ID(rho_1ID_),
order_0_(order_0), order_1_(order_1),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1){};
stoech_1_(stoech_1) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ReactionKernelIndexed_2_single_precision {
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), rho_1ID(rho_1ID_),
order_0_(order_0), order_1_(order_1),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1){};
stoech_1_(stoech_1) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ReactionKernelIndexed_3_double_precision {
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), rho_1ID(rho_1ID_),
rho_2ID(rho_2ID_), order_0_(order_0), order_1_(order_1),
order_2_(order_2), rate_coefficient_(rate_coefficient),
stoech_0_(stoech_0), stoech_1_(stoech_1), stoech_2_(stoech_2){};
stoech_0_(stoech_0), stoech_1_(stoech_1), stoech_2_(stoech_2) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ReactionKernelIndexed_3_single_precision {
: indexVectorID(indexVectorID_), rho_0ID(rho_0ID_), rho_1ID(rho_1ID_),
rho_2ID(rho_2ID_), order_0_(order_0), order_1_(order_1),
order_2_(order_2), rate_coefficient_(rate_coefficient),
stoech_0_(stoech_0), stoech_1_(stoech_1), stoech_2_(stoech_2){};
stoech_0_(stoech_0), stoech_1_(stoech_1), stoech_2_(stoech_2) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ReactionKernelIndexed_4_double_precision {
rho_2ID(rho_2ID_), rho_3ID(rho_3ID_), order_0_(order_0),
order_1_(order_1), order_2_(order_2), order_3_(order_3),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3){};
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ReactionKernelIndexed_4_single_precision {
rho_2ID(rho_2ID_), rho_3ID(rho_3ID_), order_0_(order_0),
order_1_(order_1), order_2_(order_2), order_3_(order_3),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3){};
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ReactionKernelIndexed_5_double_precision {
order_3_(order_3), order_4_(order_4),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3),
stoech_4_(stoech_4){};
stoech_4_(stoech_4) {}

void run(IBlock *block);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ReactionKernelIndexed_5_single_precision {
order_3_(order_3), order_4_(order_4),
rate_coefficient_(rate_coefficient), stoech_0_(stoech_0),
stoech_1_(stoech_1), stoech_2_(stoech_2), stoech_3_(stoech_3),
stoech_4_(stoech_4){};
stoech_4_(stoech_4) {}

void run(IBlock *block);

Expand Down
1 change: 0 additions & 1 deletion testsuite/python/constant_pH.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# pylint: disable=cyclic-import
import unittest as ut
import numpy as np
import espressomd
Expand Down
3 changes: 2 additions & 1 deletion testsuite/python/ek_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ def test_ek_bulk_reactions(self):

def test_raise_if_read_only(self):
ek_species = self.make_default_ek_species()
for key in {"lattice", "shape", "single_precision", "seed", "thermalized"}:
for key in {"lattice", "shape",
"single_precision", "seed", "thermalized"}:
with self.assertRaisesRegex(RuntimeError, f"(Parameter|Property) '{key}' is read-only"):
setattr(ek_species, key, 0)

Expand Down
3 changes: 2 additions & 1 deletion testsuite/python/ibm.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ def test_tribend_checkpointing(self):
system.bonded_inter.add(tribend_original)
system.bonded_inter.add(tribend_unpickled)
tribend_skip_init = pickle.loads(pickle.dumps(tribend_original))
for tribend in [tribend_original, tribend_unpickled, tribend_skip_init]:
for tribend in [tribend_original,
tribend_unpickled, tribend_skip_init]:
self.assertTrue(tribend.is_initialized)
self.assertAlmostEqual(tribend.theta0, theta0, delta=1e-6)
self.assertEqual(tribend.ind1, p1.id)
Expand Down
3 changes: 2 additions & 1 deletion testsuite/python/lb_lees_edwards_particle_coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def test_viscous_coupling_with_offset(self):
np.testing.assert_allclose(
np.copy(n.last_applied_force), -w * np.copy(p.f))

def check_velocity_interpolation(self, pos_offset, shear_vel, test_positions):
def check_velocity_interpolation(
self, pos_offset, shear_vel, test_positions):
system.lb = None
system.part.clear()
system.time_step = 1
Expand Down
2 changes: 1 addition & 1 deletion testsuite/python/mpiio.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_random_mock_particles():
p1 = randint_different_from(0, npart, i)
p2 = randint_different_from(0, npart, i)

# Don't add the same bond twice and don't use the same particle twice
# avoid adding the same bond twice or using the same particle twice
if p1 != p2 and (btype, p1, p2) not in p.bonds:
p.bonds.append((btype, p1, p2))
parts.append(p)
Expand Down

0 comments on commit fec0d24

Please sign in to comment.