ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
NonBondedInteraction.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 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
20/** @file
21 * The ScriptInterface counterparts of the non-bonded interactions parameters
22 * structs from the core are defined here.
23 */
24
25#pragma once
26
30
33
34#include <algorithm>
35#include <array>
36#include <cmath>
37#include <cstddef>
38#include <iterator>
39#include <memory>
40#include <ranges>
41#include <stdexcept>
42#include <string>
43#include <tuple>
44#include <variant>
45#include <vector>
46
47namespace ScriptInterface {
48namespace Interactions {
49
50class NonBondedInteractionHandle;
51
52template <class CoreIA>
54 : public AutoParameters<InteractionPotentialInterface<CoreIA>> {
55public:
57
58protected:
62
63 /** @brief Managed object. */
64 std::shared_ptr<CoreInteraction> m_handle;
65 /** @brief Handle to the container whose members have to be synchronized. */
66 std::weak_ptr<::IA_parameters> m_core_struct;
67 /** @brief Handle to the interface used to synchronize data members. */
68 std::weak_ptr<NonBondedInteractionHandle *> m_si_struct;
69 /** @brief Callback to notify changes to the interaction range. */
70 std::weak_ptr<std::function<void()>> m_notify_non_bonded_ia_change;
71 /** @brief Pointer to the corresponding member in a handle. */
73 /** @brief Create a new instance using the constructor with range checks. */
74 virtual void make_new_instance(VariantMap const &params) = 0;
75 /** @brief Which parameter indicates whether the potential is inactive. */
76 virtual std::string inactive_parameter() const { return "cutoff"; }
77 /** @brief Which magic value indicates the potential is inactive. */
78 virtual double get_inactive_cutoff() const { return inactive_cutoff; }
79
80 template <typename T>
83 [this, ptr]() { return m_handle.get()->*ptr; }};
84 }
85
86 std::set<std::string> get_valid_parameters() const {
87 auto const vec = valid_parameters();
88 return {vec.begin(), vec.end()};
89 }
90
91private:
92 void check_valid_parameters(VariantMap const &params) const {
93 auto const valid_keys = get_valid_parameters();
94 for (auto const &key : valid_keys) {
95 if (not params.contains(key)) {
96 throw std::runtime_error("Parameter '" + key + "' is missing");
97 }
98 }
99 for (auto const &key : std::views::elements<0>(params)) {
100 if (not valid_keys.contains(key)) {
101 throw std::runtime_error("Parameter '" + key + "' is not recognized");
102 }
103 }
104 }
105
106public:
107 Variant do_call_method(std::string const &name,
108 VariantMap const &params) override {
109 if (name == "set_params") {
110 context()->parallel_try_catch([this, &params]() {
111 check_valid_parameters(params);
113 });
114 // copying the new value to the core may queue a runtime error message,
115 // but we can't detect it to roll back to the last valid state
116 update_core();
117 return {};
118 }
119 if (name == "deactivate") {
120 m_handle = std::make_shared<CoreInteraction>();
121 update_core(get_value_or<bool>(params, "notify", true));
122 return {};
123 }
124 return {};
125 }
126
127 void do_construct(VariantMap const &params) final {
128 if (params.empty()) {
129 m_handle = std::make_shared<CoreInteraction>();
130 } else {
132 get_inactive_cutoff()) < 1e-9) {
133 m_handle = std::make_shared<CoreInteraction>();
134 } else {
135 context()->parallel_try_catch([this, &params]() {
136 check_valid_parameters(params);
138 });
139 }
140 }
141 }
142
143 void attach(std::weak_ptr<NonBondedInteractionHandle *> si_struct,
144 std::weak_ptr<::IA_parameters> core_struct) {
147 }
148
149 void update_core(bool notify = true);
150};
151
152#ifdef ESPRESSO_WCA
153class InteractionWCA : public InteractionPotentialInterface<::WCA_Parameters> {
154protected:
156 return &::IA_parameters::wca;
157 }
158
159public:
166
167private:
168 std::string inactive_parameter() const override { return "sigma"; }
169 double get_inactive_cutoff() const override { return 0.; }
170
171 void make_new_instance(VariantMap const &params) override {
173 params, "epsilon", "sigma");
174 }
175
176public:
177 Variant do_call_method(std::string const &name,
178 VariantMap const &params) override {
179 if (name == "get_cutoff") {
180 return m_handle.get()->cut;
181 }
183 name, params);
184 }
185};
186#endif // ESPRESSO_WCA
187
188#ifdef ESPRESSO_LENNARD_JONES
189class InteractionLJ : public InteractionPotentialInterface<::LJ_Parameters> {
190protected:
192 return &::IA_parameters::lj;
193 }
194
195public:
206
207private:
208 void make_new_instance(VariantMap const &params) override {
209 auto new_params = params;
210 auto const *shift_string = std::get_if<std::string>(&params.at("shift"));
211 if (shift_string != nullptr) {
212 if (*shift_string != "auto") {
213 throw std::invalid_argument(
214 "LJ parameter 'shift' has to be 'auto' or a float");
215 }
216 new_params["shift"] = 0.;
217 }
219 double, double, double>(
220 new_params, "epsilon", "sigma", "cutoff", "offset", "min", "shift");
221 if (shift_string != nullptr) {
222 m_handle->shift = m_handle->get_auto_shift();
223 }
224 }
225};
226#endif // ESPRESSO_LENNARD_JONES
227
228#ifdef ESPRESSO_LENNARD_JONES_GENERIC
230 : public InteractionPotentialInterface<::LJGen_Parameters> {
231protected:
235
236public:
254
255private:
256 void make_new_instance(VariantMap const &params) override {
257 auto new_params = params;
258 auto const *shift_string = std::get_if<std::string>(&params.at("shift"));
259 if (shift_string != nullptr) {
260 if (*shift_string != "auto") {
261 throw std::invalid_argument(
262 "Generic LJ parameter 'shift' has to be 'auto' or a float");
263 }
264 new_params["shift"] = 0.;
265 }
267 double, double,
268#ifdef ESPRESSO_LJGEN_SOFTCORE
269 double, double,
270#endif
271 double, double, double, double>(
272 new_params, "epsilon", "sigma", "cutoff", "shift", "offset",
273#ifdef ESPRESSO_LJGEN_SOFTCORE
274 "lam", "delta",
275#endif
276 "e1", "e2", "b1", "b2");
277 if (shift_string != nullptr) {
278 m_handle->shift = m_handle->get_auto_shift();
279 }
280 }
281};
282#endif // ESPRESSO_LENNARD_JONES_GENERIC
283
284#ifdef ESPRESSO_LJCOS
286 : public InteractionPotentialInterface<::LJcos_Parameters> {
287protected:
291
292public:
301
302private:
303 void make_new_instance(VariantMap const &params) override {
304 m_handle =
306 params, "epsilon", "sigma", "cutoff", "offset");
307 }
308};
309#endif // ESPRESSO_LJCOS
310
311#ifdef ESPRESSO_LJCOS2
313 : public InteractionPotentialInterface<::LJcos2_Parameters> {
314protected:
318
319public:
328
329private:
330 std::string inactive_parameter() const override { return "sigma"; }
331 double get_inactive_cutoff() const override { return 0.; }
332
333 void make_new_instance(VariantMap const &params) override {
334 m_handle =
336 params, "epsilon", "sigma", "offset", "width");
337 }
338
339public:
340 Variant do_call_method(std::string const &name,
341 VariantMap const &params) override {
342 if (name == "get_cutoff") {
343 return m_handle.get()->cut;
344 }
346 name, params);
347 }
348};
349#endif // ESPRESSO_LJCOS2
350
351#ifdef ESPRESSO_HERTZIAN
353 : public InteractionPotentialInterface<::Hertzian_Parameters> {
354protected:
358
359public:
366
367private:
368 std::string inactive_parameter() const override { return "sig"; }
369
374};
375#endif // ESPRESSO_HERTZIAN
376
377#ifdef ESPRESSO_GAUSSIAN
379 : public InteractionPotentialInterface<::Gaussian_Parameters> {
380protected:
384
385public:
393
394private:
399};
400#endif // ESPRESSO_GAUSSIAN
401
402#ifdef ESPRESSO_BMHTF_NACL
404 : public InteractionPotentialInterface<::BMHTF_Parameters> {
405protected:
409
410public:
421
422private:
423 void make_new_instance(VariantMap const &params) override {
425 double, double, double>(
426 params, "a", "b", "c", "d", "sig", "cutoff");
427 }
428};
429#endif // ESPRESSO_BMHTF_NACL
430
431#ifdef ESPRESSO_MORSE
433 : public InteractionPotentialInterface<::Morse_Parameters> {
434protected:
438
439public:
448
449private:
450 void make_new_instance(VariantMap const &params) override {
451 m_handle =
453 params, "eps", "alpha", "rmin", "cutoff");
454 }
455};
456#endif // ESPRESSO_MORSE
457
458#ifdef ESPRESSO_BUCKINGHAM
460 : public InteractionPotentialInterface<::Buckingham_Parameters> {
461protected:
465
466public:
478
479private:
480 void make_new_instance(VariantMap const &params) override {
482 double, double, double, double>(
483 params, "a", "b", "c", "d", "cutoff", "discont", "shift");
484 }
485};
486#endif // ESPRESSO_BUCKINGHAM
487
488#ifdef ESPRESSO_SOFT_SPHERE
490 : public InteractionPotentialInterface<::SoftSphere_Parameters> {
491protected:
495
496public:
505
506private:
507 void make_new_instance(VariantMap const &params) override {
508 m_handle =
510 params, "a", "n", "cutoff", "offset");
511 }
512};
513#endif // ESPRESSO_SOFT_SPHERE
514
515#ifdef ESPRESSO_HAT
516class InteractionHat : public InteractionPotentialInterface<::Hat_Parameters> {
517protected:
519 return &::IA_parameters::hat;
520 }
521
522public:
529
530private:
535};
536#endif // ESPRESSO_HAT
537
538#ifdef ESPRESSO_GAY_BERNE
540 : public InteractionPotentialInterface<::GayBerne_Parameters> {
541protected:
545
546public:
558
559private:
560 std::string inactive_parameter() const override { return "cut"; }
561
562 void make_new_instance(VariantMap const &params) override {
564 double, double, double, double>(
565 params, "eps", "sig", "cut", "k1", "k2", "mu", "nu");
566 }
567};
568#endif // ESPRESSO_GAY_BERNE
569
570#ifdef ESPRESSO_TABULATED
572 : public InteractionPotentialInterface<::TabulatedPotential> {
573protected:
575 return &::IA_parameters::tab;
576 }
577
578public:
587
588private:
589 std::string inactive_parameter() const override { return "max"; }
590
591 void make_new_instance(VariantMap const &params) override {
593 std::vector<double>, std::vector<double>>(
594 params, "min", "max", "force", "energy");
595 }
596
597public:
598 Variant do_call_method(std::string const &name,
599 VariantMap const &params) override {
600 if (name == "get_cutoff") {
601 return m_handle.get()->cutoff();
602 }
604 name, params);
605 }
606};
607#endif // ESPRESSO_TABULATED
608
609#ifdef ESPRESSO_DPD
610class InteractionDPD : public InteractionPotentialInterface<::DPD_Parameters> {
611protected:
613 return &::IA_parameters::dpd;
614 }
615
616public:
619 {"weight_function", AutoParameter::read_only,
620 [this]() { return m_handle.get()->radial.wf; }},
621 {"gamma", AutoParameter::read_only,
622 [this]() { return m_handle.get()->radial.gamma; }},
624 [this]() { return m_handle.get()->radial.k; }},
625 {"r_cut", AutoParameter::read_only,
626 [this]() { return m_handle.get()->radial.cutoff; }},
627 {"trans_weight_function", AutoParameter::read_only,
628 [this]() { return m_handle.get()->trans.wf; }},
629 {"trans_gamma", AutoParameter::read_only,
630 [this]() { return m_handle.get()->trans.gamma; }},
631 {"trans_r_cut", AutoParameter::read_only,
632 [this]() { return m_handle.get()->trans.cutoff; }},
633 });
634 std::ignore = get_ptr_offset(); // for code coverage
635 }
636
637private:
638 std::string inactive_parameter() const override { return "r_cut"; }
639
640 void make_new_instance(VariantMap const &params) override {
642 double, double, double, double>(
643 params, "gamma", "k", "r_cut", "weight_function", "trans_gamma",
644 "trans_r_cut", "trans_weight_function");
645 if (m_handle->radial.wf != 0 and m_handle->radial.wf != 1) {
646 throw std::domain_error(
647 "DPDInteraction parameter 'weight_function' must be 0 or 1");
648 }
649 if (m_handle->trans.wf != 0 and m_handle->trans.wf != 1) {
650 throw std::domain_error(
651 "DPDInteraction parameter 'trans_weight_function' must be 0 or 1");
652 }
653 }
654};
655#endif // ESPRESSO_DPD
656
657#ifdef ESPRESSO_THOLE
659 : public InteractionPotentialInterface<::Thole_Parameters> {
660protected:
664
665public:
672
673private:
674 std::string inactive_parameter() const override { return "scaling_coeff"; }
675 double get_inactive_cutoff() const override { return 0.; }
676
677 void make_new_instance(VariantMap const &params) override {
679 params, "scaling_coeff", "q1q2");
680 }
681};
682#endif // ESPRESSO_THOLE
683
684#ifdef ESPRESSO_SMOOTH_STEP
686 : public InteractionPotentialInterface<::SmoothStep_Parameters> {
687protected:
691
692public:
703
704private:
705 void make_new_instance(VariantMap const &params) override {
707 double, int, double>(
708 params, "eps", "sig", "cutoff", "d", "n", "k0");
709 }
710};
711#endif // ESPRESSO_SMOOTH_STEP
712
714 : public AutoParameters<NonBondedInteractionHandle> {
715 std::shared_ptr<::IA_parameters> m_handle;
716 std::shared_ptr<NonBondedInteractionHandle *> m_self;
717 std::weak_ptr<std::function<void()>> m_notify_cutoff_change;
718#ifdef ESPRESSO_WCA
719 std::shared_ptr<InteractionWCA> m_wca;
720#endif
721#ifdef ESPRESSO_LENNARD_JONES
722 std::shared_ptr<InteractionLJ> m_lj;
723#endif
724#ifdef ESPRESSO_LENNARD_JONES_GENERIC
725 std::shared_ptr<InteractionLJGen> m_ljgen;
726#endif
727#ifdef ESPRESSO_LJCOS
728 std::shared_ptr<InteractionLJcos> m_ljcos;
729#endif
730#ifdef ESPRESSO_LJCOS2
731 std::shared_ptr<InteractionLJcos2> m_ljcos2;
732#endif
733#ifdef ESPRESSO_HERTZIAN
734 std::shared_ptr<InteractionHertzian> m_hertzian;
735#endif
736#ifdef ESPRESSO_GAUSSIAN
737 std::shared_ptr<InteractionGaussian> m_gaussian;
738#endif
739#ifdef ESPRESSO_BMHTF_NACL
740 std::shared_ptr<InteractionBMHTF> m_bmhtf;
741#endif
742#ifdef ESPRESSO_MORSE
743 std::shared_ptr<InteractionMorse> m_morse;
744#endif
745#ifdef ESPRESSO_BUCKINGHAM
746 std::shared_ptr<InteractionBuckingham> m_buckingham;
747#endif
748#ifdef ESPRESSO_SOFT_SPHERE
749 std::shared_ptr<InteractionSoftSphere> m_soft_sphere;
750#endif
751#ifdef ESPRESSO_HAT
752 std::shared_ptr<InteractionHat> m_hat;
753#endif
754#ifdef ESPRESSO_GAY_BERNE
755 std::shared_ptr<InteractionGayBerne> m_gay_berne;
756#endif
757#ifdef ESPRESSO_TABULATED
758 std::shared_ptr<InteractionTabulated> m_tabulated;
759#endif
760#ifdef ESPRESSO_DPD
761 std::shared_ptr<InteractionDPD> m_dpd;
762#endif
763#ifdef ESPRESSO_THOLE
764 std::shared_ptr<InteractionThole> m_thole;
765#endif
766#ifdef ESPRESSO_SMOOTH_STEP
767 std::shared_ptr<InteractionSmoothStep> m_smooth_step;
768#endif
769
770public:
772 m_self = std::make_shared<NonBondedInteractionHandle *>(this);
773 std::vector<AutoParameter> params;
774 apply([this, &params]<typename T>(std::shared_ptr<T> &member,
775 std::string const &name,
776 std::string const &) {
777 auto const setter = [this, &member](Variant const &v) {
779 member->attach(m_self, m_handle);
780 // copying the new value to the core may queue a runtime error message,
781 // but we can't detect it to roll back to the last valid state
782 member->update_core();
783 };
784 params.emplace_back(name.c_str(), setter, [&member]() { return member; });
785 });
786 add_parameters(std::move(params));
787 }
788
789public:
790 Variant do_call_method(std::string const &name,
791 VariantMap const &params) override {
792 if (name == "reset") {
793 if (not context()->is_head_node()) {
794 return {};
795 }
796 auto const new_params = VariantMap{{"notify", false}};
797 apply([&new_params](auto &so, std::string const &, std::string const &) {
798 so->call_method("deactivate", new_params);
799 });
800 if (get_value_or<bool>(params, "notify", true)) {
801 call_method("on_non_bonded_ia_change", {});
802 }
803 return {};
804 }
805 if (name == "on_non_bonded_ia_change") {
807 return {};
808 }
809 return {};
810 }
811
812 void do_construct(VariantMap const &params) override {
813 m_handle = std::make_shared<::IA_parameters>();
814 if (not context()->is_head_node()) {
815 return;
816 }
817 apply([this, &params]<typename T>(std::shared_ptr<T> const &,
818 std::string const &name,
819 std::string const &so_name) {
820 auto so = params.contains(name)
821 ? get_value<std::shared_ptr<T>>(params.at(name))
822 : std::dynamic_pointer_cast<T>(
823 context()->make_shared(so_name, {}));
825 });
826 }
827
828 void attach(
829 std::function<void(std::shared_ptr<::IA_parameters> const &)> cb_register,
830 std::weak_ptr<std::function<void()>> cb_notify_cutoff_change) {
831 cb_register(m_handle);
832 m_notify_cutoff_change = cb_notify_cutoff_change;
833 }
834
835private:
836 void apply(auto const &&fun) {
837#ifdef ESPRESSO_WCA
838 fun(m_wca, "wca", "Interactions::InteractionWCA");
839#endif
840#ifdef ESPRESSO_LENNARD_JONES
841 fun(m_lj, "lennard_jones", "Interactions::InteractionLJ");
842#endif
843#ifdef ESPRESSO_LENNARD_JONES_GENERIC
844 fun(m_ljgen, "generic_lennard_jones", "Interactions::InteractionLJGen");
845#endif
846#ifdef ESPRESSO_LJCOS
847 fun(m_ljcos, "lennard_jones_cos", "Interactions::InteractionLJcos");
848#endif
849#ifdef ESPRESSO_LJCOS2
850 fun(m_ljcos2, "lennard_jones_cos2", "Interactions::InteractionLJcos2");
851#endif
852#ifdef ESPRESSO_HERTZIAN
853 fun(m_hertzian, "hertzian", "Interactions::InteractionHertzian");
854#endif
855#ifdef ESPRESSO_GAUSSIAN
856 fun(m_gaussian, "gaussian", "Interactions::InteractionGaussian");
857#endif
858#ifdef ESPRESSO_BMHTF_NACL
859 fun(m_bmhtf, "bmhtf", "Interactions::InteractionBMHTF");
860#endif
861#ifdef ESPRESSO_MORSE
862 fun(m_morse, "morse", "Interactions::InteractionMorse");
863#endif
864#ifdef ESPRESSO_BUCKINGHAM
865 fun(m_buckingham, "buckingham", "Interactions::InteractionBuckingham");
866#endif
867#ifdef ESPRESSO_SOFT_SPHERE
868 fun(m_soft_sphere, "soft_sphere", "Interactions::InteractionSoftSphere");
869#endif
870#ifdef ESPRESSO_HAT
871 fun(m_hat, "hat", "Interactions::InteractionHat");
872#endif
873#ifdef ESPRESSO_GAY_BERNE
874 fun(m_gay_berne, "gay_berne", "Interactions::InteractionGayBerne");
875#endif
876#ifdef ESPRESSO_TABULATED
877 fun(m_tabulated, "tabulated", "Interactions::InteractionTabulated");
878#endif
879#ifdef ESPRESSO_DPD
880 fun(m_dpd, "dpd", "Interactions::InteractionDPD");
881#endif
882#ifdef ESPRESSO_THOLE
883 fun(m_thole, "thole", "Interactions::InteractionThole");
884#endif
885#ifdef ESPRESSO_SMOOTH_STEP
886 fun(m_smooth_step, "smooth_step", "Interactions::InteractionSmoothStep");
887#endif
888 }
889
890public:
892 if (auto callback = m_notify_cutoff_change.lock()) {
893 (*callback)();
894 }
895 }
896};
897
898template <class CoreIA>
900 assert(m_handle);
901 if (auto core_struct = m_core_struct.lock()) {
902 core_struct.get()->*get_ptr_offset() = *m_handle;
903 if (notify) {
904 if (auto si_struct = m_si_struct.lock()) {
905 (**si_struct).on_non_bonded_ia_change();
906 }
907 }
908 }
909}
910
911} // namespace Interactions
912} // namespace ScriptInterface
Bind parameters in the script interface.
void add_parameters(std::vector< AutoParameter > &&params)
virtual void parallel_try_catch(std::function< void()> const &cb) const =0
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
Variant do_call_method(std::string const &name, VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
virtual void make_new_instance(VariantMap const &params)=0
Create a new instance using the constructor with range checks.
std::weak_ptr< std::function< void()> > m_notify_non_bonded_ia_change
Callback to notify changes to the interaction range.
virtual CoreInteraction IA_parameters::* get_ptr_offset() const =0
Pointer to the corresponding member in a handle.
std::shared_ptr< CoreInteraction > m_handle
Managed object.
virtual double get_inactive_cutoff() const
Which magic value indicates the potential is inactive.
void attach(std::weak_ptr< NonBondedInteractionHandle * > si_struct, std::weak_ptr<::IA_parameters > core_struct)
auto make_autoparameter(T CoreInteraction::*ptr, char const *name)
Variant do_call_method(std::string const &name, VariantMap const &params) override
std::weak_ptr<::IA_parameters > m_core_struct
Handle to the container whose members have to be synchronized.
std::weak_ptr< NonBondedInteractionHandle * > m_si_struct
Handle to the interface used to synchronize data members.
virtual std::string inactive_parameter() const
Which parameter indicates whether the potential is inactive.
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
Variant do_call_method(std::string const &name, VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
CoreInteraction IA_parameters::* get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteraction IA_parameters::* get_ptr_offset() const override
Variant do_call_method(std::string const &name, VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
void attach(std::function< void(std::shared_ptr<::IA_parameters > const &)> cb_register, std::weak_ptr< std::function< void()> > cb_notify_cutoff_change)
Variant do_call_method(std::string const &name, VariantMap const &params) override
Variant call_method(const std::string &name, const VariantMap &params)
Call a method on the object.
Context * context() const
Responsible context.
void set_parameter(const std::string &name, const Variant &value)
Set single parameter.
std::string_view name() const
constexpr double inactive_cutoff
Special cutoff value for an inactive interaction.
Definition config.hpp:44
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:133
std::shared_ptr< T > make_shared_from_args(VariantMap const &vals, ArgNames &&...args)
Make a new std::shared_ptr<T> with arguments extracted from a VariantMap.
STL namespace.
Various procedures concerning interactions between particles.
static SteepestDescentParameters params
Currently active steepest descent instance.
Parameters for non-bonded interactions.
Gaussian_Parameters gaussian
GayBerne_Parameters gay_berne
SoftSphere_Parameters soft_sphere
SmoothStep_Parameters smooth_step
Hertzian_Parameters hertzian
Buckingham_Parameters buckingham
Generic Lennard-Jones with shift.
Lennard-Jones with shift.
Lennard-Jones with a different Cos potential.
Lennard-Jones+Cos potential.
Description and getter/setter for a parameter.
static constexpr const ReadOnly read_only
Recursive variant implementation.
Definition Variant.hpp:84
Evaluate forces and energies using a custom potential profile.
std::vector< double > force_tab
Tabulated forces.
double maxval
Position on the x-axis of the last tabulated value.
std::vector< double > energy_tab
Tabulated energies.
double minval
Position on the x-axis of the first tabulated value.