ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
BindCenters.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2011-2024 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#include <config/config.hpp>
21
22#ifdef COLLISION_DETECTION
23
24#include "BindCenters.hpp"
25#include "CollisionPair.hpp"
26#include "utils.hpp"
27
28#include "Particle.hpp"
31#include "system/System.hpp"
32
33#include <utils/math/sqr.hpp>
34
35#include <cassert>
36#include <stdexcept>
37#include <utility>
38#include <vector>
39
40namespace CollisionDetection {
41
43 // Validate distance
44 if (distance <= 0.) {
45 throw std::domain_error("Parameter 'distance' must be > 0");
46 }
47 // Cache square of cutoff
49 // Check if bond exists
50 assert(system.bonded_ias->contains(bond_centers));
51 // If the bond type to bind particle centers is not a pair bond...
52 // Check that the bonds have the right number of partners
53 if (number_of_partners(*system.bonded_ias->at(bond_centers)) != 1) {
54 throw std::runtime_error("The bond type to be used for binding particle "
55 "centers needs to be a pair bond");
56 }
57}
58
60 System::System &system, std::vector<CollisionPair> &local_collision_queue) {
61 add_bind_centers(local_collision_queue, *system.cell_structure, bond_centers);
62}
63
64} // namespace CollisionDetection
65
66#endif // COLLISION_DETECTION
Data structures for bonded interactions.
int number_of_partners(Bonded_IA_Parameters const &iaparams)
Get the number of bonded partners for the specified bond.
double distance_sq
Square of distance at which particle are bound.
void handle_collisions(System::System &system, std::vector< CollisionPair > &local_collision_queue)
void initialize(System::System &system)
int bond_centers
bond type used between centers of colliding particles
double distance
Distance at which particle are bound.
Main system class.
std::shared_ptr< BondedInteractionsMap > bonded_ias
std::shared_ptr< CellStructure > cell_structure
This file contains the defaults for ESPResSo.
void add_bind_centers(std::vector< CollisionPair > &collision_queue, CellStructure &cell_structure, int bond_centers)
DEVICE_QUALIFIER constexpr T sqr(T x)
Calculates the SQuaRe of x.
Definition sqr.hpp:28