22 for (
int iP = 0; iP < P; ++iP) {
27 for (
int j = 0; j < N; ++j)
Ekin[0] +=
p[j] *
p[j] /
m[j];
93 for (
int a = 0, aN = 0, ab = 0; a < P; ++a, aN += N) {
94 for (
int b = 0, bN = 0; b < P; ++b, ++ab, bN += N) {
96 for (
int j = 0, aj = aN, bj = bN; j < N; ++j, ++aj, ++bj) {
97 term += -0.25 *
alpha[j] * (x1[aj] - x2[bj]) * (x1[aj] - x2[bj])
98 - 0.25 /
alpha[j] * (p1[aj] - p2[bj]) * (p1[aj] - p2[bj])
164 for (
int a = 0, aN = 0, ab = 0; a < P; ++a, aN += N) {
165 for (
int b = 0, bN = 0; b < P; ++b, ++ab, bN += N) {
167 for (
int j = 0, aj = aN, bj = bN; j < N; ++j, ++aj, ++bj) {
197 for (
int a = 0, ab = 0, aF = 0; a < P; ++a, aF += F) {
199 for (
int b = 0, bF = 0, bFF = 0; b < P; ++b, ++ab, bF += F, bFF += FF) {
217 int P_used,
int P,
int F) {
245 for (
int a = 0, aN = 0, aF = 0, ab = 0; a < P; ++a, aN += N, aF += F) {
248 for (
int b = 0, bN = 0, bF = 0; b < P; ++b, ++ab, bN += N, bF += F) {
257 for (
int j = 0, jFF = 0, aj = aN, bj = bN; j < N; ++j, ++aj, ++bj, jFF += FF) {
262 Tab +=
alpha[j] / (4 *
m[bj]) + pabj * pabj / (2 *
m[bj]);
286 for (
int a = 0, aN = 0, ab = 0; a < P; ++a, aN += N) {
287 for (
int b = 0, bN = 0; b < P; ++b, ++ab, bN += N) {
298 for (
int j = 0, jik = 0, jFF = 0, aj = aN, bj = bN; j < N; ++j, ++aj, ++bj, jFF +=
Dimension::FF) {
303 Tab +=
alpha[j] / (4 *
m[j]) + pabj * pabj / (2 *
m[j]);
305 for (
int i = 0, ik = 0; i < F; ++i) {
306 for (
int k = 0; k < F; ++k, ++ik) {
307 Eab += (i == k) ? 0.5e0 * std::conj(ca[i]) * cb[k] *
308 (Ea[i] + Eb[i] + (xabj -
x[aj]) * dEaj[ik] + (xabj -
x[bj]) * dEbj[ik])
310 (
p[aj] /
m[aj] * dEaj[ik] / (Ea[k] - Ea[i]) +
311 p[bj] /
m[bj] * dEbj[ik] / (Eb[k] - Eb[i]));
323 alpha0 = PM->get_double(
"alpha0",
LOC(), 1.0f);
328 gamma = PM->get_double(
"gamma",
LOC(), 0.0f);
405 P_used_ptr = DS->def_real(
"integrator.P_used");
406 norm_ptr = DS->def_real(
"integrator.norm");
417 x[j] = iP * 0.02 * (iP % 2 - 0.5) + 0.1 * j;
418 p[j] = -iP * 0.02 * (iP % 2 - 0.5) + 0.2 * j;
444 randu = sqrt(iP * iP % (j + 1));
447 randu = sqrt(iP % (j + 1));
494 for (
int j = 0; j <
Dimension::N; ++j) x_now[j] = x_prev[j], p_now[j] = p_prev[j], f_now[j] = f_prev[j];
497 for (
int j = 0; j <
Dimension::N; ++j) p_now[j] -= f_now[j] * 0.5 * signdt;
498 for (
int j = 0; j <
Dimension::N; ++j) x_now[j] += p_now[j] /
m[j] * signdt;
500 _krepr->executeKernel(stat);
502 case RepresentationPolicy::Diabatic: {
513 for (
int j = 0; j <
Dimension::N; ++j) p_now[j] -= f_now[j] * 0.5 * signdt;
540 _krepr->executeKernel(stat);
555 calc_Snuc(
Snuc,
x,
p,
m,
g,
x,
p,
m,
g,
alpha,
Dimension::P,
Dimension::N);
564 std::cout <<
"init scale: " << scale <<
"\n";
565 std::cout <<
"init xi: " <<
xi <<
"\n";
579 double dt_backup =
dt;
596 calc_Snuc(
Snuc,
x,
p,
m,
g,
x,
p,
m,
g,
alpha,
Dimension::P,
Dimension::N);
612 calc_Hbasis(
Hbasis,
vpes,
grad,
V,
dV,
x,
p,
m,
alpha,
Sele,
c,
Dimension::P,
Dimension::N,
Dimension::F);
644 calc_Snuc(
Snuc,
x_last,
p_last,
m,
g_last,
x_last,
p_last,
m,
g_last,
alpha,
Dimension::P,
Dimension::N);
653 calc_Snuc(
Snuc,
x,
p,
m,
g,
x_last,
p_last,
m,
g_last,
alpha,
Dimension::P,
Dimension::N);
659 calc_Snuc(
Snuc,
x,
p,
m,
g,
x,
p,
m,
g,
alpha,
Dimension::P,
Dimension::N);
679 calc_Hbasis(
Hbasis,
vpes,
grad,
V,
dV,
x,
p,
m,
alpha,
Sele,
c,
Dimension::P,
Dimension::N,
Dimension::F);
698 std::cout <<
"norm 1 = " << cnorm <<
"\n";
703 std::cout <<
"norm 2 = " << cnorm <<
"\n";
708 std::cout <<
"norm 3 = " << cnorm <<
"\n";
716 std::cout <<
"P_used = " <<
P_used <<
"\n";
774 std::cout <<
"t scale : " << scale <<
"\n";
779 for (
int a = 0, aik = 0; a <
P_used; ++a) {
802 for (
int iP = 0; iP <
P_used; ++iP) {
816 double max_break_val = 0.0e0;
817 int break_state_i = -1, break_state_k = -1;
832 if (break_val > max_break_val) {
833 max_break_val = break_val;
840 int break_state = (std::abs(
c[break_state_i]) > std::abs(
c[break_state_k])) ? break_state_i : break_state_k;
841 double norm_b = std::abs(
c[break_state]);
842 double norm_a = sqrt(1 - norm_b * norm_b);
867 for (
int i = 0; i <
Dimension::F; ++i) c_new[i] = ((i == break_state) ? 0.0e0 : (
c[i] / norm_phase_a));
868 for (
int i = 0; i <
Dimension::F; ++i) c_init_new[i] = c_init[i];
872 for (
int i = 0; i <
Dimension::F; ++i)
c[i] = ((i == break_state) ?
c[i] / norm_phase_b : 0.0e0);
877 Acoeff[iP] *= norm_phase_b;
888 if (P_increase >
P_used) {
initialization kernels for electonic DOFs
#define ARRAY_MATMUL_TRANS2(_A, _B, _C, _n1, _n2, _n3)
#define ARRAY_MATMUL3_TRANS1(_A, _B, _C, _D, _n1, _n2, _n0, _n3)
#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_MATMUL_TRANS1(_A, _B, _C, _n1, _n2, _n3)
#define ARRAY_CLEAR(_A, _n)
static kids_complex * U
dynamics variables for electronic DOFs
static int * occ_nuc
weighting density for nuclear force
static kids_real * T_init
static kids_complex * rho_nuc
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 * c_init
electronic vector
static int occ0
read parameters
static kids_complex * K1
partial version of K1
static kids_complex * w
kernels for time correlation function
Status & impl_0(Status &stat)
std::shared_ptr< Kernel > _krepr
static int calc_Hbasis_adia(kids_complex *Hbasis, kids_real *E, kids_real *dE, kids_real *x, kids_real *p, kids_real *m, kids_real *alpha, kids_complex *c, int P, int N, int F)
std::shared_ptr< Kernel > _kforce
virtual int getType() const
Get the type of the kernel.
kids_real * MatR_PP
temporary
static int calc_dtSele(kids_complex *dtlnSele, kids_complex *Sele, kids_complex *c, kids_complex *H, kids_real *vpes, int P, int F)
static int calc_Sele(kids_complex *S, kids_complex *c1, kids_complex *c2, kids_real xi, kids_real gamma, int P, int F)
Status & impl_1(Status &stat)
virtual const std::string getName()
Get the name of the kernel.
kids_complex * fun_diag_P
Status & executeKernel_impl(Status &stat)
Virtual function to execute the kernel implementation.
static int calc_Ekin(kids_real *Ekin, kids_real *p, kids_real *m, int P, int N)
static int calc_dtlnSnuc(kids_complex *dtlnSnuc, kids_real *x, kids_real *p, kids_real *m, kids_real *f, kids_real *alpha, kids_real *Ekin, int P, int N)
static double calc_density(kids_complex *rhored, kids_complex *Acoeff, kids_complex *Snuc, kids_complex *c, kids_real xi, kids_real gamma, int Pu, int P, int F)
static int calc_Hbasis(kids_complex *Hbasis, kids_real *vpes, kids_real *grad, kids_real *V, kids_real *dV, kids_real *x, kids_real *p, kids_real *m, kids_real *alpha, kids_complex *Sele, kids_complex *c, int P, int N, int F)
std::shared_ptr< Kernel > _kmodel
kids_complex * fun_diag_F
void setInputDataSet_impl(std::shared_ptr< DataSet > &DS)
Virtual function to set input data set for the kernel implementation.
Status & initializeKernel_impl(Status &stat)
Virtual function to initialize the kernel implementation.
static int calc_Snuc(kids_complex *S, kids_real *x1, kids_real *p1, kids_real *m1, kids_real *g1, kids_real *x2, kids_real *p2, kids_real *m2, kids_real *g2, kids_real *alpha, int P, int N)
the expression is exp(-0.25*a*(x1-x2)^2 -0.25*(p1-p2)/a + 0.5i*(p1+p2)(x1-x2) - i(g1-g2))
void setInputParam_impl(std::shared_ptr< Param > &PM)
Virtual function to set input parameters for the kernel implementation.
static int rand_uniform(kids_real *res_arr, int N=1, kids_real sigma=1.0)
static int rand_gaussian(kids_real *res_arr, int N=1, kids_real sigma=1.0, kids_real mu=0.0)
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)
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.
#define LOC()
show the location information for debug
std::size_t PN
Product of P and N (P * N).
std::size_t PNFF
Product of P, N, F, and F (P * N * F * F).
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).
std::size_t PP
Product of P and P (P * P).
< http://warp.povusers.org/FunctionParser/fparser.html
void ARRAY_CORRECT_U(kids_complex *U, size_t N)
kids_real ARRAY_INNER_TRANS1(kids_real *B, kids_real *C, size_t N1)
Compute the inner product of the transpose of B with C for real matrices.
double kids_real
Alias for real number type.
std::complex< double > kids_complex
Alias for complex number type.
kids_real ARRAY_INNER_VMV_TRANS1(kids_real *B, kids_real *C, kids_real *D, size_t N1, size_t N2)
Compute the inner product of the transpose of the real vector B with the matrix C,...
void EigenSolve(kids_real *E, kids_real *T, kids_real *A, size_t N)
Solve the eigenvalue problem for real matrices.
void ARRAY_EXP_MAT_GENERAL(kids_complex *expkA, kids_complex *A, kids_complex k, size_t N)
constexpr std::complex< real_precision > im(0.0L, 1.0L)
Imaginary Unit.
constexpr real_precision twopi
constexpr dimension7 time_d
[T]
constexpr uint32_t hash(const char *str)
declaration of variables used in the program.