qed_genmatrix.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ######################################################
  2. #
  3. # Adaptation of phi4 methods for Hamiltonian truncation to QED/Schwinger model
  4. #
  5. ######################################################
  6. import schwinger
  7. import sys
  8. import scipy
  9. import time
  10. import sys
  11. import numpy as np
  12. from scipy.constants import pi
  13. def main(argv):
  14. #if there are too few arguments, print the right syntax and exit
  15. if len(argv) < 3:
  16. print("python qed_genMatrix.py <R> <Emax>")
  17. sys.exit(-1)
  18. print("Beginning execution.")
  19. startTime = time.time()
  20. R = float(argv[1])
  21. Emax = float(argv[2])
  22. #mass
  23. m = 0.
  24. myBCs = "antiperiodic"
  25. a = schwinger.Schwinger()
  26. a.buildFullBasis(2*pi*R, m, Emax, bcs=myBCs)
  27. print(f"Basis size: {a.fullBasis.size}")
  28. # print(f"Basis elements: {a.fullBasis}")
  29. #set the file name for saving the generated matrix
  30. fstr = f"Emax={a.fullBasis.Emax}_R={R}_bcs={myBCs}"
  31. print(f"filename: {fstr}")
  32. a.buildMatrix()
  33. print("Runtime:",time.time()-startTime)
  34. a.saveMatrix(fstr)
  35. #temporary: also load in the same script
  36. #move this later
  37. """
  38. print("Beginning eigenvalue calculation.")
  39. startTime = time.time()
  40. #fname = argv[1]
  41. g = 1.#float(argv[2])
  42. Emax = 4.#float(argv[3])
  43. # Hardcoded parameters
  44. m=1.
  45. sigma = -30.
  46. neigs = 3
  47. b = schwinger.Schwinger()
  48. b.loadMatrix(fstr+".npz")
  49. b.buildBasis(Emax=Emax)
  50. print(f"full basis size = {b.fullBasis.size}")
  51. print(f"basis size = {b.basis.size}")
  52. b.setcouplings(g)
  53. print(f"Computing raw eigenvalues for g = {g}")
  54. b.computeHamiltonian(ren=False)
  55. b.computeEigval(sigma=sigma, n=neigs, ren=False)
  56. print("Raw vacuum energy: ", b.vacuumE(ren="raw"))
  57. print("Raw spectrum: ", b.spectrum(ren="raw"))
  58. """
  59. if __name__ == "__main__":
  60. main(sys.argv)