Hi Miles,
I am working with a 20-site electron system with periodic boundary condition. I obtained the ground state with dmrg and measure the spin correlation functions following this formula. However, when the largest bond dim @@\gtrsim 500@@, I always got the error message
terminate called after throwing an instance of 'std::bad_alloc'
If I run the code in gdb, I got the following error message:
Program received signal SIGABRT, Aborted.
0x00007ffff640570f in raise () from /lib64/libc.so.6
This seems to be an issue of running out of memory. However, I have ~400G memory and this program seems only using @@\gtrsim@@10G memory. I am not sure whether this is an issue of my code or I really run out of memory. The relevant part of the code is the following function:
Real TwopointCorrelation(const Electron& sites, MPS& psi, string Opi, string Opj, int site_i, int site_j)
{
int N = length(sites);
auto op_i = op(sites,Opi,site_i);
auto op_j = op(sites,Opj,site_j);
//'gauge' the MPS to site i
//any 'position' between i and j, inclusive, would work here
psi.position(site_i);
//Create the bra/dual version of the MPS psi
auto psidag = dag(psi);
//Prime the link indices to make them distinct from
//the original ket links
psidag.prime("Link");
//index linking i-1 to i:
auto li_1 = leftLinkIndex(psi,site_i);
auto C = prime(psi(site_i),li_1) * op_i * prime(psidag(site_i),"Site");
for(int k = site_i+1; k < site_j; ++k)
{
C *= psi(k) * psidag(k);
}
//index linking j to j+1:
auto lj = rightLinkIndex(psi,site_j);
C *= prime(psi(site_j),lj) * op_j * prime(psidag(site_j),"Site");
auto result = elt(C); //or eltC(C) if expecting complex
return result;
}
Thank you so much!
WunderNatur