ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
virtual_sites.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "config/config.hpp"
23
24#ifdef VIRTUAL_SITES_RELATIVE
25
26#include "BoxGeometry.hpp"
27#include "Particle.hpp"
28#include "PropagationMode.hpp"
29
30#include <utils/quaternion.hpp>
31
32#include <tuple>
33
34/** Calculate the rotation quaternion and distance between two particles */
35std::tuple<Utils::Quaternion<double>, double>
37 Particle const &p_relate_to,
38 BoxGeometry const &box_geo, double min_global_cut,
39 bool override_cutoff_check = false);
40
41/**
42 * @brief Setup a virtual site to track a real particle.
43 * @param[in] box_geo Box geometry.
44 * @param[in,out] p_vs Virtual site.
45 * @param[in] p_relate_to Real particle to follow.
46 * @param[in] min_global_cut Minimal global cutoff.
47 */
48inline void vs_relate_to(Particle &p_vs, Particle const &p_relate_to,
49 BoxGeometry const &box_geo, double min_global_cut) {
50 // Set the particle id of the particle we want to relate to, the distance
51 // and the relative orientation
52 auto &vs_relative = p_vs.vs_relative();
53 vs_relative.to_particle_id = p_relate_to.id();
54 std::tie(vs_relative.rel_orientation, vs_relative.distance) =
55 calculate_vs_relate_to_params(p_vs, p_relate_to, box_geo, min_global_cut);
56 p_vs.propagation() =
58}
59
60#endif // VIRTUAL_SITES_RELATIVE
This file contains the defaults for ESPResSo.
Quaternion implementation and trait types for boost qvm interoperability.
Struct holding all information for one particle.
Definition Particle.hpp:395
auto const & propagation() const
Definition Particle.hpp:421
auto const & vs_relative() const
Definition Particle.hpp:527
auto const & id() const
Definition Particle.hpp:414
std::tuple< Utils::Quaternion< double >, double > calculate_vs_relate_to_params(Particle const &p_current, Particle const &p_relate_to, BoxGeometry const &box_geo, double min_global_cut, bool override_cutoff_check=false)
Calculate the rotation quaternion and distance between two particles.
void vs_relate_to(Particle &p_vs, Particle const &p_relate_to, BoxGeometry const &box_geo, double min_global_cut)
Setup a virtual site to track a real particle.