KIDS  ver-0.0.1
KIDS : Kernel Integrated Dynamics Simulator
Loading...
Searching...
No Matches
Kernel_Update_T.cpp
Go to the documentation of this file.
2
4#include "kids/hash_fnv1a.h"
5#include "kids/macro_utils.h"
6#include "kids/vars_list.h"
7
8namespace PROJECT_NS {
9
10const std::string Kernel_Update_T::getName() { return "Kernel_Update_T"; }
11
13
14void Kernel_Update_T::setInputParam_impl(std::shared_ptr<Param>& PM) { gammal = PM->get_double("gammal", LOC(), 0.1); }
15
16void Kernel_Update_T::setInputDataSet_impl(std::shared_ptr<DataSet>& DS) {
17 dt_ptr = DS->def(DATA::iter::dt);
18 m = DS->def(DATA::integrator::m);
19 p = DS->def(DATA::integrator::p);
20
21 // if Langevin dynamics, set optimal c1 & c2p
22 c1 = DS->def_real("integrator.c1", Dimension::PN);
23 c2p = DS->def_real("integrator.c2p", Dimension::PN);
24 for (int i = 0; i < Dimension::PN; ++i) {
25 c1[i] = exp(-gammal * scale * dt_ptr[0]);
26 c2p[i] = sqrt(1.0 - c1[i] * c1[i]);
27 }
28
29 // if for NHC; registeration for auxiliary variables
30 // ...
31}
32
34 for (int i = 0; i < Dimension::PN; ++i) {
36 p[i] = c1[i] * p[i] + c2p[i] * sqrt(m[i] / beta) * randu;
37 }
38 return stat;
39}
40
41}; // namespace PROJECT_NS
static int rand_gaussian(kids_real *res_arr, int N=1, kids_real sigma=1.0, kids_real mu=0.0)
virtual int getType() const
Get the type of the kernel.
virtual void setInputParam_impl(std::shared_ptr< Param > &PM)
Virtual function to set input parameters for the kernel implementation.
virtual void setInputDataSet_impl(std::shared_ptr< DataSet > &DS)
Virtual function to set input data set for the kernel implementation.
virtual Status & executeKernel_impl(Status &stat)
Virtual function to execute the kernel implementation.
virtual const std::string getName()
Get the name of the kernel.
#define LOC()
show the location information for debug
Definition fmt.h:49
#define FUNCTION_NAME
Definition macro_utils.h:9
VARIABLE< kids_real > p
VARIABLE< kids_real > m
VARIABLE< kids_real > dt
std::size_t PN
Product of P and N (P * N).
Definition vars_list.cpp:14
< http://warp.povusers.org/FunctionParser/fparser.html
Definition Context.h:39
constexpr uint32_t hash(const char *str)
Definition hash_fnv1a.h:12
declaration of variables used in the program.