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-2026 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:
58
59protected:
63
64 /** @brief Managed object. */
65 std::shared_ptr<CoreInteraction> m_handle;
66 /** @brief Handle to the container whose members have to be synchronized. */
67 std::weak_ptr<::IA_parameters> m_core_struct;
68 /** @brief Handle to the interface used to synchronize data members. */
69 std::weak_ptr<NonBondedInteractionHandle *> m_si_struct;
70 /** @brief Callback to notify changes to the interaction range. */
71 std::weak_ptr<std::function<void()>> m_notify_non_bonded_ia_change;
72 /** @brief Pointer to the corresponding member in a handle. */
74 /** @brief Create a new instance using the constructor with range checks. */
75 virtual void make_new_instance(VariantMap const &params) = 0;
76 /** @brief Which parameter indicates whether the potential is inactive. */
77 virtual std::string inactive_parameter() const { return "cutoff"; }
78 /** @brief Which magic value indicates the potential is inactive. */
79 virtual double get_inactive_cutoff() const { return inactive_cutoff; }
80
81 template <typename T>
84 [this, ptr]() { return m_handle.get()->*ptr; }};
85 }
86
87 std::set<std::string> get_valid_parameters() const {
88 auto const vec = valid_parameters();
89 return {vec.begin(), vec.end()};
90 }
91
92private:
93 void check_valid_parameters(VariantMap const &params) const {
94 auto const valid_keys = get_valid_parameters();
95 for (auto const &key : valid_keys) {
96 if (not params.contains(key)) {
97 throw std::runtime_error("Parameter '" + key + "' is missing");
98 }
99 }
100 for (auto const &key : std::views::elements<0>(params)) {
101 if (not valid_keys.contains(key)) {
102 throw std::runtime_error("Parameter '" + key + "' is not recognized");
103 }
104 }
105 }
106
107public:
108 Variant do_call_method(std::string const &name,
109 VariantMap const &params) override {
110 if (name == "set_params") {
111 context()->parallel_try_catch([this, &params]() {
112 check_valid_parameters(params);
113 make_new_instance(params);
114 });
115 // copying the new value to the core may queue a runtime error message,
116 // but we can't detect it to roll back to the last valid state
117 update_core();
118 return {};
119 }
120 if (name == "deactivate") {
121 m_handle = std::make_shared<CoreInteraction>();
122 update_core(get_value_or<bool>(params, "notify", true));
123 return {};
124 }
125 return {};
126 }
127
128 void do_construct(VariantMap const &params) final {
129 if (params.empty()) {
130 m_handle = std::make_shared<CoreInteraction>();
131 } else {
132 if (std::abs(get_value<double>(params, inactive_parameter()) -
133 get_inactive_cutoff()) < 1e-9) {
134 m_handle = std::make_shared<CoreInteraction>();
135 } else {
136 context()->parallel_try_catch([this, &params]() {
137 check_valid_parameters(params);
138 make_new_instance(params);
139 });
140 }
141 }
142 }
143
144 void attach(std::weak_ptr<NonBondedInteractionHandle *> si_struct,
145 std::weak_ptr<::IA_parameters> core_struct) {
148 }
149
150 void update_core(bool notify = true);
151};
152
153#ifdef ESPRESSO_WCA
154class InteractionWCA : public InteractionPotentialInterface<::WCA_Parameters> {
155protected:
159
160public:
167
168private:
169 std::string inactive_parameter() const override { return "sigma"; }
170 double get_inactive_cutoff() const override { return 0.; }
171
172 void make_new_instance(VariantMap const &params) override {
174 params, "epsilon", "sigma");
175 }
176
177public:
178 Variant do_call_method(std::string const &name,
179 VariantMap const &params) override {
180 if (name == "get_cutoff") {
181 return m_handle.get()->cut;
182 }
184 name, params);
185 }
186};
187#endif // ESPRESSO_WCA
188
189#ifdef ESPRESSO_LENNARD_JONES
190class InteractionLJ : public InteractionPotentialInterface<::LJ_Parameters> {
191protected:
193 return &::IA_parameters::lj;
194 }
195
196public:
207
208private:
209 void make_new_instance(VariantMap const &params) override {
210 auto new_params = params;
211 auto const *shift_string = std::get_if<std::string>(&params.at("shift"));
212 if (shift_string != nullptr) {
213 if (*shift_string != "auto") {
214 throw std::invalid_argument(
215 "LJ parameter 'shift' has to be 'auto' or a float");
216 }
217 new_params["shift"] = 0.;
218 }
220 double, double, double>(
221 new_params, "epsilon", "sigma", "cutoff", "offset", "min", "shift");
222 if (shift_string != nullptr) {
223 m_handle->shift = m_handle->get_auto_shift();
224 }
225 }
226};
227#endif // ESPRESSO_LENNARD_JONES
228
229#ifdef ESPRESSO_LENNARD_JONES_GENERIC
231 : public InteractionPotentialInterface<::LJGen_Parameters> {
232protected:
236
237public:
255
256private:
257 void make_new_instance(VariantMap const &params) override {
258 auto new_params = params;
259 auto const *shift_string = std::get_if<std::string>(&params.at("shift"));
260 if (shift_string != nullptr) {
261 if (*shift_string != "auto") {
262 throw std::invalid_argument(
263 "Generic LJ parameter 'shift' has to be 'auto' or a float");
264 }
265 new_params["shift"] = 0.;
266 }
268 double, double,
269#ifdef ESPRESSO_LJGEN_SOFTCORE
270 double, double,
271#endif
272 double, double, double, double>(
273 new_params, "epsilon", "sigma", "cutoff", "shift", "offset",
274#ifdef ESPRESSO_LJGEN_SOFTCORE
275 "lam", "delta",
276#endif
277 "e1", "e2", "b1", "b2");
278 if (shift_string != nullptr) {
279 m_handle->shift = m_handle->get_auto_shift();
280 }
281 }
282};
283#endif // ESPRESSO_LENNARD_JONES_GENERIC
284
285#ifdef ESPRESSO_LJCOS
287 : public InteractionPotentialInterface<::LJcos_Parameters> {
288protected:
292
293public:
302
303private:
304 void make_new_instance(VariantMap const &params) override {
305 m_handle =
307 params, "epsilon", "sigma", "cutoff", "offset");
308 }
309};
310#endif // ESPRESSO_LJCOS
311
312#ifdef ESPRESSO_LJCOS2
314 : public InteractionPotentialInterface<::LJcos2_Parameters> {
315protected:
319
320public:
329
330private:
331 std::string inactive_parameter() const override { return "sigma"; }
332 double get_inactive_cutoff() const override { return 0.; }
333
334 void make_new_instance(VariantMap const &params) override {
335 m_handle =
337 params, "epsilon", "sigma", "offset", "width");
338 }
339
340public:
341 Variant do_call_method(std::string const &name,
342 VariantMap const &params) override {
343 if (name == "get_cutoff") {
344 return m_handle.get()->cut;
345 }
347 name, params);
348 }
349};
350#endif // ESPRESSO_LJCOS2
351
352#ifdef ESPRESSO_HERTZIAN
354 : public InteractionPotentialInterface<::Hertzian_Parameters> {
355protected:
359
360public:
367
368private:
369 std::string inactive_parameter() const override { return "sig"; }
370
371 void make_new_instance(VariantMap const &params) override {
373 params, "eps", "sig");
374 }
375};
376#endif // ESPRESSO_HERTZIAN
377
378#ifdef ESPRESSO_GAUSSIAN
380 : public InteractionPotentialInterface<::Gaussian_Parameters> {
381protected:
385
386public:
394
395private:
396 void make_new_instance(VariantMap const &params) override {
398 params, "eps", "sig", "cutoff");
399 }
400};
401#endif // ESPRESSO_GAUSSIAN
402
403#ifdef ESPRESSO_BMHTF_NACL
405 : public InteractionPotentialInterface<::BMHTF_Parameters> {
406protected:
410
411public:
422
423private:
424 void make_new_instance(VariantMap const &params) override {
426 double, double, double>(
427 params, "a", "b", "c", "d", "sig", "cutoff");
428 }
429};
430#endif // ESPRESSO_BMHTF_NACL
431
432#ifdef ESPRESSO_MORSE
434 : public InteractionPotentialInterface<::Morse_Parameters> {
435protected:
439
440public:
449
450private:
451 void make_new_instance(VariantMap const &params) override {
452 m_handle =
454 params, "eps", "alpha", "rmin", "cutoff");
455 }
456};
457#endif // ESPRESSO_MORSE
458
459#ifdef ESPRESSO_BUCKINGHAM
461 : public InteractionPotentialInterface<::Buckingham_Parameters> {
462protected:
466
467public:
479
480private:
481 void make_new_instance(VariantMap const &params) override {
483 double, double, double, double>(
484 params, "a", "b", "c", "d", "cutoff", "discont", "shift");
485 }
486};
487#endif // ESPRESSO_BUCKINGHAM
488
489#ifdef ESPRESSO_SOFT_SPHERE
491 : public InteractionPotentialInterface<::SoftSphere_Parameters> {
492protected:
496
497public:
506
507private:
508 void make_new_instance(VariantMap const &params) override {
509 m_handle =
511 params, "a", "n", "cutoff", "offset");
512 }
513};
514#endif // ESPRESSO_SOFT_SPHERE
515
516#ifdef ESPRESSO_HAT
517class InteractionHat : public InteractionPotentialInterface<::Hat_Parameters> {
518protected:
522
523public:
530
531private:
532 void make_new_instance(VariantMap const &params) override {
534 params, "F_max", "cutoff");
535 }
536};
537#endif // ESPRESSO_HAT
538
539#ifdef ESPRESSO_GAY_BERNE
541 : public InteractionPotentialInterface<::GayBerne_Parameters> {
542protected:
546
547public:
559
560private:
561 std::string inactive_parameter() const override { return "cut"; }
562
563 void make_new_instance(VariantMap const &params) override {
565 double, double, double, double>(
566 params, "eps", "sig", "cut", "k1", "k2", "mu", "nu");
567 }
568};
569#endif // ESPRESSO_GAY_BERNE
570
571#ifdef ESPRESSO_TABULATED
573 : public InteractionPotentialInterface<::TabulatedPotential> {
574protected:
578
579public:
588
589private:
590 std::string inactive_parameter() const override { return "max"; }
591
592 void make_new_instance(VariantMap const &params) override {
594 std::vector<double>, std::vector<double>>(
595 params, "min", "max", "force", "energy");
596 }
597
598public:
599 Variant do_call_method(std::string const &name,
600 VariantMap const &params) override {
601 if (name == "get_cutoff") {
602 return m_handle.get()->cutoff();
603 }
605 name, params);
606 }
607};
608#endif // ESPRESSO_TABULATED
609
610#ifdef ESPRESSO_DPD
611class InteractionDPD : public InteractionPotentialInterface<::DPD_Parameters> {
612protected:
616
617public:
620 {"weight_function", AutoParameter::read_only,
621 [this]() { return m_handle.get()->radial.wf; }},
622 {"gamma", AutoParameter::read_only,
623 [this]() { return m_handle.get()->radial.gamma; }},
625 [this]() { return m_handle.get()->radial.k; }},
626 {"r_cut", AutoParameter::read_only,
627 [this]() { return m_handle.get()->radial.cutoff; }},
628 {"trans_weight_function", AutoParameter::read_only,
629 [this]() { return m_handle.get()->trans.wf; }},
630 {"trans_gamma", AutoParameter::read_only,
631 [this]() { return m_handle.get()->trans.gamma; }},
632 {"trans_r_cut", AutoParameter::read_only,
633 [this]() { return m_handle.get()->trans.cutoff; }},
634 });
635 std::ignore = get_ptr_offset(); // for code coverage
636 }
637
638private:
639 std::string inactive_parameter() const override { return "r_cut"; }
640
641 void make_new_instance(VariantMap const &params) override {
643 double, double, double, double>(
644 params, "gamma", "k", "r_cut", "weight_function", "trans_gamma",
645 "trans_r_cut", "trans_weight_function");
646 if (m_handle->radial.wf != 0 and m_handle->radial.wf != 1) {
647 throw std::domain_error(
648 "DPDInteraction parameter 'weight_function' must be 0 or 1");
649 }
650 if (m_handle->trans.wf != 0 and m_handle->trans.wf != 1) {
651 throw std::domain_error(
652 "DPDInteraction parameter 'trans_weight_function' must be 0 or 1");
653 }
654 }
655};
656#endif // ESPRESSO_DPD
657
658#ifdef ESPRESSO_THOLE
660 : public InteractionPotentialInterface<::Thole_Parameters> {
661protected:
665
666public:
673
674private:
675 std::string inactive_parameter() const override { return "scaling_coeff"; }
676 double get_inactive_cutoff() const override { return 0.; }
677
678 void make_new_instance(VariantMap const &params) override {
680 params, "scaling_coeff", "q1q2");
681 }
682};
683#endif // ESPRESSO_THOLE
684
685#ifdef ESPRESSO_SMOOTH_STEP
687 : public InteractionPotentialInterface<::SmoothStep_Parameters> {
688protected:
692
693public:
704
705private:
706 void make_new_instance(VariantMap const &params) override {
708 double, int, double>(
709 params, "eps", "sig", "cutoff", "d", "n", "k0");
710 }
711};
712#endif // ESPRESSO_SMOOTH_STEP
713
715 : public AutoParameters<NonBondedInteractionHandle> {
716 std::shared_ptr<::IA_parameters> m_handle;
717 std::shared_ptr<NonBondedInteractionHandle *> m_self;
718 std::weak_ptr<std::function<void()>> m_notify_cutoff_change;
719#ifdef ESPRESSO_WCA
720 std::shared_ptr<InteractionWCA> m_wca;
721#endif
722#ifdef ESPRESSO_LENNARD_JONES
723 std::shared_ptr<InteractionLJ> m_lj;
724#endif
725#ifdef ESPRESSO_LENNARD_JONES_GENERIC
726 std::shared_ptr<InteractionLJGen> m_ljgen;
727#endif
728#ifdef ESPRESSO_LJCOS
729 std::shared_ptr<InteractionLJcos> m_ljcos;
730#endif
731#ifdef ESPRESSO_LJCOS2
732 std::shared_ptr<InteractionLJcos2> m_ljcos2;
733#endif
734#ifdef ESPRESSO_HERTZIAN
735 std::shared_ptr<InteractionHertzian> m_hertzian;
736#endif
737#ifdef ESPRESSO_GAUSSIAN
738 std::shared_ptr<InteractionGaussian> m_gaussian;
739#endif
740#ifdef ESPRESSO_BMHTF_NACL
741 std::shared_ptr<InteractionBMHTF> m_bmhtf;
742#endif
743#ifdef ESPRESSO_MORSE
744 std::shared_ptr<InteractionMorse> m_morse;
745#endif
746#ifdef ESPRESSO_BUCKINGHAM
747 std::shared_ptr<InteractionBuckingham> m_buckingham;
748#endif
749#ifdef ESPRESSO_SOFT_SPHERE
750 std::shared_ptr<InteractionSoftSphere> m_soft_sphere;
751#endif
752#ifdef ESPRESSO_HAT
753 std::shared_ptr<InteractionHat> m_hat;
754#endif
755#ifdef ESPRESSO_GAY_BERNE
756 std::shared_ptr<InteractionGayBerne> m_gay_berne;
757#endif
758#ifdef ESPRESSO_TABULATED
759 std::shared_ptr<InteractionTabulated> m_tabulated;
760#endif
761#ifdef ESPRESSO_DPD
762 std::shared_ptr<InteractionDPD> m_dpd;
763#endif
764#ifdef ESPRESSO_THOLE
765 std::shared_ptr<InteractionThole> m_thole;
766#endif
767#ifdef ESPRESSO_SMOOTH_STEP
768 std::shared_ptr<InteractionSmoothStep> m_smooth_step;
769#endif
770
771public:
773 m_self = std::make_shared<NonBondedInteractionHandle *>(this);
774 std::vector<AutoParameter> params;
775 apply([this, &params]<typename T>(std::shared_ptr<T> &member,
776 std::string const &name,
777 std::string const &) {
778 auto const setter = [this, &member](Variant const &v) {
780 member->attach(m_self, m_handle);
781 // copying the new value to the core may queue a runtime error message,
782 // but we can't detect it to roll back to the last valid state
783 member->update_core();
784 };
785 params.emplace_back(name.c_str(), setter, [&member]() { return member; });
786 });
787 add_parameters(std::move(params));
788 }
789
790public:
791 Variant do_call_method(std::string const &name,
792 VariantMap const &params) override {
793 if (name == "reset") {
794 if (not context()->is_head_node()) {
795 return {};
796 }
797 auto const new_params = VariantMap{{"notify", false}};
798 apply([&new_params](auto &so, std::string const &, std::string const &) {
799 so->call_method("deactivate", new_params);
800 });
801 if (get_value_or<bool>(params, "notify", true)) {
802 call_method("on_non_bonded_ia_change", {});
803 }
804 return {};
805 }
806 if (name == "on_non_bonded_ia_change") {
808 return {};
809 }
810 return {};
811 }
812
813 void do_construct(VariantMap const &params) override {
814 m_handle = std::make_shared<::IA_parameters>();
815 if (not context()->is_head_node()) {
816 return;
817 }
818 apply([this, &params]<typename T>(std::shared_ptr<T> const &,
819 std::string const &name,
820 std::string const &so_name) {
821 auto so = params.contains(name)
822 ? get_value<std::shared_ptr<T>>(params.at(name))
823 : std::dynamic_pointer_cast<T>(
824 context()->make_shared(so_name, {}));
826 });
827 }
828
829 void attach(
830 std::function<void(std::shared_ptr<::IA_parameters> const &)> cb_register,
831 std::weak_ptr<std::function<void()>> cb_notify_cutoff_change) {
832 cb_register(m_handle);
833 m_notify_cutoff_change = cb_notify_cutoff_change;
834 }
835
836private:
837 void apply(auto const &&fun) {
838#ifdef ESPRESSO_WCA
839 fun(m_wca, "wca", "Interactions::InteractionWCA");
840#endif
841#ifdef ESPRESSO_LENNARD_JONES
842 fun(m_lj, "lennard_jones", "Interactions::InteractionLJ");
843#endif
844#ifdef ESPRESSO_LENNARD_JONES_GENERIC
845 fun(m_ljgen, "generic_lennard_jones", "Interactions::InteractionLJGen");
846#endif
847#ifdef ESPRESSO_LJCOS
848 fun(m_ljcos, "lennard_jones_cos", "Interactions::InteractionLJcos");
849#endif
850#ifdef ESPRESSO_LJCOS2
851 fun(m_ljcos2, "lennard_jones_cos2", "Interactions::InteractionLJcos2");
852#endif
853#ifdef ESPRESSO_HERTZIAN
854 fun(m_hertzian, "hertzian", "Interactions::InteractionHertzian");
855#endif
856#ifdef ESPRESSO_GAUSSIAN
857 fun(m_gaussian, "gaussian", "Interactions::InteractionGaussian");
858#endif
859#ifdef ESPRESSO_BMHTF_NACL
860 fun(m_bmhtf, "bmhtf", "Interactions::InteractionBMHTF");
861#endif
862#ifdef ESPRESSO_MORSE
863 fun(m_morse, "morse", "Interactions::InteractionMorse");
864#endif
865#ifdef ESPRESSO_BUCKINGHAM
866 fun(m_buckingham, "buckingham", "Interactions::InteractionBuckingham");
867#endif
868#ifdef ESPRESSO_SOFT_SPHERE
869 fun(m_soft_sphere, "soft_sphere", "Interactions::InteractionSoftSphere");
870#endif
871#ifdef ESPRESSO_HAT
872 fun(m_hat, "hat", "Interactions::InteractionHat");
873#endif
874#ifdef ESPRESSO_GAY_BERNE
875 fun(m_gay_berne, "gay_berne", "Interactions::InteractionGayBerne");
876#endif
877#ifdef ESPRESSO_TABULATED
878 fun(m_tabulated, "tabulated", "Interactions::InteractionTabulated");
879#endif
880#ifdef ESPRESSO_DPD
881 fun(m_dpd, "dpd", "Interactions::InteractionDPD");
882#endif
883#ifdef ESPRESSO_THOLE
884 fun(m_thole, "thole", "Interactions::InteractionThole");
885#endif
886#ifdef ESPRESSO_SMOOTH_STEP
887 fun(m_smooth_step, "smooth_step", "Interactions::InteractionSmoothStep");
888#endif
889 }
890
891public:
893 if (auto callback = m_notify_cutoff_change.lock()) {
894 (*callback)();
895 }
896 }
897};
898
899template <class CoreIA>
901 assert(m_handle);
902 if (auto core_struct = m_core_struct.lock()) {
903 core_struct.get()->*get_ptr_offset() = *m_handle;
904 if (notify) {
905 if (auto si_struct = m_si_struct.lock()) {
906 (**si_struct).on_non_bonded_ia_change();
907 }
908 }
909 }
910}
911
912} // namespace Interactions
913} // 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
CoreInteractionIAParamsPtr get_ptr_offset() const override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
CoreInteractionIAParamsPtr 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
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr 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.
virtual CoreInteractionIAParamsPtr get_ptr_offset() const =0
Pointer to the corresponding member in a handle.
std::weak_ptr< std::function< void()> > m_notify_non_bonded_ia_change
Callback to notify changes to the interaction range.
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
CoreInteractionIAParamsPtr get_ptr_offset() const override
CoreInteractionIAParamsPtr 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
CoreInteractionIAParamsPtr get_ptr_offset() const override
void make_new_instance(VariantMap const &params) override
CoreInteractionIAParamsPtr get_ptr_offset() const override
CoreInteractionIAParamsPtr 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
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
constexpr double inactive_cutoff
Special cutoff value for an inactive interaction.
Definition config.hpp:53
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.
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
Description and getter/setter for a parameter.
static constexpr const ReadOnly read_only
Recursive variant implementation.
Definition Variant.hpp:84
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.