mirror of
https://github.com/triqs/dft_tools
synced 2025-03-14 04:42:04 +01:00
added corr flag to vasp_converter
This commit is contained in:
parent
1dd7552529
commit
3666518bdf
@ -155,10 +155,15 @@ class VaspConverter(ConverterTools):
|
||||
charge_below = 0.0 # This is not defined in VASP interface
|
||||
|
||||
# Note that in the DftTools convention each site gives a separate correlated shell!
|
||||
n_shells = sum([len(sh['ion_list']) for sh in p_shells])
|
||||
n_corr_shells = sum([len(sh['ion_list']) for sh in p_shells])
|
||||
|
||||
shells = []
|
||||
corr_shells = []
|
||||
shion_to_corr_shell = [[] for ish in xrange(len(p_shells))]
|
||||
shion_to_shell = [[] for ish in xrange(len(p_shells))]
|
||||
shorbs_to_globalorbs = [[] for ish in xrange(len(p_shells))]
|
||||
shorbs_to_globalorbs[0] = [0,p_shells[0]['ndim'] ]
|
||||
crshorbs_to_globalorbs = []
|
||||
icsh = 0
|
||||
for ish, sh in enumerate(p_shells):
|
||||
ion_list = sh['ion_list']
|
||||
@ -168,16 +173,25 @@ class VaspConverter(ConverterTools):
|
||||
# We set all sites inequivalent
|
||||
pars['sort'] = sh['ion_sort'][i]
|
||||
pars['l'] = sh['lorb']
|
||||
pars['corr'] = sh['corr']
|
||||
pars['dim'] = sh['ndim']
|
||||
pars['ion_list'] = sh['ion_list']
|
||||
pars['SO'] = SO
|
||||
# TODO: check what 'irep' entry does (it seems to be very specific to dmftproj)
|
||||
pars['irep'] = 0
|
||||
corr_shells.append(pars)
|
||||
shion_to_corr_shell[ish].append(i)
|
||||
|
||||
shells.append(pars)
|
||||
shion_to_shell[ish].append(i)
|
||||
if ish > 0:
|
||||
shorbs_to_globalorbs[ish] = [shorbs_to_globalorbs[ish-1][1],
|
||||
shorbs_to_globalorbs[ish-1][1]+sh['ndim']]
|
||||
if pars['corr']:
|
||||
corr_shells.append(pars)
|
||||
crshorbs_to_globalorbs.append(shorbs_to_globalorbs[ish])
|
||||
|
||||
# TODO: generalize this to the case of multiple shell groups
|
||||
n_shells = n_corr_shells # No non-correlated shells at the moment
|
||||
shells = corr_shells
|
||||
n_corr_shells = len(corr_shells)
|
||||
#n_shells = n_corr_shells # No non-correlated shells at the moment
|
||||
#shells = corr_shells
|
||||
|
||||
# FIXME: atomic sorts in Wien2K are not the same as in VASP.
|
||||
# A symmetry analysis from OUTCAR or symmetry file should be used
|
||||
@ -230,7 +244,7 @@ class VaspConverter(ConverterTools):
|
||||
# Projectors
|
||||
# print n_orbitals
|
||||
# print [crsh['dim'] for crsh in corr_shells]
|
||||
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_all = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, sum([sh['dim'] for sh in shells]), numpy.max(n_orbitals)], numpy.complex_)
|
||||
|
||||
# TODO: implement reading from more than one projector group
|
||||
# In 'dmftproj' each ion represents a separate correlated shell.
|
||||
@ -249,14 +263,28 @@ class VaspConverter(ConverterTools):
|
||||
for isp in xrange(n_spin_blocs):
|
||||
for ik in xrange(n_k):
|
||||
for ion in xrange(len(sh['ion_list'])):
|
||||
icsh = shion_to_corr_shell[ish][ion]
|
||||
for ilm in xrange(sh['ndim']):
|
||||
icsh = shion_to_shell[ish][ion]
|
||||
for ilm in xrange(shorbs_to_globalorbs[ish][0],shorbs_to_globalorbs[ish][1]):
|
||||
for ib in xrange(n_orbitals[ik, isp]):
|
||||
# This is to avoid confusion with the order of arguments
|
||||
pr = rf.next()
|
||||
pi = rf.next()
|
||||
proj_mat[ik, isp, icsh, ilm, ib] = complex(pr, pi)
|
||||
proj_mat_all[ik, isp, icsh, ilm, ib] = complex(pr, pi)
|
||||
|
||||
# now save only projectors with flag 'corr' to proj_mat
|
||||
proj_mat = numpy.zeros([n_k, n_spin_blocs, n_corr_shells, sum([crsh['dim'] for crsh in corr_shells]), numpy.max(n_orbitals)], numpy.complex_)
|
||||
addIndex = 0
|
||||
for ish, corr_shell in enumerate(corr_shells):
|
||||
if True:
|
||||
for isp in xrange(n_spin_blocs):
|
||||
for ik in xrange(n_k):
|
||||
for ion in xrange(len(corr_shell['ion_list'])):
|
||||
icsh = shion_to_shell[ish][ion]
|
||||
|
||||
for iclm,ilm in enumerate(xrange(crshorbs_to_globalorbs[ish][0],crshorbs_to_globalorbs[ish][1])):
|
||||
for ib in xrange(n_orbitals[ik, isp]):
|
||||
proj_mat[ik,isp,icsh,iclm+addIndex,ib] = proj_mat_all[ik,isp,icsh,ilm,ib]
|
||||
addIndex += corr_shell['dim']
|
||||
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:
|
||||
# print "%s:"%(it), locals()[it]
|
||||
@ -274,7 +302,7 @@ class VaspConverter(ConverterTools):
|
||||
# The subgroup containing the data. If it does not exist, it is created. If it exists, the data is overwritten!
|
||||
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',
|
||||
'rot_mat_time_inv','n_reps','dim_reps','T','n_orbitals','proj_mat','proj_mat_all','bz_weights','hopping',
|
||||
'n_inequiv_shells', 'corr_to_inequiv', 'inequiv_to_corr']
|
||||
for it in things_to_save: ar[self.dft_subgrp][it] = locals()[it]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user