42 else{ makenewLeft( denT); }
49 else{ makenewLeft( denL, denT, workmem); }
53 void CheMPS2::TensorF0::makenewRight(
TensorT * denT){
57 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
59 const double sqrt_of_2 = sqrt(2.0);
60 for (
int geval=0; geval<3; geval++){
86 double alpha = (geval==0)?sqrt_of_2:(0.5*sqrt_of_2);
88 dgemm_(&trans,¬rans,&dimR,&dimR,&dimL,&alpha,BlockT,&dimL,BlockT,&dimL,&beta,
storage+
kappa2index[ikappa],&dimR);
96 void CheMPS2::TensorF0::makenewLeft(
TensorT * denT){
100 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
102 const double sqrt_of_2 = sqrt(2.0);
103 for (
int geval=0; geval<3; geval++){
129 double alpha = sqrt_of_2;
130 if (geval>=1){ alpha *= 0.5 * (TwoSR + 1.0) / (
sector_spin_up[ikappa] + 1.0); }
132 dgemm_(¬rans,&trans,&dimL,&dimL,&dimR,&alpha,BlockT,&dimL,BlockT,&dimL,&beta,
storage+
kappa2index[ikappa],&dimL);
140 void CheMPS2::TensorF0::makenewRight(
TensorL * denL,
TensorT * denT,
double * workmem){
144 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
149 for (
int geval=0; geval<4; geval++){
150 int NLU,TwoSLU,ILU,TwoSLD,ILD;
183 if ((dimLU>0) && (dimLD>0)){
187 double * BlockL = denL->
gStorage(NLU, TwoSLU, ILU, NLU+1, TwoSLD, ILD);
196 int fase = ((((
sector_spin_up[ikappa] + 1 - TwoSLD)/2)%2)!=0)?-1:1;
197 alpha = fase * sqrt( 0.5 * ( TwoSLD + 1.0 ) / (
sector_spin_up[ikappa] + 1.0 ) );
200 dgemm_(&trans,¬rans,&dimUR,&dimLD,&dimLU,&alpha,BlockTup,&dimLU,BlockL,&dimLU,&beta,workmem,&dimUR);
205 dgemm_(¬rans,¬rans,&dimUR,&dimDR,&dimLD,&alpha,workmem,&dimUR,BlockTdown,&dimLD,&beta,
storage+
kappa2index[ikappa],&dimUR);
213 void CheMPS2::TensorF0::makenewLeft(
TensorL * denL,
TensorT * denT,
double * workmem){
217 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
222 for (
int geval=0; geval<4; geval++){
223 int NRU,TwoSRU,IRU,TwoSRD,IRD;
256 if ((dimRU>0) && (dimRD>0)){
260 double * BlockL = denL->
gStorage(NRU, TwoSRU, IRU, NRU+1, TwoSRD, IRD);
266 alpha = sqrt(0.5) * (TwoSRD + 1.0) / (
sector_spin_up[ikappa] + 1.0);
268 int fase = ((((
sector_spin_up[ikappa] - TwoSRU + 1)/2)%2)!=0)?-1:1;
269 alpha = fase * sqrt( 0.5 * (TwoSRU + 1.0) / (
sector_spin_up[ikappa] + 1.0) ) ;
272 dgemm_(¬rans,¬rans,&dimUL,&dimRD,&dimRU,&alpha,BlockTup,&dimUL,BlockL,&dimRU,&beta,workmem,&dimUL);
278 dgemm_(¬rans,&trans,&dimUL,&dimDL,&dimRD,&alpha,workmem,&dimUL,BlockTdown,&dimDL,&beta,
storage+
kappa2index[ikappa],&dimUL);
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.
virtual ~TensorF0()
Destructor.
int gCurrentDim(const int boundary, const int N, const int TwoS, const int irrep) const
Get the current virtual dimensions.
double * gStorage()
Get the pointer to the storage.
bool moving_right
Whether or not moving right.
TensorF0(const int boundary_index, const int Idiff, const bool moving_right, const SyBookkeeper *denBK)
Constructor.
int * sector_spin_up
The up spin symmetry sector.
double * gStorage()
Get the pointer to the storage.
int n_irrep
The (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and ...
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...
int * sector_irrep_up
The up spin symmetry sector.
const SyBookkeeper * bk_up
The bookkeeper of the upper MPS.
void makenew(TensorT *denT)
int * kappa2index
kappa2index[kappa] indicates the start of tensor block kappa in storage. kappa2index[nKappa] gives th...
int get_irrep() const
Get the (real-valued abelian) point group irrep difference between the symmetry sectors of the lower ...
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...