Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in feff inputs.py #3256

Merged
merged 31 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1dc8c43
Update test_sets.py
kaifengZheng Aug 19, 2023
bb74a32
add test file
kaifengZheng Aug 19, 2023
fac911d
fix a bug in inputs.py
kaifengZheng Aug 19, 2023
0018837
pre-commit auto-fixes
pre-commit-ci[bot] Aug 19, 2023
8112068
files
kaifengZheng Aug 19, 2023
943cbd4
Revert "files"
kaifengZheng Aug 19, 2023
46fbf47
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 19, 2023
09f0642
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 19, 2023
2550e26
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 20, 2023
d2c35c2
Merge branch 'master' into master
kaifengZheng Aug 20, 2023
c5020c1
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 20, 2023
18e23bd
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 20, 2023
1679411
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 21, 2023
ae62a3a
Merge branch 'master' into master
janosh Aug 21, 2023
3fd1904
remove test file and modify the test method
kaifengZheng Aug 22, 2023
84392b8
pre-commit auto-fixes
pre-commit-ci[bot] Aug 22, 2023
81c1ac5
Merge branch 'master' of https://github.com/materialsproject/pymatgen
kaifengZheng Aug 22, 2023
ccb5106
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 22, 2023
19896dc
Merge branch 'master' of https://github.com/kaifengZheng/pymatgen
kaifengZheng Aug 22, 2023
91fab3c
i->idx
janosh Aug 22, 2023
ebcedfe
Merge branch 'master' into master
kaifengZheng Aug 22, 2023
f036f0a
Merge branch 'master' into master
kaifengZheng Aug 22, 2023
00da9c8
forgot to negate check_occu after inverting semantics from skip_occu_…
janosh Aug 22, 2023
cde0422
Merge branch 'materialsproject:master' into master
kaifengZheng Aug 22, 2023
bd25993
Update test_sets.py
kaifengZheng Aug 22, 2023
95c0b56
pre-commit auto-fixes
pre-commit-ci[bot] Aug 22, 2023
80b2ad4
Merge branch 'master' into master
kaifengZheng Aug 22, 2023
c915adb
pre-commit auto-fixes
pre-commit-ci[bot] Aug 22, 2023
844336e
Update testing.py resolve conflict
kaifengZheng Aug 22, 2023
61b5914
Merge branch 'master' into master
kaifengZheng Aug 22, 2023
6607fa7
add PR link to new test
janosh Aug 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pymatgen/io/feff/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ def __init__(self, struct, absorbing_atom, radius):
self.absorbing_atom, self.center_index = get_absorbing_atom_symbol_index(absorbing_atom, struct)
self.radius = radius
self._cluster = self._set_cluster()
atom_sym = get_absorbing_atom_symbol_index(absorbing_atom, self._cluster)[0]
self.pot_dict = get_atom_map(self._cluster, atom_sym)
self.pot_dict = get_atom_map(self._cluster, self.absorbing_atom)

def _set_cluster(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/files/.pytest-split-durations
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,8 @@
"tests/io/feff/test_sets.py::TestFeffInputSet::test_get_feff_tags": 0.0002768750418908894,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_large_systems": 0.0024949999642558396,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_number_of_kpoints": 0.0026772500132210553,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_post_distdiff": 0.08853158302372321,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_postfeffset": 0.09011012403061613,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_post_dist_diff": 0.08853158302372321,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_post_feffset": 0.09011012403061613,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_reciprocal_tags_and_input": 0.02034700004151091,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_small_system_EXAFS": 0.0005435419734567404,
"tests/io/feff/test_sets.py::TestFeffInputSet::test_to_and_from_dict": 0.0007752509554848075,
Expand Down
11 changes: 9 additions & 2 deletions tests/io/feff/test_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_large_systems(self):
assert "CIF" not in elnes.tags
assert "TARGET" not in elnes.tags

def test_postfeffset(self):
def test_post_feffset(self):
self.mp_xanes.write_input(f"{self.tmp_path}/xanes_3")
feff_dict_input = FEFFDictSet.from_directory(f"{self.tmp_path}/xanes_3")
assert feff_dict_input.tags == Tags.from_file(f"{self.tmp_path}/xanes_3/feff.inp")
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_postfeffset(self):
struct_reci = Structure.from_file(f"{self.tmp_path}/Dup_reci/Co2O2.cif")
assert struct_orig == struct_reci

def test_post_distdiff(self):
def test_post_dist_diff(self):
feff_dict_input = FEFFDictSet.from_directory(f"{TEST_FILES_DIR}/feff_dist_test")
assert feff_dict_input.tags == Tags.from_file(f"{TEST_FILES_DIR}/feff_dist_test/feff.inp")
assert str(feff_dict_input.header()) == str(Header.from_file(f"{TEST_FILES_DIR}/feff_dist_test/HEADER"))
Expand Down Expand Up @@ -259,3 +259,10 @@ def test_big_radius(self):
},
)
assert str(dict_set) is not None

def test_cluster_index(self):
# https://github.com/materialsproject/pymatgen/pull/3256
cif_file = f"{TEST_FILES_DIR}/Fe3O4.cif"
structure = CifParser(cif_file).get_structures()[0]
for idx in range(len(structure.species)):
assert Atoms(structure, idx, 3).cluster