[1]:
# useful to autoreload the module without restarting the kernel
%load_ext autoreload
%autoreload 2
[2]:
from mppi import Utilities as U, Parsers as P
import os
Tutorial for the NsdbsParser class
This tutorial describes the usage of the NsdbsParser class, that perform the parsing of the ns.db1 NSCF database created by Yambo in the SAVE folder.
This database collects information about the lattice and electronic properties of the system.
As a first test we consider a Pw nscf computation for GaAs and build the SAVE folder with Yambo
[3]:
source = 'Pw_bands/gaas_nscf.save'
yambo_path = 'Yambo_Nsdbs_gaas'
We create the Yambo SAVE using the functio of the Utilities module
[4]:
U.build_SAVE(source_dir=source,run_dir=yambo_path)
SAVE folder already present in Yambo_Nsdbs_gaas. No operations performed.
We also make a fixsymm to study the content of the ns.db1 database after the fixsym procedure
[5]:
U.make_FixSymm(yambo_path)
FixSymm folder Yambo_Nsdbs_gaas/FixSymm already found. No operations performed.
We parse the ns.db1 database, we also parse the Pw data-file-schema.xml to compare the output of the two
[6]:
pw_data = P.PwParser(os.path.join(source,'data-file-schema.xml'))
yambo_data = P.NsdbsParser(save=os.path.join(yambo_path,'SAVE'))
yambo_data_fixsym = P.NsdbsParser(save=os.path.join(yambo_path,'FixSymm','SAVE'))
Parse file : Pw_bands/gaas_nscf.save/data-file-schema.xml
Parse file : Yambo_Nsdbs_gaas/SAVE/ns.db1
Parse file : Yambo_Nsdbs_gaas/FixSymm/SAVE/ns.db1
We comment on the meaning of some of the attributes of the classes
The number of kpoints (actually in the IBZ since they are reduced by the symmetries of the lattice). If the fixsymm is performed only the simmetries preserved by the external field are mantained
[7]:
print(pw_data.nkpoints)
print(yambo_data.nkpoints)
print(yambo_data_fixsym.nkpoints)
29
29
164
[10]:
print(len(yambo_data.sym))
print(len(yambo_data_fixsym.sym))
48
4
[12]:
sum(pw_data.weights)
[12]:
array([2.])
We compare the values of members and methods in the various cases
[13]:
pw_data.kpoints
[13]:
array([[ 0. , 0. , 0. ],
[-0.125, 0.125, -0.125],
[-0.25 , 0.25 , -0.25 ],
[-0.375, 0.375, -0.375],
[ 0.5 , -0.5 , 0.5 ],
[ 0. , 0.25 , 0. ],
[-0.125, 0.375, -0.125],
[-0.25 , 0.5 , -0.25 ],
[ 0.625, -0.375, 0.625],
[ 0.5 , -0.25 , 0.5 ],
[ 0.375, -0.125, 0.375],
[ 0.25 , 0. , 0.25 ],
[ 0. , 0.5 , 0. ],
[-0.125, 0.625, -0.125],
[ 0.75 , -0.25 , 0.75 ],
[ 0.625, -0.125, 0.625],
[ 0.5 , 0. , 0.5 ],
[ 0. , 0.75 , 0. ],
[ 0.875, -0.125, 0.875],
[ 0.75 , 0. , 0.75 ],
[ 0. , -1. , 0. ],
[-0.25 , 0.5 , 0. ],
[ 0.625, -0.375, 0.875],
[ 0.5 , -0.25 , 0.75 ],
[ 0.75 , -0.25 , 1. ],
[ 0.625, -0.125, 0.875],
[ 0.5 , 0. , 0.75 ],
[-0.25 , -1. , 0. ],
[-0.5 , -1. , 0. ]])
[8]:
yambo_data.kpoints
[8]:
array([[ 0. , 0. , 0. ],
[-0.125, 0.125, -0.125],
[-0.25 , 0.25 , -0.25 ],
[-0.375, 0.375, -0.375],
[ 0.5 , -0.5 , 0.5 ],
[ 0. , 0.25 , 0. ],
[-0.125, 0.375, -0.125],
[-0.25 , 0.5 , -0.25 ],
[ 0.625, -0.375, 0.625],
[ 0.5 , -0.25 , 0.5 ],
[ 0.375, -0.125, 0.375],
[ 0.25 , 0. , 0.25 ],
[ 0. , 0.5 , 0. ],
[-0.125, 0.625, -0.125],
[ 0.75 , -0.25 , 0.75 ],
[ 0.625, -0.125, 0.625],
[ 0.5 , 0. , 0.5 ],
[ 0. , 0.75 , 0. ],
[ 0.875, -0.125, 0.875],
[ 0.75 , 0. , 0.75 ],
[ 0. , -1. , 0. ],
[-0.25 , 0.5 , 0. ],
[ 0.625, -0.375, 0.875],
[ 0.5 , -0.25 , 0.75 ],
[ 0.75 , -0.25 , 1. ],
[ 0.625, -0.125, 0.875],
[ 0.5 , 0. , 0.75 ],
[-0.25 , -1. , 0. ],
[-0.5 , -1. , 0. ]])
[9]:
yambo_data_fixsym.kpoints[0:40]
[9]:
array([[ 0. , 0. , 0. ],
[-0.125, 0.125, -0.125],
[-0.25 , 0.25 , -0.25 ],
[-0.375, 0.375, -0.375],
[ 0.5 , -0.5 , 0.5 ],
[ 0. , 0.25 , 0. ],
[-0.125, 0.375, -0.125],
[-0.25 , 0.5 , -0.25 ],
[ 0.625, -0.375, 0.625],
[ 0.5 , -0.25 , 0.5 ],
[ 0.375, -0.125, 0.375],
[ 0.25 , 0. , 0.25 ],
[ 0. , 0.5 , 0. ],
[-0.125, 0.625, -0.125],
[ 0.75 , -0.25 , 0.75 ],
[ 0.625, -0.125, 0.625],
[ 0.5 , 0. , 0.5 ],
[ 0. , 0.75 , 0. ],
[ 0.875, -0.125, 0.875],
[ 0.75 , 0. , 0.75 ],
[ 0. , -1. , 0. ],
[-0.25 , 0.5 , 0. ],
[ 0.625, -0.375, 0.875],
[ 0.5 , -0.25 , 0.75 ],
[ 0.75 , -0.25 , 1. ],
[ 0.625, -0.125, 0.875],
[ 0.5 , 0. , 0.75 ],
[-0.25 , -1. , 0. ],
[-0.5 , -1. , 0. ],
[-0.5 , -0.25 , 0.25 ],
[ 0.25 , -0.5 , 0.25 ],
[-0.25 , 0.5 , 0.25 ],
[-0.5 , 0.25 , 0.25 ],
[ 0.5 , 0.25 , -0.25 ],
[-0.25 , 0.25 , 0.25 ],
[-0.625, 0.375, 0.625],
[-0.375, 0.625, 0.625],
[ 0.375, 0.625, -0.625],
[-0.625, 0.375, -0.625],
[ 0.625, -0.375, -0.625]])
[10]:
pw_data.get_evals(set_gap=1.42)[0]
Apply a scissor of 1.1944603652824988 eV
[10]:
array([-1.27408522e+01, -4.17967883e-11, -2.92121882e-11, 0.00000000e+00,
1.42000000e+00, 4.95251862e+00, 4.95251862e+00, 4.95251862e+00])
[11]:
yambo_data.get_evals(set_gap=1.42)[0]
Apply a scissor of 1.1944603652824988 eV
[11]:
array([-1.27408522e+01, -4.17967883e-11, -2.92121882e-11, 0.00000000e+00,
1.42000000e+00, 4.95251862e+00, 4.95251862e+00, 4.95251862e+00])
[15]:
yambo_data_fixsym.get_evals(set_scissor=1.19446036)[40]
Apply a scissor of 1.19446036 eV
[15]:
array([-11.02871514, -6.46343287, -2.19792567, -1.41642963,
3.13269293, 5.50126577, 6.51799126, 8.87077968])
[16]:
pw_data.get_gap()
Direct gap system
=================
Gap : 0.22553963471750116 eV
[16]:
{'gap': 0.22553963471750116,
'direct_gap': 0.22553963471750116,
'position_cbm': 0,
'positon_vbm': 0}
[17]:
yambo_data.get_gap()
Direct gap system
=================
Gap : 0.22553963471750116 eV
[17]:
{'gap': 0.22553963471750116,
'direct_gap': 0.22553963471750116,
'position_cbm': 0,
'positon_vbm': 0}
[18]:
pw_data.get_transitions()[0]
[18]:
array([12.9663918 , 16.49891042, 16.49891042, 16.49891042, 0.22553963,
3.75805826, 3.75805826, 3.75805826, 0.22553963, 3.75805826,
3.75805826, 3.75805826, 0.22553963, 3.75805826, 3.75805826,
3.75805826])
[19]:
yambo_data.get_transitions()[0]
[19]:
array([12.9663918 , 16.49891042, 16.49891042, 16.49891042, 0.22553963,
3.75805826, 3.75805826, 3.75805826, 0.22553963, 3.75805826,
3.75805826, 3.75805826, 0.22553963, 3.75805826, 3.75805826,
3.75805826])
[ ]:
[ ]:
[ ]:
[ ]: