FrictionQPotSpringBlock v0.22.7
Loading...
Searching...
No Matches
Line2d.h
Go to the documentation of this file.
1
7#ifndef FRICTIONQPOTSPRINGBLOCK_LINE2D_H
8#define FRICTIONQPOTSPRINGBLOCK_LINE2D_H
9
10#include "config.h"
11#include "detail.h"
12
13#include <prrng.h>
14
15#include <GMatTensor/version.h>
16
18
19namespace detail {
20
29get_initstate_2d(uint64_t seed, const std::array<size_t, 2>& shape)
30{
32 seed + xt::arange<uint64_t>(shape[0] * shape[1]).reshape(shape);
33 return ret;
34};
35
36} // namespace detail
37
41namespace Line2d {
42
53inline std::vector<std::string> version_dependencies()
54{
55 return GMatTensor::version_dependencies();
56}
57
62inline std::vector<std::string> version_compiler()
63{
64 return GMatTensor::version_compiler();
65}
66
70using Generator =
71 prrng::pcg32_tensor_cumsum<array_type::tensor<double, 3>, array_type::tensor<ptrdiff_t, 2>, 2>;
72
78 : public detail::System<2, detail::Cuspy<Generator>, Generator, detail::Laplace2d> {
79protected:
83
84public:
89 double m,
90 double eta,
91 double mu,
92 double k_interactions,
93 double k_frame,
94 double dt,
95 const std::array<size_t, 2>& shape,
96 uint64_t seed,
97 const std::string& distribution,
98 const std::vector<double>& parameters,
99 double offset = -100.0,
100 size_t nchunk = 5000
101 )
102 : m_gen(
103 std::array<size_t, 1>{nchunk},
104 detail::get_initstate_2d(seed, shape),
105 xt::eval(xt::zeros<uint64_t>(shape)),
106 detail::string_to_distribution(distribution),
107 parameters,
108 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
109 )
110 {
111 m_gen += offset;
113 m_int = detail::Laplace2d(k_interactions, shape[0], shape[1]);
114 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen, &m_int);
115 }
116};
117
123 : public detail::System<2, detail::Cuspy<Generator>, Generator, detail::QuarticGradient2d> {
124protected:
128
129public:
134 double m,
135 double eta,
136 double mu,
137 double k2,
138 double k4,
139 double k_frame,
140 double dt,
141 const std::array<size_t, 2>& shape,
142 uint64_t seed,
143 const std::string& distribution,
144 const std::vector<double>& parameters,
145 double offset = -100.0,
146 size_t nchunk = 5000
147 )
148 : m_gen(
149 std::array<size_t, 1>{nchunk},
150 detail::get_initstate_2d(seed, shape),
151 xt::eval(xt::zeros<uint64_t>(shape)),
152 detail::string_to_distribution(distribution),
153 parameters,
154 prrng::alignment(/*buffer*/ 2, /*margin*/ 30, /*min_margin*/ 6, /*strict*/ false)
155 )
156 {
157 m_gen += offset;
159 m_int = detail::QuarticGradient2d(k2, k4, shape[0], shape[1]);
160 this->initSystem(m, eta, k_frame, mu, dt, &m_pot, &m_gen, &m_int);
161 }
162};
163
164} // namespace Line2d
165} // namespace FrictionQPotSpringBlock
166
167#endif
array_type::tensor< uint64_t, 2 > get_initstate_2d(uint64_t seed, const std::array< size_t, 2 > &shape)
Get the default initial state.
Definition Line2d.h:29
Identical to Line1d::System_Cuspy_Laplace() but with '2d' interactions.
Definition Line2d.h:78
System_Cuspy_Laplace(double m, double eta, double mu, double k_interactions, double k_frame, double dt, const std::array< size_t, 2 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Standard system with a cuspy potential energy landscape and short range interactions.
Definition Line2d.h:88
detail::Laplace2d m_int
Class to get the forces from particle interaction.
Definition Line2d.h:82
detail::Cuspy< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Line2d.h:81
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Line2d.h:80
Identical to Line1d::System_Cuspy_QuarticGradient() but with '2d' interactions.
Definition Line2d.h:123
System_Cuspy_QuarticGradient(double m, double eta, double mu, double k2, double k4, double k_frame, double dt, const std::array< size_t, 2 > &shape, uint64_t seed, const std::string &distribution, const std::vector< double > &parameters, double offset=-100.0, size_t nchunk=5000)
Same as System_Cuspy_Laplace() but with a quartic interactions.
Definition Line2d.h:133
detail::QuarticGradient2d m_int
Class to get the forces from particle interaction.
Definition Line2d.h:127
Generator m_gen
Pointer to chunk of yield 'positions' (automatically updated if needed)
Definition Line2d.h:125
detail::Cuspy< Generator > m_pot
Class to get the forces from the local potential energy landscape.
Definition Line2d.h:126
A piece-wise quadratic local potential energy.
Definition detail.h:114
Short range interactions based on the Laplacian .
Definition detail.h:524
Short range interactions based on quartic interactions.
Definition detail.h:658
System in generic number of dimensions.
Definition detail.h:1053
void initSystem(double m, double eta, double k_frame, double mu, double dt, detail::Cuspy< Generator > *potential, Generator *chunk, detail::Laplace2d *interactions=nullptr, void *external=nullptr)
Initialise the system.
Definition detail.h:1096
prrng::pcg32_tensor_cumsum< array_type::tensor< double, 3 >, array_type::tensor< ptrdiff_t, 2 >, 2 > Generator
Chunked storage of the cumulative sum of random numbers, used in all classes.
Definition Line2d.h:70
std::vector< std::string > version_compiler()
Return information on the compiler, platform, C++ standard, and the compilation data.
Definition Line2d.h:62
std::vector< std::string > version_dependencies()
Return versions of this library and of all of its dependencies.
Definition Line2d.h:53
xt::xarray< T > array
Arbitrary rank array.
Definition config.h:178
Tensor products / operations.
Definition config.h:145