ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
core/pair_criteria/DistanceCriterion.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_DISTANCE_CRITERION_HPP
20#define ESPRESSO_SRC_CORE_PAIR_CRITERIA_DISTANCE_CRITERION_HPP
21
22#include "pair_criteria/PairCriterion.hpp"
23
24#include "BoxGeometry.hpp"
25#include "system/System.hpp"
26
27namespace PairCriteria {
28/**
29 * @brief True if two particles are closer than a cut off distance,
30 * respecting minimum image convention.
31 */
33public:
34 bool decide(const Particle &p1, const Particle &p2) const override {
35 auto const &box_geo = *System::get_system().box_geo;
36 return box_geo.get_mi_vector(p1.pos(), p2.pos()).norm() <= m_cut_off;
37 }
38 double get_cut_off() { return m_cut_off; }
39 void set_cut_off(double c) { m_cut_off = c; }
40
41private:
42 double m_cut_off;
43};
44
45} // namespace PairCriteria
46
47#endif
True if two particles are closer than a cut off distance, respecting minimum image convention.
bool decide(const Particle &p1, const Particle &p2) const override
Criterion which returns a true/false value for a pair of particles.
std::shared_ptr< BoxGeometry > box_geo
System & get_system()
Struct holding all information for one particle.
Definition Particle.hpp:393
auto const & pos() const
Definition Particle.hpp:429