2 * \brief Code to implement the potential declared in nullpotential.h
4 * This restraint is implemented in a transitional style. We are moving in the direction of
5 * callback based data flow. There is also a preference amongst the GROMACS developers for
6 * stateless objects or free functions. State can be provided by library-managed facilities
7 * rather than stored in long-lived objects.
9 * The IRestraintPotential framework is due for revision in conjunction with ongoing evolution of
10 * the gmx::MDModules interactions. Until then, we try to use a forward looking design.
12 * \author M. Eric Irrgang <ericirrgang@gmail.com>
15 #include "nullpotential.h"
22 null_input_param_type makeNullParams(std::vector<int>&& sites)
24 return null_input_param_type{ std::move(sites), 0 };
27 std::vector<int> sites(const null_input_param_type& input)
32 gmx::PotentialPointData evaluate(
36 null_input_param_type* input)
39 return gmx::PotentialPointData();
42 int count(const null_input_param_type& input)
47 gmx::PotentialPointData NullRestraint::evaluate(gmx::Vector r1, gmx::Vector r2, double t)
49 return ::plugin::evaluate(r1, r2, t, &data_);
52 std::vector<int> NullRestraint::sites() const
54 return ::plugin::sites(data_);
57 NullRestraint::NullRestraint(std::vector<int> sites,
58 const NullRestraint::input_param_type& params,
59 std::shared_ptr<Resources> /*resources*/) :
60 data_{ std::move(sites), params.count_ }
64 // Important: Explicitly instantiate a definition for the templated class declared in
65 // ensemblepotential.h. Failing to do this will cause a linker error.
66 template class ::plugin::RestraintModule<NullRestraint>;
68 } // end namespace plugin