forked from glotzerlab/hoomd-component-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathExampleExternalPotential.h
73 lines (56 loc) · 2.31 KB
/
ExampleExternalPotential.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) 2009-2025 The Regents of the University of Michigan.
// Part of HOOMD-blue, released under the BSD 3-Clause License.
#pragma once
#include "hoomd/HOOMDMath.h"
#include "hoomd/VectorMath.h"
#include "hoomd/hpmc/ExternalPotential.h"
#include <pybind11/pybind11.h>
namespace hoomd
{
namespace hpmc
{
/** Example external potential for use with HPMC simulations.
This example external potential applies a harmonic trap at the center of the simulation box.
TODO: Rename the "ExampleExternalPotential" to a class name that represents your potential.
"ExampleExternal" appears many times in C++, CMakeLists, and Python files. Consider using a
global search and replace tool.
*/
class ExampleExternalPotential : public ExternalPotential
{
public:
ExampleExternalPotential(std::shared_ptr<SystemDefinition> sysdef);
virtual ~ExampleExternalPotential() { }
/// Set type-pair-dependent parameters to the potential.
void setParamsPython(const std::string& particle_type, pybind11::dict params);
/// Get type-pair-dependent parameters.
pybind11::dict getParamsPython(const std::string& particle_type);
protected:
LongReal particleEnergyImplementation(uint64_t timestep,
unsigned int tag_i,
unsigned int type_i,
const vec3<LongReal>& r_i,
const quat<LongReal>& q_i,
LongReal charge_i,
Trial trial = Trial::None) override;
/// per-type parameters
struct ParamType
{
ParamType() { }
/// Construct a parameter set from a dictionary.
ParamType(pybind11::dict v);
/// Convert a parameter set to a dictionary.
pybind11::dict asDict();
// TODO: Rename m_epsilon and add per-type quantities as needed.
/// Prefactor in harmonic potential.
LongReal m_epsilon;
};
/// Parameters per type.
std::vector<ParamType> m_params;
};
namespace detail
{
//! Export the ExampleUpdater class to python
void export_ExampleExternalPotential(pybind11::module& m);
} // end namespace detail
} // end namespace hpmc
} // end namespace hoomd