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

Add pymatgen.io.openff module #3729

Merged
merged 55 commits into from
Apr 10, 2024
Merged

Conversation

orionarcher
Copy link
Contributor

@orionarcher orionarcher commented Mar 31, 2024

Summary

This PR adds basic integration with the openff.toolkit Molecule representation. It is intended to be use in the classical_md workflows in atomate2 and emmet.

Currently, this functionality is downstream in a PR to atomate2. As basic IO functionality, I would like to migrate it upstream to pymatgen. Especially because some functions will also be used in the classical_md emmet Builder.

Major changes:

  • Several utility functions that support IO between pymatgen.Molecule/pymatgen.MoleculeGraph <-> openff.toolkit.Molecule
  • Restructure testing to use micromamba
  • Fix errors in babel.py

Checklist

  • Google format doc strings added. Check with ruff.
  • Type annotations included. Check with mypy.
  • Tests added for new features/fixes.
  • If applicable, new classes/functions/modules have duecredit @due.dcite decorators to reference relevant papers by DOI (example)

Tip: Install pre-commit hooks to auto-check types and linting before every commit:

pip install -U pre-commit
pre-commit install

Summary by CodeRabbit

  • New Features
    • Introduced utility functions for seamless conversion between Pymatgen and OpenFF molecules, enhancing interoperability.
    • Added support for new molecular structures in XYZ format, expanding the range of molecules that can be analyzed.
  • Enhancements
    • Updated method calls for force field types in OpenBabel for improved consistency.
    • Enhanced test suite with functions for converting between different molecular representations and ensuring isomorphism.
  • Bug Fixes
    • Adjusted warning messages and print statements for force field handling in OpenBabel integration.
  • Dependencies
    • Added openbabel>=3.1.1 to optional requirements, broadening the toolkit's compatibility.
    • Updated GitHub workflows and setup configurations to include essential dependencies for a more robust testing environment.
  • Refactor
    • Improved code readability and efficiency in several modules by updating variable names and simplifying serialization logic.
  • Tests
    • Expanded testing framework to cover new functionalities and ensure reliability across molecular conversion and analysis tasks.

Copy link

coderabbitai bot commented Mar 31, 2024

Warning

Rate Limit Exceeded

@janosh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 28 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 1410a2e and 780394d.

Walkthrough

The updates in this version enhance the interoperability between Pymatgen and OpenFF, focusing on molecular analysis and integration improvements. These changes streamline molecular conversions, refine force field handling, optimize dependencies, and enhance testing for a smoother user experience in computational chemistry and materials science.

Changes

Files Summary
pymatgen/io/openff.py, pymatgen/io/babel.py Introduced utility functions for molecular conversions and updated OpenBabel method calls for consistency.
pymatgen/io/abinit/abiobjects.py Enhanced key filtering in class methods through dictionary comprehension updates.
.github/workflows/test.yml, requirements-optional.txt, setup.py Adjusted installation commands and dependencies for improved environment setup.
tests/io/test_openff.py, tests/files/classical_md_mols/CCO.xyz Added tests for molecular conversions and introduced new molecular structures.
Tests related to analysis/chemenv/connectivity and cp2k/test_inputs.py Refactored serialization logic and renamed test methods for clarity.
tests/phonon/test_dos.py Modified assertion for checking JSON structure prefix in tests.

🐰✨
In the realm where molecules dance,
A rabbit hopped, taking a chance.
Bridging worlds with a magical flair,
OpenFF and Pymatgen, a perfect pair.
With tests and tweaks, it leaps ahead,
Through code and docs, its wisdom spread.
🌌🔬✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@orionarcher orionarcher changed the title [WIP] Add a pymatgen.io.openff module Add a pymatgen.io.openff module Mar 31, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 079c354 and f52a8df.
Files selected for processing (2)
  • pymatgen/io/openff.py (1 hunks)
  • tests/io/test_openff.py (1 hunks)
Additional Context Used
Additional comments not posted (17)
tests/io/test_openff.py (10)

23-35: In test_molgraph_from_atom_bonds, the test case is well-structured and covers the conversion from an OpenFF molecule to a MoleculeGraph and back. However, it's recommended to add more assertions to verify the properties of the resulting molecules, such as checking the correctness of atom types, formal charges, and partial charges, to ensure a comprehensive test coverage.


38-67: In test_molgraph_from_openff_mol_cco, the test case effectively checks the conversion from an OpenFF molecule to a MoleculeGraph and validates the isomorphism between the original and converted graphs. Consider adding assertions to verify the correctness of atom types, formal charges, and partial charges in the converted MoleculeGraph for a more thorough test.


70-89: In test_molgraph_to_openff_pf6, the assertion assert pf6_openff_1 == pf6_openff_2 might not be sufficient to ensure the equality of two OpenFF molecules, as it relies on the __eq__ method which might not deeply compare all molecule attributes. It's advisable to use tk.Molecule.is_isomorphic_with with appropriate matching criteria to ensure a more robust comparison.


92-101: Similar to the previous comment, in test_molgraph_to_openff_cco, consider using tk.Molecule.is_isomorphic_with for comparing cco_openff_1 and cco_openff_2 to ensure a more comprehensive comparison that includes checking atom types, bond orders, and possibly stereochemistry.


104-117: test_openff_back_and_forth provides a good test for converting between OpenFF and MoleculeGraph representations and back. However, it would be beneficial to add more assertions to check the properties of the resulting molecules, such as atom types, formal charges, and partial charges, to ensure the conversion process preserves these properties accurately.


120-135: In test_get_atom_map, the test cases cover different molecules and their expected atom mappings. It's well-structured and seems comprehensive. However, consider adding a negative test case where no isomorphism is expected to ensure the function correctly handles such scenarios.


138-152: test_infer_openff_mol effectively tests the inference of OpenFF molecules from different geometries. The assertions on the number of atoms and bonds are appropriate. To enhance the test, consider adding assertions to verify the correctness of atom types and bond orders in the inferred OpenFF molecules.


155-160: In test_add_conformer, the test case checks the addition of a conformer to an OpenFF molecule. It's recommended to add assertions to verify the coordinates of the added conformer match the expected values, ensuring the conformer is correctly added.


163-169: test_assign_partial_charges correctly tests the assignment of partial charges to an OpenFF molecule. To further improve the test, consider adding a case where partial charges are assigned using a charge method (e.g., "am1bcc") instead of directly providing the charges, to ensure the functionality works as expected in different scenarios.


172-180: test_create_openff_mol tests the creation of an OpenFF molecule from a SMILES string and optional geometry. It's advisable to add more assertions to verify the properties of the created molecule, such as checking if the partial charges are correctly scaled and if the molecule's stereochemistry is correctly inferred when allow_undefined_stereo=True.

pymatgen/io/openff.py (7)

17-71: In molgraph_to_openff_mol, the function converts a MoleculeGraph to an OpenFF Molecule. It's well-documented and covers the conversion of atom and bond properties. However, consider handling cases where the MoleculeGraph might contain multiple disconnected molecules, as the current implementation assumes a single molecule. This could be addressed by adding a check for disconnected components in the graph and raising an appropriate error or handling each component separately.


74-114: molgraph_from_openff_mol effectively converts an OpenFF Molecule to a MoleculeGraph. The function mirrors the structure generated by tk.Molecule.to_networkx. To enhance this function, consider adding support for handling multiple conformers if present in the OpenFF molecule, as the current implementation only uses the first conformer. This could involve iterating over all conformers and creating a separate MoleculeGraph for each.


117-156: get_atom_map computes an atom mapping between two OpenFF Molecules. The function attempts to find an isomorphism with varying levels of restrictions. It's well-implemented, but consider adding logging or warnings when the function needs to relax restrictions (e.g., stereochemistry, bond order) to find an isomorphism. This would provide users with more insight into the matching process and potential discrepancies between the molecules.


159-180: In infer_openff_mol, the function infers an OpenFF Molecule from a pymatgen.core.Molecule. The use of OpenBabelNN and metal_edge_extender for constructing the MoleculeGraph is a good approach. However, consider adding error handling for cases where the inference process fails due to unsupported elements or configurations in the input molecule, ensuring the function fails gracefully with informative error messages.


183-221: add_conformer adds conformers to an OpenFF Molecule based on provided geometry. The function includes a TODO comment about testing, which indicates that it might not have been thoroughly tested. It's crucial to add unit tests for this function to ensure its correctness, especially for edge cases such as non-isomorphic geometries or when no geometry is provided.


224-264: assign_partial_charges assigns partial charges to an OpenFF Molecule. The function handles different scenarios, including provided partial charges and using a charge method. To improve this function, consider adding validation for the charge_method parameter to ensure it's supported by OpenFF toolkit, and provide clear error messages if an unsupported method is specified.


267-318: create_openff_mol creates an OpenFF Molecule from a SMILES string and optional geometry. The function is comprehensive and handles various scenarios, including charge scaling and partial charge assignment. However, the error handling for mismatched lengths between partial_charges and geometry could be improved by specifying which molecule or atom caused the mismatch, making it easier for users to debug issues.

@janosh janosh added io Input/output functionality molecules Molecule stuff feature PRs with new features, not enhancements to existing features md Molecular dynamics labels Apr 1, 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.

cool, excited to see this! 👍

is the issue here that openff is only installable with conda/mamba?
we could try installing from source in CI

@orionarcher
Copy link
Contributor Author

we could try installing from source in CI

Sounds good! I'll try adding that to the CI.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f52a8df and b9b36b9.
Files selected for processing (8)
  • .github/workflows/test.yml (1 hunks)
  • pymatgen/io/openff.py (1 hunks)
  • tests/files/classical_md_mols/CCO.xyz (1 hunks)
  • tests/files/classical_md_mols/FEC-r.xyz (1 hunks)
  • tests/files/classical_md_mols/FEC-s.xyz (1 hunks)
  • tests/files/classical_md_mols/Li.xyz (1 hunks)
  • tests/files/classical_md_mols/PF6.xyz (1 hunks)
  • tests/io/test_openff.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • tests/files/classical_md_mols/Li.xyz
Files skipped from review as they are similar to previous changes (1)
  • tests/io/test_openff.py
Additional comments not posted (4)
tests/files/classical_md_mols/PF6.xyz (1)

1-9: The XYZ format is correctly followed, and the file appears relevant to the PR's objectives.

tests/files/classical_md_mols/CCO.xyz (1)

1-11: The XYZ format is correctly followed, and the file appears relevant to the PR's objectives.

tests/files/classical_md_mols/FEC-r.xyz (1)

1-12: The XYZ format is correctly followed, and the file appears relevant to the PR's objectives.

tests/files/classical_md_mols/FEC-s.xyz (1)

1-12: The XYZ format is correctly followed, and the file appears relevant to the PR's objectives.

@@ -111,6 +111,8 @@ jobs:
# TODO remove next line installing ase from main branch when FrechetCellFilter is released
uv pip install --upgrade 'git+https://gitlab.com/ase/ase' --system

uv pip install git+https://github.com/openforcefield/openff-toolkit.git
Copy link

Choose a reason for hiding this comment

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

Consider pinning the openff-toolkit dependency to a specific commit or release tag to ensure stability in your CI/CD pipeline.

- uv pip install git+https://github.com/openforcefield/openff-toolkit.git
+ uv pip install git+https://github.com/openforcefield/openff-toolkit.git@<commit_or_tag>

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
uv pip install git+https://github.com/openforcefield/openff-toolkit.git
uv pip install git+https://github.com/openforcefield/openff-toolkit.git@<commit_or_tag>

Comment on lines +281 to +284
if geometry is None:
raise ValueError("geometries must be set if partial_charges is set")
if len(partial_charges) != len(geometry):
raise ValueError("partial charges must have same length & order as geometry")
Copy link

Choose a reason for hiding this comment

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

Validate the length of partial_charges against the number of atoms in geometry instead of the length of geometry.

- if len(partial_charges) != len(geometry):
+ if len(partial_charges) != geometry.num_sites:

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if geometry is None:
raise ValueError("geometries must be set if partial_charges is set")
if len(partial_charges) != len(geometry):
raise ValueError("partial charges must have same length & order as geometry")
if geometry is None:
raise ValueError("geometries must be set if partial_charges is set")
if len(partial_charges) != geometry.num_sites:
raise ValueError("partial charges must have same length & order as geometry")

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b9b36b9 and 2902ea4.
Files selected for processing (2)
  • .github/workflows/test.yml (1 hunks)
  • pymatgen/io/openff.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml

if partial_charges is not None:
if geometry is None:
raise ValueError("geometries must be set if partial_charges is set")
if len(partial_charges) != len(geometry):
Copy link

Choose a reason for hiding this comment

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

Validate the length of partial_charges against the number of atoms in geometry instead of the length of geometry.

- if len(partial_charges) != len(geometry):
+ if len(partial_charges) != geometry.num_sites:

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if len(partial_charges) != len(geometry):
if len(partial_charges) != geometry.num_sites:

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2902ea4 and 8eb6b4c.
Files selected for processing (3)
  • .github/workflows/test.yml (1 hunks)
  • pymatgen/io/openff.py (1 hunks)
  • requirements-optional.txt (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml
Additional comments not posted (5)
requirements-optional.txt (1)

15-15: LGTM! The addition of openbabel>=3.1.1 aligns with the PR's objectives and enhances integration capabilities.

pymatgen/io/openff.py (4)

40-40: The TODO comment about asserting the presence of only one molecule is addressed. Ensure the assertion is implemented as suggested in the previous review.


204-204: The TODO comment about testing the add_conformer function is addressed. Ensure unit tests are added to cover this functionality.


247-247: The TODO comment about testing the assign_partial_charges function is addressed. Ensure unit tests are added to cover this functionality.


296-296: The suggestion to validate the length of partial_charges against the number of atoms in geometry instead of the length of geometry is addressed. Ensure this change is implemented as suggested.

@orionarcher
Copy link
Contributor Author

orionarcher commented Apr 8, 2024

I switched over the test suite to use micromamba and the speed is ~20-30% faster on ubuntu and comparable on windows. The test file is also significantly shorter because I switched bader, enumlib, openbabel and packmol to mamba installs rather than building from source.

By adding openbabel I discovered several failing tests that were flying under the radar and that are now causing CI to fail.

  • errors in test_babel.py which I fixed
  • errors in analysis/test_graphs.py and io/qchem/test_outputs.py that I am not sure how to debug. These are failing both locally and in the ubuntu CI. It's not an issue in the windows CI because openbabel is not being installed.

@janosh, what do you recommend as the path forward here?

Should we:
a) merge as is with tests failing?
b) disable the tests and contact the maintainers?
c) have someone (preferably other than me) try to debug the failing tests triggered by the addition of openbabel?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cf2df32 and 4802525.
Files selected for processing (2)
  • .github/workflows/test.yml (1 hunks)
  • pymatgen/io/babel.py (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml
Additional comments not posted (2)
pymatgen/io/babel.py (2)

185-192: Consider enhancing the warning message to include the list of supported forcefields for user convenience.


350-350: The addition of the from_str method enhances the module's functionality by providing a convenient way to create molecules from string data.

Comment on lines +267 to +270
ff = openbabel.OBForceField.FindType(forcefield)
if ff == 0:
print(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")
ff = openbabel.OBForceField_FindType("mmff94")
ff = openbabel.OBForceField.FindType("mmff94")
Copy link

Choose a reason for hiding this comment

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

Replace the print statement with a warning to maintain consistency and provide users with better control over error messages.

- print(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")
+ warnings.warn(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
ff = openbabel.OBForceField.FindType(forcefield)
if ff == 0:
print(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")
ff = openbabel.OBForceField_FindType("mmff94")
ff = openbabel.OBForceField.FindType("mmff94")
ff = openbabel.OBForceField.FindType(forcefield)
if ff == 0:
warnings.warn(f"Could not find {forcefield=} in openbabel, the forcefield will be reset as default 'mmff94'")
ff = openbabel.OBForceField.FindType("mmff94")

@janosh
Copy link
Member

janosh commented Apr 9, 2024

@orionarcher luckily fixing the 3 failing tests was fairly easy. fixing the third surfaced a 4 issue so there's still 1 failing test

b) disable the tests and contact the maintainers?

i think we can skip TestQCOutput.test_all for now and ping @samblau and @espottesmith. if you guys have time to take a look, feel free to suggest a fix

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4


# set atom properties
partial_charges = []
# TODO: should assert that there is only one molecule
Copy link

Choose a reason for hiding this comment

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

Consider implementing the suggested assertion to ensure molgraph_to_openff_mol handles only one molecule.

+ assert len(molgraph.molecule) == 1, "The MoleculeGraph should contain exactly one molecule."

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
# TODO: should assert that there is only one molecule
# TODO: should assert that there is only one molecule
assert len(molgraph.molecule) == 1, "The MoleculeGraph should contain exactly one molecule."

Molecule with added conformers and a dictionary representing the atom
mapping.
"""
# TODO: test this
Copy link

Choose a reason for hiding this comment

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

Ensure unit tests for add_conformer are added to verify its functionality and handle edge cases.

Would you like me to help by writing some unit tests for this function?

Returns:
tk.Molecule: The OpenFF Molecule with assigned partial charges.
"""
# TODO: test this
Copy link

Choose a reason for hiding this comment

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

It's important to add unit tests for assign_partial_charges to ensure its correctness and robustness.

Would you like assistance in creating unit tests for this function?

Comment on lines +300 to +301
if len(partial_charges) != len(geometry):
raise ValueError("partial charges must have same length & order as geometry")
Copy link

Choose a reason for hiding this comment

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

Correctly validate the length of partial_charges against the number of atoms in geometry.

- if len(partial_charges) != len(geometry):
+ if len(partial_charges) != geometry.num_sites:

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if len(partial_charges) != len(geometry):
raise ValueError("partial charges must have same length & order as geometry")
if len(partial_charges) != geometry.num_sites:
raise ValueError("partial charges must have same length & order as geometry")

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

tar xvzf bader_lnx_64.tar.gz
sudo mv bader /usr/local/bin/
continue-on-error: true # This is not critical to succeed.
micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes
Copy link

Choose a reason for hiding this comment

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

Consider pinning the versions of enumlib, packmol, bader, openbabel, and openff-toolkit to ensure reproducibility and stability in your CI/CD pipeline.

- micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes
+ micromamba install -n pmg -c conda-forge enumlib=<version> packmol=<version> bader=<version> openbabel=<version> openff-toolkit=<version> --yes

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
micromamba install -n pmg -c conda-forge enumlib packmol bader openbabel openff-toolkit --yes
micromamba install -n pmg -c conda-forge enumlib=<version> packmol=<version> bader=<version> openbabel=<version> openff-toolkit=<version> --yes

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.

thanks @orionarcher. excited about the new OpenFF integration!

and really appreciate that you reinstated the openbabel tests!

@janosh janosh changed the title Add a pymatgen.io.openff module Add pymatgen.io.openff module Apr 10, 2024
@janosh janosh enabled auto-merge (squash) April 10, 2024 08:03
@janosh janosh merged commit 7064c43 into materialsproject:master Apr 10, 2024
22 checks passed
@DanielYang59 DanielYang59 mentioned this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature PRs with new features, not enhancements to existing features io Input/output functionality md Molecular dynamics molecules Molecule stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants