12inline bool isFileExists(
const std::string& name) {
return std::ifstream{name.c_str()}.good(); }
14extern double phi(
double lambda,
double N0_max,
int F);
59 cmsh_type = NADPolicy::_from(PM->get_string(
"cmsh_flag",
LOC(),
"CVSH"));
61 alpha0 = PM->get_double(
"alpha0",
LOC(), 0.5);
70 use_wmm = PM->get_bool(
"use_wmm",
LOC(),
false);
71 use_sqc = PM->get_bool(
"use_sqc",
LOC(),
false);
79 use_sum = PM->get_bool(
"use_sum",
LOC(),
false);
100 case NADPolicy::CVSH:
107 case NADPolicy::BOSD:
111 case NADPolicy::CVSD:
178 for (
int i = 0; i <
Dimension::F; ++i) c[i] = std::abs(c[i] * c[i]);
200 for (
int i = 0; i <
Dimension::F; ++i) norm += std::abs(c[i] * c[i]);
213 std::string init_nuclinp =
_param->get_string(
"init_nuclinp",
LOC());
214 std::string open_file = init_nuclinp;
217 std::string stmp, eachline;
218 std::ifstream ifs(open_file);
219 while (getline(ifs, eachline)) {
220 if (eachline.find(
"init.c") != eachline.npos) {
221 getline(ifs, eachline);
222 for (
int i = 0; i < Dimension::N; ++i) ifs >> c[i];
234 double randu = 1.0e0;
236 double gamma_uu = 0.0e0;
249 if (i == iocc || j == iocc)
continue;
257 }
else if (i == iocc || j == iocc) {
258 rho_ele[ij] *= gamma_ou;
260 rho_ele[ij] *= gamma_uu;
290 RepresentationPolicy::Adiabatic,
295 RepresentationPolicy::Adiabatic,
302 RepresentationPolicy::Adiabatic,
304 wz_A[0] = std::abs(rho_ele[0] - rho_ele[3]);
307 ww_A[0] = 4.0 - 1.0 / (max_val * max_val);
309 RepresentationPolicy::Adiabatic,
310 RepresentationPolicy::Diabatic,
312 wz_D[0] = std::abs(rho_ele[0] - rho_ele[3]);
315 ww_D[0] = 4.0 - 1.0 / (max_val * max_val);
317 RepresentationPolicy::Diabatic,
392 for (
int i = 0; i <
Dimension::F; ++i) c[i] = c_init[i];
393 for (
int ik = 0; ik <
Dimension::FF; ++ik) rho_ele[ik] = rho_ele_init[ik];
394 for (
int ik = 0; ik <
Dimension::FF; ++ik) rho_nuc[ik] = rho_nuc_init[ik];
416 RepresentationPolicy::Adiabatic,
420 RepresentationPolicy::Adiabatic,
426 Efrom =
calc_Ew(
E, rho_nuc, *occ_nuc);
479 Epot[0] =
vpes[0] + ((*occ_nuc == to) ? Eto : Efrom);
501 if (Ew_new != Ew_old) {
502 double vdotd = 0.0e0;
504 double xsolve = (Ew_new - Ew_old) / (
scale *
dt) / vdotd;
511 RepresentationPolicy::Adiabatic,
516 RepresentationPolicy::Adiabatic,
523 for (
int i = 0; i <
Dimension::FF; ++i) rho_nuc[i] = rho_ele[i] + (rho_nuc_init[i] - rho_ele_init[i]);
526 RepresentationPolicy::Adiabatic,
536 ww_A[0] = 4.0 - 1.0 / (max_val * max_val);
537 ww_A[0] = std::min({abs(ww_A[0]), std::abs(ww_A_init[0])});
555 RepresentationPolicy::Adiabatic,
559 RepresentationPolicy::Adiabatic,
563 RepresentationPolicy::Adiabatic,
567 RepresentationPolicy::Adiabatic,
572 RepresentationPolicy::Adiabatic,
573 RepresentationPolicy::Diabatic,
583 ww_D[0] = 4.0 - 1.0 / (max_val * max_val);
585 double y = max_val - 0.5e0;
586 ww_D[0] = (23.0e0 / 2 * y - 72.0e0 * y * y + 140.0e0 * y * y * y + 480.0e0 * y * y * y * y -
587 840.0e0 * y * y * y * y * y) +
588 (9.0e0 / 4.0 - 9.0e0 * y * y - 420.0e0 * y * y * y * y + 1680.0e0 * y * y * y * y * y * y) *
591 ww_D[0] = std::min({abs(ww_D[0]), std::abs(ww_D_init[0])});
595 RepresentationPolicy::Diabatic,
597 double vmax0 = 0.0e0, vsec0 = 0.0e0;
598 double vmaxt = 0.0e0, vsect = 0.0e0;
600 if (abs(rho_ele_init[ii]) > vmax0) {
602 vmax0 = std::abs(rho_ele_init[ii]);
603 }
else if (abs(rho_ele_init[ii]) > vsec0) {
604 vsec0 = std::abs(rho_ele_init[ii]);
606 if (abs(rho_ele[ii]) > vmax0) {
608 vmaxt = std::abs(rho_ele[ii]);
609 }
else if (abs(rho_ele[ii]) > vsect) {
610 vsect = std::abs(rho_ele[ii]);
614 double lambda1 = std::min({1 / vsect, 2 / (vmax0 + vsec0)});
615 double lambda2 = std::max({1 / vmaxt, 1 / vmax0});
616 if (lambda1 > lambda2) {
622 RepresentationPolicy::Diabatic,
660 RepresentationPolicy::Diabatic,
664 RepresentationPolicy::Diabatic,
668 RepresentationPolicy::Diabatic,
672 RepresentationPolicy::Diabatic,
676 RepresentationPolicy::Diabatic,
680 RepresentationPolicy::Diabatic,
684 RepresentationPolicy::Diabatic,
688 RepresentationPolicy::Diabatic,
bool isFileExists(const std::string &name)
double phi(double lambda, double N0_max, int F)
bool isFileExists(const std::string &name)
double phi(double lambda, double N0_max, int F)
this file provides Kernel_NADForce class enabling force weighting from electronic properties.
#define ARRAY_MATMUL3_TRANS2(_A, _B, _C, _D, _n1, _n2, _n0, _n3)
#define ARRAY_MATMUL(_A, _B, _C, _n1, _n2, _n3)
#define ARRAY_EYE(_A, _n)
#define ARRAY_CLEAR(_A, _n)
virtual const std::string getName()
Get the name of the kernel.
virtual void setInputDataSet_impl(std::shared_ptr< DataSet > &DS)
Virtual function to set input data set for the kernel implementation.
NADPolicy::_type cmsh_type
virtual Status & initializeKernel_impl(Status &stat)
Virtual function to initialize the kernel implementation.
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.
kids_bint * at_samplingstep_finally_ptr
virtual Status & executeKernel_impl(Status &stat)
Virtual function to execute the kernel implementation.
static kids_complex * U
dynamics variables for electronic DOFs
static int ker_from_rho(kids_complex *ker, kids_complex *rho, kids_real xi, kids_real gamma, int fdim, bool quantize=false, int occ=-1)
convert c (electonic amplititude) to kernel (affine map of the density)
static kids_complex * ww_A_init
static int * occ_nuc
weighting density for nuclear force
static kids_complex * K1QA
Simplex Quantization.
static kids_complex * ww_D_init
static kids_real * T_init
static kids_complex * rho_ele
static kids_complex * rho_nuc_init
static kids_complex * K1QD
Simplex Quantization.
static kids_complex * rho_nuc
static kids_complex * K2QA
Heaviside Quantization.
static kids_complex * K2QD
Heaviside Quantization.
static int ker_from_c(kids_complex *ker, kids_complex *c, kids_real xi, kids_real gamma, int fdim)
convert c (electonic amplititude) to kernel (affine map of the density)
static kids_complex * ww_D
static kids_complex * c_init
electronic vector
static kids_complex * K2
partial version of K2
static kids_complex * ww_A
static int occ0
read parameters
static kids_complex * K1DD
static kids_complex * K2DD
static kids_complex * K1DA
static kids_complex * wz_A
static kids_complex * rho_ele_init
electronic density
static kids_complex * K1
partial version of K1
static kids_complex * K0
partial version of K0
static kids_complex * K2DA
static kids_complex * w
kernels for time correlation function
static kids_complex * wz_D
static NADForcePolicy::_type NADForce_type
static int rand_uniform(kids_real *res_arr, int N=1, kids_real sigma=1.0)
static int rand_catalog(int *res_arr, int N=1, bool reset=false, int begin=0, int end=1)
static RepresentationPolicy::_type ele_repr_type
representation for electronic dynamics
static int transform(kids_complex *A, kids_real *T, int fdim, RepresentationPolicy::_type from, RepresentationPolicy::_type to, SpacePolicy::_type Stype)
static RepresentationPolicy::_type inp_repr_type
representatioin for input (quantities)
std::shared_ptr< Param > _param
Shared pointer to the Param object associated with this kernel.
Status & executeKernel(Status &stat)
Execute the kernel's algorithm and those of its children.
std::shared_ptr< DataSet > _dataset
Shared pointer to the DataSet object associated with this kernel.
static int hopping_choose(kids_complex *rho, kids_complex *H, int from, kids_real dt)
static double gamma_wigner(int fdim)
static int pop_neg_choose(kids_complex *rho)
static int pop_choose(kids_complex *rho)
static int c_window(kids_complex *c, int iocc, int type, int fdim)
static double gamma_opt(int fdim)
static int c_focus(kids_complex *c, double xi, double gamma, int occ, int fdim)
static void hopping_direction(kids_real *direction, kids_real *dE, int from, int to)
static int max_choose(kids_complex *rho)
static int c_sphere(kids_complex *c, int fdim)
sampling mapping variables from uniform sphere distribution (i.e.
static int ker_binning(kids_complex *ker, kids_complex *rho, int sqc_type)
#define LOC()
show the location information for debug
VARIABLE< kids_real > direction
VARIABLE< kids_complex > wrho
VARIABLE< kids_real > ftmp
VARIABLE< kids_real > sqcIA
VARIABLE< kids_real > Epot
VARIABLE< kids_real > alpha
VARIABLE< kids_real > fadd
VARIABLE< kids_real > sqcID
VARIABLE< kids_real > sqcw
VARIABLE< kids_bint > at_samplingstep_finally
VARIABLE< kids_complex > H
VARIABLE< kids_real > vpes
std::size_t NFF
Product of N, F, and F (N * F * F).
std::size_t N
Number of nuclear degrees of freedom.
std::size_t PF
Product of P and F (P * F).
std::size_t PFF
Product of P, F, and F (P * F * F).
std::size_t P
Number of parallel trajectories (swarms of trajectories) in each Monte Carlo run.
std::size_t F
Number of electronic degrees of freedom.
std::size_t Fadd1
F plus 1 (F + 1).
std::size_t FF
Product of F and F (F * F).
< http://warp.povusers.org/FunctionParser/fparser.html
double calc_alpha(kids_real *V, int i=0, int k=1, int F=2)
void ARRAY_MAT_DIAG(kids_real *A, kids_real *B, size_t N1)
Copy the diagonal elements from matrix B to matrix A for real matrices.
int calc_distforce(kids_real *f1, kids_real *E, kids_real *dE, kids_complex *wrho, kids_complex *rho, double alpha)
the force driven from the shape of distorted-density W(\rho)
double calc_Ew(kids_real *E, kids_complex *wrho, int occ)
double kids_real
Alias for real number type.
std::complex< double > kids_complex
Alias for complex number type.
int hopping_impulse(kids_real *direction, kids_real *np, kids_real *nm, kids_real Efrom, kids_real Eto, int from, int to, bool reflect)
int calc_wrho(kids_complex *wrho, kids_complex *rho, double xi, double gamma, double alpha)
constexpr real_precision halfpi
constexpr std::complex< real_precision > iu(1.0L, 0.0L)
constexpr real_precision sqrthalf
constexpr std::complex< real_precision > im(0.0L, 1.0L)
Imaginary Unit.
constexpr real_precision twopi
constexpr std::complex< real_precision > iz(0.0L, 0.0L)
constexpr dimension7 time_d
[T]
std::basic_string< CharT > concat(const separator_t< CharT > &sep, Args &&... seq)
constexpr uint32_t hash(const char *str)
declaration of variables used in the program.