3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-21 20:03:41 +01:00

Minor clean up.

This commit is contained in:
Priyanka Seth 2015-02-10 16:35:12 +01:00
parent 4abd04bbee
commit 674059506f
3 changed files with 38 additions and 64 deletions

View File

@ -41,8 +41,8 @@ class Wien2kConverter(ConverterTools):
"""
assert type(filename)==StringType, "Please provide the DFT files' base name as a string."
if hdf_filename is None: hdf_filename = filename
self.hdf_file = hdf_filename+'.h5'
if hdf_filename is None: hdf_filename = filename+'.h5'
self.hdf_file = hdf_filename
self.dft_file = filename+'.ctqmcout'
self.symmcorr_file = filename+'.symqmc'
self.parproj_file = filename+'.parproj'

View File

@ -845,31 +845,6 @@ class SumkDFT:
# FIXME LEAVE UNDOCUMENTED
################
# FIXME Merge with calc_mu?
def calc_mu_nonint(self, dens_req, orb = None, precision = 0.01):
def F(mu):
gnonint = self.extract_G_loc(mu = mu, with_Sigma = False)
if orb is None:
dens = 0.0
for ish in range(self.n_inequiv_shells):
dens += gnonint[ish].total_density()
else:
dens = gnonint[orb].total_density()
return dens
self.chemical_potential = dichotomy.dichotomy(function = F,
x_init = self.chemical_potential, y_value = dens_req,
precision_on_y = precision, delta_x = 0.5, max_loops = 100,
x_name = "Chemical Potential", y_name = "Total Density",
verbosity = 3)[0]
return self.chemical_potential
def calc_dc_for_density(self,orb,dc_init,dens_mat,density=None,precision=0.01):
"""Searches for DC in order to fulfill charge neutrality.
If density is given, then DC is set such that the LOCAL charge of orbital

View File

@ -40,6 +40,16 @@ class SumkDFTTools(SumkDFT):
misc_data=misc_data)
def read_parproj_input_from_hdf(self):
"""
Reads the data for the partial projectors from the HDF file
"""
things_to_read = ['dens_mat_below','n_parproj','proj_mat_all','rot_mat_all','rot_mat_all_time_inv']
value_read = self.read_input_from_hdf(subgrp=self.parproj_data,things_to_read = things_to_read)
return value_read
def check_input_dos(self, om_min, om_max, n_om, beta=10, broadening=0.01):
delta_om = (om_max-om_min)/(n_om-1)
@ -115,19 +125,6 @@ class SumkDFTTools(SumkDFT):
f.close()
def read_parproj_input_from_hdf(self):
"""
Reads the data for the partial projectors from the HDF file
"""
things_to_read = ['dens_mat_below','n_parproj','proj_mat_all','rot_mat_all','rot_mat_all_time_inv']
value_read = self.read_input_from_hdf(subgrp=self.parproj_data,things_to_read = things_to_read)
return value_read
def dos_partial(self,broadening=0.01):
"""calculates the orbitally-resolved DOS"""
@ -218,11 +215,8 @@ class SumkDFTTools(SumkDFT):
f.close()
def spaghettis(self,broadening,shift=0.0,plot_range=None, ishell=None, invert_Akw=False, fermi_surface=False):
""" Calculates the correlated band structure with a real-frequency self energy.
ATTENTION: Many things from the original input file are overwritten!!!"""
""" Calculates the correlated band structure with a real-frequency self energy."""
assert hasattr(self,"Sigma_imp_w"), "spaghettis: Set Sigma_imp_w first."
things_to_read = ['n_k','n_orbitals','proj_mat','hopping','n_parproj','proj_mat_all']
@ -233,26 +227,6 @@ class SumkDFTTools(SumkDFT):
# FIXME CAN REMOVE?
# print hamiltonian for checks:
if self.SP == 1 and self.SO == 0:
f1=open('hamup.dat','w')
f2=open('hamdn.dat','w')
for ik in range(self.n_k):
for i in range(self.n_orbitals[ik,0]):
f1.write('%s %s\n'%(ik,self.hopping[ik,0,i,i].real))
for i in range(self.n_orbitals[ik,1]):
f2.write('%s %s\n'%(ik,self.hopping[ik,1,i,i].real))
f1.write('\n')
f2.write('\n')
f1.close()
f2.close()
else:
f=open('ham.dat','w')
for ik in range(self.n_k):
for i in range(self.n_orbitals[ik,0]):
f.write('%s %s\n'%(ik,self.hopping[ik,0,i,i].real))
f.write('\n')
f.close()
#=========================================
@ -451,6 +425,31 @@ class SumkDFTTools(SumkDFT):
return dens_mat
def print_hamiltonian(self):
""" Print Hamiltonian for checks."""
if self.SP == 1 and self.SO == 0:
f1=open('hamup.dat','w')
f2=open('hamdn.dat','w')
for ik in range(self.n_k):
for i in range(self.n_orbitals[ik,0]):
f1.write('%s %s\n'%(ik,self.hopping[ik,0,i,i].real))
for i in range(self.n_orbitals[ik,1]):
f2.write('%s %s\n'%(ik,self.hopping[ik,1,i,i].real))
f1.write('\n')
f2.write('\n')
f1.close()
f2.close()
else:
f=open('ham.dat','w')
for ik in range(self.n_k):
for i in range(self.n_orbitals[ik,0]):
f.write('%s %s\n'%(ik,self.hopping[ik,0,i,i].real))
f.write('\n')
f.close()
# ----------------- transport -----------------------
def read_transport_input_from_hdf(self):