ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
script_interface/observables/RDF.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2022 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef SCRIPT_INTERFACE_RDF_HPP
23#define SCRIPT_INTERFACE_RDF_HPP
24
27
29
30#include <boost/range/algorithm.hpp>
31
32#include <cstddef>
33#include <iterator>
34#include <memory>
35#include <vector>
36
37namespace ScriptInterface {
38namespace Observables {
39
40class RDF : public AutoParameters<RDF, Observable> {
41
42public:
43 RDF() {
44 this->add_parameters(
46 [this]() { return rdf_observable()->ids1(); }},
48 [this]() { return rdf_observable()->ids2(); }},
49 {"n_r_bins", AutoParameter::read_only,
50 [this]() { return static_cast<int>(rdf_observable()->n_r_bins); }},
52 [this]() { return rdf_observable()->min_r; }},
54 [this]() { return rdf_observable()->max_r; }}});
55 }
56
57 void do_construct(VariantMap const &params) override {
58 context()->parallel_try_catch([&]() {
59 m_observable =
60 make_shared_from_args<::Observables::RDF, std::vector<int>,
61 std::vector<int>, int, double, double>(
62 params, "ids1", "ids2", "n_r_bins", "min_r", "max_r");
63 });
64 }
65
66 std::shared_ptr<::Observables::RDF> rdf_observable() const {
67 return m_observable;
68 }
69
70 std::shared_ptr<::Observables::Observable> observable() const override {
71 return m_observable;
72 }
73
74private:
75 std::shared_ptr<::Observables::RDF> m_observable;
76};
77
78} /* namespace Observables */
79} /* namespace ScriptInterface */
80
81#endif
Bind parameters in the script interface.
void add_parameters(std::vector< AutoParameter > &&params)
std::shared_ptr<::Observables::RDF > rdf_observable() const
std::shared_ptr<::Observables::Observable > observable() const override
void do_construct(VariantMap const &params) override
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:82
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only