def test_C2(self): en, wf, ham = energies(1, B20=0.3365, B22=7.4851, B40=0.4062, IB42=-3.8296, IB44=-2.3210) self._do_test_eigensystem(en, wf, ham)
def test_C2v_ext(self): en, wf, ham = energies(1, B20=0.3365, B22=7.4851, B40=0.4062, B42=-3.8296, B44=-2.3210, Bext=[1, 2, 3]) self._do_test_eigensystem(en, wf, ham)
def _calcEigensystem(self): """Calculate the eigensystem: energies and wavefunctions. Also store them and the hamiltonian. Protected method. Shouldn't be called directly by user code. """ if self._dirty_eigensystem: import CrystalField.energies as energies nre = self.ion_nre_map[self._ion] self._eigenvalues, self._eigenvectors, self._hamiltonian = energies.energies(nre, **self._fieldParameters) self._dirty_eigensystem = False
def _calcEigensystem(self): """Calculate the eigensystem: energies and wavefunctions. Also store them and the hamiltonian. Protected method. Shouldn't be called directly by user code. """ if self._dirty_eigensystem: import CrystalField.energies as energies nre = self.ion_nre_map[self._ion] self._eigenvalues, self._eigenvectors, self._hamiltonian = energies.energies( nre, **self._fieldParameters) self._dirty_eigensystem = False
def test_upd3(self): # Parameters are from Phys Rev B 89 235114 / arXiv:1403.4785, originally calculated using McPhase # Ion is U4+ which is equivalent to Pr3+ (5f2 instead of 4f2) en, wf, ham = energies(2, B20=0.035, B40=-0.012, B43=-0.027, B60=-0.00012, B63=0.0025, B66=0.0068) self._do_test_eigensystem(en, wf, ham) expectedEigenvalues = [ 0, 0, 4.36, 9.64, 9.64, 20.65, 30.03, 30.03, 52.50 ] emin = np.amin(en) for i in range(9): self.assertAlmostEqual(expectedEigenvalues[i], en[i], 1) # Now test the eigenvectors by computing the dipole transition matrix elements. Use the magnetic field # terms but divide by gJ*uB (gJ=0.8 for U4+/Pr3+ and uB=0.6715) _, _, hx = energies(2, Bext=[1, 0, 0]) _, _, hy = energies(2, Bext=[0, 1, 0]) _, _, hz = energies(2, Bext=[0, 0, 1]) ix = np.dot(np.conj(np.transpose(wf)), np.dot(hx, wf)) iy = np.dot(np.conj(np.transpose(wf)), np.dot(hy, wf)) iz = np.dot(np.conj(np.transpose(wf)), np.dot(hz, wf)) gJuB = 0.53716 trans = np.multiply(ix, np.conj(ix)) + np.multiply( iy, np.conj(iy)) + np.multiply(iz, np.conj(iz)) # For some reason, in the paper I also divided the matrix elements by a factor of 4. (not sure why) trans = trans / (gJuB**2) / 4 expectedDipoleTM = [ 0, 0, 0.31, 1.24 / 2., 1.24 / 2., 2.04, 3.4 / 2., 3.4 / 2., 0 ] for i in range(2, 9): self.assertAlmostEqual(expectedDipoleTM[i], trans[i, 0] + trans[i, 1], 1)
def test_upd3(self): # Parameters are from Phys Rev B 89 235114 / arXiv:1403.4785, originally calculated using McPhase # Ion is U4+ which is equivalent to Pr3+ (5f2 instead of 4f2) en, wf, ham = energies(2, B20=0.035, B40=-0.012, B43=-0.027, B60=-0.00012, B63=0.0025, B66=0.0068) self._do_test_eigensystem(en, wf, ham) expectedEigenvalues = [0, 0, 4.36, 9.64, 9.64, 20.65, 30.03, 30.03, 52.50] emin = np.amin(en) for i in range(9): self.assertAlmostEqual(expectedEigenvalues[i], en[i], 1) # Now test the eigenvectors by computing the dipole transition matrix elements. Use the magnetic field # terms but divide by gJ*uB (gJ=0.8 for U4+/Pr3+ and uB=0.6715) _, _, hx = energies(2, Bext=[1, 0, 0]) _, _, hy = energies(2, Bext=[0, 1, 0]) _, _, hz = energies(2, Bext=[0, 0, 1]) ix = np.dot(np.conj(np.transpose(wf)), np.dot(hx, wf)) iy = np.dot(np.conj(np.transpose(wf)), np.dot(hy, wf)) iz = np.dot(np.conj(np.transpose(wf)), np.dot(hz, wf)) gJuB = 0.53716 trans = np.multiply(ix, np.conj(ix)) + np.multiply(iy, np.conj(iy)) + np.multiply(iz, np.conj(iz)) # For some reason, in the paper I also divided the matrix elements by a factor of 4. (not sure why) trans = trans / (gJuB ** 2) / 4 expectedDipoleTM = [0, 0, 0.31, 1.24 / 2., 1.24 / 2., 2.04, 3.4 / 2., 3.4 / 2., 0] for i in range(2, 9): self.assertAlmostEqual(expectedDipoleTM[i], trans[i, 0] + trans[i, 1], 1)