42 else{ makenewLeft( denT); }
49 else{ makenewLeft( denL, denT, workmem); }
53 void CheMPS2::TensorS0::makenewRight(
TensorT * denT){
57 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
68 double alpha = sqrt(2.0);
70 dgemm_(&trans,¬rans,&dimUR,&dimDR,&dimL,&alpha,BlockTup,&dimL,BlockTdown,&dimL,&beta,
storage+
kappa2index[ikappa],&dimUR);
77 void CheMPS2::TensorS0::makenewLeft(
TensorT * denT){
81 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
92 double alpha = sqrt(2.0);
94 dgemm_(¬rans,&trans,&dimUL,&dimDL,&dimR,&alpha,BlockTup,&dimUL,BlockTdown,&dimDL,&beta,
storage+
kappa2index[ikappa],&dimUL);
101 void CheMPS2::TensorS0::makenewRight(
TensorL * denL,
TensorT * denT,
double * workmem){
105 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
110 for (
int geval=0; geval<4; geval++){
111 int NLU,TwoSLU,ILU,TwoSLD,ILD;
144 if ((dimLU>0) && (dimLD>0)){
148 double * BlockL = denL->
gStorage(NLU, TwoSLU, ILU, NLU+1, TwoSLD, ILD);
155 int fase = ((((
sector_spin_up[ikappa] - TwoSLD + 1)/2)%2)!=0)?-1:1;
156 alpha = fase * sqrt(0.5 * (TwoSLD+1.0) / (
sector_spin_up[ikappa]+1.0) );
161 dgemm_(&trans,¬rans,&dimUR,&dimLD,&dimLU,&alpha,BlockTup,&dimLU,BlockL,&dimLU,&beta,workmem,&dimUR);
166 dgemm_(¬rans,¬rans,&dimUR,&dimDR,&dimLD,&alpha,workmem,&dimUR,BlockTdown,&dimLD,&beta,
storage+
kappa2index[ikappa],&dimUR);
174 void CheMPS2::TensorS0::makenewLeft(
TensorL * denL,
TensorT * denT,
double * workmem){
178 for (
int ikappa=0; ikappa<
nKappa; ikappa++){
183 for (
int geval=0; geval<4; geval++){
184 int NRU,TwoSRU,IRU,TwoSRD,IRD;
217 if ((dimRU>0) && (dimRD>0)){
221 double * BlockL = denL->
gStorage(NRU, TwoSRU, IRU, NRU+1, TwoSRD, IRD);
227 int fase = ((((
sector_spin_up[ikappa] - TwoSRU + 1)/2)%2)!=0)?-1:1;
228 alpha = fase * sqrt(0.5 * (TwoSRU+1.0) / (
sector_spin_up[ikappa]+1.0) );
230 alpha = - sqrt(0.5) * (TwoSRD+1.0) / (
sector_spin_up[ikappa]+1.0);
233 dgemm_(¬rans,¬rans,&dimUL,&dimRD,&dimRU,&alpha,BlockTup,&dimUL,BlockL,&dimRU,&beta,workmem,&dimUL);
239 dgemm_(¬rans,&trans,&dimUL,&dimDL,&dimRD,&alpha,workmem,&dimUL,BlockTdown,&dimDL,&beta,
storage+
kappa2index[ikappa],&dimUL);
void makenew(TensorT *denT)
TensorS0(const int boundary_index, const int Idiff, const bool moving_right, const SyBookkeeper *denBK)
Constructor.
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.
virtual ~TensorS0()
Destructor.
double * gStorage()
Get the pointer to the storage.
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.
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.
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...