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

Docstring tweaks for io.vasp.inputs and format tweaks for some other parts #3996

Merged
merged 18 commits into from
Aug 14, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Aug 12, 2024

Summary

Separated from #3994 to avoid PR pollution

TODOs:

@@ -2610,12 +2604,6 @@ def __init__(
def __str__(self) -> str:
return "\n".join(str(potcar).strip("\n") for potcar in self) + "\n"

def __iter__(self) -> Iterator[PotcarSingle]:
Copy link
Contributor Author

@DanielYang59 DanielYang59 Aug 12, 2024

Choose a reason for hiding this comment

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

I believe it should be safe to remove this now.

The following script seems to give the right type without __iter__:

from pymatgen.io.vasp.inputs import Potcar


potcar = Potcar.from_file("tests/files/io/vasp/inputs/POTCAR_C2.gz")

for psingle in potcar:
    print(type(psingle))   >>> <class 'pymatgen.io.vasp.inputs.PotcarSingle'>

dct["unit_cell_formula"] = comp.as_dict()
dct["reduced_cell_formula"] = Composition(comp.reduced_formula).as_dict()
dct["pretty_formula"] = comp.reduced_formula
symbols = [s.split()[1] for s in self.potcar_symbols]
Copy link
Contributor Author

@DanielYang59 DanielYang59 Aug 12, 2024

Choose a reason for hiding this comment

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

symbols is unused, wondering why it's not automatically marked by any linter

@DanielYang59 DanielYang59 changed the title Docstring tweaks for io.vasp.inputs Docstring tweaks for io.vasp.inputs and format tweaks for some other parts Aug 12, 2024
@DanielYang59 DanielYang59 marked this pull request as ready for review August 13, 2024 02:30
@shyuep shyuep merged commit cadcae4 into materialsproject:master Aug 14, 2024
33 checks passed
@DanielYang59 DanielYang59 deleted the tweak-io-vasp-inputs branch August 15, 2024 02:04
@janosh janosh added linting Linting and quality assurance docs Documentation, examples, user guides labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation, examples, user guides linting Linting and quality assurance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants