Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
+++
title = "HarmonicGroove"
weight = 100000
+++

# HarmonicGroovePotential

It is a Harmonic potential between particle and a spatial structure.

{{<<katex dispaly>>}}
U(r) = k(v - v_0)^2
{{</katex>}}

## Example

```toml
[[forcefields.external]]
interaction = "Distance"
potential = "HarmonicGroove"
shape.name = "AxisAlignedPlane"
shape.axis = "X"
shape.position = 0.0
shape.margin = 1.0

parameters = [
{index = 0, k = 1.0, v0 = 1.0},
# ...
]
```

## Input Reference

- `k`: Floating
- It determines the strength of the potential.
- `v0`: Floating
- It determines the native length.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ parameters = [
- The following potentials are available.
- [`"LennardJonesWall"`]({{<relref "LennardJonesWallPotential.md">}})
- [`"ExcludedVolumeWall"`]({{<relref "ExcludedVolumeWallPotential.md">}})
- [`"HarmonicGroove"`]({{<relref "HarmonicGroovePotential.md">}})
- [`"ImplicitMembrane"`]({{<relref "ImplicitMembranePotential.md">}})
- `shape`: Table
- The shape and the position of a structure that interacts with particles.
Expand Down
4 changes: 2 additions & 2 deletions book/content.en/docs/reference/forcefields/global/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ bookCollapseSection = true

It depends on the distances between two particles.

## [3SPN2BaseBase](3SPN2BaseBaseInteraction.md)
## [3SPN2BaseBase]({{<relref "3SPN2BaseBaseInteraction.md">}})

It is specific to 3SPN2 Coarse-Grained DNA model.

## [ProteinDNANonSpecific](ProteinDNANonSpecificInteraction.md)
## [ProteinDNANonSpecific]({{<relref "ProteinDNANonSpecificInteraction.md">}})

It is a Coarse-Grained hydrogen bond model.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ parameters = [
- The cutoff distance relative to the maximum {{<katex>}}\sigma_{ij}{{</katex>}}.
- `index`: Integer
- The index of the particle.
- `offset`: Integer (ptional. By default, 0.)
- `offset`: Integer (optional. By default, 0.)
- Offset of the index.
- `sigma`: Floating
- It determines the effective particle size.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
+++
title = "HarmonicGroove"
weight = 200000
+++

# HarmonicGroovePotential

シンプルな調和振動子ポテンシャルです。

{{<katex display>}}
U(r) = k (v - v_0)^2
{{</katex>}}

## Example

```toml
[[forcefields.external]]
interaction = "Distance"
potential = "HarmonicGroove"
shape.name = "AxisAlignedPlane"
shape.axis = "X"
shape.position = 0.0
shape.margin = 1.0

parameters = [
{index = 0, k = 1.0, v0 = 1.0},
# ...
]
```

## Input Reference

- `k`: 浮動小数点数型
- ポテンシャルの強さを指定します。
- `v0`: 浮動小数点数型
- 最安定点を指定します。
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ parameters = [
- The following potentials are available.
- [`"LennardJonesWall"`]({{<relref "LennardJonesWallPotential.md">}})
- [`"ExcludedVolumeWall"`]({{<relref "ExcludedVolumeWallPotential.md">}})
- [`"HarmonicGroove"`]({{<relref "HarmonicGroovePotential.md">}})
- [`"ImplicitMembrane"`]({{<relref "ImplicitMembranePotential.md">}})
- `shape`: Table
- The shape and the position of a structure that interacts with particles.
Expand Down
1 change: 1 addition & 0 deletions mjolnir/forcefield/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(mjolnir_forcefield_external_cpp_files
"${CMAKE_CURRENT_SOURCE_DIR}/ExcludedVolumeWallPotential.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ImplicitMembranePotential.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/LennardJonesWallPotential.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/HarmonicGroovePotential.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/RectangularBoxInteraction.cpp"
)
set(mjolnir_forcefield_cpp_files
Expand Down
11 changes: 11 additions & 0 deletions mjolnir/forcefield/external/HarmonicGroovePotential.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <mjolnir/forcefield/external/HarmonicGroovePotential.hpp>

#ifndef MJOLNIR_SEPARATE_BUILD
#error "MJOLNIR_SEPARATE_BUILD flag is required"
#endif

namespace mjolnir
{
template class HarmonicGroovePotential<double>;
template class HarmonicGroovePotential<float>;
} // mjolnir
93 changes: 93 additions & 0 deletions mjolnir/forcefield/external/HarmonicGroovePotential.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#ifndef MJOLNIR_POTENTIAL_EXTERNAL_HARMONIC_GROOVE_POTENTIAL_HPP
#define MJOLNIR_POTENTIAL_EXTERNAL_HARMONIC_GROOVE_POTENTIAL_HPP
#include <mjolnir/core/System.hpp>
#include <limits>

namespace mjolnir
{

/*! @brief harmonic potential *
* designed for external force field. Force particle-particle Harmonic potential, *
* see mjolnir/forcefield/local/HarmonicPotential.hpp */
template<typename realT>
class HarmonicGroovePotential
{
public:
using real_type = realT;
using parameter_type = std::pair<real_type, real_type>;
using container_type = std::vector<parameter_type>;

static constexpr real_type default_cutoff() noexcept
{
return std::numeric_limits<real_type>::max();
}
static constexpr parameter_type default_parameter() noexcept
{
return std::make_pair(real_type(0), real_type(0));
}

public:

HarmonicGroovePotential(
const std::vector<std::pair<std::size_t, parameter_type>>& params)
{
this->parameters_.resize(params.size());
this->participants_.reserve(params.size());
for(const auto& idxp : params)
{
const auto idx = idxp.first;
this->participants_.push_back(idx);
if(idx >= this->parameters_.size())
{
this->parameters_.resize(idx+1, default_parameter());
}
this->parameters_.at(idx) = idxp.second;
}
}
~HarmonicGroovePotential(){}

real_type potential(const std::size_t i, const real_type v) const noexcept
{
const parameter_type k_v0 = this->parameters_[i];
const real_type dv = v - k_v0.second;
return k_v0.first * dv * dv;
}

real_type derivative(const std::size_t i, const real_type v) const noexcept
{
const parameter_type k_v0 = this->parameters_[i];
return 2 * k_v0.first * (v - k_v0.second);
}

real_type max_cutoff_length() const noexcept
{
return this->default_cutoff();
}

std::vector<std::size_t> const& participants() const noexcept
{
return participants_;
}

// nothing to do when system parameters change.
template<typename T>
void update(const System<T>&) const noexcept {return;}

const char* name() const noexcept {return "HarmonicGroove";}

container_type& parameters() noexcept {return parameters_;}
container_type const& parameters() const noexcept {return parameters_;}

private:

container_type parameters_;
std::vector<std::size_t> participants_;
};

#ifndef MJOLNIR_SEPARATE_BUILD
extern template class HarmonicGroovePotential<double>;
extern template class HarmonicGroovePotential<float>;
#endif // MJOLNIR_SEPARATE_BUILD

} // mjolnir
#endif // MJOLNIR_POTENTIAL_EXTERNAL_HARMONIC_GROOVE_POTENTIAL_HPP
8 changes: 4 additions & 4 deletions mjolnir/input/read_external_interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, Un
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, CuboidalPeriodicBoundary>>> read_afm_flexible_fitting_interaction(const toml::value&);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, CuboidalPeriodicBoundary>>> read_afm_flexible_fitting_interaction(const toml::value&);

template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, UnlimitedBoundary> >> read_external_distance_interaction_shape(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, UnlimitedBoundary> >> read_external_distance_interaction_shape(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, CuboidalPeriodicBoundary>>> read_external_distance_interaction_shape(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, CuboidalPeriodicBoundary>>> read_external_distance_interaction_shape(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, UnlimitedBoundary> >> read_external_distance_interaction(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, UnlimitedBoundary> >> read_external_distance_interaction(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, CuboidalPeriodicBoundary>>> read_external_distance_interaction(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, CuboidalPeriodicBoundary>>> read_external_distance_interaction(const toml::value& external);

template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<double, UnlimitedBoundary> >> read_pulling_force_interaction(const toml::value& external);
template std::unique_ptr<ExternalForceInteractionBase<SimulatorTraits<float, UnlimitedBoundary> >> read_pulling_force_interaction(const toml::value& external);
Expand Down
Loading