Skip to content

Commit

Permalink
Merge pull request #1793 from glotzerlab/mesh_helfrich_energy
Browse files Browse the repository at this point in the history
Mesh helfrich energy
  • Loading branch information
joaander authored Oct 16, 2024
2 parents 614e405 + 36f306f commit 5cd89bf
Show file tree
Hide file tree
Showing 14 changed files with 1,729 additions and 26 deletions.
5 changes: 5 additions & 0 deletions hoomd/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def __init__(self, *args, **kwargs):
"This build of HOOMD-blue does not support GPUs.")


class MPINotAvailableError(NotImplementedError):
"""Error for when a feature is not implemented for MPI."""
pass


class IncompleteSpecificationError(ValueError):
"""Error when a value is missing."""
pass
Expand Down
2 changes: 1 addition & 1 deletion hoomd/md/BendingRigidityMeshForceCompute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void BendingRigidityMeshForceCompute::setParams(unsigned int type, Scalar K)
void BendingRigidityMeshForceCompute::setParamsPython(std::string type, pybind11::dict params)
{
auto typ = m_mesh_data->getMeshBondData()->getTypeByName(type);
auto _params = rigidity_params(params);
auto _params = bending_params(params);
setParams(typ, _params.k);
}

Expand Down
41 changes: 20 additions & 21 deletions hoomd/md/BendingRigidityMeshForceCompute.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,36 @@ namespace hoomd
{
namespace md
{

//! Computes rigidity energy forces on the mesh
/*! BendingRigidity energy forces are computed on every particle in a mesh.
\ingroup computes
*/
class PYBIND11_EXPORT BendingRigidityMeshForceCompute : public ForceCompute
struct bending_params
{
struct rigidity_params
{
Scalar k;
Scalar k;

#ifndef __HIPCC__
rigidity_params() : k(0) { }
bending_params() : k(0) { }

rigidity_params(pybind11::dict params) : k(params["k"].cast<Scalar>()) { }
bending_params(pybind11::dict params) : k(params["k"].cast<Scalar>()) { }

pybind11::dict asDict()
{
pybind11::dict v;
v["k"] = k;
return v;
}
#endif
pybind11::dict asDict()
{
pybind11::dict v;
v["k"] = k;
return v;
}
#endif
}
#if HOOMD_LONGREAL_SIZE == 32
__attribute__((aligned(4)));
__attribute__((aligned(4)));
#else
__attribute__((aligned(8)));
__attribute__((aligned(8)));
#endif

//! Computes rigidity energy forces on the mesh
/*! BendingRigidity energy forces are computed on every particle in a mesh.
\ingroup computes
*/
class PYBIND11_EXPORT BendingRigidityMeshForceCompute : public ForceCompute
{
public:
//! Constructs the compute
BendingRigidityMeshForceCompute(std::shared_ptr<SystemDefinition> sysdef,
Expand Down
5 changes: 5 additions & 0 deletions hoomd/md/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set(_md_sources module-md.cc
HarmonicAngleForceCompute.cc
HarmonicDihedralForceCompute.cc
HarmonicImproperForceCompute.cc
HelfrichMeshForceCompute.cc
IntegrationMethodTwoStep.cc
IntegratorTwoStep.cc
ManifoldZCylinder.cc
Expand Down Expand Up @@ -133,6 +134,8 @@ set(_md_headers ActiveForceComputeGPU.h
HarmonicDihedralForceCompute.h
HarmonicImproperForceComputeGPU.h
HarmonicImproperForceCompute.h
HelfrichMeshForceComputeGPU.h
HelfrichMeshForceCompute.h
IntegrationMethodTwoStep.h
IntegratorTwoStep.h
ManifoldZCylinder.h
Expand Down Expand Up @@ -225,6 +228,7 @@ list(APPEND _md_sources ActiveForceComputeGPU.cc
HarmonicAngleForceComputeGPU.cc
HarmonicDihedralForceComputeGPU.cc
HarmonicImproperForceComputeGPU.cc
HelfrichMeshForceComputeGPU.cc
MolecularForceCompute.cu
NeighborListGPU.cc
NeighborListGPUBinned.cc
Expand Down Expand Up @@ -261,6 +265,7 @@ set(_md_cu_sources ActiveForceComputeGPU.cu
HarmonicAngleForceGPU.cu
HarmonicDihedralForceGPU.cu
HarmonicImproperForceGPU.cu
HelfrichMeshForceComputeGPU.cu
MolecularForceCompute.cu
NeighborListGPUBinned.cu
NeighborListGPU.cu
Expand Down
Loading

0 comments on commit 5cd89bf

Please sign in to comment.