24 #include "MPIchemps2.h" 26 void CheMPS2::Heff::addDiagram1A(
const int ikappa,
double * memS,
double * memHeff,
const Sobject * denS, TensorX * Xleft)
const{
27 int dimL = denBK->
gCurrentDim(denS->gIndex(), denS->gNL(ikappa), denS->gTwoSL(ikappa), denS->gIL(ikappa));
28 int dimR = denBK->
gCurrentDim(denS->gIndex()+2, denS->gNR(ikappa), denS->gTwoSR(ikappa), denS->gIR(ikappa));
29 double * BlockX = Xleft->gStorage( denS->gNL(ikappa), denS->gTwoSL(ikappa), denS->gIL(ikappa), denS->gNL(ikappa), denS->gTwoSL(ikappa), denS->gIL(ikappa) );
33 dgemm_(¬r,¬r,&dimL,&dimR,&dimL,&one,BlockX,&dimL,memS+denS->gKappa2index(ikappa),&dimL,&one,memHeff+denS->gKappa2index(ikappa),&dimL);
36 void CheMPS2::Heff::addDiagram1B(
const int ikappa,
double * memS,
double * memHeff,
const Sobject * denS, TensorX * Xright)
const{
37 int dimL = denBK->
gCurrentDim(denS->gIndex(), denS->gNL(ikappa), denS->gTwoSL(ikappa), denS->gIL(ikappa));
38 int dimR = denBK->
gCurrentDim(denS->gIndex()+2, denS->gNR(ikappa), denS->gTwoSR(ikappa), denS->gIR(ikappa));
39 double * BlockX = Xright->gStorage( denS->gNR(ikappa), denS->gTwoSR(ikappa), denS->gIR(ikappa), denS->gNR(ikappa), denS->gTwoSR(ikappa), denS->gIR(ikappa) );
44 dgemm_(¬r,&trans,&dimL,&dimR,&dimR,&one,memS+denS->gKappa2index(ikappa),&dimL,BlockX,&dimR,&one,memHeff+denS->gKappa2index(ikappa),&dimL);
47 void CheMPS2::Heff::addDiagram1C(
const int ikappa,
double * memS,
double * memHeff,
const Sobject * denS,
double Helem_links)
const{
48 if (denS->gN1(ikappa)==2){
50 int ptr = denS->gKappa2index(ikappa);
51 int dim = denS->gKappa2index(ikappa+1) - ptr;
52 daxpy_(&dim,&Helem_links,memS+ptr,&inc,memHeff+ptr,&inc);
56 void CheMPS2::Heff::addDiagram1D(
const int ikappa,
double * memS,
double * memHeff,
const Sobject * denS,
double Helem_rechts)
const{
57 if (denS->gN2(ikappa)==2){
59 int ptr = denS->gKappa2index(ikappa);
60 int dim = denS->gKappa2index(ikappa+1) - ptr;
61 daxpy_(&dim,&Helem_rechts,memS+ptr,&inc,memHeff+ptr,&inc);
65 void CheMPS2::Heff::addDiagramExcitations(
const int ikappa,
double * memS,
double * memHeff,
const Sobject * denS,
int nLower,
double ** VeffTilde)
const{
67 int dimTotal = denS->gKappa2index(denS->gNKappa());
68 int ptr = denS->gKappa2index(ikappa);
69 int dimBlock = denS->gKappa2index(ikappa+1) - ptr;
71 #ifdef CHEMPS2_MPI_COMPILATION 75 for (
int state=0; state<nLower; state++){
76 #ifdef CHEMPS2_MPI_COMPILATION 77 if ( MPIchemps2::owner_specific_excitation( Prob->
gL(), state ) == MPIRANK )
80 double alpha = ddot_(&dimTotal, memS, &inc, VeffTilde[state], &inc);
81 daxpy_(&dimBlock,&alpha,VeffTilde[state]+ptr,&inc,memHeff+ptr,&inc);
int gCurrentDim(const int boundary, const int N, const int TwoS, const int irrep) const
Get the current virtual dimensions.
static int mpi_rank()
Get the rank of this MPI process.
int gL() const
Get the number of orbitals.