mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 04:13:47 +01:00
Added consistency check for the number of sites
'check_data_consistency' now first checks that site indices in projected shells do not exceed the number of ions in the structure.
This commit is contained in:
parent
f96e4dfe9e
commit
fb3bc8eeff
@ -81,6 +81,7 @@ def check_data_consistency(pars, el_struct):
|
|||||||
"""
|
"""
|
||||||
# Check that ions inside each shell are of the same sort
|
# Check that ions inside each shell are of the same sort
|
||||||
for sh in pars.shells:
|
for sh in pars.shells:
|
||||||
|
assert max(sh['ion_list']) <= el_struct.natom, "Site index in the projected shell exceeds the number of ions in the structure"
|
||||||
sorts = set([el_struct.type_of_ion[io] for io in sh['ion_list']])
|
sorts = set([el_struct.type_of_ion[io] for io in sh['ion_list']])
|
||||||
assert len(sorts) == 1, "Each projected shell must contain only ions of the same sort"
|
assert len(sorts) == 1, "Each projected shell must contain only ions of the same sort"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user