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

Clean up test files: dedicated VASP directories, xyz, mcif, cssr, exciting, wannier90 #3681

Merged
merged 44 commits into from
Mar 11, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Mar 9, 2024

Clean up test files: dedicated VASP directories

The third (hopefully the last) episode of cleaning up VASP test files: relocate dedicated VASP directories to vasp/fixtures, following #3653 and #3674.

Tasks

  • Relocate dedicated VASP directories
  • Compress some hidden VASP outputs
  • Group some files: xyz, mcif, cssr, exciting, wannier90

@DanielYang59

This comment was marked as resolved.

@janosh
Copy link
Member

janosh commented Mar 11, 2024

UPDATE: already created a dedicated dir for borg.

great! i would also have gone with this approach 👍

@DanielYang59 DanielYang59 marked this pull request as ready for review March 11, 2024 05:59
@janosh janosh added tests Issues with or changes to the pymatgen test suite housekeeping Moving around or cleaning up old code/files vasp Vienna Ab initio Simulation Package dx Developer experience labels Mar 11, 2024
Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really nice to bring the repo size down by compressing more test files! thanks @DanielYang59 👍

@janosh janosh merged commit 668fa57 into materialsproject:master Mar 11, 2024
22 checks passed
@DanielYang59 DanielYang59 deleted the relocate-vasp-fixtures branch March 11, 2024 07:06
@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Mar 11, 2024

really nice to bring the repo size down by compressing more test files!

Thanks for reviewing. Didn't compress much files 😃 just grouped different types to tidy up the test files.

@janosh
Copy link
Member

janosh commented Mar 11, 2024

quarter million lines gone. i call that a win 😄

@DanielYang59
Copy link
Contributor Author

quarter million lines gone.

Yes I indeed removed some unused test directories. Tried my best to search globally for their names and at least confirmed they're not explicitly called. Also committed all removals individually in case any need to be recovered.

With this said, I'm not sure what is the best practice, but I think it's better to explicitly declare file name in unit tests wherever possible? Or if this is not possible, at least put a comment about the target directory/file.

For example this gave me quite a painful time:

def test_assimilate(self):
entry = self.drone.assimilate(TEST_FILES_DIR)
for param in ("hubbards", "is_hubbard", "potcar_spec", "run_type"):
assert param in entry.parameters
assert entry.data["efermi"] == approx(-6.62148548)
assert entry.reduced_formula == "Xe"
assert entry.energy == approx(0.5559329)

Because:

  • No comment nor explicit declaration of test file name.
  • A ton of possible target vasprun.xml files exist in directory and don't know which is the target file.
  • Result hard coded.

Can you please encourage developers to add a comment or declare explicitly in the future if anyone is adding test files? Thanks a ton 😃 .

@janosh
Copy link
Member

janosh commented Mar 11, 2024

Can you please encourage developers to add a comment or declare explicitly in the future if anyone is adding test files? Thanks a ton 😃 .

of course! this test predates my becoming a pymatgen co-maintainer but i'm glad you refactored to clarify the test ↔ test-file association here

DanielYang59 added a commit to DanielYang59/pymatgen that referenced this pull request Mar 17, 2024
janosh added a commit that referenced this pull request Apr 10, 2024
* track test files

* clean up test code

* some `sourcery` fixes

* remove debug files

* legacy fix for #3681

* `sourcery` fixes (no functional change)

* (WIP) add type annotations for Slab

* WIP-add more type annotations

* fix hkl_transformation types plus some mypy errors

* remove tolist() and replace import Self

* revert renaming get_d

* fix private func naming

* fix _is_already_analyzed

* tweak docstring

* adjust method order in Slab class

* docstring and format tweaks

* docstring tweaks

* docstring tweaks

* fix arg name specie

* use species over specie

* clean up symmetrically_remove_atoms

* ignore override mypy error in Slab

* fix merge conflicts

* pre-commit auto-fixes

* make docstring more concise and fix mypy error

* organise __init__

* pre-commit auto-fixes

* NOTE: rename `get_slab` to `_get_slab`

* pre-commit auto-fixes

* revert renaming of get_slab to _get_slab

* docstring tweak

* further clean up and fix test

* ruff fix

* fix unit test for Slab.as_dict

* add list to np.ndarray convert in slab.from_dict

* move private methods to where its used

* finish tweaking comments in get_slab method

* relocate method to where its used

* some mypy fixes

* make comment and docstring more concise

* add comments for calculate_possible_shifts

* add TODO and DEBUG tags

* remove DEBUG tags

* add TODO tag and docstring for get_z_ranges

* add comments for get_slabs method

* clarify second matching

* mypy fixes

* rename a var

* clean up `move_to_other_side` method

* finish cleaning up `repair_broken_bonds`

* revise docstring

* clarify comments for `nonstoichiometric_symmetrized_slab`

* replace `point` with `site`

* clean up `get_d`

* docstring tweaks

* clean up init for ReconstructionGenerator

* finish cleaning `ReconstructionGenerator`

* more comment tweaks

* tweak module docstring

* rename private `is_already_analyzed` to `is_in_miller_family`

* put `generate_all_slabs` closer to `SlabGenerator`

* move `get_slab_regions` and `center_slab` closer to `Slab`

* finish cleaning up `surface`

* add another tag

* fix typos

* refactor ReconstructionGenerator.get_unreconstructed_slabs

* CONSTANT_CASE module-scoped reconstructions_archive

---------

Co-authored-by: Janosh Riebesell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Developer experience housekeeping Moving around or cleaning up old code/files tests Issues with or changes to the pymatgen test suite vasp Vienna Ab initio Simulation Package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants