3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-01 02:45:33 +02:00

Change execs to setattr, getattr, etc

This commit is contained in:
Priyanka Seth 2014-10-31 18:52:32 +01:00
parent abd087e674
commit 9793daf86b
8 changed files with 108 additions and 193 deletions

Binary file not shown.

View File

@ -1,2 +1,19 @@
* realfreq --> w?
* matsubara --> iw?
Changed the following:
* <<= --> <<
* retval -> read_value
* Gupf -> G_upfold
* read_symmetry_input -> convert_symmetry_input
* moved find_dc, find_mu_nonint, check_projectors, sorts_of_atoms,
number_of_atoms to end, not to be documented.
* replaced all instances of
exec "self.%s = mpi.bcast(self.%s)"%(it,it)
with
setattr(self,it,mpi.bcast(getattr(self,it))
* replaced long archive saves in converters by setattr construction
* removed G_upfolded_id -- looked redundant

View File

@ -76,6 +76,7 @@ def U_matrix_kanamori(n_orb, U_int, J_hund):
return U, Uprime
#FIXME WIEN CONVENTION first eg then t2g
# Get t2g or eg components
def t2g_submatrix(U):
"""Return only the t2g part of the full d-manifold two- or four-index U matrix."""

View File

@ -169,7 +169,7 @@ class HkConverter:
for isp in range(n_spin_blocs):
for ik in xrange(n_k) :
no = n_orbitals[ik,isp]
# IF TRUE, FIRST READ ALL REAL COMPONENTS OF ONE kPOINT, OTHERWISE TUPLE OF real,im
if (first_real_part_matrix):
for i in xrange(no):
@ -201,18 +201,9 @@ class HkConverter:
hopping[ik,isp,i,j] += R.next() * 1j
if ((only_upper_triangle)and(i!=j)): hopping[ik,isp,j,i] = hopping[ik,isp,i,j].conjugate()
# keep some things that we need for reading parproj:
self.n_shells = n_shells
self.shells = shells
self.n_corr_shells = n_corr_shells
self.corr_shells = corr_shells
self.n_spin_blocs = n_spin_blocs
self.n_orbitals = n_orbitals
self.n_k = n_k
self.SO = SO
self.SP = SP
self.energy_unit = energy_unit
things_to_set = ['n_shells','shells','n_corr_shells','corr_shells','n_spin_blocs','n_orbitals','n_k','SO','SP','energy_unit']
for it in things_to_set: setattr(self,it,locals()[it])
except StopIteration : # a more explicit error if the file is corrupted.
raise "HK Converter : reading file lda_file failed!"
@ -224,32 +215,11 @@ class HkConverter:
if not (self.lda_subgrp in ar): ar.create_group(self.lda_subgrp)
# The subgroup containing the data. If it does not exist, it is created.
# If it exists, the data is overwritten!!!
ar[self.lda_subgrp]['energy_unit'] = energy_unit
ar[self.lda_subgrp]['n_k'] = n_k
ar[self.lda_subgrp]['k_dep_projection'] = k_dep_projection
ar[self.lda_subgrp]['SP'] = SP
ar[self.lda_subgrp]['SO'] = SO
ar[self.lda_subgrp]['charge_below'] = charge_below
ar[self.lda_subgrp]['density_required'] = density_required
ar[self.lda_subgrp]['symm_op'] = symm_op
ar[self.lda_subgrp]['n_shells'] = n_shells
ar[self.lda_subgrp]['shells'] = shells
ar[self.lda_subgrp]['n_corr_shells'] = n_corr_shells
ar[self.lda_subgrp]['corr_shells'] = corr_shells
ar[self.lda_subgrp]['use_rotations'] = use_rotations
ar[self.lda_subgrp]['rot_mat'] = rot_mat
ar[self.lda_subgrp]['rot_mat_time_inv'] = rot_mat_time_inv
ar[self.lda_subgrp]['n_reps'] = n_reps
ar[self.lda_subgrp]['dim_reps'] = dim_reps
ar[self.lda_subgrp]['T'] = T
ar[self.lda_subgrp]['n_orbitals'] = n_orbitals
ar[self.lda_subgrp]['proj_mat'] = proj_mat
ar[self.lda_subgrp]['bz_weights'] = bz_weights
ar[self.lda_subgrp]['hopping'] = hopping
del ar
things_to_save = ['energy_unit','n_k','k_dep_projection','SP','SO','charge_below','density_required',
'symm_op','n_shells','shells','n_corr_shells','corr_shells','use_rotations','rot_mat',
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping']
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
del ar
@ -300,4 +270,3 @@ class HkConverter:
self.n_inequiv_corr_shells += 1
tmp.append( lst[i+1][1:3] )
self.invshellmap.append(i+1)

View File

@ -191,16 +191,8 @@ class Wien2kConverter:
hopping[ik,isp,i,i] = R.next() * energy_unit
# keep some things that we need for reading parproj:
self.n_shells = n_shells
self.shells = shells
self.n_corr_shells = n_corr_shells
self.corr_shells = corr_shells
self.n_spin_blocs = n_spin_blocs
self.n_orbitals = n_orbitals
self.n_k = n_k
self.SO = SO
self.SP = SP
self.energy_unit = energy_unit
things_to_set = ['n_shells','shells','n_corr_shells','corr_shells','n_spin_blocs','n_orbitals','n_k','SO','SP','energy_unit']
for it in things_to_set: setattr(self,it,locals()[it])
except StopIteration : # a more explicit error if the file is corrupted.
raise "Wien2k_converter : reading file lda_file failed!"
@ -212,35 +204,16 @@ class Wien2kConverter:
if not (self.lda_subgrp in ar): ar.create_group(self.lda_subgrp)
# The subgroup containing the data. If it does not exist, it is created.
# If it exists, the data is overwritten!!!
ar[self.lda_subgrp]['energy_unit'] = energy_unit
ar[self.lda_subgrp]['n_k'] = n_k
ar[self.lda_subgrp]['k_dep_projection'] = k_dep_projection
ar[self.lda_subgrp]['SP'] = SP
ar[self.lda_subgrp]['SO'] = SO
ar[self.lda_subgrp]['charge_below'] = charge_below
ar[self.lda_subgrp]['density_required'] = density_required
ar[self.lda_subgrp]['symm_op'] = symm_op
ar[self.lda_subgrp]['n_shells'] = n_shells
ar[self.lda_subgrp]['shells'] = shells
ar[self.lda_subgrp]['n_corr_shells'] = n_corr_shells
ar[self.lda_subgrp]['corr_shells'] = corr_shells
ar[self.lda_subgrp]['use_rotations'] = use_rotations
ar[self.lda_subgrp]['rot_mat'] = rot_mat
ar[self.lda_subgrp]['rot_mat_time_inv'] = rot_mat_time_inv
ar[self.lda_subgrp]['n_reps'] = n_reps
ar[self.lda_subgrp]['dim_reps'] = dim_reps
ar[self.lda_subgrp]['T'] = T
ar[self.lda_subgrp]['n_orbitals'] = n_orbitals
ar[self.lda_subgrp]['proj_mat'] = proj_mat
ar[self.lda_subgrp]['bz_weights'] = bz_weights
ar[self.lda_subgrp]['hopping'] = hopping
things_to_save = ['energy_unit','n_k','k_dep_projection','SP','SO','charge_below','density_required',
'symm_op','n_shells','shells','n_corr_shells','corr_shells','use_rotations','rot_mat',
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','bz_weights','hopping']
for it in things_to_save: ar[self.lda_subgrp][it] = locals()[it]
del ar
# Symmetries are used,
# Now do the symmetries for correlated orbitals:
self.read_symmetry_input(orbits=corr_shells,symm_file=self.symm_file,symm_subgrp=self.symm_subgrp,SO=SO,SP=SP)
self.convert_symmetry_input(orbits=corr_shells,symm_file=self.symm_file,symm_subgrp=self.symm_subgrp,SO=SO,SP=SP)
def convert_parproj_input(self, par_proj_subgrp='SumK_LDA_ParProj', symm_par_subgrp='SymmPar'):
@ -318,13 +291,13 @@ class Wien2kConverter:
if not (self.par_proj_subgrp in ar): ar.create_group(self.par_proj_subgrp)
# The subgroup containing the data. If it does not exist, it is created.
# If it exists, the data is overwritten!!!
thingstowrite = ['dens_mat_below','n_parproj','proj_mat_pc','rot_mat_all','rot_mat_all_time_inv']
for it in thingstowrite: exec "ar['%s']['%s'] = %s"%(self.par_proj_subgrp,it,it)
things_to_save = ['dens_mat_below','n_parproj','proj_mat_pc','rot_mat_all','rot_mat_all_time_inv']
for it in things_to_save: ar[self.par_proj_subgrp][it] = locals()[it]
del ar
# Symmetries are used,
# Now do the symmetries for all orbitals:
self.read_symmetry_input(orbits=self.shells,symm_file=self.symmpar_file,symm_subgrp=self.symm_par_subgrp,SO=self.SO,SP=self.SP)
self.convert_symmetry_input(orbits=self.shells,symm_file=self.symmpar_file,symm_subgrp=self.symm_par_subgrp,SO=self.SO,SP=self.SP)
def convert_bands_input(self, bands_subgrp = 'SumK_LDA_Bands'):
@ -411,15 +384,13 @@ class Wien2kConverter:
# The subgroup containing the data. If it does not exist, it is created.
# If it exists, the data is overwritten!!!
thingstowrite = ['n_k','n_orbitals','proj_mat','hopping','n_parproj','proj_mat_pc']
for it in thingstowrite: exec "ar['%s']['%s'] = %s"%(self.bands_subgrp,it,it)
things_to_save = ['n_k','n_orbitals','proj_mat','hopping','n_parproj','proj_mat_pc']
for it in things_to_save: ar[self.bands_subgrp][it] = locals()[it]
del ar
def read_symmetry_input(self, orbits, symm_file, symm_subgrp, SO, SP):
def convert_symmetry_input(self, orbits, symm_file, symm_subgrp, SO, SP):
"""
Reads input for the symmetrisations from symm_file, which is case.sympar or case.symqmc.
"""
@ -453,9 +424,6 @@ class Wien2kConverter:
for j in xrange(orbits[orb][3]):
mat[in_s][orb][i,j] += 1j * R.next() # imaginary part
# determine the inequivalent shells:
#SHOULD BE FINALLY REMOVED, PUT IT FOR ALL ORBITALS!!!!! (PS: FIXME?)
#self.inequiv_shells(orbits)
mat_tinv = [numpy.identity(orbits[orb][3],numpy.complex_)
for orb in range(n_orbits)]
@ -479,8 +447,8 @@ class Wien2kConverter:
# Save it to the HDF:
ar=HDFArchive(self.hdf_file,'a')
if not (symm_subgrp in ar): ar.create_group(symm_subgrp)
thingstowrite = ['n_s','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
for it in thingstowrite: exec "ar['%s']['%s'] = %s"%(symm_subgrp,it,it)
things_to_save = ['n_s','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
for it in things_to_save: ar[symm_subgrp][it] = locals()[it]
del ar
@ -531,4 +499,3 @@ class Wien2kConverter:
self.n_inequiv_corr_shells += 1
tmp.append( lst[i+1][1:3] )
self.invshellmap.append(i+1)

View File

@ -27,10 +27,6 @@ import pytriqs.utility.dichotomy as dichotomy
from pytriqs.gf.local import *
from pytriqs.archive import *
import pytriqs.utility.mpi as mpi
from math import cos,sin
# FIXME PS: This isn't used it seems
# from pytriqs.operators.operators2 import *
class SumkLDA:
"""This class provides a general SumK method for combining ab-initio code and pytriqs."""
@ -133,9 +129,9 @@ class SumkLDA:
"""
read_value = True
# init variables on all nodes:
for it in things_to_read: exec "self.%s = 0"%it
for it in optional_things: exec "self.%s = 0"%it
# init variables on all nodes to ensure mpi broadcast works at the end
for it in things_to_read: setattr(self,it,0)
for it in optional_things: setattr(self,it,0)
if (mpi.is_master_node()):
ar=HDFArchive(self.hdf_file,'a')
@ -143,7 +139,7 @@ class SumkLDA:
# first read the necessary things:
for it in things_to_read:
if (it in ar[subgrp]):
exec "self.%s = ar['%s']['%s']"%(it,subgrp,it)
setattr(self,it,ar[subgrp][it])
else:
mpi.report("Loading %s failed!"%it)
read_value = False
@ -153,7 +149,7 @@ class SumkLDA:
read_value = {}
for it in optional_things:
if (it in ar[subgrp]):
exec "self.%s = ar['%s']['%s']"%(it,subgrp,it)
setattr(self,it,ar[subgrp][it])
read_value['%s'%it] = True
else:
read_value['%s'%it] = False
@ -164,9 +160,8 @@ class SumkLDA:
del ar
# now do the broadcasting:
for it in things_to_read: exec "self.%s = mpi.bcast(self.%s)"%(it,it)
for it in optional_things: exec "self.%s = mpi.bcast(self.%s)"%(it,it)
for it in things_to_read: setattr(self,it,mpi.bcast(getattr(self,it)))
for it in optional_things: setattr(self,it,mpi.bcast(getattr(self,it)))
read_value = mpi.bcast(read_value)
@ -178,11 +173,9 @@ class SumkLDA:
"""Saves some quantities into an HDF5 arxiv"""
if not (mpi.is_master_node()): return # do nothing on nodes
ar=HDFArchive(self.hdf_file,'a')
ar[self.lda_data]['chemical_potential'] = self.chemical_potential
ar[self.lda_data]['dc_energ'] = self.dc_energ
ar[self.lda_data]['dc_imp'] = self.dc_imp
things_to_save=['chemical_potential','dc_imp','dc_energ']
for it in things_to_save: ar[self.lda_data][it] = getattr(self,it)
del ar
@ -190,7 +183,6 @@ class SumkLDA:
"""Loads some quantities from an HDF5 arxiv"""
things_to_read=['chemical_potential','dc_imp','dc_energ']
read_value = self.read_input_from_hdf(subgrp=self.lda_data,things_to_read=things_to_read)
return read_value
@ -259,51 +251,17 @@ class SumkLDA:
if (with_Sigma):
stmp = self.add_dc()
beta = self.Sigma_imp[0].mesh.beta #override beta if Sigma is present
beta = self.Sigma_imp[0].mesh.beta # override beta if Sigma is present
#
# if (self.G_upfold is None):
# # first setting up of G_upfold
# BS = [ range(self.n_orbitals[ik,ntoi[ib]]) for ib in bln ]
# gf_struct = [ (bln[ib], BS[ib]) for ib in range(self.n_spin_blocks_gf[self.SO]) ]
# a_list = [a for a,al in gf_struct]
# if (with_Sigma): #take the mesh from Sigma if necessary
# glist = lambda : [ GfImFreq(indices = al, mesh = self.Sigma_imp[0].mesh) for a,al in gf_struct]
# else:
# glist = lambda : [ GfImFreq(indices = al, beta = beta) for a,al in gf_struct]
# self.G_upfold = BlockGf(name_list = a_list, block_list = glist(),make_copies=False)
# self.G_upfold.zero()
# self.G_upfold_id = self.G_upfold.copy()
# self.G_upfold_id << iOmega_n
#
# GFsize = [ gf.N1 for sig,gf in self.G_upfold]
# unchangedsize = all( [ self.n_orbitals[ik,ntoi[bln[ib]]]==GFsize[ib]
# for ib in range(self.n_spin_blocks_gf[self.SO]) ] )
#
# if ((not unchangedsize)or(self.G_upfold.mesh.beta!=beta)):
# BS = [ range(self.n_orbitals[ik,ntoi[ib]]) for ib in bln ]
# gf_struct = [ (bln[ib], BS[ib]) for ib in range(self.n_spin_blocks_gf[self.SO]) ]
# a_list = [a for a,al in gf_struct]
# if (with_Sigma):
# glist = lambda : [ GfImFreq(indices = al, mesh = self.Sigma_imp[0].mesh) for a,al in gf_struct]
# else:
# glist = lambda : [ GfImFreq(indices = al, beta = beta) for a,al in gf_struct]
# self.G_upfold = BlockGf(name_list = a_list, block_list = glist(),make_copies=False)
# self.G_upfold.zero()
# self.G_upfold_id = self.G_upfold.copy()
# self.G_upfold_id << iOmega_n
#
###
# FIXME PS Remove commented out code above if this works
# Do we need to set up G_upfold?
set_up_G_upfold = False
if self.G_upfold == None:
set_up_G_upfold = False # assume not
if self.G_upfold == None: # yes if not G_upfold provided
set_up_G_upfold = True
else:
else: # yes if inconsistencies present in existing G_upfold
GFsize = [ gf.N1 for sig,gf in self.G_upfold]
unchangedsize = all( [ self.n_orbitals[ik,ntoi[bln[ib]]]==GFsize[ib]
for ib in range(self.n_spin_blocks_gf[self.SO]) ] )
if ((not unchangedsize)or(self.G_upfold.mesh.beta!=beta)): set_up_G_upfold = True
if ( (not unchangedsize) or (self.G_upfold.mesh.beta != beta) ): set_up_G_upfold = True
# Set up G_upfold
if set_up_G_upfold:
@ -316,13 +274,9 @@ class SumkLDA:
glist = lambda : [ GfImFreq(indices = al, beta = beta) for a,al in gf_struct]
self.G_upfold = BlockGf(name_list = a_list, block_list = glist(),make_copies=False)
self.G_upfold.zero()
self.G_upfold_id = self.G_upfold.copy()
self.G_upfold_id << iOmega_n
###
self.G_upfold << iOmega_n
idmat = [numpy.identity(self.n_orbitals[ik,ntoi[bl]],numpy.complex_) for bl in bln]
self.G_upfold << self.G_upfold_id
M = copy.deepcopy(idmat)
for ibl in range(self.n_spin_blocks_gf[self.SO]):
ind = ntoi[bln[ibl]]
@ -868,33 +822,6 @@ class SumkLDA:
return self.chemical_potential
#FIXME NOT USED!
def find_mu_nonint(self, dens_req, orb = None, beta = 40, precision = 0.01):
def F(mu):
#gnonint = self.nonint_G(beta=beta,mu=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_corr_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= "Local Density",
verbosity = 3)[0]
return self.chemical_potential
def extract_G_loc(self, mu=None, with_Sigma = True):
"""
extracts the local downfolded Green function at the chemical potential of the class.
@ -1073,6 +1000,32 @@ class SumkLDA:
# FIXME LEAVE UNDOCUMENTED
################
def find_mu_nonint(self, dens_req, orb = None, beta = 40, precision = 0.01):
def F(mu):
#gnonint = self.nonint_G(beta=beta,mu=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_corr_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= "Local Density",
verbosity = 3)[0]
return self.chemical_potential
def find_dc(self,orb,guess,dens_mat,dens_req=None,precision=0.01):
"""Searches for DC in order to fulfill charge neutrality.
If dens_req is given, then DC is set such that the LOCAL charge of orbital

View File

@ -242,8 +242,8 @@ class SumkLDATools(SumkLDA):
Reads the data for the partial projectors from the HDF file
"""
thingstoread = ['dens_mat_below','n_parproj','proj_mat_pc','rot_mat_all','rot_mat_all_time_inv']
read_value = self.read_input_from_hdf(subgrp=self.par_proj_data,things_to_read = thingstoread)
things_to_read = ['dens_mat_below','n_parproj','proj_mat_pc','rot_mat_all','rot_mat_all_time_inv']
read_value = self.read_input_from_hdf(subgrp=self.par_proj_data,things_to_read = things_to_read)
return read_value
@ -253,8 +253,8 @@ class SumkLDATools(SumkLDA):
assert hasattr(self,"Sigma_imp"), "Set Sigma First!!"
#thingstoread = ['Dens_Mat_below','N_parproj','Proj_Mat_pc','rotmat_all']
#read_value = self.read_input_from_HDF(SubGrp=self.par_proj_data, thingstoread=thingstoread)
#things_to_read = ['Dens_Mat_below','N_parproj','Proj_Mat_pc','rotmat_all']
#read_value = self.read_input_from_HDF(SubGrp=self.par_proj_data, things_to_read=things_to_read)
read_value = self.read_par_proj_input_from_hdf()
if not read_value: return read_value
if self.symm_op: self.Symm_par = Symmetry(self.hdf_file,subgroup=self.symm_par_data)
@ -347,12 +347,13 @@ class SumkLDATools(SumkLDA):
ATTENTION: Many things from the original input file are are overwritten!!!"""
assert hasattr(self,"Sigma_imp"), "Set Sigma First!!"
thingstoread = ['n_k','n_orbitals','proj_mat','hopping','n_parproj','proj_mat_pc']
read_value = self.read_input_from_hdf(subgrp=self.bands_data,things_to_read=thingstoread)
things_to_read = ['n_k','n_orbitals','proj_mat','hopping','n_parproj','proj_mat_pc']
read_value = self.read_input_from_hdf(subgrp=self.bands_data,things_to_read=things_to_read)
if not read_value: return read_value
if fermi_surface: ishell=None
# FIXME CAN REMOVE?
# print hamiltonian for checks:
if ((self.SP==1)and(self.SO==0)):
f1=open('hamup.dat','w')
@ -422,7 +423,7 @@ class SumkLDATools(SumkLDA):
for sig,gf in S: Akw[sig][ik,0] += gf.data[iom,:,:].imag.trace()/(-3.1415926535) * (M[1]-M[0])
else:
for sig,gf in S: Akw[sig][ik,iom] += gf.data[iom,:,:].imag.trace()/(-3.1415926535)
Akw[sig][ik,iom] += ik*shift # shift Akw for plotting in xmgrace
Akw[sig][ik,iom] += ik*shift # shift Akw for plotting in xmgrace -- REMOVE
else:
@ -433,6 +434,7 @@ class SumkLDATools(SumkLDA):
for sig,gf in tmp: tmp[sig] << self.downfold_pc(ik,ir,ishell,sig,S[sig],gf)
Gproj += tmp
# FIXME NEED TO READ IN ROTMAT_ALL FROM PARPROJ SUBGROUP, REPLACE ROTLOC WITH ROTLOC_ALL
# TO BE FIXED:
# rotate to local frame
#if (self.use_rotations):
@ -506,7 +508,7 @@ class SumkLDATools(SumkLDA):
f.close()
# FIXME MOVE OUT OF HERE! THIS IS TEXT FILE READING!
def constr_Sigma_real_axis(self, filename, hdf=True, hdf_dataset='SigmaReFreq',n_om=0,orb=0, tol_mesh=1e-6):
"""Uses Data from files to construct Sigma (or GF) on the real axis."""
@ -572,6 +574,12 @@ class SumkLDATools(SumkLDA):
ar = HDFArchive(filename)
SigmaME = ar[hdf_dataset]
del ar
#OTHER SOLUTION FIXME
#else:
# SigmaME=0
#SigmaME = mpi.broadcast..
# we need some parameters to construct Sigma on other nodes
omega_min=SigmaME.mesh.omega_min
omega_max=SigmaME.mesh.omega_max
@ -600,8 +608,8 @@ class SumkLDATools(SumkLDA):
The theta-projectors are used, hence case.parproj data is necessary"""
#thingstoread = ['Dens_Mat_below','N_parproj','Proj_Mat_pc','rotmat_all']
#read_value = self.read_input_from_HDF(SubGrp=self.par_proj_data,thingstoread=thingstoread)
#things_to_read = ['Dens_Mat_below','N_parproj','Proj_Mat_pc','rotmat_all']
#read_value = self.read_input_from_HDF(SubGrp=self.par_proj_data,things_to_read=things_to_read)
read_value = self.read_par_proj_input_from_hdf()
if not read_value: return read_value
if self.symm_op: self.Symm_par = Symmetry(self.hdf_file,subgroup=self.symm_par_data)

View File

@ -43,8 +43,8 @@ class Symmetry:
"""
assert type(hdf_file)==StringType,"hdf_file must be a filename"; self.hdf_file = hdf_file
thingstoread = ['n_s','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
for it in thingstoread: exec "self.%s = 0"%it
things_to_read = ['n_s','n_atoms','perm','orbits','SO','SP','time_inv','mat','mat_tinv']
for it in things_to_read: setattr(self,it,0)
if (mpi.is_master_node()):
#Read the stuff on master:
@ -54,12 +54,12 @@ class Symmetry:
else:
ar2 = ar[subgroup]
for it in thingstoread: exec "self.%s = ar2['%s']"%(it,it)
for it in things_to_read: setattr(self,it,ar2[it])
del ar2
del ar
#broadcasting
for it in thingstoread: exec "self.%s = mpi.bcast(self.%s)"%(it,it)
# Broadcasting
for it in things_to_read: setattr(self,it,mpi.bcast(getattr(self,it)))
# now define the mapping of orbitals:
# self.map[iorb]=jorb gives the permutation of the orbitals as given in the list, when the
@ -135,7 +135,7 @@ class Symmetry:
self.mat[in_s][iorb].conjugate().transpose()) / self.n_s
# This does not what it is supposed to do, check how this should work:
# Markus: This does not what it is supposed to do, check how this should work (keep for now)
# if ((self.SO==0) and (self.SP==0)):
# # add time inv:
#mpi.report("Add time inversion")