ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/pair_criteria/BondCriterion.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#ifndef ESPRESSO_SRC_CORE_PAIR_CRITERIA_BOND_CRITERION_HPP
20#define ESPRESSO_SRC_CORE_PAIR_CRITERIA_BOND_CRITERION_HPP
21
22#include "pair_criteria/PairCriterion.hpp"
23
24#include "BondList.hpp"
25
26namespace PairCriteria {
27/** @brief True if a bond of given type exists between two particles. */
29public:
30 bool decide(Particle const &p1, Particle const &p2) const override {
31 return pair_bond_exists_on(p1.bonds(), p2.id(), m_bond_type) ||
32 pair_bond_exists_on(p2.bonds(), p1.id(), m_bond_type);
33 }
34 int get_bond_type() { return m_bond_type; }
35 void set_bond_type(int t) { m_bond_type = t; }
36
37private:
38 int m_bond_type;
39};
40} // namespace PairCriteria
41
42#endif
bool pair_bond_exists_on(BondList const &bonds, int partner_id, int bond_id)
Check if there is a specific bond in a bond list.
Definition BondList.hpp:238
True if a bond of given type exists between two particles.
bool decide(Particle const &p1, Particle const &p2) const override
Criterion which returns a true/false value for a pair of particles.
Struct holding all information for one particle.
Definition Particle.hpp:395
auto const & bonds() const
Definition Particle.hpp:428
auto const & id() const
Definition Particle.hpp:414