19#ifndef OBSERVABLES_PARTICLEDIHEDRALS_HPP
20#define OBSERVABLES_PARTICLEDIHEDRALS_HPP
24#include "system/System.hpp"
50 if (this->
ids().size() < 4)
51 throw std::runtime_error(
"At least 4 particles are required");
58 auto const positions_sorted = detail::get_all_particle_positions(
59 comm, local_particles,
ids(),
traits,
false);
61 if (comm.rank() != 0) {
67 auto v1 = box_geo.get_mi_vector(positions_sorted[1], positions_sorted[0]);
68 auto v2 = box_geo.get_mi_vector(positions_sorted[2], positions_sorted[1]);
70 for (std::size_t i = 0, end =
n_values(); i < end; i++) {
71 auto v3 = box_geo.get_mi_vector(positions_sorted[i + 3],
72 positions_sorted[i + 2]);
83 std::vector<std::size_t>
shape()
const override {
84 assert(
ids().size() >= 3);
85 return {
ids().size() - 3};
Vector implementation and trait types for boost qvm interoperability.
Calculate dihedral angles between particles in a polymer.
BondDihedrals(std::vector< int > ids)
std::vector< double > evaluate(boost::mpi::communicator const &comm, ParticleReferenceRange const &local_particles, const ParticleObservables::traits< Particle > &traits) const override
std::vector< std::size_t > shape() const override
std::size_t n_values() const
Size of the flat array returned by the observable.
Particle-based observable.
PidObservable(std::vector< int > ids)
std::vector< int > const & ids() const
std::shared_ptr< BoxGeometry > box_geo
__device__ void vector_product(float const *a, float const *b, float *out)
std::vector< std::reference_wrapper< Particle const > > ParticleReferenceRange
Vector< T, 3 > vector_product(Vector< T, 3 > const &a, Vector< T, 3 > const &b)