17#include <Kokkos_Random.hpp>
32 Kokkos::Random_XorShift1024_Pool<> randPool_ = Kokkos::Random_XorShift1024_Pool<>(1234);
40 temperature_ = temperature;
45 set(zeta, temperature);
59 template <OnePositionPredicate Pred>
63template <OnePositionPredicate Pred>
69 auto dtHalf(0.5_r * dt);
76 auto temperature = temperature_;
79 auto kernel = KOKKOS_LAMBDA(
const idx_t& idx,
real_t& maxDistSqr)
96 pos(idx, 0), pos(idx, 1), pos(idx, 2), vel(idx, 0), vel(idx, 1), vel(idx, 2), dtHalf);
98 if (pred(pos(idx, 0), pos(idx, 1), pos(idx, 2)))
101 auto randGen = RNG.get_state();
116 RNG.free_state(randGen);
120 pos(idx, 0), pos(idx, 1), pos(idx, 2), vel(idx, 0), vel(idx, 1), vel(idx, 2), dtHalf);
122 dx[0] -= pos(idx, 0);
123 dx[1] -= pos(idx, 1);
124 dx[2] -= pos(idx, 2);
127 maxDistSqr = Kokkos::max(distSqr, maxDistSqr);
130 Kokkos::parallel_reduce(
"VelocityVerletLangevinThermostat::preForceIntegrate",
133 Kokkos::Max<real_t>(maxDistSqr));
135 return std::sqrt(maxDistSqr);
Definition VelocityVerletLangevinThermostat.hpp:30
void set(const real_t &zeta, const real_t &temperature)
Definition VelocityVerletLangevinThermostat.hpp:37
real_t preForceIntegrate_apply_if(data::Atoms &atoms, const real_t dt, const Pred &pred)
Definition VelocityVerletLangevinThermostat.hpp:64
real_t preForceIntegrate(data::Atoms &atoms, const real_t dt)
Definition VelocityVerletLangevinThermostat.hpp:48
void postForceIntegrate(data::Atoms &atoms, const real_t dt)
Definition VelocityVerletLangevinThermostat.hpp:54
VelocityVerletLangevinThermostat(const real_t &zeta, const real_t &temperature)
Definition VelocityVerletLangevinThermostat.hpp:43
static void postForceIntegrate(data::Atoms &atoms, const real_t dt)
Definition VelocityVerlet.cpp:69
Data structure for storing information about atoms on the host and the device.
Definition Atoms.hpp:35
KOKKOS_FORCEINLINE_FUNCTION vel_t getVel() const
Definition Atoms.hpp:65
idx_t numLocalAtoms
Definition Atoms.hpp:120
KOKKOS_FORCEINLINE_FUNCTION pos_t getPos() const
Definition Atoms.hpp:64
KOKKOS_FORCEINLINE_FUNCTION force_t getForce() const
Definition Atoms.hpp:66
KOKKOS_FORCEINLINE_FUNCTION charge_t getMass() const
Definition Atoms.hpp:68
KOKKOS_INLINE_FUNCTION void updateDrift(real_t &pos_x, real_t &pos_y, real_t &pos_z, const real_t &vel_x, const real_t &vel_y, const real_t &vel_z, const real_t &dt)
Definition UpdateSteps.hpp:43
KOKKOS_INLINE_FUNCTION void updateKick(real_t &vel_x, real_t &vel_y, real_t &vel_z, const real_t &force_x, const real_t &force_y, const real_t &force_z, const real_t &dt, const real_t &mass)
Definition UpdateSteps.hpp:26
KOKKOS_INLINE_FUNCTION void updateOrnsteinUhlenbeck(real_t &vel_x, real_t &vel_y, real_t &vel_z, const real_t &dt, const real_t &mass, const real_t &zeta, const real_t &temperature, const real_t &rand_x, const real_t &rand_y, const real_t &rand_z)
Definition UpdateSteps.hpp:57
KOKKOS_INLINE_FUNCTION real_t dot3(real_t const *const a, real_t const *const b)
Definition math.hpp:24
Definition BerendsenBarostat.cpp:18
int64_t idx_t
Definition datatypes.hpp:91
double real_t
Definition datatypes.hpp:99