phi4eigs.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 renorm
  10. import sys
  11. import scipy
  12. import time
  13. def main(argv):
  14. if len(argv) < 4:
  15. print(argv[0], "<fname> <g> <Emax>")
  16. return -1
  17. print("Beginning execution.")
  18. initialTime = time.time()
  19. fname = argv[1]
  20. g = float(argv[2])
  21. Emax = float(argv[3])
  22. # Hardcoded parameters
  23. m=1.
  24. sigma = -30.
  25. neigs = 3
  26. a = phi1234.Phi1234()
  27. a.loadMatrix(fname)
  28. a.buildBasis(k=1, Emax=Emax)
  29. a.buildBasis(k=-1, Emax=Emax)
  30. print('K=1 full basis size = ', a.fullBasis[1].size)
  31. print('K=-1 full basis size = ', a.fullBasis[-1].size)
  32. print('K=1 basis size = ', a.basis[1].size)
  33. print('K=-1 basis size = ', a.basis[-1].size)
  34. a.setcouplings(g4=g)
  35. print("Computing raw eigenvalues for g4 = ", g)
  36. a.computeHamiltonian(k=1, ren=False)
  37. a.computeHamiltonian(k=-1, ren=False)
  38. a.computeEigval(k=1, sigma=sigma, n=neigs, ren=False)
  39. a.computeEigval(k=-1, sigma=sigma, n=neigs, ren=False)
  40. print("Raw vacuum energy: ", a.vacuumE(ren="raw"))
  41. print("K=1 Raw spectrum: ", a.spectrum(k=1, ren="raw"))
  42. print("K=-1 Raw spectrum: ", a.spectrum(k=-1, ren="raw"))
  43. a.renlocal(Er=a.vacuumE(ren="raw"))
  44. print("Computing renormalized eigenvalues for g0r,g2r,g4r = ", a.g0r,a.g2r,a.g4r)
  45. a.computeHamiltonian(k=1, ren=True)
  46. a.computeHamiltonian(k=-1, ren=True)
  47. a.computeEigval(k=1, sigma=sigma, n=neigs, ren=True, corr=True)
  48. a.computeEigval(k=-1, sigma=sigma, n=neigs, ren=True, corr=True)
  49. print("Renlocal vacuum energy: ", a.vacuumE(ren="renlocal"))
  50. print("K=1 renlocal spectrum: ", a.spectrum(k=1, ren="renlocal"))
  51. print("K=-1 renlocal spectrum: ", a.spectrum(k=-1, ren="renlocal"))
  52. print("Rensubl vacuum energy: ", a.vacuumE(ren="rensubl"))
  53. print("K=1 rensubl spectrum: ", a.spectrum(k=1, ren="rensubl"))
  54. print("K=-1 rensubl spectrum: ", a.spectrum(k=-1, ren="rensubl"))
  55. print("Total runtime: ",time.time()-initialTime)
  56. if __name__ == "__main__":
  57. main(sys.argv)