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 <memory>
31#include <vector>
32
33namespace ScriptInterface {
34namespace Observables {
35
36class RDF : public AutoParameters<RDF, Observable> {
37
38public:
39 RDF() {
40 this->add_parameters(
42 [this]() { return rdf_observable()->ids1(); }},
44 [this]() { return rdf_observable()->ids2(); }},
45 {"n_r_bins", AutoParameter::read_only,
46 [this]() { return static_cast<int>(rdf_observable()->n_r_bins); }},
48 [this]() { return rdf_observable()->min_r; }},
50 [this]() { return rdf_observable()->max_r; }}});
51 }
52
53 void do_construct(VariantMap const &params) override {
54 context()->parallel_try_catch([&]() {
55 m_observable =
57 std::vector<int>, int, double, double>(
58 params, "ids1", "ids2", "n_r_bins", "min_r", "max_r");
59 });
60 }
61
62 std::shared_ptr<::Observables::RDF> rdf_observable() const {
63 return m_observable;
64 }
65
66 std::shared_ptr<::Observables::Observable> observable() const override {
67 return m_observable;
68 }
69
70private:
71 std::shared_ptr<::Observables::RDF> m_observable;
72};
73
74} /* namespace Observables */
75} /* namespace ScriptInterface */
76
77#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
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:69
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only