40#include <boost/variant.hpp>
78 p2.
mol_id(), flatten(stress));
82 if (!obs_pressure.
coulomb.empty() and kernel_pressure !=
nullptr) {
84 auto const p_coulomb = (*kernel_pressure)(p1.
q() * p2.
q(), d, dist);
86 for (std::size_t i = 0u; i < 3u; i++) {
87 for (std::size_t j = 0u; j < 3u; j++) {
88 obs_pressure.
coulomb[i * 3u + j] += p_coulomb(i, j);
97 fprintf(stderr,
"calculating pressure for magnetostatics which doesn't "
98 "have it implemented\n");
103inline std::optional<Utils::Matrix<double, 3, 3>>
110 std::optional<Utils::Matrix<double, 3, 3>> pressure{std::nullopt};
117inline std::optional<Utils::Matrix<double, 3, 3>>
122 if ((boost::get<AngleHarmonicBond>(&iaparams) !=
nullptr) ||
123 (boost::get<AngleCosineBond>(&iaparams) !=
nullptr) ||
125 (boost::get<TabulatedAngleBond>(&iaparams) !=
nullptr) ||
127 (boost::get<AngleCossquareBond>(&iaparams) !=
nullptr)) {
135 std::tie(std::ignore, force2, force3) = result.value();
142 std::to_string(iaparams.which()) +
143 " in pressure calculation.";
152 std::span<Particle *> partners,
BoxGeometry const &box_geo,
160 *partners[1], box_geo);
163 std::to_string(iaparams.which()) +
164 " in pressure calculation.";
179 for (std::size_t k = 0u; k < 3u; k++)
180 for (std::size_t l = 0u; l < 3u; l++)
Vector implementation and trait types for boost qvm interoperability.
Data structures for bonded interactions.
int number_of_partners(Bonded_IA_Parameters const &iaparams)
Get the number of bonded partners for the specified bond.
boost::variant< NoneBond, FeneBond, HarmonicBond, QuarticBond, BondedCoulomb, BondedCoulombSR, AngleHarmonicBond, AngleCosineBond, AngleCossquareBond, DihedralBond, TabulatedDistanceBond, TabulatedAngleBond, TabulatedDihedralBond, ThermalizedBond, RigidBond, IBMTriel, IBMVolCons, IBMTribend, OifGlobalForcesBond, OifLocalForcesBond, VirtualBond > Bonded_IA_Parameters
Variant in which to store the parameters of an individual bonded interaction.
container for bonded interactions.
Utils::Vector< T, 3 > get_mi_vector(const Utils::Vector< T, 3 > &a, const Utils::Vector< T, 3 > &b) const
Get the minimum-image vector between two coordinates.
Observable for the pressure and energy.
std::span< double > coulomb
Contribution(s) from Coulomb interactions.
void add_non_bonded_contribution(int type1, int type2, int molid1, int molid2, std::span< const double > data)
std::span< double > kinetic_lin
Contribution from linear kinetic energy.
This file contains the defaults for ESPResSo.
static auto pair_force(Utils::Vector3d const &d, Utils::Vector3d const &m1, Utils::Vector3d const &m2)
Pair force of two interacting dipoles.
This file contains the errorhandling code for severe errors, like a broken bond or illegal parameter ...
#define runtimeWarningMsg()
bool do_nonbonded(Particle const &p1, Particle const &p2)
Determine if the non-bonded interactions between p1 and p2 should be calculated.
ParticleForce calc_central_radial_force(IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist)
std::optional< Utils::Vector3d > calc_bond_pair_force(Bonded_IA_Parameters const &iaparams, Particle const &p1, Particle const &p2, Utils::Vector3d const &dx, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Compute the bonded interaction force between particle pairs.
ParticleForce calc_non_central_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist)
std::optional< std::tuple< Utils::Vector3d, Utils::Vector3d, Utils::Vector3d > > calc_bonded_three_body_force(Bonded_IA_Parameters const &iaparams, BoxGeometry const &box_geo, Particle const &p1, Particle const &p2, Particle const &p3)
Solver const & get_dipoles()
Matrix< T, N, M > tensor_product(const Vector< T, N > &x, const Vector< T, M > &y)
Various procedures concerning interactions between particles.
void add_non_bonded_pair_virials(Particle const &p1, Particle const &p2, Utils::Vector3d const &d, double dist, IA_parameters const &ia_params, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel_forces, Coulomb::ShortRangePressureKernel::kernel_type const *kernel_pressure, Observable_stat &obs_pressure)
Calculate non-bonded energies between a pair of particles.
std::optional< Utils::Matrix< double, 3, 3 > > calc_bonded_pressure_tensor(Bonded_IA_Parameters const &iaparams, Particle const &p1, std::span< Particle * > partners, BoxGeometry const &box_geo, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
void add_kinetic_virials(Particle const &p1, Observable_stat &obs_pressure)
Calculate kinetic pressure (aka energy) for one particle.
std::optional< Utils::Matrix< double, 3, 3 > > calc_bonded_three_body_pressure_tensor(Bonded_IA_Parameters const &iaparams, Particle const &p1, Particle const &p2, Particle const &p3, BoxGeometry const &box_geo)
std::optional< Utils::Matrix< double, 3, 3 > > calc_bonded_virial_pressure_tensor(Bonded_IA_Parameters const &iaparams, Particle const &p1, Particle const &p2, BoxGeometry const &box_geo, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Solver::ShortRangeForceKernel kernel_type
Solver::ShortRangePressureKernel kernel_type
Parameters for non-bonded interactions.
Struct holding all information for one particle.
auto const & mass() const
auto const & type() const
auto const & mol_id() const
Matrix representation with static size.
Utils::Vector3d thole_pair_force(Particle const &p1, Particle const &p2, IA_parameters const &ia_params, Utils::Vector3d const &d, double dist, BondedInteractionsMap const &bonded_ias, Coulomb::ShortRangeForceKernel::kernel_type const *kernel)
Calculate Thole force.