Advanced Computing Platform for Theoretical Physics

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

Commit 35a00557 authored by Lei Wang's avatar Lei Wang
Browse files

lanczos works for 2d Ising, need to test for 3d case

parent c21098b1
......@@ -15,8 +15,8 @@ if __name__=='__main__':
import argparse
parser = argparse.ArgumentParser(description='')
parser.add_argument("-D", type=int, default=2, help="D")
parser.add_argument("-Dcut", type=int, default=24, help="Dcut")
parser.add_argument("-Niter", type=int, default=50, help="Niter")
parser.add_argument("-Dcut", type=int, default=20, help="Dcut")
parser.add_argument("-Niter", type=int, default=10, help="Niter")
parser.add_argument("-float32", action='store_true', help="use float32")
parser.add_argument("-lanczos", action='store_true', help="lanczos")
......
......@@ -48,7 +48,7 @@ def vmps(T, d, D, Nepochs=50, Ainit=None, use_lanczos=False):
else:
A = Ainit
optimizer = torch.optim.LBFGS([A], max_iter=20)
optimizer = torch.optim.LBFGS([A], max_iter=10)
def closure():
optimizer.zero_grad()
#print ('einsum', time.time()- t0)
......@@ -56,7 +56,7 @@ def vmps(T, d, D, Nepochs=50, Ainit=None, use_lanczos=False):
t0 = time.time()
loss = mpsrg(A, T.detach(), use_lanczos) # loss = -lnZ , here we optimize over A
#print ('mpsrg', time.time()- t0)
#print (' loss', loss.item())
print (' loss', loss.item())
t0 = time.time()
loss.backward(retain_graph=False)
#print ('backward', time.time()- t0)
......@@ -64,7 +64,7 @@ def vmps(T, d, D, Nepochs=50, Ainit=None, use_lanczos=False):
for epoch in range(Nepochs):
loss = optimizer.step(closure)
#print (' epoch, free energy', epoch, loss.item())
print (' epoch, loss', epoch, loss.item())
return -mpsrg(A.detach(), T, use_lanczos) # pass lnZ out, we need to optimize over T
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment