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

Structure/Molecule.to() now always return same string written to file #3236

Merged
merged 7 commits into from
Aug 10, 2023

Conversation

janosh
Copy link
Member

@janosh janosh commented Aug 10, 2023

Previously if filename was passed, Structure/Molecule.to(filename="some/file.json|cif|yaml|poscar|...") would return None. No performance cost from always returning the same string that was written to file. Simplifies implementation and testing, and can be useful in rare cases.

96f7084 fix some ruff PERF401
580b760 fix test_calculate_chgnet() for next chgnet release
2781937 always return string from Structure.to() regardless of filename kwarg
a6f9609 update TestIStructure.test_to_from_file_string
3d4b306 same for Molecule.to()
98b6ba9 update TestIMolecule.test_to_from_file_string
2ee87bb improve class XYZ logic for setting self._mols

@janosh janosh added tests Issues with or changes to the pymatgen test suite api Application programming interface core Pymatgen core labels Aug 10, 2023
@janosh janosh enabled auto-merge (squash) August 10, 2023 20:58
@janosh janosh merged commit 8465e67 into master Aug 10, 2023
@janosh janosh deleted the struct-mol-to-return-str branch August 10, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Application programming interface core Pymatgen core tests Issues with or changes to the pymatgen test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant