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#ifndef SCRIPT_INTERFACE_INTERACTIONS_NONBONDED_INTERACTION_HPP
26#define SCRIPT_INTERFACE_INTERACTIONS_NONBONDED_INTERACTION_HPP
27
31
34
35#include <algorithm>
36#include <array>
37#include <cmath>
38#include <cstddef>
39#include <iterator>
40#include <memory>
41#include <stdexcept>
42#include <string>
43#include <tuple>
44#include <vector>
45
46namespace ScriptInterface {
47namespace Interactions {
48
49template <class CoreIA>
51 : public AutoParameters<InteractionPotentialInterface<CoreIA>> {
52 /** @brief Particle type pair. */
53 std::array<int, 2> m_types = {-1, -1};
54
55public:
56 using CoreInteraction = CoreIA;
57
58protected:
62
63 /** @brief Managed object. */
64 std::shared_ptr<CoreInteraction> m_ia_si;
65 /** @brief Pointer to the corresponding member in a handle. */
67 /** @brief Create a new instance using the constructor with range checks. */
68 virtual void make_new_instance(VariantMap const &params) = 0;
69 /** @brief Which parameter indicates whether the potential is inactive. */
70 virtual std::string inactive_parameter() const { return "cutoff"; }
71 /** @brief Which magic value indicates the potential is inactive. */
72 virtual double inactive_cutoff() const { return INACTIVE_CUTOFF; }
73
74 template <typename T>
75 auto make_autoparameter(T CoreInteraction::*ptr, char const *name) {
77 [this, ptr]() { return m_ia_si.get()->*ptr; }};
78 }
79
80private:
81 void check_valid_parameters(VariantMap const &params) const {
82 auto const keys = get_valid_parameters();
83 for (auto const &key : keys) {
84 if (params.count(std::string(key)) == 0) {
85 throw std::runtime_error("Parameter '" + key + "' is missing");
86 }
87 }
88 for (auto const &kv : params) {
89 if (std::find(keys.begin(), keys.end(), kv.first) == keys.end()) {
90 throw std::runtime_error("Parameter '" + kv.first +
91 "' is not recognized");
92 }
93 }
94 }
95
96public:
97 Variant do_call_method(std::string const &name,
98 VariantMap const &params) override {
99 if (name == "set_params") {
100 context()->parallel_try_catch([this, &params]() {
101 check_valid_parameters(params);
103 });
104 if (m_types[0] != -1) {
107 }
108 return {};
109 }
110 if (name == "deactivate") {
111 m_ia_si = std::make_shared<CoreInteraction>();
112 if (m_types[0] != -1) {
115 }
116 return {};
117 }
118 if (name == "is_registered") {
119 return m_types[0] != -1;
120 }
121 if (name == "bind_types") {
122 auto types = get_value<std::vector<int>>(params, "_types");
123 if (types[0] > types[1]) {
124 std::swap(types[0], types[1]);
125 }
126 if (m_types[0] == -1 or
127 (m_types[0] == types[0] and m_types[1] == types[1])) {
128 m_types[0] = types[0];
129 m_types[1] = types[1];
130 } else {
131 context()->parallel_try_catch([this]() {
132 throw std::runtime_error(
133 "Non-bonded interaction is already bound to interaction pair [" +
134 std::to_string(m_types[0]) + ", " + std::to_string(m_types[1]) +
135 "]");
136 });
137 }
138 return {};
139 }
140 return {};
141 }
142
143 void do_construct(VariantMap const &params) final {
144 if (params.count("_types") != 0) {
145 do_call_method("bind_types", params);
146 m_ia_si = std::make_shared<CoreInteraction>();
148 } else {
149 if (std::abs(get_value<double>(params, inactive_parameter()) -
150 inactive_cutoff()) < 1e-9) {
151 m_ia_si = std::make_shared<CoreInteraction>();
152 } else {
153 context()->parallel_try_catch([this, &params]() {
154 check_valid_parameters(params);
156 });
157 }
158 }
159 }
160
162 assert(m_ia_si != nullptr);
163 auto &core_ias = *System::get_system().nonbonded_ias;
164 core_ias.get_ia_param(m_types[0], m_types[1]).*get_ptr_offset() = *m_ia_si;
165 }
166
168 assert(m_ia_si != nullptr);
169 auto const &core_ias = *System::get_system().nonbonded_ias;
170 *m_ia_si = core_ias.get_ia_param(m_types[0], m_types[1]).*get_ptr_offset();
171 }
172};
173
174#ifdef WCA
175class InteractionWCA : public InteractionPotentialInterface<::WCA_Parameters> {
176protected:
178 return &::IA_parameters::wca;
179 }
180
181public:
188
189private:
190 std::string inactive_parameter() const override { return "sigma"; }
191 double inactive_cutoff() const override { return 0.; }
192
193 void make_new_instance(VariantMap const &params) override {
194 m_ia_si = make_shared_from_args<CoreInteraction, double, double>(
195 params, "epsilon", "sigma");
196 }
197
198public:
199 Variant do_call_method(std::string const &name,
200 VariantMap const &params) override {
201 if (name == "get_cutoff") {
202 return m_ia_si.get()->cut;
203 }
205 name, params);
206 }
207};
208#endif // WCA
209
210#ifdef LENNARD_JONES
211class InteractionLJ : public InteractionPotentialInterface<::LJ_Parameters> {
212protected:
214 return &::IA_parameters::lj;
215 }
216
217public:
228
229private:
230 void make_new_instance(VariantMap const &params) override {
231 auto new_params = params;
232 auto const *shift_string = boost::get<std::string>(&params.at("shift"));
233 if (shift_string != nullptr) {
234 if (*shift_string != "auto") {
235 throw std::invalid_argument(
236 "LJ parameter 'shift' has to be 'auto' or a float");
237 }
238 new_params["shift"] = 0.;
239 }
240 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
241 double, double, double>(
242 new_params, "epsilon", "sigma", "cutoff", "offset", "min", "shift");
243 if (shift_string != nullptr) {
244 m_ia_si->shift = m_ia_si->get_auto_shift();
245 }
246 }
247};
248#endif // LENNARD_JONES
249
250#ifdef LENNARD_JONES_GENERIC
252 : public InteractionPotentialInterface<::LJGen_Parameters> {
253protected:
257
258public:
276
277private:
278 void make_new_instance(VariantMap const &params) override {
279 auto new_params = params;
280 auto const *shift_string = boost::get<std::string>(&params.at("shift"));
281 if (shift_string != nullptr) {
282 if (*shift_string != "auto") {
283 throw std::invalid_argument(
284 "Generic LJ parameter 'shift' has to be 'auto' or a float");
285 }
286 new_params["shift"] = 0.;
287 }
288 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
289 double, double,
290#ifdef LJGEN_SOFTCORE
291 double, double,
292#endif
293 double, double, double, double>(
294 new_params, "epsilon", "sigma", "cutoff", "shift", "offset",
295#ifdef LJGEN_SOFTCORE
296 "lam", "delta",
297#endif
298 "e1", "e2", "b1", "b2");
299 if (shift_string != nullptr) {
300 m_ia_si->shift = m_ia_si->get_auto_shift();
301 }
302 }
303};
304#endif // LENNARD_JONES_GENERIC
305
306#ifdef LJCOS
308 : public InteractionPotentialInterface<::LJcos_Parameters> {
309protected:
313
314public:
323
324private:
325 void make_new_instance(VariantMap const &params) override {
326 m_ia_si =
327 make_shared_from_args<CoreInteraction, double, double, double, double>(
328 params, "epsilon", "sigma", "cutoff", "offset");
329 }
330};
331#endif // LJCOS
332
333#ifdef LJCOS2
335 : public InteractionPotentialInterface<::LJcos2_Parameters> {
336protected:
340
341public:
350
351private:
352 std::string inactive_parameter() const override { return "sigma"; }
353 double inactive_cutoff() const override { return 0.; }
354
355 void make_new_instance(VariantMap const &params) override {
356 m_ia_si =
357 make_shared_from_args<CoreInteraction, double, double, double, double>(
358 params, "epsilon", "sigma", "offset", "width");
359 }
360
361public:
362 Variant do_call_method(std::string const &name,
363 VariantMap const &params) override {
364 if (name == "get_cutoff") {
365 return m_ia_si.get()->cut;
366 }
368 name, params);
369 }
370};
371#endif // LJCOS2
372
373#ifdef HERTZIAN
375 : public InteractionPotentialInterface<::Hertzian_Parameters> {
376protected:
380
381public:
388
389private:
390 std::string inactive_parameter() const override { return "sig"; }
391
392 void make_new_instance(VariantMap const &params) override {
393 m_ia_si = make_shared_from_args<CoreInteraction, double, double>(
394 params, "eps", "sig");
395 }
396};
397#endif // HERTZIAN
398
399#ifdef GAUSSIAN
401 : public InteractionPotentialInterface<::Gaussian_Parameters> {
402protected:
406
407public:
415
416private:
417 void make_new_instance(VariantMap const &params) override {
418 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double>(
419 params, "eps", "sig", "cutoff");
420 }
421};
422#endif // GAUSSIAN
423
424#ifdef BMHTF_NACL
426 : public InteractionPotentialInterface<::BMHTF_Parameters> {
427protected:
431
432public:
443
444private:
445 void make_new_instance(VariantMap const &params) override {
446 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
447 double, double, double>(
448 params, "a", "b", "c", "d", "sig", "cutoff");
449 }
450};
451#endif // BMHTF_NACL
452
453#ifdef MORSE
455 : public InteractionPotentialInterface<::Morse_Parameters> {
456protected:
460
461public:
470
471private:
472 void make_new_instance(VariantMap const &params) override {
473 m_ia_si =
474 make_shared_from_args<CoreInteraction, double, double, double, double>(
475 params, "eps", "alpha", "rmin", "cutoff");
476 }
477};
478#endif // MORSE
479
480#ifdef BUCKINGHAM
482 : public InteractionPotentialInterface<::Buckingham_Parameters> {
483protected:
487
488public:
500
501private:
502 void make_new_instance(VariantMap const &params) override {
503 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
504 double, double, double, double>(
505 params, "a", "b", "c", "d", "cutoff", "discont", "shift");
506 }
507};
508#endif // BUCKINGHAM
509
510#ifdef SOFT_SPHERE
512 : public InteractionPotentialInterface<::SoftSphere_Parameters> {
513protected:
517
518public:
527
528private:
529 void make_new_instance(VariantMap const &params) override {
530 m_ia_si =
531 make_shared_from_args<CoreInteraction, double, double, double, double>(
532 params, "a", "n", "cutoff", "offset");
533 }
534};
535#endif // SOFT_SPHERE
536
537#ifdef HAT
538class InteractionHat : public InteractionPotentialInterface<::Hat_Parameters> {
539protected:
541 return &::IA_parameters::hat;
542 }
543
544public:
551
552private:
553 void make_new_instance(VariantMap const &params) override {
554 m_ia_si = make_shared_from_args<CoreInteraction, double, double>(
555 params, "F_max", "cutoff");
556 }
557};
558#endif // HAT
559
560#ifdef GAY_BERNE
562 : public InteractionPotentialInterface<::GayBerne_Parameters> {
563protected:
567
568public:
580
581private:
582 std::string inactive_parameter() const override { return "cut"; }
583
584 void make_new_instance(VariantMap const &params) override {
585 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
586 double, double, double, double>(
587 params, "eps", "sig", "cut", "k1", "k2", "mu", "nu");
588 }
589};
590#endif // GAY_BERNE
591
592#ifdef TABULATED
594 : public InteractionPotentialInterface<::TabulatedPotential> {
595protected:
597 return &::IA_parameters::tab;
598 }
599
600public:
609
610private:
611 std::string inactive_parameter() const override { return "max"; }
612
613 void make_new_instance(VariantMap const &params) override {
615 std::vector<double>, std::vector<double>>(
616 params, "min", "max", "force", "energy");
617 }
618
619public:
620 Variant do_call_method(std::string const &name,
621 VariantMap const &params) override {
622 if (name == "get_cutoff") {
623 return m_ia_si.get()->cutoff();
624 }
626 name, params);
627 }
628};
629#endif // TABULATED
630
631#ifdef DPD
632class InteractionDPD : public InteractionPotentialInterface<::DPD_Parameters> {
633protected:
635 return &::IA_parameters::dpd;
636 }
637
638public:
641 {"weight_function", AutoParameter::read_only,
642 [this]() { return m_ia_si.get()->radial.wf; }},
643 {"gamma", AutoParameter::read_only,
644 [this]() { return m_ia_si.get()->radial.gamma; }},
646 [this]() { return m_ia_si.get()->radial.k; }},
647 {"r_cut", AutoParameter::read_only,
648 [this]() { return m_ia_si.get()->radial.cutoff; }},
649 {"trans_weight_function", AutoParameter::read_only,
650 [this]() { return m_ia_si.get()->trans.wf; }},
651 {"trans_gamma", AutoParameter::read_only,
652 [this]() { return m_ia_si.get()->trans.gamma; }},
653 {"trans_r_cut", AutoParameter::read_only,
654 [this]() { return m_ia_si.get()->trans.cutoff; }},
655 });
656 std::ignore = get_ptr_offset(); // for code coverage
657 }
658
659private:
660 std::string inactive_parameter() const override { return "r_cut"; }
661
662 void make_new_instance(VariantMap const &params) override {
663 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
664 double, double, double, double>(
665 params, "gamma", "k", "r_cut", "weight_function", "trans_gamma",
666 "trans_r_cut", "trans_weight_function");
667 if (m_ia_si->radial.wf != 0 and m_ia_si->radial.wf != 1) {
668 throw std::domain_error(
669 "DPDInteraction parameter 'weight_function' must be 0 or 1");
670 }
671 if (m_ia_si->trans.wf != 0 and m_ia_si->trans.wf != 1) {
672 throw std::domain_error(
673 "DPDInteraction parameter 'trans_weight_function' must be 0 or 1");
674 }
675 }
676};
677#endif // DPD
678
679#ifdef THOLE
681 : public InteractionPotentialInterface<::Thole_Parameters> {
682protected:
686
687public:
694
695private:
696 std::string inactive_parameter() const override { return "scaling_coeff"; }
697 double inactive_cutoff() const override { return 0.; }
698
699 void make_new_instance(VariantMap const &params) override {
700 m_ia_si = make_shared_from_args<CoreInteraction, double, double>(
701 params, "scaling_coeff", "q1q2");
702 }
703};
704#endif // THOLE
705
706#ifdef SMOOTH_STEP
708 : public InteractionPotentialInterface<::SmoothStep_Parameters> {
709protected:
713
714public:
725
726private:
727 void make_new_instance(VariantMap const &params) override {
728 m_ia_si = make_shared_from_args<CoreInteraction, double, double, double,
729 double, int, double>(
730 params, "eps", "sig", "cutoff", "d", "n", "k0");
731 }
732};
733#endif // SMOOTH_STEP
734
736 : public AutoParameters<NonBondedInteractionHandle> {
737 std::array<int, 2> m_types = {-1, -1};
738 std::shared_ptr<::IA_parameters> m_interaction;
739#ifdef WCA
740 std::shared_ptr<InteractionWCA> m_wca;
741#endif
742#ifdef LENNARD_JONES
743 std::shared_ptr<InteractionLJ> m_lj;
744#endif
745#ifdef LENNARD_JONES_GENERIC
746 std::shared_ptr<InteractionLJGen> m_ljgen;
747#endif
748#ifdef LJCOS
749 std::shared_ptr<InteractionLJcos> m_ljcos;
750#endif
751#ifdef LJCOS2
752 std::shared_ptr<InteractionLJcos2> m_ljcos2;
753#endif
754#ifdef HERTZIAN
755 std::shared_ptr<InteractionHertzian> m_hertzian;
756#endif
757#ifdef GAUSSIAN
758 std::shared_ptr<InteractionGaussian> m_gaussian;
759#endif
760#ifdef BMHTF_NACL
761 std::shared_ptr<InteractionBMHTF> m_bmhtf;
762#endif
763#ifdef MORSE
764 std::shared_ptr<InteractionMorse> m_morse;
765#endif
766#ifdef BUCKINGHAM
767 std::shared_ptr<InteractionBuckingham> m_buckingham;
768#endif
769#ifdef SOFT_SPHERE
770 std::shared_ptr<InteractionSoftSphere> m_soft_sphere;
771#endif
772#ifdef HAT
773 std::shared_ptr<InteractionHat> m_hat;
774#endif
775#ifdef GAY_BERNE
776 std::shared_ptr<InteractionGayBerne> m_gay_berne;
777#endif
778#ifdef TABULATED
779 std::shared_ptr<InteractionTabulated> m_tabulated;
780#endif
781#ifdef DPD
782 std::shared_ptr<InteractionDPD> m_dpd;
783#endif
784#ifdef THOLE
785 std::shared_ptr<InteractionThole> m_thole;
786#endif
787#ifdef SMOOTH_STEP
788 std::shared_ptr<InteractionSmoothStep> m_smooth_step;
789#endif
790
791 template <class T>
792 auto make_autoparameter(std::shared_ptr<T> &member, const char *key) const {
793 auto const setter = [this, &member](Variant const &v) {
794 member = get_value<std::shared_ptr<T>>(v);
795 if (m_types[0] != -1) {
796 auto const types = Variant{std::vector<int>{{m_types[0], m_types[1]}}};
797 member->do_call_method("bind_types", VariantMap{{"_types", types}});
798 member->copy_si_to_core();
800 }
801 };
802 return AutoParameter{key, setter, [&member]() { return member; }};
803 }
804
805public:
808#ifdef WCA
809 make_autoparameter(m_wca, "wca"),
810#endif
811#ifdef LENNARD_JONES
812 make_autoparameter(m_lj, "lennard_jones"),
813#endif
814#ifdef LENNARD_JONES_GENERIC
815 make_autoparameter(m_ljgen, "generic_lennard_jones"),
816#endif
817#ifdef LJCOS
818 make_autoparameter(m_ljcos, "lennard_jones_cos"),
819#endif
820#ifdef LJCOS2
821 make_autoparameter(m_ljcos2, "lennard_jones_cos2"),
822#endif
823#ifdef HERTZIAN
824 make_autoparameter(m_hertzian, "hertzian"),
825#endif
826#ifdef GAUSSIAN
827 make_autoparameter(m_gaussian, "gaussian"),
828#endif
829#ifdef BMHTF_NACL
830 make_autoparameter(m_bmhtf, "bmhtf"),
831#endif
832#ifdef MORSE
833 make_autoparameter(m_morse, "morse"),
834#endif
835#ifdef BUCKINGHAM
836 make_autoparameter(m_buckingham, "buckingham"),
837#endif
838#ifdef SOFT_SPHERE
839 make_autoparameter(m_soft_sphere, "soft_sphere"),
840#endif
841#ifdef HAT
842 make_autoparameter(m_hat, "hat"),
843#endif
844#ifdef GAY_BERNE
845 make_autoparameter(m_gay_berne, "gay_berne"),
846#endif
847#ifdef TABULATED
848 make_autoparameter(m_tabulated, "tabulated"),
849#endif
850#ifdef DPD
851 make_autoparameter(m_dpd, "dpd"),
852#endif
853#ifdef THOLE
854 make_autoparameter(m_thole, "thole"),
855#endif
856#ifdef SMOOTH_STEP
857 make_autoparameter(m_smooth_step, "smooth_step"),
858#endif
859 });
860 }
861
862private:
863 template <class T>
864 void set_member(std::shared_ptr<T> &member, std::string key,
865 std::string so_name, VariantMap const &params) {
866 auto const ia_types = VariantMap{{"_types", params.at("_types")}};
867 if (params.count(key) != 0) {
868 member = get_value<std::shared_ptr<T>>(params.at(key));
869 member->do_call_method("bind_types", ia_types);
870 member->copy_si_to_core();
871 } else {
872 auto so_object = context()->make_shared_local(so_name, ia_types);
873 member = std::dynamic_pointer_cast<T>(so_object);
874 member->copy_core_to_si();
875 }
876 }
877
878public:
879 Variant do_call_method(std::string const &name,
880 VariantMap const &params) override {
881 assert(params.empty());
882 if (name == "get_types") {
883 return std::vector<int>{{m_types[0], m_types[1]}};
884 }
885 return {};
886 }
887
888 void do_construct(VariantMap const &params) override {
889 assert(params.count("_types") != 0);
890 auto &nonbonded_ias = *System::get_system().nonbonded_ias;
891 auto const types = get_value<std::vector<int>>(params.at("_types"));
892 m_types[0] = std::min(types[0], types[1]);
893 m_types[1] = std::max(types[0], types[1]);
894 nonbonded_ias.make_particle_type_exist(m_types[1]);
895 // create interface objects
896 m_interaction =
897 nonbonded_ias.get_ia_param_ref_counted(m_types[0], m_types[1]);
898#ifdef WCA
899 set_member(m_wca, "wca", "Interactions::InteractionWCA", params);
900#endif
901#ifdef LENNARD_JONES
902 set_member(m_lj, "lennard_jones", "Interactions::InteractionLJ", params);
903#endif
904#ifdef LENNARD_JONES_GENERIC
905 set_member(m_ljgen, "generic_lennard_jones",
906 "Interactions::InteractionLJGen", params);
907#endif
908#ifdef LJCOS
909 set_member(m_ljcos, "lennard_jones_cos", "Interactions::InteractionLJcos",
910 params);
911#endif
912#ifdef LJCOS2
913 set_member(m_ljcos2, "lennard_jones_cos2",
914 "Interactions::InteractionLJcos2", params);
915#endif
916#ifdef HERTZIAN
917 set_member(m_hertzian, "hertzian", "Interactions::InteractionHertzian",
918 params);
919#endif
920#ifdef GAUSSIAN
921 set_member(m_gaussian, "gaussian", "Interactions::InteractionGaussian",
922 params);
923#endif
924#ifdef BMHTF_NACL
925 set_member(m_bmhtf, "bmhtf", "Interactions::InteractionBMHTF", params);
926#endif
927#ifdef MORSE
928 set_member(m_morse, "morse", "Interactions::InteractionMorse", params);
929#endif
930#ifdef BUCKINGHAM
931 set_member(m_buckingham, "buckingham",
932 "Interactions::InteractionBuckingham", params);
933#endif
934#ifdef SOFT_SPHERE
935 set_member(m_soft_sphere, "soft_sphere",
936 "Interactions::InteractionSoftSphere", params);
937#endif
938#ifdef HAT
939 set_member(m_hat, "hat", "Interactions::InteractionHat", params);
940#endif
941#ifdef GAY_BERNE
942 set_member(m_gay_berne, "gay_berne", "Interactions::InteractionGayBerne",
943 params);
944#endif
945#ifdef TABULATED
946 set_member(m_tabulated, "tabulated", "Interactions::InteractionTabulated",
947 params);
948#endif
949#ifdef DPD
950 set_member(m_dpd, "dpd", "Interactions::InteractionDPD", params);
951#endif
952#ifdef THOLE
953 set_member(m_thole, "thole", "Interactions::InteractionThole", params);
954#endif
955#ifdef SMOOTH_STEP
956 set_member(m_smooth_step, "smooth_step",
957 "Interactions::InteractionSmoothStep", params);
958#endif
959 }
960
961 auto get_ia() const { return m_interaction; }
962};
963
964} // namespace Interactions
965} // namespace ScriptInterface
966
967#endif
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
virtual std::shared_ptr< ObjectHandle > make_shared_local(std::string const &name, VariantMap const &parameters)=0
Get a new reference counted instance of a script interface by name.
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.
virtual CoreInteraction IA_parameters::* get_ptr_offset() const =0
Pointer to the corresponding member in a handle.
std::shared_ptr< CoreInteraction > m_ia_si
Managed object.
virtual double inactive_cutoff() const
Which magic value indicates the potential is inactive.
auto make_autoparameter(T CoreInteraction::*ptr, char const *name)
Variant do_call_method(std::string const &name, VariantMap const &params) override
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
Variant do_call_method(std::string const &name, VariantMap const &params) override
boost::string_ref name() const
virtual Variant do_call_method(const std::string &, const VariantMap &)
Local implementation of call_method.
Context * context() const
Responsible context.
std::shared_ptr< InteractionsNonBonded > nonbonded_ias
std::unordered_map< std::string, Variant > VariantMap
Definition Variant.hpp:82
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.
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.
Definition Variant.hpp:80
System & get_system()
Various procedures concerning interactions between particles.
constexpr double INACTIVE_CUTOFF
Cutoff for deactivated interactions.
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
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.