1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- """
- Created on Mon Jun 22 20:51:40 2020
- @author: Ian Lim
- """
- from statefuncs import State, Basis
- from qedstatefuncs import FermionState, FermionBasis
- from phi1234 import Phi1234
- from schwinger import Schwinger
- from scipy.constants import pi
- import numpy as np
- import unittest
- import time
- from numpy.testing import assert_array_equal
- def calculateAxialCharge(state):
-
- total = 0
-
- for wn in np.arange(state.nmin, state.nmax+1):
- if wn < 0:
- total -= (state[wn][0]-state[wn][1])
- elif wn > 0:
- total += (state[wn][0]-state[wn][1])
-
- return total
- class TestSchwinger(unittest.TestCase):
- def setUp(self):
- self.schwinger = Schwinger()
- self.schwinger.buildFullBasis(Emax=3., m=0, L=2*pi)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- def testGenerateOperators(self):
-
- ops = self.schwinger.generateOperators()
-
-
-
- def testMatrix(self):
- verbose = False
- if verbose:
- print("Beginning Schwinger matrix test")
-
- start = time.time()
-
-
-
-
-
-
-
-
-
- """
- for key in ops.keys():
- for op in ops[key]:
- print(f"Coeff:{op.coeff}, ops:{op}")
- """
-
-
- self.schwinger.buildMatrix()
-
- print(f"Runtime: {time.time()-start}")
-
- if verbose:
- print("Free Hamiltonian:")
- print(self.schwinger.h0.M.toarray())
-
-
-
- print("Order zero potential matrix:")
- print(self.schwinger.potential.M.toarray())
-
-
-
-
-
- if __name__ == '__main__':
- unittest.main()
|