3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-04 21:23:53 +01:00

fix: np.int / np.float / np. complex are depracted (np v1.20) / removed (np v1.24)

This commit is contained in:
Alexander Hampel 2023-01-23 15:40:57 -05:00
parent 9d1f822730
commit a9e99f2308
19 changed files with 158 additions and 158 deletions

View File

@ -25,19 +25,19 @@ calculation. The default name of this group is `dft_input`. Its contents are
================= ====================================================================== ===================================================================================== ================= ====================================================================== =====================================================================================
Name Type Meaning Name Type Meaning
================= ====================================================================== ===================================================================================== ================= ====================================================================== =====================================================================================
energy_unit numpy.float Unit of energy used for the calculation. energy_unit float Unit of energy used for the calculation.
n_k numpy.int Number of k-points used for the BZ integration. n_k int Number of k-points used for the BZ integration.
k_dep_projection numpy.int 1 if the dimension of the projection operators depend on the k-point, k_dep_projection int 1 if the dimension of the projection operators depend on the k-point,
0 otherwise. 0 otherwise.
SP numpy.int 1 for spin-polarised Hamiltonian, 0 for paramagnetic Hamiltonian. SP int 1 for spin-polarised Hamiltonian, 0 for paramagnetic Hamiltonian.
SO numpy.int 1 if spin-orbit interaction is included, 0 otherwise. SO int 1 if spin-orbit interaction is included, 0 otherwise.
charge_below numpy.float Number of electrons in the crystal below the correlated orbitals. charge_below float Number of electrons in the crystal below the correlated orbitals.
Note that this is for compatibility with dmftproj, otherwise set to 0 Note that this is for compatibility with dmftproj, otherwise set to 0
density_required numpy.float Required total electron density. Needed to determine the chemical potential. density_required float Required total electron density. Needed to determine the chemical potential.
The density in the projection window is then `density_required`-`charge_below`. The density in the projection window is then `density_required`-`charge_below`.
symm_op numpy.int 1 if symmetry operations are used for the BZ sums, symm_op int 1 if symmetry operations are used for the BZ sums,
0 if all k-points are directly included in the input. 0 if all k-points are directly included in the input.
n_shells numpy.int Number of atomic shells for which post-processing is possible. n_shells int Number of atomic shells for which post-processing is possible.
Note: this is `not` the number of correlated orbitals! Note: this is `not` the number of correlated orbitals!
If there are two equivalent atoms in the unit cell, `n_shells` is 2. If there are two equivalent atoms in the unit cell, `n_shells` is 2.
shells list of dict {string:int}, dim n_shells x 4 Atomic shell information. shells list of dict {string:int}, dim n_shells x 4 Atomic shell information.
@ -46,17 +46,17 @@ shells list of dict {string:int}, dim n_shells x 4
'l' is the angular quantum number, 'dim' is the dimension of the atomic shell. 'l' is the angular quantum number, 'dim' is the dimension of the atomic shell.
e.g. for two equivalent atoms in the unit cell, `atom` runs from 0 to 1, e.g. for two equivalent atoms in the unit cell, `atom` runs from 0 to 1,
but `sort` can take only one value 0. but `sort` can take only one value 0.
n_corr_shells numpy.int Number of correlated atomic shells. n_corr_shells int Number of correlated atomic shells.
If there are two correlated equivalent atoms in the unit cell, `n_corr_shells` is 2. If there are two correlated equivalent atoms in the unit cell, `n_corr_shells` is 2.
n_inequiv_shells numpy.int Number of inequivalent atomic shells. Needs to be smaller than `n_corr_shells`. n_inequiv_shells int Number of inequivalent atomic shells. Needs to be smaller than `n_corr_shells`.
The up / downfolding routines mediate between all correlated shells and the The up / downfolding routines mediate between all correlated shells and the
actual inequivalent shells, by using the self-energy etc. for all equal shells actual inequivalent shells, by using the self-energy etc. for all equal shells
belonging to the same class of inequivalent shells. The mapping is performed with belonging to the same class of inequivalent shells. The mapping is performed with
information stored in `corr_to_inequiv` and `inequiv_to_corr`. information stored in `corr_to_inequiv` and `inequiv_to_corr`.
corr_to_inequiv list of numpy.int, dim `n_corr_shells` mapping from correlated shells to inequivalent correlated shells. corr_to_inequiv list of int, dim `n_corr_shells` mapping from correlated shells to inequivalent correlated shells.
A list of length `n_corr_shells` containing integers, where same numbers mark A list of length `n_corr_shells` containing integers, where same numbers mark
equivalent sites. equivalent sites.
inequiv_to_corr list of numpy.int, dim `n_inequiv_shells` A list of length `n_inequiv_shells` containing list indices as integers pointing inequiv_to_corr list of int, dim `n_inequiv_shells` A list of length `n_inequiv_shells` containing list indices as integers pointing
to the corresponding sites in `corr_to_inequiv`. to the corresponding sites in `corr_to_inequiv`.
corr_shells list of dict {string:int}, dim n_corr_shells x 6 Correlated orbital information. corr_shells list of dict {string:int}, dim n_corr_shells x 6 Correlated orbital information.
For each correlated shell, have a dict with keys For each correlated shell, have a dict with keys
@ -64,15 +64,15 @@ corr_shells list of dict {string:int}, dim n_corr_shells x 6
'atom' is the atom index, 'sort' defines the equivalency of the atoms, 'atom' is the atom index, 'sort' defines the equivalency of the atoms,
'l' is the angular quantum number, 'dim' is the dimension of the atomic shell. 'l' is the angular quantum number, 'dim' is the dimension of the atomic shell.
'SO' is one if spin-orbit is included, 0 otherwise, 'irep' is a dummy integer 0. 'SO' is one if spin-orbit is included, 0 otherwise, 'irep' is a dummy integer 0.
use_rotations numpy.int 1 if local and global coordinate systems are used, 0 otherwise. use_rotations int 1 if local and global coordinate systems are used, 0 otherwise.
rot_mat list of numpy.array.complex, Rotation matrices for correlated shells, if `use_rotations`. rot_mat list of numpy.array.complex, Rotation matrices for correlated shells, if `use_rotations`.
dim n_corr_shells x [corr_shells['dim'],corr_shells['dim']] These rotations are automatically applied for up / downfolding. dim n_corr_shells x [corr_shells['dim'],corr_shells['dim']] These rotations are automatically applied for up / downfolding.
Set to the unity matrix if no rotations are used. Set to the unity matrix if no rotations are used.
rot_mat_time_inv list of numpy.int, dim n_corr_shells If `SP` is 1, 1 if the coordinate transformation contains inversion, 0 otherwise. rot_mat_time_inv list of int, dim n_corr_shells If `SP` is 1, 1 if the coordinate transformation contains inversion, 0 otherwise.
If `use_rotations` or `SP` is 0, give a list of zeros. If `use_rotations` or `SP` is 0, give a list of zeros.
n_reps numpy.int Number of irreducible representations of the correlated shell. n_reps int Number of irreducible representations of the correlated shell.
e.g. 2 if eg/t2g splitting is used. e.g. 2 if eg/t2g splitting is used.
dim_reps list of numpy.int, dim n_reps Dimension of the representations. dim_reps list of int, dim n_reps Dimension of the representations.
e.g. [2,3] for eg/t2g subsets. e.g. [2,3] for eg/t2g subsets.
T list of numpy.array.complex, Transformation matrix from the spherical harmonics to impurity problem basis T list of numpy.array.complex, Transformation matrix from the spherical harmonics to impurity problem basis
dim n_inequiv_corr_shell x normally the real cubic harmonics). dim n_inequiv_corr_shell x normally the real cubic harmonics).

View File

@ -666,7 +666,7 @@ class BlockStructure(object):
return self._create_gf_or_matrix(ish, gf_function, BlockGf, space, **kwargs) return self._create_gf_or_matrix(ish, gf_function, BlockGf, space, **kwargs)
def create_matrix(self, ish=0, space='solver', dtype=np.complex_): def create_matrix(self, ish=0, space='solver', dtype=complex):
""" Create a zero matrix having the correct structure. """ Create a zero matrix having the correct structure.
For ``space='solver'``, the structure is according to For ``space='solver'``, the structure is according to

View File

@ -183,7 +183,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
n_orbitals=n_orbitals[:,:1] n_orbitals=n_orbitals[:,:1]
#Resize proj_mat, mat, T #Resize proj_mat, mat, T
#make temporary projector array #make temporary projector array
proj_mat_tmp = numpy.zeros([n_k, 1, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], numpy.complex_) proj_mat_tmp = numpy.zeros([n_k, 1, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], complex)
for ish in range(n_corr_shells): for ish in range(n_corr_shells):
#update proj_mat #update proj_mat
for ik in range(n_k): for ik in range(n_k):
@ -206,7 +206,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
#size of each quadrant in the lm symmetry array. #size of each quadrant in the lm symmetry array.
size=int(0.5*corr_shells[ish]['dim']) size=int(0.5*corr_shells[ish]['dim'])
#temporary spin block array for SU(2) spin operations on mat #temporary spin block array for SU(2) spin operations on mat
spinmat = numpy.zeros([size,2,size,2],numpy.complex_) spinmat = numpy.zeros([size,2,size,2],complex)
for isym in range(n_symm): for isym in range(n_symm):
#expand size of array #expand size of array
mat[isym][ish]=numpy.lib.pad(mat[isym][ish],((0,size),(0,size)),'constant',constant_values=(0.0)) mat[isym][ish]=numpy.lib.pad(mat[isym][ish],((0,size),(0,size)),'constant',constant_values=(0.0))
@ -233,7 +233,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
Rearranges the energy eigenvalue arrays into TRIQS format Rearranges the energy eigenvalue arrays into TRIQS format
""" """
hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max(n_orbitals), numpy.max(n_orbitals)], numpy.complex_) hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max(n_orbitals), numpy.max(n_orbitals)], complex)
#loop over spin #loop over spin
for isp in range(n_spin_blocs): for isp in range(n_spin_blocs):
#loop over k-points #loop over k-points
@ -295,7 +295,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
mpi.report("Reading %s and EFERMI.OUT" % self.eval_file) mpi.report("Reading %s and EFERMI.OUT" % self.eval_file)
[en,occ,nstsv]=read_Elk.read_eig(self) [en,occ,nstsv]=read_Elk.read_eig(self)
#read projectors calculated in the Elk calculation #read projectors calculated in the Elk calculation
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], numpy.complex_) proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], complex)
mpi.report("Reading projector(s)") mpi.report("Reading projector(s)")
for ish in range(n_corr_shells): for ish in range(n_corr_shells):
[n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext) [n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext)
@ -349,7 +349,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
#require a symmetry matrix to rotate from jatom to iatom. Below finds the non inversion #require a symmetry matrix to rotate from jatom to iatom. Below finds the non inversion
#symmetric matrices which were used in calculating the projectors #symmetric matrices which were used in calculating the projectors
use_rotations = 1 use_rotations = 1
rot_mat = [numpy.identity(corr_shells[icrsh]['dim'], numpy.complex_) for icrsh in range(n_corr_shells)] rot_mat = [numpy.identity(corr_shells[icrsh]['dim'], complex) for icrsh in range(n_corr_shells)]
for icrsh in range(n_corr_shells): for icrsh in range(n_corr_shells):
#incrsh = corr_to_inequiv[icrsh] #incrsh = corr_to_inequiv[icrsh]
#iatom = corr_shells[incrsh]['atom'] #iatom = corr_shells[incrsh]['atom']
@ -407,7 +407,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
symm_subgrp=self.symmcorr_subgrp symm_subgrp=self.symmcorr_subgrp
#Elk does not use time inversion symmetry #Elk does not use time inversion symmetry
time_inv = [0 for j in range(n_symm)] time_inv = [0 for j in range(n_symm)]
mat_tinv = [numpy.identity(orbits[orb]['dim'], numpy.complex_) mat_tinv = [numpy.identity(orbits[orb]['dim'], complex)
for orb in range(n_orbits)] for orb in range(n_orbits)]
#Save all the symmetry data #Save all the symmetry data
if not (symm_subgrp in ar): if not (symm_subgrp in ar):
@ -465,7 +465,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
en=numpy.loadtxt('BAND.OUT') en=numpy.loadtxt('BAND.OUT')
nstsv=int(len(en[:,1])/n_k) nstsv=int(len(en[:,1])/n_k)
#convert the en array into a workable format #convert the en array into a workable format
entmp = numpy.zeros([n_k,nstsv], numpy.complex_) entmp = numpy.zeros([n_k,nstsv], complex)
enj=0 enj=0
for ist in range(nstsv): for ist in range(nstsv):
for ik in range(n_k): for ik in range(n_k):
@ -473,7 +473,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
enj+=1 enj+=1
del en del en
#read projectors #read projectors
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], numpy.complex_) proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], complex)
mpi.report("Reading projector(s)") mpi.report("Reading projector(s)")
for ish in range(n_corr_shells): for ish in range(n_corr_shells):
[n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext) [n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext)
@ -546,7 +546,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
[bz_weights,vkl]=read_Elk.read_kpoints(self,filext=filext) [bz_weights,vkl]=read_Elk.read_kpoints(self,filext=filext)
#read projectors #read projectors
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], numpy.complex_) proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), nstsv], complex)
mpi.report("Reading projector(s)") mpi.report("Reading projector(s)")
for ish in range(n_corr_shells): for ish in range(n_corr_shells):
[n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext) [n_orbitals,band_window,rep,proj_mat]=read_Elk.read_projector(self,corr_shells,n_spin_blocs,ish,proj_mat,ind,T,basis,filext)
@ -615,7 +615,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
[bc,maxlm] = read_Elk.read_bc(self) [bc,maxlm] = read_Elk.read_bc(self)
#set up SO bc array #set up SO bc array
if (self.SO): if (self.SO):
tmp = numpy.zeros([2*maxlm,1,self.n_atoms,self.nstsv,self.n_k], numpy.float_) tmp = numpy.zeros([2*maxlm,1,self.n_atoms,self.nstsv,self.n_k], float)
#put both spinors into the lm array indices. #put both spinors into the lm array indices.
tmp[0:maxlm,0,:,:,:]=bc[0:maxlm,0,:,:,:] tmp[0:maxlm,0,:,:,:]=bc[0:maxlm,0,:,:,:]
tmp[maxlm:2*maxlm,0,:,:,:]=bc[0:maxlm,1,:,:,:] tmp[maxlm:2*maxlm,0,:,:,:]=bc[0:maxlm,1,:,:,:]
@ -626,7 +626,7 @@ class ElkConverter(ConverterTools,Elk_tools,read_Elk):
#reduce bc matrix to band states stored in hdf file #reduce bc matrix to band states stored in hdf file
n_spin_blocs=self.SP+1-self.SO n_spin_blocs=self.SP+1-self.SO
tmp = numpy.zeros([maxlm,n_spin_blocs,self.n_atoms,numpy.max(self.n_orbitals),self.n_k], numpy.float_) tmp = numpy.zeros([maxlm,n_spin_blocs,self.n_atoms,numpy.max(self.n_orbitals),self.n_k], float)
for ik in range(self.n_k): for ik in range(self.n_k):
for isp in range(n_spin_blocs): for isp in range(n_spin_blocs):
nst=self.n_orbitals[ik,isp] nst=self.n_orbitals[ik,isp]

View File

@ -42,7 +42,7 @@ class ElkConverterTools:
routine. routine.
""" """
eps=1E-8 eps=1E-8
v=numpy.zeros([3], numpy.float_) v=numpy.zeros([3], float)
# find the determinant # find the determinant
det=numpy.linalg.det(rot) det=numpy.linalg.det(rot)
if (abs(det-1.0)<eps): if (abs(det-1.0)<eps):
@ -100,7 +100,7 @@ class ElkConverterTools:
""" """
Calculate the rotation SU(2) matrix - see Elk's axangsu2 routine. Calculate the rotation SU(2) matrix - see Elk's axangsu2 routine.
""" """
su2=numpy.zeros([2,2], numpy.complex_) su2=numpy.zeros([2,2], complex)
t1=numpy.sqrt(numpy.dot(v,v)) t1=numpy.sqrt(numpy.dot(v,v))
if(t1<1E-8): if(t1<1E-8):
raise "sym_converter : zero length axis vector!" raise "sym_converter : zero length axis vector!"
@ -143,12 +143,12 @@ class ElkConverterTools:
perm=[] perm=[]
iea=[] iea=[]
for isym in range(nsym): for isym in range(nsym):
iea.append(numpy.zeros([natmtot,ns], numpy.int_)) iea.append(numpy.zeros([natmtot,ns], int))
#loop over species #loop over species
for js in range(ns): for js in range(ns):
#loop over species atoms #loop over species atoms
v=numpy.zeros([3,na[js]], numpy.float_) v=numpy.zeros([3,na[js]], float)
v2=numpy.zeros(3, numpy.float_) v2=numpy.zeros(3, float)
for ia in range(na[js]): for ia in range(na[js]):
v[:,ia]=self.v3frac(atpos[js][ia][0:3],epslat) v[:,ia]=self.v3frac(atpos[js][ia][0:3],epslat)
for ia in range(na[js]): for ia in range(na[js]):
@ -180,14 +180,14 @@ class ElkConverterTools:
#need SciPy routines to get Euler angles - need version 1.4+ #need SciPy routines to get Euler angles - need version 1.4+
#from scipy.spatial.transform import Rotation as R #from scipy.spatial.transform import Rotation as R
symmat=[] symmat=[]
rot=numpy.identity(3, numpy.float_) rot=numpy.identity(3, float)
angi=numpy.zeros(3, numpy.float_) angi=numpy.zeros(3, float)
#loop over symmetries #loop over symmetries
for isym in range(nsym): for isym in range(nsym):
symmat.append([]) symmat.append([])
for ish in range(n_shells): for ish in range(n_shells):
l=shells[ish]['l'] l=shells[ish]['l']
symmat[isym].append(numpy.zeros([2*l+1, 2*l+1], numpy.complex_)) symmat[isym].append(numpy.zeros([2*l+1, 2*l+1], complex))
#get determinant #get determinant
det=numpy.linalg.det(symlat[isym]) det=numpy.linalg.det(symlat[isym])
p=1 p=1
@ -217,7 +217,7 @@ class ElkConverterTools:
""" """
eps=1E-8 eps=1E-8
pi=numpy.pi pi=numpy.pi
ang=numpy.zeros(3, numpy.float_) ang=numpy.zeros(3, float)
#get the Euler angles #get the Euler angles
if((abs(rot[2,0])>eps) or (abs(rot[2,1])>eps)): if((abs(rot[2,0])>eps) or (abs(rot[2,1])>eps)):
ang[0]=numpy.arctan2(rot[2,1],rot[2,0]) ang[0]=numpy.arctan2(rot[2,1],rot[2,0])
@ -243,7 +243,7 @@ class ElkConverterTools:
calculates the rotation matrix in complex spherical harmonics for l. calculates the rotation matrix in complex spherical harmonics for l.
THIS HAS ONLY BEEN TESTED FOR l=2. THIS HAS ONLY BEEN TESTED FOR l=2.
""" """
d=numpy.identity(2*l+1, numpy.complex_) d=numpy.identity(2*l+1, complex)
# generate the rotation matrix about the y-axis # generate the rotation matrix about the y-axis
dy=self.ylmroty(angi[1],l) dy=self.ylmroty(angi[1],l)
# apply inversion to odd l values if required # apply inversion to odd l values if required
@ -268,7 +268,7 @@ class ElkConverterTools:
#import the factorial function - needed for later versions of scipy (needs testing) #import the factorial function - needed for later versions of scipy (needs testing)
from scipy import special as spec from scipy import special as spec
#calculates the rotation matrix in complex spherical harmonics for l #calculates the rotation matrix in complex spherical harmonics for l
dy=numpy.identity(2*l+1, numpy.float_) dy=numpy.identity(2*l+1, float)
#sine and cosine of beta #sine and cosine of beta
cb=numpy.cos(beta/2.0) cb=numpy.cos(beta/2.0)
sb=numpy.sin(beta/2.0) sb=numpy.sin(beta/2.0)

View File

@ -159,13 +159,13 @@ class readElkfiles:
n_shells=0 n_shells=0
n_inequiv_shells=0 n_inequiv_shells=0
#local arrays #local arrays
neqatom=[]#numpy.zeros([n_shells], numpy.int) neqatom=[]#numpy.zeros([n_shells], int)
proj=[] proj=[]
shells=[]#numpy.zeros([n_shells], numpy.int) shells=[]#numpy.zeros([n_shells], int)
corr_shells=[]#numpy.zeros([n_shells], numpy.int) corr_shells=[]#numpy.zeros([n_shells], int)
prjtype=[] prjtype=[]
wan=[] wan=[]
proj_info=[]#numpy.zeros([n_shells], numpy.int) proj_info=[]#numpy.zeros([n_shells], int)
T=[] T=[]
basis=[] basis=[]
inequiv_to_corr=[] inequiv_to_corr=[]
@ -196,7 +196,7 @@ class readElkfiles:
corr_shells.append(shells[n_shells].copy()) corr_shells.append(shells[n_shells].copy())
n_orb=2*shells[n_shells]['l']+1 n_orb=2*shells[n_shells]['l']+1
#lm submatrix indices #lm submatrix indices
idxlm.append(numpy.zeros(2*lmax+1, dtype=numpy.int_)) idxlm.append(numpy.zeros(2*lmax+1, dtype=int))
nrep=proj[ip]['dim'] nrep=proj[ip]['dim']
for i in range(nrep): for i in range(nrep):
idxlm[n_shells][i]=next(R)-1 idxlm[n_shells][i]=next(R)-1
@ -205,7 +205,7 @@ class readElkfiles:
basis.append(int(next(R))) basis.append(int(next(R)))
#determine whether which basis the projectors where generated in #determine whether which basis the projectors where generated in
#spherical harmonics #spherical harmonics
T.append(numpy.zeros([n_orb, n_orb], dtype=numpy.complex_)) T.append(numpy.zeros([n_orb, n_orb], dtype=complex))
#Elk generated unitary basis #Elk generated unitary basis
if (basis[n_shells]==2): if (basis[n_shells]==2):
#reads the transformation matrix #reads the transformation matrix
@ -354,7 +354,7 @@ class readElkfiles:
dim_rep=gen['dim_rep'] dim_rep=gen['dim_rep']
lat=[] lat=[]
n_k=gen['n_k'] n_k=gen['n_k']
n_orbitals = numpy.zeros([n_k, n_spin_blocks], numpy.int) n_orbitals = numpy.zeros([n_k, n_spin_blocks], int)
band_window = [None for isp in range(n_spin_blocks)] band_window = [None for isp in range(n_spin_blocks)]
for isp in range(n_spin_blocks): for isp in range(n_spin_blocks):
band_window[isp] = numpy.zeros([n_k, 2], dtype=int) band_window[isp] = numpy.zeros([n_k, 2], dtype=int)
@ -375,7 +375,7 @@ class readElkfiles:
band_window[isp][ik, 0] = proj_dim['ist_min'] band_window[isp][ik, 0] = proj_dim['ist_min']
band_window[isp][ik, 1] = proj_dim['ist_max'] band_window[isp][ik, 1] = proj_dim['ist_max']
#define temporary matrix for reading in the projectors #define temporary matrix for reading in the projectors
mat = numpy.zeros([dim, n_orbitals[ik,isp]], numpy.complex_) mat = numpy.zeros([dim, n_orbitals[ik,isp]], complex)
# Real part # Real part
for j in range(dim): for j in range(dim):
for i in range(n_orbitals[ik,isp]): for i in range(n_orbitals[ik,isp]):
@ -453,9 +453,9 @@ class readElkfiles:
kp=[] kp=[]
#reads in the k index, lattice vectors, weights and nmat for each kpt #reads in the k index, lattice vectors, weights and nmat for each kpt
#array for bz weights #array for bz weights
bz_weights = numpy.ones([n_k], numpy.float_) / float(n_k) bz_weights = numpy.ones([n_k], float) / float(n_k)
#array for lattice vectors #array for lattice vectors
vkl = numpy.ones([n_k,3], numpy.float_) vkl = numpy.ones([n_k,3], float)
for ik in range(n_k): for ik in range(n_k):
#k-grid info #k-grid info
k_entries = ['ik', 'vklx','vkly','vklz', 'bz_weights', 'nmat'] k_entries = ['ik', 'vklx','vkly','vklz', 'bz_weights', 'nmat']
@ -487,9 +487,9 @@ class readElkfiles:
nsym = 48 nsym = 48
#set up symmetry matrices #set up symmetry matrices
for isym in range(nsym): for isym in range(nsym):
symmat.append(numpy.zeros([3, 3], numpy.float_)) symmat.append(numpy.zeros([3, 3], float))
spinmat.append(numpy.zeros([3, 3], numpy.float_)) spinmat.append(numpy.zeros([3, 3], float))
tr.append(numpy.zeros([3], numpy.float_)) tr.append(numpy.zeros([3], float))
#read the number of crystal symmetries #read the number of crystal symmetries
x = next(R) x = next(R)
nsym = int(atof(x[0])) nsym = int(atof(x[0]))
@ -534,10 +534,10 @@ class readElkfiles:
dft_file='LATTICE.OUT' dft_file='LATTICE.OUT'
R = self.read_elk_file2( dft_file, self.fortran_to_replace) R = self.read_elk_file2( dft_file, self.fortran_to_replace)
try: try:
amat = numpy.zeros([3, 3], numpy.float_) amat = numpy.zeros([3, 3], float)
amatinv = numpy.zeros([3, 3], numpy.float_) amatinv = numpy.zeros([3, 3], float)
bmat = numpy.zeros([3, 3], numpy.float_) bmat = numpy.zeros([3, 3], float)
bmatinv = numpy.zeros([3, 3], numpy.float_) bmatinv = numpy.zeros([3, 3], float)
#real space lattice matrices #real space lattice matrices
#cycling through information which is not needed #cycling through information which is not needed
for i in range(4): for i in range(4):
@ -612,7 +612,7 @@ class readElkfiles:
#loop over atomss pre species #loop over atomss pre species
atpos.append([]) atpos.append([])
for ia in range(na[js]): for ia in range(na[js]):
atpos[js].append(numpy.zeros(6, numpy.float_)) atpos[js].append(numpy.zeros(6, float))
x = next(R) x = next(R)
for j in range(6): for j in range(6):
atpos[js][ia][j]=atof(x[j]) atpos[js][ia][j]=atof(x[j])
@ -657,7 +657,7 @@ class readElkfiles:
dim=gen['maxlm'] dim=gen['maxlm']
lmax=numpy.sqrt(dim)-1 lmax=numpy.sqrt(dim)-1
bc = numpy.zeros([dim,nspinor,self.n_atoms,self.nstsv,self.n_k], numpy.float_) bc = numpy.zeros([dim,nspinor,self.n_atoms,self.nstsv,self.n_k], float)
for ik in range(0,self.n_k): for ik in range(0,self.n_k):
for iatom in range(0,self.n_atoms): for iatom in range(0,self.n_atoms):

View File

@ -134,7 +134,7 @@ class HkConverter(ConverterTools):
use_rotations = 0 use_rotations = 0
rot_mat = [numpy.identity( rot_mat = [numpy.identity(
corr_shells[icrsh]['dim'], numpy.complex_) for icrsh in range(n_corr_shells)] corr_shells[icrsh]['dim'], complex) for icrsh in range(n_corr_shells)]
rot_mat_time_inv = [0 for i in range(n_corr_shells)] rot_mat_time_inv = [0 for i in range(n_corr_shells)]
# Representative representations are read from file # Representative representations are read from file
@ -152,7 +152,7 @@ class HkConverter(ConverterTools):
# Wien2k) # Wien2k)
ll = 2 * corr_shells[inequiv_to_corr[ish]]['l'] + 1 ll = 2 * corr_shells[inequiv_to_corr[ish]]['l'] + 1
lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1) lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1)
T.append(numpy.zeros([lmax, lmax], numpy.complex_)) T.append(numpy.zeros([lmax, lmax], complex))
T[ish] = numpy.array([[0.0, 0.0, 1.0, 0.0, 0.0], T[ish] = numpy.array([[0.0, 0.0, 1.0, 0.0, 0.0],
[1.0 / sqrt(2.0), 0.0, 0.0, [1.0 / sqrt(2.0), 0.0, 0.0,
@ -170,11 +170,11 @@ class HkConverter(ConverterTools):
# define the number of n_orbitals for all k points: it is the # define the number of n_orbitals for all k points: it is the
# number of total bands and independent of k! # number of total bands and independent of k!
n_orbitals = numpy.ones( n_orbitals = numpy.ones(
[n_k, n_spin_blocs], numpy.int) * sum([sh['dim'] for sh in shells]) [n_k, n_spin_blocs], int) * sum([sh['dim'] for sh in shells])
# Initialise the projectors: # Initialise the projectors:
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max( proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max(
[crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], numpy.complex_) [crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], complex)
# Read the projectors from the file: # Read the projectors from the file:
for ik in range(n_k): for ik in range(n_k):
@ -196,9 +196,9 @@ class HkConverter(ConverterTools):
# now define the arrays for weights and hopping ... # now define the arrays for weights and hopping ...
# w(k_index), default normalisation # w(k_index), default normalisation
bz_weights = numpy.ones([n_k], numpy.float_) / float(n_k) bz_weights = numpy.ones([n_k], float) / float(n_k)
hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max( hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max(
n_orbitals), numpy.max(n_orbitals)], numpy.complex_) n_orbitals), numpy.max(n_orbitals)], complex)
if (weights_in_file): if (weights_in_file):
# weights in the file # weights in the file

View File

@ -152,10 +152,10 @@ class ElectronicStructure:
# Spin factor # Spin factor
sp_fac = 2.0 if ns == 1 and not self.nc_flag else 1.0 sp_fac = 2.0 if ns == 1 and not self.nc_flag else 1.0
den_mat = np.zeros((ns, nproj, nproj), dtype=np.float64) den_mat = np.zeros((ns, nproj, nproj), dtype=float)
overlap = np.zeros((ns, nproj, nproj), dtype=np.float64) overlap = np.zeros((ns, nproj, nproj), dtype=float)
# ov_min = np.ones((ns, nproj, nproj), dtype=np.float64) * 100.0 # ov_min = np.ones((ns, nproj, nproj), dtype=float) * 100.0
# ov_max = np.zeros((ns, nproj, nproj), dtype=np.float64) # ov_max = np.zeros((ns, nproj, nproj), dtype=float)
for ispin in range(ns): for ispin in range(ns):
for ik in range(nk): for ik in range(nk):
kweight = self.kmesh['kweights'][ik] kweight = self.kmesh['kweights'][ik]

View File

@ -268,7 +268,7 @@ class ConfigParameters:
err_mess = "Complex matrix must contain 2*M values:\n%s"%(par_str) err_mess = "Complex matrix must contain 2*M values:\n%s"%(par_str)
assert 2 * (nm // 2) == nm, err_mess assert 2 * (nm // 2) == nm, err_mess
tmp = np.array(rows, dtype=np.complex128) tmp = np.array(rows, dtype=complex)
mat = tmp[:, 0::2] + 1.0j * tmp[:, 1::2] mat = tmp[:, 0::2] + 1.0j * tmp[:, 1::2]
return mat return mat

View File

@ -68,7 +68,7 @@ class ProjectorGroup:
# Determine the minimum and maximum band numbers # Determine the minimum and maximum band numbers
if 'bands' in gr_pars: if 'bands' in gr_pars:
nk, nband, ns_band = eigvals.shape nk, nband, ns_band = eigvals.shape
ib_win = np.zeros((nk, ns_band, 2), dtype=np.int32) ib_win = np.zeros((nk, ns_band, 2), dtype=int)
ib_win[:,:,0] = gr_pars['bands'][0]-1 ib_win[:,:,0] = gr_pars['bands'][0]-1
ib_win[:,:,1] = gr_pars['bands'][1]-1 ib_win[:,:,1] = gr_pars['bands'][1]-1
ib_min = gr_pars['bands'][0] - 1 ib_min = gr_pars['bands'][0] - 1
@ -152,7 +152,7 @@ class ProjectorGroup:
block_maps, ndim = self.get_block_matrix_map() block_maps, ndim = self.get_block_matrix_map()
_, ns, nk, _, _ = self.shells[0].proj_win.shape _, ns, nk, _, _ = self.shells[0].proj_win.shape
p_mat = np.zeros((ndim, self.nb_max), dtype=np.complex128) p_mat = np.zeros((ndim, self.nb_max), dtype=complex)
# Note that 'ns' and 'nk' are the same for all shells # Note that 'ns' and 'nk' are the same for all shells
for isp in range(ns): for isp in range(ns):
for ik in range(nk): for ik in range(nk):
@ -201,7 +201,7 @@ class ProjectorGroup:
_, ns, nk, _, _ = self.shells[0].proj_win.shape _, ns, nk, _, _ = self.shells[0].proj_win.shape
self.hk = np.zeros((ns,nk,ndim,ndim), dtype=np.complex128) self.hk = np.zeros((ns,nk,ndim,ndim), dtype=complex)
# Note that 'ns' and 'nk' are the same for all shells # Note that 'ns' and 'nk' are the same for all shells
for isp in range(ns): for isp in range(ns):
for ik in range(nk): for ik in range(nk):
@ -209,7 +209,7 @@ class ProjectorGroup:
bmax = self.ib_win[ik, isp, 1]+1 bmax = self.ib_win[ik, isp, 1]+1
nb = bmax - bmin nb = bmax - bmin
p_mat = np.zeros((ndim, nb), dtype=np.complex128) p_mat = np.zeros((ndim, nb), dtype=complex)
#print(bmin,bmax,nb) #print(bmin,bmax,nb)
# Combine all projectors of the group to one block projector # Combine all projectors of the group to one block projector
for bl_map in block_maps: for bl_map in block_maps:
@ -251,8 +251,8 @@ class ProjectorGroup:
block_maps, ndim = self.get_block_matrix_map() block_maps, ndim = self.get_block_matrix_map()
_, ns, nk, _, _ = self.shells[0].proj_win.shape _, ns, nk, _, _ = self.shells[0].proj_win.shape
p_mat = np.zeros((ndim, self.nb_max), dtype=np.complex128) p_mat = np.zeros((ndim, self.nb_max), dtype=complex)
p_full = np.zeros((1,ns,nk,self.nb_max, self.nb_max), dtype=np.complex128) p_full = np.zeros((1,ns,nk,self.nb_max, self.nb_max), dtype=complex)
# Note that 'ns' and 'nk' are the same for all shells # Note that 'ns' and 'nk' are the same for all shells
@ -452,7 +452,7 @@ class ProjectorGroup:
raise Exception("Energy window does not overlap with the band structure") raise Exception("Energy window does not overlap with the band structure")
nk, nband, ns_band = eigvals.shape nk, nband, ns_band = eigvals.shape
ib_win = np.zeros((nk, ns_band, 2), dtype=np.int32) ib_win = np.zeros((nk, ns_band, 2), dtype=int)
ib_min = 10000000 ib_min = 10000000
ib_max = 0 ib_max = 0

View File

@ -155,7 +155,7 @@ class ProjectorShell:
assert nr%ns_dim == 0, "Number of rows in TRANSFILE is not compatible with the spin dimension" assert nr%ns_dim == 0, "Number of rows in TRANSFILE is not compatible with the spin dimension"
ndim = nr // ns_dim ndim = nr // ns_dim
self.tmatrices = np.zeros((nion, nr, nm * ns_dim), dtype=np.complex128) self.tmatrices = np.zeros((nion, nr, nm * ns_dim), dtype=complex)
if is_complex: if is_complex:
raw_matrices = raw_matrices[:, ::2] + raw_matrices[:, 1::2] * 1j raw_matrices = raw_matrices[:, ::2] + raw_matrices[:, 1::2] * 1j
@ -187,7 +187,7 @@ class ProjectorShell:
ndim = nrow ndim = nrow
self.tmatrices = np.zeros((nion, nrow, nm), dtype=np.complex128) self.tmatrices = np.zeros((nion, nrow, nm), dtype=complex)
for io in range(nion): for io in range(nion):
self.tmatrices[io, :, :] = raw_matrix self.tmatrices[io, :, :] = raw_matrix
@ -200,9 +200,9 @@ class ProjectorShell:
ndim = nm * ns_dim ndim = nm * ns_dim
# We still need the matrices for the output # We still need the matrices for the output
self.tmatrices = np.zeros((nion, ndim, ndim), dtype=np.complex128) self.tmatrices = np.zeros((nion, ndim, ndim), dtype=complex)
for io in range(nion): for io in range(nion):
self.tmatrices[io, :, :] = np.identity(ndim, dtype=np.complex128) self.tmatrices[io, :, :] = np.identity(ndim, dtype=complex)
return ndim return ndim
@ -230,11 +230,11 @@ class ProjectorShell:
# TODO: implement a non-collinear case # TODO: implement a non-collinear case
# for a non-collinear case 'ndim' is 'ns * nm' # for a non-collinear case 'ndim' is 'ns * nm'
ndim = self.tmatrices.shape[1] ndim = self.tmatrices.shape[1]
self.proj_arr = np.zeros((nion, ns, nk, ndim, nb), dtype=np.complex128) self.proj_arr = np.zeros((nion, ns, nk, ndim, nb), dtype=complex)
for ik in range(nk): for ik in range(nk):
kp = kmesh['kpoints'][ik] kp = kmesh['kpoints'][ik]
for io, ion in enumerate(self.ion_list): for io, ion in enumerate(self.ion_list):
proj_k = np.zeros((ns, nlm, nb), dtype=np.complex128) proj_k = np.zeros((ns, nlm, nb), dtype=complex)
qcoord = structure['qcoords'][ion] qcoord = structure['qcoords'][ion]
# kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord)) # kphase = np.exp(-2.0j * np.pi * np.dot(kp, qcoord))
# kphase = 1.0 # kphase = 1.0
@ -249,7 +249,7 @@ class ProjectorShell:
else: else:
# No transformation: just copy the projectors as they are # No transformation: just copy the projectors as they are
self.proj_arr = np.zeros((nion, ns, nk, nlm, nb), dtype=np.complex128) self.proj_arr = np.zeros((nion, ns, nk, nlm, nb), dtype=complex)
for io, ion in enumerate(self.ion_list): for io, ion in enumerate(self.ion_list):
qcoord = structure['qcoords'][ion] qcoord = structure['qcoords'][ion]
for m in range(nlm): for m in range(nlm):
@ -282,7 +282,7 @@ class ProjectorShell:
# Set the dimensions of the array # Set the dimensions of the array
nion, ns, nk, nlm, nbtot = self.proj_arr.shape nion, ns, nk, nlm, nbtot = self.proj_arr.shape
# !!! Note that the order of the two last indices is different !!! # !!! Note that the order of the two last indices is different !!!
self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=np.complex128) self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=complex)
# Select projectors for a given energy window # Select projectors for a given energy window
ns_band = self.ib_win.shape[1] ns_band = self.ib_win.shape[1]
@ -310,14 +310,14 @@ class ProjectorShell:
assert spin_diag, "spin_diag = False is not implemented" assert spin_diag, "spin_diag = False is not implemented"
if site_diag: if site_diag:
occ_mats = np.zeros((ns, nion, nlm, nlm), dtype=np.float64) occ_mats = np.zeros((ns, nion, nlm, nlm), dtype=float)
overlaps = np.zeros((ns, nion, nlm, nlm), dtype=np.float64) overlaps = np.zeros((ns, nion, nlm, nlm), dtype=float)
else: else:
ndim = nion * nlm ndim = nion * nlm
occ_mats = np.zeros((ns, 1, ndim, ndim), dtype=np.float64) occ_mats = np.zeros((ns, 1, ndim, ndim), dtype=float)
overlaps = np.zeros((ns, 1, ndim, ndim), dtype=np.float64) overlaps = np.zeros((ns, 1, ndim, ndim), dtype=float)
# self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=np.complex128) # self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=complex)
kweights = el_struct.kmesh['kweights'] kweights = el_struct.kmesh['kweights']
occnums = el_struct.ferw occnums = el_struct.ferw
ib1 = self.ib_min ib1 = self.ib_min
@ -332,7 +332,7 @@ class ProjectorShell:
overlaps[isp, io, :, :] += np.dot(proj_k, overlaps[isp, io, :, :] += np.dot(proj_k,
proj_k.conj().T).real * weight proj_k.conj().T).real * weight
else: else:
proj_k = np.zeros((ndim, nbtot), dtype=np.complex128) proj_k = np.zeros((ndim, nbtot), dtype=complex)
for isp in range(ns): for isp in range(ns):
for ik, weight, occ in zip(it.count(), kweights, occnums[isp, :, :]): for ik, weight, occ in zip(it.count(), kweights, occnums[isp, :, :]):
for io in range(nion): for io in range(nion):
@ -363,9 +363,9 @@ class ProjectorShell:
assert site_diag, "site_diag = False is not implemented" assert site_diag, "site_diag = False is not implemented"
assert spin_diag, "spin_diag = False is not implemented" assert spin_diag, "spin_diag = False is not implemented"
loc_ham = np.zeros((ns, nion, nlm, nlm), dtype=np.complex128) loc_ham = np.zeros((ns, nion, nlm, nlm), dtype=complex)
# self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=np.complex128) # self.proj_win = np.zeros((nion, ns, nk, nlm, nb_max), dtype=complex)
kweights = el_struct.kmesh['kweights'] kweights = el_struct.kmesh['kweights']
occnums = el_struct.ferw occnums = el_struct.ferw
ib1 = self.ib_min ib1 = self.ib_min
@ -403,7 +403,7 @@ class ProjectorShell:
ne = len(emesh) ne = len(emesh)
dos = np.zeros((ne, ns, nion, nlm)) dos = np.zeros((ne, ns, nion, nlm))
w_k = np.zeros((nk, nb_max, ns, nion, nlm), dtype=np.complex128) w_k = np.zeros((nk, nb_max, ns, nion, nlm), dtype=complex)
for isp in range(ns): for isp in range(ns):
for ik in range(nk): for ik in range(nk):
is_b = min(isp, ns_band) is_b = min(isp, ns_band)

View File

@ -251,7 +251,7 @@ class Plocar:
except: except:
print("!!! WARNING !!!: Error reading E-Fermi from LOCPROJ, trying DOSCAR") print("!!! WARNING !!!: Error reading E-Fermi from LOCPROJ, trying DOSCAR")
plo = np.zeros((nproj, self.nspin, nk, self.nband), dtype=np.complex128) plo = np.zeros((nproj, self.nspin, nk, self.nband), dtype=complex)
proj_params = [{} for i in range(nproj)] proj_params = [{} for i in range(nproj)]
iproj_site = 0 iproj_site = 0
@ -685,7 +685,7 @@ def read_symmcar(vasp_dir, symm_filename='SYMMCAR'):
print(" {0:>26} {1:d}".format("L_max:", lmax)) print(" {0:>26} {1:d}".format("L_max:", lmax))
rot_mats = np.zeros((nrot, lmax+1, mmax, mmax)) rot_mats = np.zeros((nrot, lmax+1, mmax, mmax))
rot_map = np.zeros((nrot, ntrans, nion), dtype=np.int32) rot_map = np.zeros((nrot, ntrans, nion), dtype=int)
for irot in range(nrot): for irot in range(nrot):
# Empty line # Empty line

View File

@ -259,7 +259,7 @@ class VaspConverter(ConverterTools):
# NB!: these rotation matrices are specific to Wien2K! Set to identity in VASP # NB!: these rotation matrices are specific to Wien2K! Set to identity in VASP
use_rotations = 1 use_rotations = 1
rot_mat = [numpy.identity(corr_shells[icrsh]['dim'],numpy.complex_) for icrsh in range(n_corr_shells)] rot_mat = [numpy.identity(corr_shells[icrsh]['dim'],complex) for icrsh in range(n_corr_shells)]
rot_mat_time_inv = [0 for i in range(n_corr_shells)] rot_mat_time_inv = [0 for i in range(n_corr_shells)]
# TODO: implement transformation matrices # TODO: implement transformation matrices
@ -276,16 +276,16 @@ class VaspConverter(ConverterTools):
ll = 2 * corr_shells[inequiv_to_corr[ish]]['l']+1 ll = 2 * corr_shells[inequiv_to_corr[ish]]['l']+1
lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1) lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1)
# TODO: at the moment put T-matrices to identities # TODO: at the moment put T-matrices to identities
T.append(numpy.identity(lmax, numpy.complex_)) T.append(numpy.identity(lmax, complex))
# if nc_flag: # if nc_flag:
## TODO: implement the noncollinear part ## TODO: implement the noncollinear part
# raise NotImplementedError("Noncollinear calculations are not implemented") # raise NotImplementedError("Noncollinear calculations are not implemented")
# else: # else:
hopping = numpy.zeros([n_k, n_spin_blocs, nb_max, nb_max], numpy.complex_) hopping = numpy.zeros([n_k, n_spin_blocs, nb_max, nb_max], complex)
f_weights = numpy.zeros([n_k, n_spin_blocs, nb_max], numpy.float_) f_weights = numpy.zeros([n_k, n_spin_blocs, nb_max], float)
band_window = [numpy.zeros((n_k, 2), dtype=int) for isp in range(n_spin_blocs)] band_window = [numpy.zeros((n_k, 2), dtype=int) for isp in range(n_spin_blocs)]
n_orbitals = numpy.zeros([n_k, n_spin_blocs], numpy.int) n_orbitals = numpy.zeros([n_k, n_spin_blocs], int)
for isp in range(n_spin_blocs): for isp in range(n_spin_blocs):
@ -299,7 +299,7 @@ class VaspConverter(ConverterTools):
f_weights[ik, isp, ib] = next(rf) f_weights[ik, isp, ib] = next(rf)
if self.proj_or_hk == 'hk': if self.proj_or_hk == 'hk':
hopping = numpy.zeros([n_k, n_spin_blocs, n_orbs, n_orbs], numpy.complex_) hopping = numpy.zeros([n_k, n_spin_blocs, n_orbs, n_orbs], complex)
# skip header lines # skip header lines
hk_file = self.basename + '.hk%i'%(ig + 1) hk_file = self.basename + '.hk%i'%(ig + 1)
f_hk = open(hk_file, 'rt') f_hk = open(hk_file, 'rt')
@ -324,7 +324,7 @@ class VaspConverter(ConverterTools):
# Projectors # Projectors
# print n_orbitals # print n_orbitals
# print [crsh['dim'] for crsh in corr_shells] # print [crsh['dim'] for crsh in corr_shells]
proj_mat_csc = numpy.zeros([n_k, n_spin_blocs, sum([sh['dim'] for sh in shells]), numpy.max(n_orbitals)], numpy.complex_) proj_mat_csc = numpy.zeros([n_k, n_spin_blocs, sum([sh['dim'] for sh in shells]), numpy.max(n_orbitals)], complex)
# TODO: implement reading from more than one projector group # TODO: implement reading from more than one projector group
# In 'dmftproj' each ion represents a separate correlated shell. # In 'dmftproj' each ion represents a separate correlated shell.
@ -351,7 +351,7 @@ class VaspConverter(ConverterTools):
proj_mat_csc[ik, isp, ilm, ib] = complex(pr, pi) proj_mat_csc[ik, isp, ilm, ib] = complex(pr, pi)
# now save only projectors with flag 'corr' to proj_mat # now save only projectors with flag 'corr' to proj_mat
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], numpy.complex_) proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max([crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], complex)
if self.proj_or_hk == 'proj': if self.proj_or_hk == 'proj':
for ish, sh in enumerate(p_shells): for ish, sh in enumerate(p_shells):
if sh['corr']: if sh['corr']:

View File

@ -155,7 +155,7 @@ class Wien2kConverter(ConverterTools):
use_rotations = 1 use_rotations = 1
rot_mat = [numpy.identity( rot_mat = [numpy.identity(
corr_shells[icrsh]['dim'], numpy.complex_) for icrsh in range(n_corr_shells)] corr_shells[icrsh]['dim'], complex) for icrsh in range(n_corr_shells)]
# read the matrices # read the matrices
rot_mat_time_inv = [0 for i in range(n_corr_shells)] rot_mat_time_inv = [0 for i in range(n_corr_shells)]
@ -186,7 +186,7 @@ class Wien2kConverter(ConverterTools):
# is of dimension 2l+1 without SO, and 2*(2l+1) with SO! # is of dimension 2l+1 without SO, and 2*(2l+1) with SO!
ll = 2 * corr_shells[inequiv_to_corr[ish]]['l'] + 1 ll = 2 * corr_shells[inequiv_to_corr[ish]]['l'] + 1
lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1) lmax = ll * (corr_shells[inequiv_to_corr[ish]]['SO'] + 1)
T.append(numpy.zeros([lmax, lmax], numpy.complex_)) T.append(numpy.zeros([lmax, lmax], complex))
# now read it from file: # now read it from file:
for i in range(lmax): for i in range(lmax):
@ -200,14 +200,14 @@ class Wien2kConverter(ConverterTools):
n_spin_blocs = SP + 1 - SO n_spin_blocs = SP + 1 - SO
# read the list of n_orbitals for all k points # read the list of n_orbitals for all k points
n_orbitals = numpy.zeros([n_k, n_spin_blocs], numpy.int) n_orbitals = numpy.zeros([n_k, n_spin_blocs], int)
for isp in range(n_spin_blocs): for isp in range(n_spin_blocs):
for ik in range(n_k): for ik in range(n_k):
n_orbitals[ik, isp] = int(next(R)) n_orbitals[ik, isp] = int(next(R))
# Initialise the projectors: # Initialise the projectors:
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max( proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, max(
[crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], numpy.complex_) [crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], complex)
# Read the projectors from the file: # Read the projectors from the file:
for ik in range(n_k): for ik in range(n_k):
@ -227,9 +227,9 @@ class Wien2kConverter(ConverterTools):
# now define the arrays for weights and hopping ... # now define the arrays for weights and hopping ...
# w(k_index), default normalisation # w(k_index), default normalisation
bz_weights = numpy.ones([n_k], numpy.float_) / float(n_k) bz_weights = numpy.ones([n_k], float) / float(n_k)
hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max( hopping = numpy.zeros([n_k, n_spin_blocs, numpy.max(
n_orbitals), numpy.max(n_orbitals)], numpy.complex_) n_orbitals), numpy.max(n_orbitals)], complex)
# weights in the file # weights in the file
for ik in range(n_k): for ik in range(n_k):
@ -304,7 +304,7 @@ class Wien2kConverter(ConverterTools):
mpi.report("Reading input from %s..." % self.parproj_file) mpi.report("Reading input from %s..." % self.parproj_file)
dens_mat_below = [[numpy.zeros([self.shells[ish]['dim'], self.shells[ish]['dim']], numpy.complex_) for ish in range(self.n_shells)] dens_mat_below = [[numpy.zeros([self.shells[ish]['dim'], self.shells[ish]['dim']], complex) for ish in range(self.n_shells)]
for isp in range(self.n_spin_blocs)] for isp in range(self.n_spin_blocs)]
R = ConverterTools.read_fortran_file( R = ConverterTools.read_fortran_file(
@ -315,10 +315,10 @@ class Wien2kConverter(ConverterTools):
# Initialise P, here a double list of matrices: # Initialise P, here a double list of matrices:
proj_mat_all = numpy.zeros([self.n_k, self.n_spin_blocs, self.n_shells, max( proj_mat_all = numpy.zeros([self.n_k, self.n_spin_blocs, self.n_shells, max(
n_parproj), max([sh['dim'] for sh in self.shells]), numpy.max(self.n_orbitals)], numpy.complex_) n_parproj), max([sh['dim'] for sh in self.shells]), numpy.max(self.n_orbitals)], complex)
rot_mat_all = [numpy.identity( rot_mat_all = [numpy.identity(
self.shells[ish]['dim'], numpy.complex_) for ish in range(self.n_shells)] self.shells[ish]['dim'], complex) for ish in range(self.n_shells)]
rot_mat_all_time_inv = [0 for i in range(self.n_shells)] rot_mat_all_time_inv = [0 for i in range(self.n_shells)]
for ish in range(self.n_shells): for ish in range(self.n_shells):
@ -409,14 +409,14 @@ class Wien2kConverter(ConverterTools):
n_k = int(next(R)) n_k = int(next(R))
# read the list of n_orbitals for all k points # read the list of n_orbitals for all k points
n_orbitals = numpy.zeros([n_k, self.n_spin_blocs], numpy.int) n_orbitals = numpy.zeros([n_k, self.n_spin_blocs], int)
for isp in range(self.n_spin_blocs): for isp in range(self.n_spin_blocs):
for ik in range(n_k): for ik in range(n_k):
n_orbitals[ik, isp] = int(next(R)) n_orbitals[ik, isp] = int(next(R))
# Initialise the projectors: # Initialise the projectors:
proj_mat = numpy.zeros([n_k, self.n_spin_blocs, self.n_corr_shells, max( proj_mat = numpy.zeros([n_k, self.n_spin_blocs, self.n_corr_shells, max(
[crsh['dim'] for crsh in self.corr_shells]), numpy.max(n_orbitals)], numpy.complex_) [crsh['dim'] for crsh in self.corr_shells]), numpy.max(n_orbitals)], complex)
# Read the projectors from the file: # Read the projectors from the file:
for ik in range(n_k): for ik in range(n_k):
@ -435,7 +435,7 @@ class Wien2kConverter(ConverterTools):
proj_mat[ik, isp, icrsh, i, j] += 1j * next(R) proj_mat[ik, isp, icrsh, i, j] += 1j * next(R)
hopping = numpy.zeros([n_k, self.n_spin_blocs, numpy.max( hopping = numpy.zeros([n_k, self.n_spin_blocs, numpy.max(
n_orbitals), numpy.max(n_orbitals)], numpy.complex_) n_orbitals), numpy.max(n_orbitals)], complex)
# Grab the H # Grab the H
# we use now the convention of a DIAGONAL Hamiltonian!!!! # we use now the convention of a DIAGONAL Hamiltonian!!!!
@ -451,7 +451,7 @@ class Wien2kConverter(ConverterTools):
# Initialise P, here a double list of matrices: # Initialise P, here a double list of matrices:
proj_mat_all = numpy.zeros([n_k, self.n_spin_blocs, self.n_shells, max(n_parproj), max( proj_mat_all = numpy.zeros([n_k, self.n_spin_blocs, self.n_shells, max(n_parproj), max(
[sh['dim'] for sh in self.shells]), numpy.max(n_orbitals)], numpy.complex_) [sh['dim'] for sh in self.shells]), numpy.max(n_orbitals)], complex)
for ish in range(self.n_shells): for ish in range(self.n_shells):
for ik in range(n_k): for ik in range(n_k):
@ -754,7 +754,7 @@ class Wien2kConverter(ConverterTools):
for i_symm in range(n_symm): for i_symm in range(n_symm):
mat.append([numpy.zeros([orbits[orb]['dim'], orbits[orb][ mat.append([numpy.zeros([orbits[orb]['dim'], orbits[orb][
'dim']], numpy.complex_) for orb in range(n_orbits)]) 'dim']], complex) for orb in range(n_orbits)])
for orb in range(n_orbits): for orb in range(n_orbits):
for i in range(orbits[orb]['dim']): for i in range(orbits[orb]['dim']):
for j in range(orbits[orb]['dim']): for j in range(orbits[orb]['dim']):
@ -765,7 +765,7 @@ class Wien2kConverter(ConverterTools):
mat[i_symm][orb][i, j] += 1j * \ mat[i_symm][orb][i, j] += 1j * \
next(R) # imaginary part next(R) # imaginary part
mat_tinv = [numpy.identity(orbits[orb]['dim'], numpy.complex_) mat_tinv = [numpy.identity(orbits[orb]['dim'], complex)
for orb in range(n_orbits)] for orb in range(n_orbits)]
if ((SO == 0) and (SP == 0)): if ((SO == 0) and (SP == 0)):

View File

@ -581,7 +581,7 @@ class SumkDFT(object):
G_latt << Omega + 1j * broadening G_latt << Omega + 1j * broadening
idmat = [numpy.identity( idmat = [numpy.identity(
self.n_orbitals[ik, ntoi[sp]], numpy.complex_) for sp in spn] self.n_orbitals[ik, ntoi[sp]], complex) for sp in spn]
M = copy.deepcopy(idmat) M = copy.deepcopy(idmat)
for ibl in range(self.n_spin_blocks[self.SO]): for ibl in range(self.n_spin_blocks[self.SO]):
@ -1297,10 +1297,10 @@ class SumkDFT(object):
if res.fun > threshold: continue if res.fun > threshold: continue
# reinterpret the solution as a complex number # reinterpret the solution as a complex number
y = res.x.view(numpy.complex_) y = res.x.view(complex)
# reconstruct the T matrix # reconstruct the T matrix
T = numpy.zeros(N.shape[:-1], dtype=numpy.complex_) T = numpy.zeros(N.shape[:-1], dtype=complex)
for i in range(len(y)): for i in range(len(y)):
T += N[:, :, i] * y[i] T += N[:, :, i] * y[i]
@ -1470,7 +1470,7 @@ class SumkDFT(object):
for icrsh in range(self.n_corr_shells): for icrsh in range(self.n_corr_shells):
for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]: for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]:
dens_mat[icrsh][sp] = numpy.zeros( dens_mat[icrsh][sp] = numpy.zeros(
[self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], numpy.complex_) [self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], complex)
ikarray = numpy.array(list(range(self.n_k))) ikarray = numpy.array(list(range(self.n_k)))
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -1488,7 +1488,7 @@ class SumkDFT(object):
ntoi = self.spin_names_to_ind[self.SO] ntoi = self.spin_names_to_ind[self.SO]
spn = self.spin_block_names[self.SO] spn = self.spin_block_names[self.SO]
dims = {sp:self.n_orbitals[ik, ntoi[sp]] for sp in spn} dims = {sp:self.n_orbitals[ik, ntoi[sp]] for sp in spn}
MMat = [numpy.zeros([dims[sp], dims[sp]], numpy.complex_) for sp in spn] MMat = [numpy.zeros([dims[sp], dims[sp]], complex) for sp in spn]
for isp, sp in enumerate(spn): for isp, sp in enumerate(spn):
ind = ntoi[sp] ind = ntoi[sp]
@ -1569,7 +1569,7 @@ class SumkDFT(object):
for ish in range(self.n_inequiv_shells): for ish in range(self.n_inequiv_shells):
for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]: for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]:
eff_atlevels[ish][sp] = numpy.identity( eff_atlevels[ish][sp] = numpy.identity(
self.corr_shells[self.inequiv_to_corr[ish]]['dim'], numpy.complex_) self.corr_shells[self.inequiv_to_corr[ish]]['dim'], complex)
eff_atlevels[ish][sp] *= -self.chemical_potential eff_atlevels[ish][sp] *= -self.chemical_potential
eff_atlevels[ish][ eff_atlevels[ish][
sp] -= self.dc_imp[self.inequiv_to_corr[ish]][sp] sp] -= self.dc_imp[self.inequiv_to_corr[ish]][sp]
@ -1583,13 +1583,13 @@ class SumkDFT(object):
dim = self.corr_shells[icrsh]['dim'] dim = self.corr_shells[icrsh]['dim']
for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]: for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]:
self.Hsumk[icrsh][sp] = numpy.zeros( self.Hsumk[icrsh][sp] = numpy.zeros(
[dim, dim], numpy.complex_) [dim, dim], complex)
for isp, sp in enumerate(self.spin_block_names[self.corr_shells[icrsh]['SO']]): for isp, sp in enumerate(self.spin_block_names[self.corr_shells[icrsh]['SO']]):
ind = self.spin_names_to_ind[ ind = self.spin_names_to_ind[
self.corr_shells[icrsh]['SO']][sp] self.corr_shells[icrsh]['SO']][sp]
for ik in range(self.n_k): for ik in range(self.n_k):
n_orb = self.n_orbitals[ik, ind] n_orb = self.n_orbitals[ik, ind]
MMat = numpy.identity(n_orb, numpy.complex_) MMat = numpy.identity(n_orb, complex)
MMat = self.hopping[ MMat = self.hopping[
ik, ind, 0:n_orb, 0:n_orb] - (1 - 2 * isp) * self.h_field * MMat ik, ind, 0:n_orb, 0:n_orb] - (1 - 2 * isp) * self.h_field * MMat
projmat = self.proj_mat[ik, ind, icrsh, 0:dim, 0:n_orb] projmat = self.proj_mat[ik, ind, icrsh, 0:dim, 0:n_orb]
@ -1631,7 +1631,7 @@ class SumkDFT(object):
dim = self.corr_shells[icrsh]['dim'] dim = self.corr_shells[icrsh]['dim']
spn = self.spin_block_names[self.corr_shells[icrsh]['SO']] spn = self.spin_block_names[self.corr_shells[icrsh]['SO']]
for sp in spn: for sp in spn:
self.dc_imp[icrsh][sp] = numpy.zeros([dim, dim], numpy.float_) self.dc_imp[icrsh][sp] = numpy.zeros([dim, dim], float)
self.dc_energ = [0.0 for icrsh in range(self.n_corr_shells)] self.dc_energ = [0.0 for icrsh in range(self.n_corr_shells)]
def set_dc(self, dc_imp, dc_energ): def set_dc(self, dc_imp, dc_energ):
@ -1709,7 +1709,7 @@ class SumkDFT(object):
Ncr[bl] += dens_mat[block].real.trace() Ncr[bl] += dens_mat[block].real.trace()
Ncrtot = sum(Ncr.values()) Ncrtot = sum(Ncr.values())
for sp in spn: for sp in spn:
self.dc_imp[icrsh][sp] = numpy.identity(dim, numpy.float_) self.dc_imp[icrsh][sp] = numpy.identity(dim, float)
if self.SP == 0: # average the densities if there is no SP: if self.SP == 0: # average the densities if there is no SP:
Ncr[sp] = Ncrtot / len(spn) Ncr[sp] = Ncrtot / len(spn)
# correction for SO: we have only one block in this case, but # correction for SO: we have only one block in this case, but
@ -2050,14 +2050,14 @@ class SumkDFT(object):
# Convert Fermi weights to a density matrix # Convert Fermi weights to a density matrix
dens_mat_dft = {} dens_mat_dft = {}
for sp in spn: for sp in spn:
dens_mat_dft[sp] = [fermi_weights[ik, ntoi[sp], :].astype(numpy.complex_) for ik in range(self.n_k)] dens_mat_dft[sp] = [fermi_weights[ik, ntoi[sp], :].astype(complex) for ik in range(self.n_k)]
# Set up deltaN: # Set up deltaN:
deltaN = {} deltaN = {}
for sp in spn: for sp in spn:
deltaN[sp] = [numpy.zeros([self.n_orbitals[ik, ntoi[sp]], self.n_orbitals[ deltaN[sp] = [numpy.zeros([self.n_orbitals[ik, ntoi[sp]], self.n_orbitals[
ik, ntoi[sp]]], numpy.complex_) for ik in range(self.n_k)] ik, ntoi[sp]]], complex) for ik in range(self.n_k)]
ikarray = numpy.arange(self.n_k) ikarray = numpy.arange(self.n_k)
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -2301,7 +2301,7 @@ class SumkDFT(object):
def check_projectors(self): def check_projectors(self):
"""Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and """Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and
specifically that it matches DFT.""" specifically that it matches DFT."""
dens_mat = [numpy.zeros([self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], numpy.complex_) dens_mat = [numpy.zeros([self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], complex)
for icrsh in range(self.n_corr_shells)] for icrsh in range(self.n_corr_shells)]
for ik in range(self.n_k): for ik in range(self.n_k):

View File

@ -104,16 +104,16 @@ class SumkDFTTools(SumkDFT):
for icrsh in range(self.n_corr_shells): for icrsh in range(self.n_corr_shells):
G_loc[icrsh].zero() G_loc[icrsh].zero()
DOS = {sp: numpy.zeros([n_om], numpy.float_) DOS = {sp: numpy.zeros([n_om], float)
for sp in self.spin_block_names[self.SO]} for sp in self.spin_block_names[self.SO]}
DOSproj = [{} for ish in range(self.n_inequiv_shells)] DOSproj = [{} for ish in range(self.n_inequiv_shells)]
DOSproj_orb = [{} for ish in range(self.n_inequiv_shells)] DOSproj_orb = [{} for ish in range(self.n_inequiv_shells)]
for ish in range(self.n_inequiv_shells): for ish in range(self.n_inequiv_shells):
for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]: for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]:
dim = self.corr_shells[self.inequiv_to_corr[ish]]['dim'] dim = self.corr_shells[self.inequiv_to_corr[ish]]['dim']
DOSproj[ish][sp] = numpy.zeros([n_om], numpy.float_) DOSproj[ish][sp] = numpy.zeros([n_om], float)
DOSproj_orb[ish][sp] = numpy.zeros( DOSproj_orb[ish][sp] = numpy.zeros(
[n_om, dim, dim], numpy.complex_) [n_om, dim, dim], complex)
ikarray = numpy.array(list(range(self.n_k))) ikarray = numpy.array(list(range(self.n_k)))
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -240,16 +240,16 @@ class SumkDFTTools(SumkDFT):
for block, block_dim in gf_struct_parproj_all[0]] for block, block_dim in gf_struct_parproj_all[0]]
G_loc_all = BlockGf(name_list=spn, block_list=glist_all, make_copies=False) G_loc_all = BlockGf(name_list=spn, block_list=glist_all, make_copies=False)
DOS = {sp: numpy.zeros([n_om], numpy.float_) DOS = {sp: numpy.zeros([n_om], float)
for sp in self.spin_block_names[self.SO]} for sp in self.spin_block_names[self.SO]}
DOSproj = {} DOSproj = {}
DOSproj_orb = {} DOSproj_orb = {}
for sp in self.spin_block_names[self.SO]: for sp in self.spin_block_names[self.SO]:
dim = n_local_orbs dim = n_local_orbs
DOSproj[sp] = numpy.zeros([n_om], numpy.float_) DOSproj[sp] = numpy.zeros([n_om], float)
DOSproj_orb[sp] = numpy.zeros( DOSproj_orb[sp] = numpy.zeros(
[n_om, dim, dim], numpy.complex_) [n_om, dim, dim], complex)
ikarray = numpy.array(list(range(self.n_k))) ikarray = numpy.array(list(range(self.n_k)))
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -374,16 +374,16 @@ class SumkDFTTools(SumkDFT):
for ish in range(self.n_shells): for ish in range(self.n_shells):
G_loc[ish].zero() G_loc[ish].zero()
DOS = {sp: numpy.zeros([n_om], numpy.float_) DOS = {sp: numpy.zeros([n_om], float)
for sp in self.spin_block_names[self.SO]} for sp in self.spin_block_names[self.SO]}
DOSproj = [{} for ish in range(self.n_shells)] DOSproj = [{} for ish in range(self.n_shells)]
DOSproj_orb = [{} for ish in range(self.n_shells)] DOSproj_orb = [{} for ish in range(self.n_shells)]
for ish in range(self.n_shells): for ish in range(self.n_shells):
for sp in self.spin_block_names[self.SO]: for sp in self.spin_block_names[self.SO]:
dim = self.shells[ish]['dim'] dim = self.shells[ish]['dim']
DOSproj[ish][sp] = numpy.zeros([n_om], numpy.float_) DOSproj[ish][sp] = numpy.zeros([n_om], float)
DOSproj_orb[ish][sp] = numpy.zeros( DOSproj_orb[ish][sp] = numpy.zeros(
[n_om, dim, dim], numpy.complex_) [n_om, dim, dim], complex)
ikarray = numpy.array(list(range(self.n_k))) ikarray = numpy.array(list(range(self.n_k)))
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -518,11 +518,11 @@ class SumkDFTTools(SumkDFT):
spn = self.spin_block_names[self.SO] spn = self.spin_block_names[self.SO]
DOS = {sp: numpy.zeros([n_om], numpy.float_) DOS = {sp: numpy.zeros([n_om], float)
for sp in self.spin_block_names[self.SO]} for sp in self.spin_block_names[self.SO]}
#set up temporary arrays for pdos calculations #set up temporary arrays for pdos calculations
if (pdos): if (pdos):
pDOS = {sp: numpy.zeros([self.n_atoms,self.maxlm,n_om], numpy.float_) pDOS = {sp: numpy.zeros([self.n_atoms,self.maxlm,n_om], float)
for sp in self.spin_block_names[self.SO]} for sp in self.spin_block_names[self.SO]}
ntoi = self.spin_names_to_ind[self.SO] ntoi = self.spin_names_to_ind[self.SO]
else: else:
@ -713,18 +713,18 @@ class SumkDFTTools(SumkDFT):
#orthogonal vector used for plane calculations #orthogonal vector used for plane calculations
if orthvec is None: if orthvec is None:
#set to [0,0,1] by default #set to [0,0,1] by default
orthvec = numpy.zeros(3,dtype=numpy.float_) orthvec = numpy.zeros(3,dtype=float)
orthvec[2] = 1.0 orthvec[2] = 1.0
elif orthvec.size != 3: elif orthvec.size != 3:
assert 0, "The input numpy orthvec is not the required size of 3!" assert 0, "The input numpy orthvec is not the required size of 3!"
spn = self.spin_block_names[self.SO] spn = self.spin_block_names[self.SO]
Akw = {sp: numpy.zeros([self.n_k, n_om], numpy.float_) Akw = {sp: numpy.zeros([self.n_k, n_om], float)
for sp in spn} for sp in spn}
#Cartesian lattice coordinates array #Cartesian lattice coordinates array
vkc = numpy.zeros([self.n_k,3], numpy.float_) vkc = numpy.zeros([self.n_k,3], float)
ikarray = numpy.array(range(self.n_k)) ikarray = numpy.array(range(self.n_k))
for ik in mpi.slice_array(ikarray): for ik in mpi.slice_array(ikarray):
@ -750,8 +750,8 @@ class SumkDFTTools(SumkDFT):
iknr = numpy.arange(self.n_k) iknr = numpy.arange(self.n_k)
if sym: if sym:
vkltmp = self.vkl vkltmp = self.vkl
v = numpy.zeros(3, numpy.float_) v = numpy.zeros(3, float)
v_orth = numpy.zeros(3, numpy.float_) v_orth = numpy.zeros(3, float)
for isym in range(self.n_symm): for isym in range(self.n_symm):
#calculate the orthonormal vector after symmetry operation. This is used to #calculate the orthonormal vector after symmetry operation. This is used to
#check if the orthonormal vector after the symmetry operation is parallel #check if the orthonormal vector after the symmetry operation is parallel
@ -865,11 +865,11 @@ class SumkDFTTools(SumkDFT):
n_om = len(mesh[(mesh > om_minplot)&(mesh < om_maxplot)]) n_om = len(mesh[(mesh > om_minplot)&(mesh < om_maxplot)])
if ishell is None: if ishell is None:
Akw = {sp: numpy.zeros([self.n_k, n_om], numpy.float_) Akw = {sp: numpy.zeros([self.n_k, n_om], float)
for sp in spn} for sp in spn}
else: else:
Akw = {sp: numpy.zeros( Akw = {sp: numpy.zeros(
[self.shells[ishell]['dim'], self.n_k, n_om], numpy.float_) for sp in spn} [self.shells[ishell]['dim'], self.n_k, n_om], float) for sp in spn}
if ishell is not None: if ishell is not None:
assert isinstance(ishell, int) and ishell in range(len(self.shells)), "ishell must be of type integer and consistent with number of shells." assert isinstance(ishell, int) and ishell in range(len(self.shells)), "ishell must be of type integer and consistent with number of shells."
@ -990,7 +990,7 @@ class SumkDFTTools(SumkDFT):
spn = self.spin_block_names[self.SO] spn = self.spin_block_names[self.SO]
ntoi = self.spin_names_to_ind[self.SO] ntoi = self.spin_names_to_ind[self.SO]
# Density matrix in the window # Density matrix in the window
self.dens_mat_window = [[numpy.zeros([self.shells[ish]['dim'], self.shells[ish]['dim']], numpy.complex_) self.dens_mat_window = [[numpy.zeros([self.shells[ish]['dim'], self.shells[ish]['dim']], complex)
for ish in range(self.n_shells)] for ish in range(self.n_shells)]
for isp in range(len(spn))] for isp in range(len(spn))]
# Set up G_loc # Set up G_loc
@ -1262,7 +1262,7 @@ class SumkDFTTools(SumkDFT):
print("Omega mesh automatically repined to: ", self.Om_mesh) print("Omega mesh automatically repined to: ", self.Om_mesh)
self.Gamma_w = {direction: numpy.zeros( self.Gamma_w = {direction: numpy.zeros(
(len(self.Om_mesh), n_om), dtype=numpy.float_) for direction in self.directions} (len(self.Om_mesh), n_om), dtype=float) for direction in self.directions}
# Sum over all k-points # Sum over all k-points
ikarray = numpy.array(list(range(self.n_k))) ikarray = numpy.array(list(range(self.n_k)))
@ -1270,7 +1270,7 @@ class SumkDFTTools(SumkDFT):
# Calculate G_w for ik and initialize A_kw # Calculate G_w for ik and initialize A_kw
G_w = self.lattice_gf(ik, mu, iw_or_w="w", beta=beta, G_w = self.lattice_gf(ik, mu, iw_or_w="w", beta=beta,
broadening=broadening, mesh=mesh, with_Sigma=with_Sigma) broadening=broadening, mesh=mesh, with_Sigma=with_Sigma)
A_kw = [numpy.zeros((self.n_orbitals[ik][isp], self.n_orbitals[ik][isp], n_om), dtype=numpy.complex_) A_kw = [numpy.zeros((self.n_orbitals[ik][isp], self.n_orbitals[ik][isp], n_om), dtype=complex)
for isp in range(n_inequiv_spin_blocks)] for isp in range(n_inequiv_spin_blocks)]
for isp in range(n_inequiv_spin_blocks): for isp in range(n_inequiv_spin_blocks):

View File

@ -105,7 +105,7 @@ else:
for conjugate in conjugate_values: for conjugate in conjugate_values:
# construct a random block-diagonal Hloc # construct a random block-diagonal Hloc
Hloc = np.zeros((10,10), dtype=np.complex_) Hloc = np.zeros((10,10), dtype=complex)
# the Hloc of the first three 2x2 blocks is equal # the Hloc of the first three 2x2 blocks is equal
Hloc0 = get_random_hermitian(2) Hloc0 = get_random_hermitian(2)
Hloc[:2,:2] = Hloc0 Hloc[:2,:2] = Hloc0

View File

@ -20,7 +20,7 @@ def get_random_transformation(dim):
return T return T
# construct a random block-diagonal Hloc # construct a random block-diagonal Hloc
Hloc = np.zeros((10,10), dtype=np.complex_) Hloc = np.zeros((10,10), dtype=complex)
# the Hloc of the first three 2x2 blocks is equal # the Hloc of the first three 2x2 blocks is equal
Hloc0 = get_random_hermitian(2) Hloc0 = get_random_hermitian(2)
Hloc[:2,:2] = Hloc0 Hloc[:2,:2] = Hloc0
@ -88,7 +88,7 @@ Gt = BlockGf(name_block_generator = [(name,
n_points=len(block.mesh), n_points=len(block.mesh),
indices=block.indices)) for name, block in G], make_copies=False) indices=block.indices)) for name, block in G], make_copies=False)
known_moments = np.zeros((2,10,10), dtype=np.complex) known_moments = np.zeros((2,10,10), dtype=complex)
known_moments[1,:] = np.eye(10) known_moments[1,:] = np.eye(10)
tail, err = fit_tail(G['ud'], known_moments) tail, err = fit_tail(G['ud'], known_moments)
Gt['ud'].set_from_fourier(G['ud'], tail) Gt['ud'].set_from_fourier(G['ud'], tail)

View File

@ -29,7 +29,7 @@ class TestBlockMap(mytest.MyTestCase):
self.mock_eigvals = np.zeros((1, 11, 1)) self.mock_eigvals = np.zeros((1, 11, 1))
nproj = 16 nproj = 16
self.mock_plo = np.zeros((nproj, 1, 1, 11), dtype=np.complex128) self.mock_plo = np.zeros((nproj, 1, 1, 11), dtype=complex)
self.mock_proj_params = [{} for i in range(nproj)] self.mock_proj_params = [{} for i in range(nproj)]
ip = 0 ip = 0
# Mock d-sites # Mock d-sites

View File

@ -73,7 +73,7 @@ class TestProjectorGroupCompl(mytest.MyTestCase):
bmax = self.proj_gr.ib_win[ik, isp, 1]+1 bmax = self.proj_gr.ib_win[ik, isp, 1]+1
nb = bmax - bmin nb = bmax - bmin
p_mat = np.zeros((ndim, nb), dtype=np.complex128) p_mat = np.zeros((ndim, nb), dtype=complex)
#print(bmin,bmax,nb) #print(bmin,bmax,nb)
# Combine all projectors of the group to one block projector # Combine all projectors of the group to one block projector
for bl_map in block_maps: for bl_map in block_maps: