File for giving multiplying functions to the wave vectors for TPQ and TE method.
More...
#include "Common.hpp"
#include "diagonalcalc.hpp"
#include "Multiply.hpp"
#include "wrapperMPI.hpp"
#include "mltply.hpp"
#include <iostream>
Go to the source code of this file.
|
int | Multiply (struct BindStruct *X) |
| Function of calculating the i-th step norm as
\[ N^{(i)} = |L v_1^{(i)}-v_0^{(i)}/N_s | \]
and update the i+1-th wave vector as
\[ v_0^{(i+1)} = \frac{L v_1^{(i)}-v_0^{(i)}/N_s}{N^{(i)}} \]
for TPQ calculation. More...
|
|
int | MultiplyForTEM (struct BindStruct *X, std::complex< double > **v2) |
| Function of multiplying Hamiltonian for Time Evolution. More...
|
|
File for giving multiplying functions to the wave vectors for TPQ and TE method.
- Author
- Takahiro Misawa (The University of Tokyo)
-
Kazuyoshi Yoshimi (The University of Tokyo)
-
Kota Ido (The University of Tokyo)
Definition in file Multiply.cpp.
◆ Multiply()
Function of calculating the i-th step norm as
\[ N^{(i)} = |L v_1^{(i)}-v_0^{(i)}/N_s | \]
and update the i+1-th wave vector as
\[ v_0^{(i+1)} = \frac{L v_1^{(i)}-v_0^{(i)}/N_s}{N^{(i)}} \]
for TPQ calculation.
- Parameters
-
X | [in] data list for calculation (idim_max and NsiteMPI) |
- Return values
-
0 | normally finished |
-1 | unnormally finished |
- Author
- Takahiro Misawa (The University of Tokyo)
-
Kazuyoshi Yoshimi (The University of Tokyo)
Definition at line 44 of file Multiply.cpp.
References BindStruct::Check, BindStruct::Def, global_norm, CheckList::idim_max, LargeValue, MultiplyForTEM(), NormMPI_dv(), DefineList::NsiteMPI, NumAve, v0, and v1.
Referenced by CalcByTPQ().
55 #pragma omp parallel for default(none) private(i,rand_i) \ 56 shared(v0, v1,NumAve) firstprivate(i_max, Ns, LargeValue) 57 for (i = 1; i <= i_max; i++) {
58 for (rand_i = 0; rand_i <
NumAve; rand_i++) {
63 #pragma omp parallel for default(none) private(i,rand_i) \ 64 shared(v0,NumAve,global_norm) firstprivate(i_max) 65 for (i = 1; i <= i_max; i++)
66 for (rand_i = 0; rand_i <
NumAve; rand_i++)
struct DefineList Def
Definision of system (Hamiltonian) etc.
std::complex< double > ** v0
void NormMPI_dv(long int ndim, int nstate, std::complex< double > **_v1, double *dnorm)
Compute norm of process-distributed vector .
std::complex< double > ** v1
int NsiteMPI
Total number of sites, differ from DefineList::Nsite.
struct CheckList Check
Size of the Hilbert space.
long int idim_max
The dimension of the Hilbert space of this process.
◆ MultiplyForTEM()
int MultiplyForTEM |
( |
struct BindStruct * |
X, |
|
|
std::complex< double > ** |
v2 |
|
) |
| |
Function of multiplying Hamiltonian for Time Evolution.
Make \( |v_0 \rangle = |\psi(t+dt) \rangle \) from \( |v_1 \rangle = | \psi(t) \rangle \) and \( |v_0 \rangle = H |\psi(t) \rangle \).
- Parameters
-
X | [in] data list for calculation (idim_max and TimeSlice) |
- Return values
-
0 | normally finished |
-1 | unnormally finished |
Definition at line 80 of file Multiply.cpp.
References BindStruct::Check, BindStruct::Def, ParamList::ExpandCoef, global_norm, I(), CheckList::idim_max, mltply(), DefineList::Param, SumMPI_d(), ParamList::TimeSlice, v0, and v1.
Referenced by CalcByTEM(), and Multiply().
88 std::complex<double> tmp1 = 1.0;
89 std::complex<double> tmp2 = 0.0;
95 if (dt < pow(10.0, -14)) {
96 #pragma omp parallel for default(none) private(i) \ 97 shared(I,v0, v1, v2) firstprivate(i_max, dt, tmp2) 98 for (i = 1; i <= i_max; i++) {
102 v2[i][0] = 0.0 +
I * 0.0;
108 #pragma omp parallel for default(none) private(i) \ 109 shared(v0, v1, v2,I) firstprivate(i_max, dt, tmp1, tmp2) 110 for (i = 1; i <= i_max; i++) {
112 v0[i][0] =
v1[i][0] + tmp1 * tmp2;
114 v2[i][0] = 0.0 +
I * 0.0;
117 tmp1 *= -
I * dt / (std::complex<double>)coef;
121 #pragma omp parallel for default(none) private(i) shared(I, v0, v1, v2) \ 122 firstprivate(i_max, tmp1, myrank) 123 for (i = 1; i <= i_max; i++) {
124 v0[i][0] += tmp1 * v2[i][0];
126 v2[i][0] = 0.0 +
I * 0.0;
131 #pragma omp parallel for default(none) reduction(+: dnorm) private(i) shared(v0) \ 132 firstprivate(i_max, dt) 133 for (i = 1; i <= i_max; i++) {
134 dnorm += real(conj(
v0[i][0])*
v0[i][0]);
139 #pragma omp parallel for default(none) private(i) shared(v0) firstprivate(i_max, dnorm) 140 for (i = 1; i <= i_max; i++) {
141 v0[i][0] =
v0[i][0] / dnorm;
struct DefineList Def
Definision of system (Hamiltonian) etc.
std::complex< double > ** v0
std::complex< double > I(0.0, 1.0)
int mltply(struct BindStruct *X, int nstate, std::complex< double > **tmp_v0, std::complex< double > **tmp_v1)
Parent function of multiplying the wavefunction by the Hamiltonian. . First, the calculation of diago...
std::complex< double > ** v1
double SumMPI_d(double norm)
MPI wrapper function to obtain sum of Double across processes.
struct CheckList Check
Size of the Hilbert space.
long int idim_max
The dimension of the Hilbert space of this process.