genMatrix.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ######################################################
  2. #
  3. # Fock space Hamiltonian truncation for phi^4 theory in 2 dimensions
  4. # Authors: Slava Rychkov (slava.rychkov@lpt.ens.fr) and Lorenzo Vitale (lorenzo.vitale@epfl.ch)
  5. # December 2014
  6. #
  7. ######################################################
  8. import phi1234
  9. import sys
  10. import scipy
  11. import time
  12. def main(argv):
  13. #if there are too few arguments, print the right syntax and exit
  14. if len(argv) < 3:
  15. print("python genMatrix.py <L> <Emax>")
  16. sys.exit(-1)
  17. print("Beginning execution.")
  18. startTime = time.time()
  19. #circle circumference (p.5)
  20. L = float(argv[1])
  21. #maximum energy (compare Eq. 2.26)
  22. Emax = float(argv[2])
  23. #mass
  24. m = 1.
  25. a = phi1234.Phi1234()
  26. #build the full basis with both values of k (parity)
  27. a.buildFullBasis(k=1, Emax=Emax, L=L, m=m)
  28. a.buildFullBasis(k=-1, Emax=Emax, L=L, m=m)
  29. print("K=1 basis size :", a.fullBasis[1].size)
  30. print("K=-1 basis size :", a.fullBasis[-1].size)
  31. #set the file name for saving the generated matrix
  32. fstr = "Emax="+str(a.fullBasis[1].Emax)+"_L="+str(a.L)
  33. a.buildMatrix()
  34. print("Runtime:",time.time()-startTime)
  35. #a.saveMatrix(fstr)
  36. if __name__ == "__main__":
  37. main(sys.argv)