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

Remove deprecated analysis.interface, rename classes to PascalCase and rename with_* to from_* #3725

Merged
merged 15 commits into from Mar 29, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Mar 29, 2024

Summary

  • Remove legacy analysis.interface (deprecated 3 years ago, see discussion)
  • Rename several classes to PascalCase (see discussion)
  • Rename several with_* classmethods to from_* in analysis.graphs

Note:

The renamed classes in cp2k.inputs does not have corresponding unit tests at all.

Summary by CodeRabbit

  • Refactor
    • Enhanced graph initialization methods across various modules for improved consistency and future maintenance.
  • Bug Fixes
    • Corrected class name spelling in the quasiharmonic module for clarity.
  • Documentation
    • Added deprecation warnings for renamed methods and classes to guide developers towards updated usage.
  • Style
    • Standardized naming conventions in input and set modules for better readability and consistency.

Copy link

coderabbitai bot commented Mar 29, 2024

Walkthrough

The recent updates to the pymatgen library focus on standardizing method naming conventions, particularly in the transition from methods prefixed with with_ to those starting with from_ for initializing and constructing graphs. This change affects various modules, enhancing consistency and readability. Additionally, there's a minor correction in class naming and a push towards more descriptive and uniform naming across different modules, improving the overall clarity and usability of the library.

Changes

Files Change Summary
.../analysis/bond_dissociation.py, .../dimensionality.py Updated to use MoleculeGraph.from_local_env_strategy and from_edges for MoleculeGraph instances.
.../analysis/fragmenter.py, tests/.../test_fragmenter.py Switched to from_local_env_strategy and from_edges in fragmenter modules and tests.
.../analysis/functional_groups.py, tests/.../test_functional_groups.py Updated FunctionalGroupExtractor to use MoleculeGraph.from_local_env_strategy.
.../analysis/graphs.py, tests/.../test_graphs.py Renamed methods from with_ to from_ with deprecation warnings.
.../analysis/local_env.py, tests/.../test_local_env.py Added deprecated import and renamed methods, switching to from_local_env_strategy.
.../analysis/magnetism/heisenberg.py Modified method calls to use StructureGraph.from_local_env_strategy and from_empty_graph.
.../analysis/quasiharmonic.py Corrected class name spelling and removed PascalCase recommendation.
.../command_line/critic2_caller.py Updated structure_graph method to use StructureGraph.from_empty_graph.
.../io/cp2k/inputs.py, .../sets.py Renamed classes and entities for consistency and deprecated old names.
.../io/qchem/outputs.py Updated to use MoleculeGraph.from_local_env_strategy for graph initialization.
tests/io/test_babel.py Modified to use MoleculeGraph.from_empty_graph.

🐇✨
In the realm of atoms and bonds, where the graphs do weave and sway,
A change was made, from with_ to from_, in a most harmonious way.
Names now flow like a gentle stream, clarity in every line,
As the code rabbit hops along, through the pymatgen shrine.
🌟📚
Celebrate we shall, for consistency's light,
Guides us through the code, making everything right.
🎉🐾

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@janosh
Copy link
Member

janosh commented Mar 29, 2024

bear in mind that we need deprecations for all these changes. might be easier to do them alongside each change rather than all at once at the end to ensure we don't forget any

@DanielYang59
Copy link
Contributor Author

It looks like my method to deprecate class methods (with_*) is flawed, and therefore calling the deprecated class method would trigger an error, can you please give me some advice on this @janosh? Thanks!

    def wrapped(*args, **kwargs):
        msg = craft_message(old, replacement, message)
        warnings.warn(msg, category=category, stacklevel=2)
>       return old(*args, **kwargs)
E       TypeError: 'classmethod' object is not callable

@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Mar 29, 2024

might be easier to them alongside each change rather than all at once at the end to ensure we don't forget any

Agreed :) Already moved replacement and old together in 0a2461b. Thanks for the head up!

@DanielYang59 DanielYang59 marked this pull request as ready for review March 29, 2024 11:16
@DanielYang59
Copy link
Contributor Author

Please review @janosh. Thanks!

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 b2edd88 and dfa183e.
Files selected for processing (17)
  • pymatgen/analysis/bond_dissociation.py (2 hunks)
  • pymatgen/analysis/dimensionality.py (1 hunks)
  • pymatgen/analysis/fragmenter.py (2 hunks)
  • pymatgen/analysis/functional_groups.py (1 hunks)
  • pymatgen/analysis/graphs.py (17 hunks)
  • pymatgen/analysis/local_env.py (8 hunks)
  • pymatgen/analysis/magnetism/heisenberg.py (2 hunks)
  • pymatgen/analysis/quasiharmonic.py (2 hunks)
  • pymatgen/command_line/critic2_caller.py (1 hunks)
  • pymatgen/io/cp2k/inputs.py (8 hunks)
  • pymatgen/io/cp2k/sets.py (11 hunks)
  • pymatgen/io/qchem/outputs.py (1 hunks)
  • tests/analysis/test_fragmenter.py (3 hunks)
  • tests/analysis/test_functional_groups.py (1 hunks)
  • tests/analysis/test_graphs.py (27 hunks)
  • tests/analysis/test_local_env.py (5 hunks)
  • tests/io/test_babel.py (1 hunks)
Additional Context Used
Additional comments not posted (79)
tests/analysis/test_functional_groups.py (1)

32-32: Renaming with_local_env_strategy to from_local_env_strategy aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the outcome of the tests.

tests/io/test_babel.py (1)

56-56: Renaming MoleculeGraph.with_empty_graph to MoleculeGraph.from_empty_graph aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the outcome of the tests.

tests/analysis/test_fragmenter.py (3)

75-75: Renaming MoleculeGraph.with_local_env_strategy to MoleculeGraph.from_local_env_strategy aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the outcome of the tests.


84-84: Renaming MoleculeGraph.with_local_env_strategy to MoleculeGraph.from_local_env_strategy aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the outcome of the tests.


99-99: Renaming MoleculeGraph.with_edges to MoleculeGraph.from_edges aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the outcome of the tests.

pymatgen/analysis/functional_groups.py (1)

89-89: Renaming with_local_env_strategy to from_local_env_strategy aligns with the PR's objective of improving method naming clarity. Ensure that this change does not alter the intended functionality of the method or affect the functionality of the FunctionalGroupExtractor class.

pymatgen/analysis/quasiharmonic.py (2)

229-229: The change in the class name from QuasiharmonicDebyeApprox to QuasiHarmonicDebyeApprox aligns with the PR's objective of ensuring consistency in naming conventions. Ensure that this change does not alter the intended functionality of the class or affect its usage across the codebase.


364-364: The modification in the deprecation message to remove the recommendation to use PascalCase is appropriate, as the class name already adheres to PascalCase. Ensure that the deprecation process is communicated clearly to users.

pymatgen/analysis/fragmenter.py (3)

83-83: The method MoleculeGraph.from_local_env_strategy is correctly used to initialize MoleculeGraph based on the local environment strategy. This change aligns with the PR's objective to rename methods for clarity.


86-86: The method MoleculeGraph.from_edges is correctly used to initialize MoleculeGraph with specified edges. This change is consistent with the renaming objective and improves clarity in method naming.


310-310: The open_ring function now correctly returns a MoleculeGraph using the from_local_env_strategy method. This change is in line with the PR's objective to rename methods for improved clarity.

pymatgen/analysis/bond_dissociation.py (3)

93-93: The method MoleculeGraph.from_local_env_strategy is correctly used to initialize MoleculeGraph for the principle molecule graph. This change aligns with the PR's objective to rename methods for clarity.


290-290: The method MoleculeGraph.from_local_env_strategy is correctly used to initialize the initial_molgraph from the initial molecule. This change is consistent with the renaming objective and improves clarity in method naming.


293-293: The method MoleculeGraph.from_local_env_strategy is correctly used to initialize the final_molgraph from the final molecule. This change is in line with the PR's objective to rename methods for improved clarity.

pymatgen/analysis/dimensionality.py (1)

290-290: The method MoleculeGraph.from_edges is correctly used in the zero_d_graph_to_molecule_graph function to construct a MoleculeGraph from edges. This change aligns with the PR's objective to rename methods for clarity and is appropriate for initializing MoleculeGraph instances based on edges.

pymatgen/command_line/critic2_caller.py (1)

532-532: The change from StructureGraph.with_empty_graph to StructureGraph.from_empty_graph aligns with the PR's objective to rename methods for improved clarity. This change is correctly applied and enhances the readability and intuitiveness of the method call.

pymatgen/analysis/magnetism/heisenberg.py (2)

119-119: The method StructureGraph.from_local_env_strategy has been correctly renamed to StructureGraph.from_local_env_strategy as part of the PR's objective to improve method naming clarity. This change aligns with the Python community's convention of using from_* for class methods that instantiate objects in a specific way.


545-545: The method StructureGraph.from_empty_graph has been correctly renamed to StructureGraph.from_empty_graph, following the PR's objective to rename methods for improved clarity. This change is consistent with the convention of using from_* for class methods that instantiate objects in a specific way.

tests/analysis/test_graphs.py (25)

56-56: The method call StructureGraph.from_empty_graph correctly reflects the PR's objective to rename methods for clarity. This change from with_empty_graph to from_empty_graph improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


109-109: The method call StructureGraph.from_local_env_strategy correctly replaces the previous with_local_env_strategy, adhering to the PR's objective of renaming methods for improved clarity. This change enhances the readability and intuitive understanding of the method's functionality, which is to create a StructureGraph instance based on a local environment strategy.


137-137: The usage of StructureGraph.from_local_env_strategy here is consistent with the PR's goal of renaming methods for clarity. This change makes it clearer that the method is constructing a new StructureGraph instance from a local environment strategy, which is a more intuitive description of the method's functionality.


209-209: The method call StructureGraph.from_local_env_strategy is correctly updated from with_local_env_strategy, aligning with the PR's objectives. This renaming enhances the method's semantic clarity, indicating that it creates a StructureGraph instance based on a local environment strategy.


228-228: The use of StructureGraph.from_local_env_strategy here follows the PR's intention of renaming methods for improved clarity. This change is beneficial as it more accurately describes the method's purpose of constructing a StructureGraph instance from a local environment strategy, improving code readability.


234-234: The method call StructureGraph.from_empty_graph is correctly updated to reflect the PR's objective of renaming methods for clarity. This change from with_empty_graph to from_empty_graph improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


333-333: The method call StructureGraph.from_local_env_strategy is correctly updated from with_local_env_strategy, aligning with the PR's objectives. This renaming enhances the method's semantic clarity, indicating that it creates a StructureGraph instance based on a local environment strategy.


338-338: The usage of StructureGraph.from_local_env_strategy here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new StructureGraph instance from a local environment strategy, which is a more intuitive description of the method's functionality.


359-359: The method call StructureGraph.from_local_env_strategy is correctly updated from with_local_env_strategy, aligning with the PR's objectives. This renaming enhances the method's semantic clarity, indicating that it creates a StructureGraph instance based on a local environment strategy.


401-401: The use of StructureGraph.from_local_env_strategy here follows the PR's intention of renaming methods for improved clarity. This change is beneficial as it more accurately describes the method's purpose of constructing a StructureGraph instance from a local environment strategy, improving code readability.


406-406: The method call StructureGraph.from_local_env_strategy correctly reflects the PR's objective to rename methods for clarity. This change from with_local_env_strategy to from_local_env_strategy improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


427-427: The usage of StructureGraph.from_edges here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new StructureGraph instance from a set of edges, which is a more intuitive description of the method's functionality.


437-437: The method call StructureGraph.from_local_env_strategy is correctly updated from with_local_env_strategy, aligning with the PR's objectives. This renaming enhances the method's semantic clarity, indicating that it creates a StructureGraph instance based on a local environment strategy.


475-475: The use of StructureGraph.from_local_env_strategy here follows the PR's intention of renaming methods for improved clarity. This change is beneficial as it more accurately describes the method's purpose of constructing a StructureGraph instance from a local environment strategy, improving code readability.


573-573: The method call MoleculeGraph.from_edges correctly reflects the PR's objective to rename methods for clarity. This change from with_edges to from_edges improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


584-584: The usage of MoleculeGraph.from_edges here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new MoleculeGraph instance from a set of edges, which is a more intuitive description of the method's functionality.


594-594: The method call MoleculeGraph.from_edges is correctly updated to reflect the PR's objective of renaming methods for clarity. This change from with_edges to from_edges improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


595-595: The method call MoleculeGraph.from_local_env_strategy correctly replaces the previous with_local_env_strategy, adhering to the PR's objective of renaming methods for improved clarity. This change enhances the readability and intuitive understanding of the method's functionality, which is to create a MoleculeGraph instance based on a local environment strategy.


605-605: The usage of MoleculeGraph.from_local_env_strategy here, despite being within a test for an inappropriate strategy, is consistent with the PR's goal of renaming methods for improved clarity. The change makes it clearer that the method is intended to construct a new MoleculeGraph instance from a local environment strategy, even though this particular case tests for an error condition.


700-700: The method call MoleculeGraph.from_empty_graph is correctly updated to reflect the PR's objective of renaming methods for clarity. This change from with_empty_graph to from_empty_graph improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


714-714: The usage of MoleculeGraph.from_empty_graph here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new MoleculeGraph instance from an empty graph, which is a more intuitive description of the method's functionality.


788-788: The method call MoleculeGraph.from_edges correctly reflects the PR's objective to rename methods for clarity. This change from with_edges to from_edges improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


835-835: The usage of MoleculeGraph.from_edges here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new MoleculeGraph instance from a set of edges, which is a more intuitive description of the method's functionality.


843-843: The method call MoleculeGraph.from_edges is correctly updated to reflect the PR's objective of renaming methods for clarity. This change from with_edges to from_edges improves the semantic understanding of the method's purpose, aligning with common Python practices for class method naming that create instances from specific states or data.


847-847: The usage of MoleculeGraph.from_edges here is consistent with the PR's goal of renaming methods for improved clarity. This change makes it clearer that the method is constructing a new MoleculeGraph instance from a set of edges, which is a more intuitive description of the method's functionality.

tests/analysis/test_local_env.py (6)

14-16: Renaming of classes BrunnerNN_real, BrunnerNN_reciprocal, and BrunnerNN_relative to BrunnerNNReal, BrunnerNNReciprocal, and BrunnerNNRelative aligns with Python's naming conventions and improves readability.


418-430: The instantiation of BrunnerNNReciprocal, BrunnerNNRelative, and BrunnerNNReal classes with the updated names is correctly done. The method calls and assertions within these tests are logically sound and adhere to the testing framework's guidelines.


1339-1345: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1342-1372]

The creation of MoleculeGraph for phsh using from_edges method is correctly implemented. The edges dictionary accurately represents the molecular structure, which is crucial for the subsequent tests involving oxygen_edge_extender.


1391-1405: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1372-1402]

Similarly, the creation of MoleculeGraph for LiEC is correctly done. The edges dictionary is well-defined, setting up a proper test environment for metal_edge_extender.


1394-1402: The instantiation of MoleculeGraph for the water cluster around potassium (water_cluster_K) with an empty graph is a good setup for testing the metal_edge_extender function. It's important to ensure that the test accurately reflects the intended use case of the function.


418-430: Using the updated class names in the test cases ensures consistency with the main codebase changes. It's good practice to keep test cases updated to reflect changes in the code they are testing.

pymatgen/io/cp2k/sets.py (10)

317-323: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [93-320]

The constructor of DftSet is well-implemented with comprehensive documentation. However, given its complexity, consider refactoring to improve readability and maintainability. For instance, breaking down the setup process into smaller, more focused methods could enhance clarity and make the code easier to follow.


666-677: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [320-674]

The get_basis_and_potential method is comprehensive and handles various strategies for specifying basis and potential information. To improve readability, consider refactoring by extracting some of the logic into smaller, helper functions. This could make the method easier to follow and maintain.


666-677: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [674-688]

The get_cutoff_from_basis method is efficiently implemented and clearly documented. Good use of numpy operations for handling exponents.


834-840: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [688-927]

The get_xc_functionals method is concise and effectively handles the retrieval and expansion of XC functional names. Well done.


834-840: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [837-860]

The write_potential_file method is effectively implemented, using the PotentialFile class to write potentials to a file. Consistent with the approach used for writing basis sets.


857-863: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [860-886]

The print_forces method correctly configures the CP2K input to print out forces and stress during the calculation. Well-implemented.


883-889: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [886-927]

The print_dos method is well-documented and includes necessary conditional checks for compatibility with k-point calculations. The considerations for setting ndigits are clearly explained.


927-927: The remaining methods in DftSet, such as print_pdos, print_ldos, etc., are consistently implemented and well-documented. The approach to configuring print settings for the CP2K input is clear and effective.


927-927: The StaticSet class provides a convenient way to set up static calculations by correctly inheriting from DftSet and specifying parameters for static calculations.


927-927: The remaining classes, such as RelaxSet, CellOptSet, etc., are consistently implemented and serve as convenient constructors for specific types of calculations. The inheritance from DftSet is correctly utilized across these classes.

pymatgen/io/cp2k/inputs.py (10)

1589-1589: The changes to VHartreeCube look good. Ensure its integration with the rest of the system is verified.


1609-1611: The deprecation of V_Hartree_Cube in favor of VHartreeCube is handled correctly. Ensure all references to V_Hartree_Cube throughout the codebase are updated to VHartreeCube.


1614-1614: The changes to MOCubes look good. Ensure its integration with the rest of the system is verified.


1654-1654: The deprecation of MO_Cubes in favor of MOCubes is handled correctly. Ensure all references to MO_Cubes throughout the codebase are updated to MOCubes.


1658-1658: The changes to EDensityCube look good. Ensure its integration with the rest of the system is verified.


1679-1679: The deprecation of E_Density_Cube in favor of EDensityCube is handled correctly. Ensure all references to E_Density_Cube throughout the codebase are updated to EDensityCube.


1849-1849: The changes to XCFunctional look good. Ensure its integration with the rest of the system is verified.


1878-1878: The deprecation of Xc_Functional in favor of XCFunctional is handled correctly. Ensure all references to Xc_Functional throughout the codebase are updated to XCFunctional.


2106-2106: The changes to BandStructure look good. Ensure its integration with the rest of the system is verified.


2186-2186: The deprecation of Band_Structure in favor of BandStructure is handled correctly. Ensure all references to Band_Structure throughout the codebase are updated to BandStructure.

pymatgen/analysis/graphs.py (3)

19-19: The import of deprecated from monty.dev is added to support the deprecation warnings for the renamed methods. Ensure that the monty package is included in the project dependencies.


198-212: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [157-207]

Renaming methods from with_ to from_ and adding deprecation warnings is a good practice for maintaining backward compatibility while signaling the future removal of these methods. However, ensure that all references to these methods throughout the codebase and documentation are updated to reflect the new names.

Verification successful

The shell script outputs indicate that the methods with_empty_graph, with_edges, and with_local_env_strategy are still present in the pymatgen/analysis/graphs.py file. This presence is consistent with the practice of deprecating methods while introducing new ones with updated names for backward compatibility. Therefore, the review comment is verified based on the information available, but it's important to ensure that these deprecated methods are properly marked and documented as such, and that new references in the codebase use the updated method names.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for references to the old method names to ensure they've been updated.
rg --type py "with_empty_graph"
rg --type py "with_edges"
rg --type py "with_local_env_strategy"

Length of output: 554


202-204: The deprecation message format is consistent across the renamed methods, providing clear information on the deprecation date and the removal date. This consistency helps in maintaining a standard approach to deprecation across the codebase.

pymatgen/io/qchem/outputs.py (1)

2231-2233: The implementation of check_for_structure_changes using MoleculeGraph with OpenBabelNN is a robust approach for comparing molecular connectivity. However, consider the following points for refinement:

  • The handling of special_elements and their distances might not be fully utilized in the current logic. If there's a specific reason for identifying these elements and their distances, ensure that this information is effectively used or clarify its purpose.
  • The method returns strings to indicate the type of structural change. While this works, it might be beneficial to define these return values as constants or an Enum to avoid potential issues with typos and to facilitate easier handling of these states elsewhere in the code.
  • Ensure that the method's documentation clearly explains the return values and under what conditions each is returned.
pymatgen/analysis/local_env.py (6)

18-24: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [93-93]

The ValenceIonicRadiusEvaluator class is well-implemented and follows best practices for encapsulation and method responsibilities.


18-24: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1025-1025]

The NearNeighbors base class provides a clear and concise interface for subclasses to implement specific near neighbor finding algorithms.


3604-3604: The Critic2NN class introduces a dependency on critic2 for topological analysis. It's important to ensure that the critic2 dependency is properly managed and documented, including installation instructions for users who may not have critic2 installed.


3449-3449: The CutOffDictNN class provides a simple and effective way to define near neighbor relationships using a dictionary of fixed cut-off distances. It would be helpful to include examples or guidance on configuring the cut-off distances for common use cases to assist users in effectively utilizing this class.


3604-3604: The CrystalNN class offers a flexible and comprehensive approach to determining near neighbors in periodic structures. Given the complexity and the number of parameters available for tuning the analysis, enhancing the documentation to cover the use of these parameters and their impact on the neighbor finding process would greatly benefit users.


3604-3604: The oxygen_edge_extender and metal_edge_extender functions provide valuable utility in identifying and adding missed bonds in molecular structures. Reviewing the distance criteria and element types used in these functions to ensure they are suitable for a wide range of molecular structures would be beneficial.

pymatgen/analysis/local_env.py Show resolved Hide resolved
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 again @DanielYang59! 👍

@janosh janosh merged commit 3a49dd9 into materialsproject:master Mar 29, 2024
22 checks passed
@DanielYang59 DanielYang59 deleted the rename branch March 29, 2024 11:33
@DanielYang59
Copy link
Contributor Author

Thanks again for reviewing @janosh! Cheers!

@DanielYang59 DanielYang59 changed the title Remove legacy analysis.interface, rename classes to PascalCase and rename with_* to from_* Remove deprecated analysis.interface, rename classes to PascalCase and rename with_* to from_* Mar 29, 2024
@janosh janosh added housekeeping Linting fixes, cleaning up and refactoring code api Application programming interface labels Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Application programming interface housekeeping Linting fixes, cleaning up and refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants