Skip to content

Commit

Permalink
fix: np.int / np.float / np. complex are depracted (np v1.20) / remov…
Browse files Browse the repository at this point in the history
…ed (np v1.24)
  • Loading branch information
the-hampel committed Jan 25, 2023
1 parent 9d1f822 commit a9e99f2
Show file tree
Hide file tree
Showing 19 changed files with 158 additions and 158 deletions.
34 changes: 17 additions & 17 deletions doc/h5structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ calculation. The default name of this group is `dft_input`. Its contents are
================= ====================================================================== =====================================================================================
Name Type Meaning
================= ====================================================================== =====================================================================================
energy_unit numpy.float Unit of energy used for the calculation.
n_k numpy.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,
energy_unit float Unit of energy used for the calculation.
n_k int Number of k-points used for the BZ integration.
k_dep_projection int 1 if the dimension of the projection operators depend on the k-point,
0 otherwise.
SP numpy.int 1 for spin-polarised Hamiltonian, 0 for paramagnetic Hamiltonian.
SO numpy.int 1 if spin-orbit interaction is included, 0 otherwise.
charge_below numpy.float Number of electrons in the crystal below the correlated orbitals.
SP int 1 for spin-polarised Hamiltonian, 0 for paramagnetic Hamiltonian.
SO int 1 if spin-orbit interaction is included, 0 otherwise.
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
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`.
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.
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!
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.
Expand All @@ -46,33 +46,33 @@ 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.
e.g. for two equivalent atoms in the unit cell, `atom` runs from 0 to 1,
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.
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
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
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
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`.
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
['atom', 'sort', 'l', 'dim', 'SO', 'irrep'].
'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.
'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`.
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.
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.
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.
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.
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).
Expand Down
2 changes: 1 addition & 1 deletion python/triqs_dft_tools/block_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def create_gf(self, ish=0, gf_function=GfImFreq, space='solver', **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.
For ``space='solver'``, the structure is according to
Expand Down
22 changes: 11 additions & 11 deletions python/triqs_dft_tools/converters/elk.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def update_so_quatities(self,n_shells,shells,n_corr_shells,corr_shells,n_inequiv
n_orbitals=n_orbitals[:,:1]
#Resize proj_mat, mat, T
#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):
#update proj_mat
for ik in range(n_k):
Expand All @@ -206,7 +206,7 @@ def update_so_quatities(self,n_shells,shells,n_corr_shells,corr_shells,n_inequiv
#size of each quadrant in the lm symmetry array.
size=int(0.5*corr_shells[ish]['dim'])
#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):
#expand size of array
mat[isym][ish]=numpy.lib.pad(mat[isym][ish],((0,size),(0,size)),'constant',constant_values=(0.0))
Expand All @@ -233,7 +233,7 @@ def sort_dft_eigvalues(self,n_spin_blocs,SO,n_k,n_orbitals,band_window,en,energy
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
for isp in range(n_spin_blocs):
#loop over k-points
Expand Down Expand Up @@ -295,7 +295,7 @@ def convert_dft_input(self):
mpi.report("Reading %s and EFERMI.OUT" % self.eval_file)
[en,occ,nstsv]=read_Elk.read_eig(self)
#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)")
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)
Expand Down Expand Up @@ -349,7 +349,7 @@ def convert_dft_input(self):
#require a symmetry matrix to rotate from jatom to iatom. Below finds the non inversion
#symmetric matrices which were used in calculating the projectors
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):
#incrsh = corr_to_inequiv[icrsh]
#iatom = corr_shells[incrsh]['atom']
Expand Down Expand Up @@ -407,7 +407,7 @@ def convert_dft_input(self):
symm_subgrp=self.symmcorr_subgrp
#Elk does not use time inversion symmetry
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)]
#Save all the symmetry data
if not (symm_subgrp in ar):
Expand Down Expand Up @@ -465,15 +465,15 @@ def convert_bands_input(self):
en=numpy.loadtxt('BAND.OUT')
nstsv=int(len(en[:,1])/n_k)
#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
for ist in range(nstsv):
for ik in range(n_k):
entmp[ik,ist]=en[enj,1]
enj+=1
del en
#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)")
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)
Expand Down Expand Up @@ -546,7 +546,7 @@ def convert_fs_input(self):
[bz_weights,vkl]=read_Elk.read_kpoints(self,filext=filext)

#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)")
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)
Expand Down Expand Up @@ -615,7 +615,7 @@ def dft_band_characters(self):
[bc,maxlm] = read_Elk.read_bc(self)
#set up SO bc array
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.
tmp[0:maxlm,0,:,:,:]=bc[0:maxlm,0,:,:,:]
tmp[maxlm:2*maxlm,0,:,:,:]=bc[0:maxlm,1,:,:,:]
Expand All @@ -626,7 +626,7 @@ def dft_band_characters(self):

#reduce bc matrix to band states stored in hdf file
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 isp in range(n_spin_blocs):
nst=self.n_orbitals[ik,isp]
Expand Down
22 changes: 11 additions & 11 deletions python/triqs_dft_tools/converters/elktools/elk_converter_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def rotaxang(self,rot):
routine.
"""
eps=1E-8
v=numpy.zeros([3], numpy.float_)
v=numpy.zeros([3], float)
# find the determinant
det=numpy.linalg.det(rot)
if (abs(det-1.0)<eps):
Expand Down Expand Up @@ -100,7 +100,7 @@ def axangsu2(self,v,th):
"""
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))
if(t1<1E-8):
raise "sym_converter : zero length axis vector!"
Expand Down Expand Up @@ -143,12 +143,12 @@ def gen_perm(self,nsym,ns,na,natmtot,symmat,tr,atpos,epslat=1E-6):
perm=[]
iea=[]
for isym in range(nsym):
iea.append(numpy.zeros([natmtot,ns], numpy.int_))
iea.append(numpy.zeros([natmtot,ns], int))
#loop over species
for js in range(ns):
#loop over species atoms
v=numpy.zeros([3,na[js]], numpy.float_)
v2=numpy.zeros(3, numpy.float_)
v=numpy.zeros([3,na[js]], float)
v2=numpy.zeros(3, float)
for ia in range(na[js]):
v[:,ia]=self.v3frac(atpos[js][ia][0:3],epslat)
for ia in range(na[js]):
Expand Down Expand Up @@ -180,14 +180,14 @@ def symlat_to_complex_harmonics(self,nsym,n_shells,symlat,shells):
#need SciPy routines to get Euler angles - need version 1.4+
#from scipy.spatial.transform import Rotation as R
symmat=[]
rot=numpy.identity(3, numpy.float_)
angi=numpy.zeros(3, numpy.float_)
rot=numpy.identity(3, float)
angi=numpy.zeros(3, float)
#loop over symmetries
for isym in range(nsym):
symmat.append([])
for ish in range(n_shells):
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
det=numpy.linalg.det(symlat[isym])
p=1
Expand Down Expand Up @@ -217,7 +217,7 @@ def zyz_euler(self,rot):
"""
eps=1E-8
pi=numpy.pi
ang=numpy.zeros(3, numpy.float_)
ang=numpy.zeros(3, float)
#get the Euler angles
if((abs(rot[2,0])>eps) or (abs(rot[2,1])>eps)):
ang[0]=numpy.arctan2(rot[2,1],rot[2,0])
Expand All @@ -243,7 +243,7 @@ def ylmrot(self,p,angi,l):
calculates the rotation matrix in complex spherical harmonics for l.
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
dy=self.ylmroty(angi[1],l)
# apply inversion to odd l values if required
Expand All @@ -268,7 +268,7 @@ def ylmroty(self,beta,l):
#import the factorial function - needed for later versions of scipy (needs testing)
from scipy import special as spec
#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
cb=numpy.cos(beta/2.0)
sb=numpy.sin(beta/2.0)
Expand Down
Loading

0 comments on commit a9e99f2

Please sign in to comment.