3
0
mirror of https://github.com/triqs/dft_tools synced 2025-01-10 21:18:22 +01:00

Fixing TransBasis

This commit is contained in:
Hermann Schnait 2019-06-18 16:53:44 +02:00
parent d66950a043
commit 810b315c92

View File

@ -60,6 +60,10 @@ class TransBasis:
- 'eal' : local hamiltonian (i.e. crystal field) - 'eal' : local hamiltonian (i.e. crystal field)
- 'dm' : local density matrix - 'dm' : local density matrix
calc_in_solver_blocks : bool, optional
Whether the property shall be diagonalized in the
full sumk structure, or just in the solver structure.
Returns Returns
------- -------
wsqr : double wsqr : double
@ -78,26 +82,27 @@ class TransBasis:
if calc_in_solver_blocks: if calc_in_solver_blocks:
trafo = self.SK.block_structure.transformation trafo = self.SK.block_structure.transformation
self.SK.block_structure.transform = None self.SK.block_structure.transformation = None
prop_solver = self.SK.block_structure.convert_matrix(prop, space_from='sumk', space_to='solver') prop_solver = self.SK.block_structure.convert_matrix(prop, space_from='sumk', space_to='solver')
v= [] v= {}
for name in prop_solver: for name in prop_solver:
v[name] = numpy.linalg.eigh(prop_solver[name])[1] v[name] = numpy.linalg.eigh(prop_solver[name])[1]
self.w = self.SK.block_structure.convert_matrix(v, space_from='solver', space_to='sumk')['ud' if self.SK.SO else 'up'] self.w = self.SK.block_structure.convert_matrix(v, space_from='solver', space_to='sumk')['ud' if self.SK.SO else 'up']
self.T = numpy.dot(self.T.transpose().conjugate(), self.T = numpy.dot(self.T.transpose().conjugate(),
self.w).conjugate().transpose() self.w).conjugate().transpose()
self.SK.block_structure.transform = trafo self.SK.block_structure.transformation = trafo
if self.SK.SO == 0:
self.eig, self.w = numpy.linalg.eigh(prop['up'])
# calculate new Transformation matrix
self.T = numpy.dot(self.T.transpose().conjugate(),
self.w).conjugate().transpose()
else: else:
self.eig, self.w = numpy.linalg.eigh(prop['ud']) if self.SK.SO == 0:
# calculate new Transformation matrix self.eig, self.w = numpy.linalg.eigh(prop['up'])
self.T = numpy.dot(self.T.transpose().conjugate(), # calculate new Transformation matrix
self.w).conjugate().transpose() self.T = numpy.dot(self.T.transpose().conjugate(),
self.w).conjugate().transpose()
else:
self.eig, self.w = numpy.linalg.eigh(prop['ud'])
# calculate new Transformation matrix
self.T = numpy.dot(self.T.transpose().conjugate(),
self.w).conjugate().transpose()
# measure for the 'unity' of the transformation: # measure for the 'unity' of the transformation:
wsqr = sum(abs(self.w.diagonal())**2) / self.w.diagonal().size wsqr = sum(abs(self.w.diagonal())**2) / self.w.diagonal().size