3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-02 11:25:29 +02:00

Added consistency check for projected shells

Added a check to 'check_data_consistency()' that verifies
that each shell contains only one sort of ions.

Also added a non-functioning test (implementation is commented)
for the function.
It requires a full set of VASP files for an example with multiple atom sorts.
This commit is contained in:
Oleg E. Peil 2015-09-16 11:40:01 +02:00 committed by Michel Ferrero
parent 36c928a4b5
commit 1f57cd1935
4 changed files with 59 additions and 15 deletions

View File

@ -76,7 +76,10 @@ def check_data_consistency(pars, el_struct):
"""
Check the consistency of the VASP data.
"""
pass
# Check that ions inside each shell are of the same sort
for sh in pars.shells:
sorts = set(el_struct.poscar.type_of_ion[sh['ion_list']])
assert len(sorts) == 1, "Each projected shell must contain only ions of the same sort"
################################################################################
# select_bands()

View File

@ -0,0 +1,28 @@
NdNiO3
1.0
5.3871197701 0.0000000000 0.0000000000
0.0000000000 5.3826699257 0.0000000000
0.0000000000 0.0000000000 7.6093997955
Nd Ni O
4 4 12
Direct
0.995800018 0.035000000 0.250000000
0.004199982 0.964999974 0.750000000
0.495800018 0.465000004 0.750000000
0.504199982 0.535000026 0.250000000
0.500000000 0.000000000 0.000000000
0.000000000 0.500000000 0.000000000
0.500000000 0.000000000 0.500000000
0.000000000 0.500000000 0.500000000
0.069300003 0.489699990 0.250000000
0.930700004 0.510300040 0.750000000
0.569299996 0.010300010 0.750000000
0.430700004 0.989699960 0.250000000
0.716600001 0.287099987 0.039500002
0.283399999 0.712900043 0.960500002
0.216600001 0.212900013 0.960500002
0.783399999 0.787099957 0.039500002
0.283399999 0.712900043 0.539499998
0.716600001 0.287099987 0.460500002
0.783399999 0.787099957 0.460500002
0.216600001 0.212900013 0.539499998

View File

@ -1,6 +1,8 @@
import vaspio
from inpconf import ConfigParameters
from plotools import check_data_consistency
from elstruct import ElectronicStructure
import mytest
################################################################################
@ -12,23 +14,26 @@ class TestDataConsistency(mytest.MyTestCase):
"""
Function:
def read_plocar(filename)
def check_data_consistency(pars, el_struct)
Scenarios:
- **if** file PLOCAR does not exist **raise** IOError
- **if** PLOCAR is truncated **raise** IOError
- **if** the precision flag is not 4 or 8 **raise** ValueError
- **if** PLOCAR with prec=8 is read **compare** the output
- **if** PLOCAR with prec=4 is read **compare** the output
- **if** a shell contains ions of different types **raise** AssertionError
"""
# Scenario 1
def test_example(self):
conf_file = 'example.cfg'
pars = ConfigParameters(conf_file)
pars.parse_input()
vasp_data = vaspio.VaspData('./')
print pars.shells
print pars.groups
def test_shell_ion_types(self):
pass
# conf_file = 'wrong_shell.cfg'
# pars = ConfigParameters(conf_file)
# pars.parse_input()
# vasp_data = vaspio.VaspData('./', read_all=False)
# vasp_data.poscar.from_file('./', poscar_filename='POSCAR.complex')
# el_strct = ElectronicStructure(vasp_data)
#
# print pars.shells
# print vasp_data.poscar.type_of_ion
#
# err_mess = "Each projected shell must"
# with self.assertRaisesRegexp(Exception, err_mess):
# check_data_consistency(pars, el_struct)

View File

@ -0,0 +1,8 @@
[Shell 1]
LSHELL = 2
IONS = 4 5 6 7
EMIN = -15.0
EMAX = 5.0