51 double * workmem =
new double[ dimL * dimR ];
53 #pragma omp for schedule(dynamic) 54 for (
int ikappa = 0; ikappa <
nKappa; ikappa++ ){
67 double * workmem =
new double[ dimL * dimR ];
69 #pragma omp for schedule(dynamic) 70 for (
int ikappa = 0; ikappa <
nKappa; ikappa++ ){
85 #pragma omp parallel for schedule(dynamic) 86 for (
int ikappa = 0; ikappa <
nKappa; ikappa++ ){ create_right( ikappa, mps_tensor_up, mps_tensor_down ); }
88 #pragma omp parallel for schedule(dynamic) 89 for (
int ikappa = 0; ikappa <
nKappa; ikappa++ ){ create_left( ikappa, mps_tensor_up, mps_tensor_down ); }
94 void CheMPS2::TensorO::create_right(
const int ikappa,
TensorT * mps_tensor_up,
TensorT * mps_tensor_down ){
103 for (
int geval = 0; geval < 4; geval++ ){
130 if (( dimLup > 0 ) && ( dimLdown > 0 ) && ( dimLup == dimLdown )){
136 double * Tup = mps_tensor_up->
gStorage( NL, TwoSL, IL, NR, TwoSR, IR );
137 double * Tdown = mps_tensor_down->
gStorage( NL, TwoSL, IL, NR, TwoSR, IR );
138 dgemm_( &trans, ¬rans, &dimRup, &dimRdown, &dimLup, &alpha, Tup, &dimLup, Tdown, &dimLdown, &beta,
storage +
kappa2index[ ikappa ], &dimRup );
145 void CheMPS2::TensorO::create_left(
const int ikappa,
TensorT * mps_tensor_up,
TensorT * mps_tensor_down ){
154 for (
int geval = 0; geval < 4; geval++ ){
181 if (( dimRup > 0 ) && ( dimRdown > 0 ) && ( dimRup == dimRdown )){
183 double alpha = (( geval > 1 ) ? (( TwoSR + 1.0 ) / ( TwoSL + 1 )) : 1.0 );
187 double * Tup = mps_tensor_up->
gStorage( NL, TwoSL, IL, NR, TwoSR, IR );
188 double * Tdown = mps_tensor_down->
gStorage( NL, TwoSL, IL, NR, TwoSR, IR );
189 dgemm_( ¬rans, &trans, &dimLup, &dimLdown, &dimRup, &alpha, Tup, &dimLup, Tdown, &dimLdown, &beta,
storage +
kappa2index[ ikappa ], &dimLup );
int index
Index of the Tensor object. For TensorT: a site index; for other tensors: a boundary index...
int * sector_nelec_up
The up particle number sector.
int gCurrentDim(const int boundary, const int N, const int TwoS, const int irrep) const
Get the current virtual dimensions.
const SyBookkeeper * bk_down
The bookkeeper of the lower MPS.
void create(TensorT *mps_tensor_up, TensorT *mps_tensor_down)
Clear and add the relevant terms to the TensorO.
void update_ownmem(TensorT *mps_tensor_up, TensorT *mps_tensor_down, TensorO *previous)
Update the previous TensorO.
bool moving_right
Whether or not moving right.
int * sector_spin_up
The up spin symmetry sector.
double * gStorage()
Get the pointer to the storage.
void update_moving_left(const int ikappa, TensorOperator *previous, TensorT *mps_tensor_up, TensorT *mps_tensor_down, double *workmem)
Update moving left.
static int directProd(const int Irrep1, const int Irrep2)
Get the direct product of the irreps with numbers Irrep1 and Irrep2: a bitwise XOR for psi4's convent...
TensorO(const int boundary_index, const bool moving_right, const SyBookkeeper *book_up, const SyBookkeeper *book_down)
Constructor.
int * sector_irrep_up
The up spin symmetry sector.
const SyBookkeeper * bk_up
The bookkeeper of the upper MPS.
int * kappa2index
kappa2index[kappa] indicates the start of tensor block kappa in storage. kappa2index[nKappa] gives th...
int gMaxDimAtBound(const int boundary) const
Get the maximum virtual dimension at a certain boundary.
virtual ~TensorO()
Destructor.
void clear()
Set all storage variables to 0.0.
int nKappa
Number of Tensor blocks.
int gIrrep(const int orbital) const
Get an orbital irrep.
double * storage
The actual variables. Tensor block kappa begins at storage+kappa2index[kappa] and ends at storage+kap...
void update_moving_right(const int ikappa, TensorOperator *previous, TensorT *mps_tensor_up, TensorT *mps_tensor_down, double *workmem)
Update moving right.