Advanced Computing Platform for Theoretical Physics

commit大文件会使得服务器变得不稳定，请大家尽量只commit代码，不要commit大的文件。

Commit a813c8cb by Lei Wang

### use tensornets; enable checkpoint

parent e3f4b90c
contraction.py 0 → 100644
 import torch from tensornets import CTMRG def ctmrg(T, chi, maxiter, epsilon, use_checkpoint=False): C, E = CTMRG(T, chi, maxiter, epsilon, use_checkpoint=use_checkpoint) Z1 = torch.einsum('ab,bcd,fd,gha,chij,fjk,lg,mil,mk', (C,E,C,E,T,E,C,E,C)) Z3 = torch.einsum('ab,bc,cd,da', (C,C,C,C)) Z2 = torch.einsum('ab,bcd,de,fa,gcf,ge',(C,E,C,C,E,C)) lnZ = torch.log(Z1.abs()) + torch.log(Z3.abs()) - 2.*torch.log(Z2.abs()) return lnZ def symmetrize(A): ''' A(phy, up, left, down, right) left-right, up-down, diagonal symmetrize ''' Asymm = (A + A.permute(0, 1, 4, 3, 2))/2. # left-right symmetry Asymm = (Asymm + Asymm.permute(0, 3, 2, 1, 4))/2. # up-down symmetry Asymm = (Asymm + Asymm.permute(0, 4, 3, 2, 1))/2. # skew-diagonal symmetry Asymm = (Asymm + Asymm.permute(0, 2, 1, 4, 3))/2. # diagonal symmetry return Asymm/Asymm.norm()