Skip to content

Reuse the same output patterns#504

Merged
jan-janssen merged 4 commits intomainfrom
refactor
Jul 23, 2025
Merged

Reuse the same output patterns#504
jan-janssen merged 4 commits intomainfrom
refactor

Conversation

@jan-janssen
Copy link
Copy Markdown
Member

@jan-janssen jan-janssen commented Jul 23, 2025

Summary by CodeRabbit

  • Refactor

    • Unified and streamlined the structure of task dictionaries across elastic, energy-volume curve, phonon, and quasi-harmonic workflows for greater consistency and clarity.
    • Updated function and method signatures to use grouped dictionaries for related data, improving encapsulation and maintainability.
    • Adjusted internal variable names and return values to match the new data structures.
  • Tests

    • Revised test cases to align with the new task dictionary formats and variable names, ensuring compatibility with the refactored workflows.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 23, 2025

Walkthrough

This update standardizes the structure of task dictionaries across elastic, energy-volume curve, phonon, and quasi-harmonic workflows. Functions now return grouped dictionaries (e.g., under keys like "calc_energy" or "calc_forces") instead of separate variables. Corresponding workflows and tests are refactored to consume and pass these unified data structures, with function signatures and internal state updated accordingly.

Changes

Files/Paths Change Summary
atomistics/workflows/elastic/helper.py Changed return type and docstring of get_tasks_for_elastic_matrix to return nested task dictionary and symmetry dictionary.
atomistics/workflows/elastic/workflow.py Updated generate_structures to handle new return structure from helper, returning full task dictionary.
atomistics/workflows/evcurve/helper.py Refactored get_tasks_for_energy_volume_curve to return dict under "calc_energy"; updated analysis function accordingly.
atomistics/workflows/evcurve/workflow.py Renamed internal _structure_dict to _task_dict; updated methods to use and return new task dictionary.
atomistics/workflows/phonons/helper.py Modified get_tasks_for_harmonic_approximation to return a dict under "calc_forces" and swapped tuple order.
atomistics/workflows/phonons/workflow.py Updated unpacking and return of task dictionary from helper function.
atomistics/workflows/quasiharmonic.py Consolidated separate variables into grouped dictionaries for tasks and QH data; updated function signatures and internal state.
tests/test_elastic_lammpslib_functional.py Updated test to use new return order and structure from get_tasks_for_elastic_matrix.
tests/test_evcurve_lammpslib_function_parallel.py,
tests/test_evcurve_lammpslib_functional.py
Renamed test variables from structure_dict to task_dict for consistency with new helper return values.
tests/test_phonons_lammpslib_functional.py Swapped unpacking order and updated evaluation calls for new phonon helper return structure.
tests/test_quasiharmonic_lammpslib_functional.py Refactored to use consolidated task_dict and qh_dict from QH helper, updating all downstream calls.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Workflow
    participant Helper

    User->>Workflow: generate_structures()
    Workflow->>Helper: get_tasks_for_*()
    Helper-->>Workflow: task_dict, meta_dict
    Workflow->>User: task_dict
    User->>Workflow: analyse_structures(output_dict)
    Workflow->>Helper: analyse_results_for_*(output_dict, task_dict/meta_dict)
    Helper-->>Workflow: analysis_result
    Workflow->>User: analysis_result
Loading

Estimated code review effort

3 (~45 minutes)

Possibly related PRs

  • pyiron/atomistics#503: Renamed generate_structures_helper to get_tasks_for_elastic_matrix; this PR further changes its return type and structure.

Poem

A bunny hopped through fields of code,
Grouping tasks in one abode.
"Calc_energy" and "calc_forces" too,
Now nest together, neat and true.
Workflows dance in tidy rows—
Oh, how this rabbit’s garden grows!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.29%. Comparing base (491ff68) to head (949de6c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #504   +/-   ##
=======================================
  Coverage   85.29%   85.29%           
=======================================
  Files          43       43           
  Lines        2584     2584           
=======================================
  Hits         2204     2204           
  Misses        380      380           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@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

🔭 Outside diff range comments (1)
atomistics/workflows/phonons/helper.py (1)

270-270: Update return type annotation to match actual behavior.

The type annotation still reflects the old return order and structure. It should be updated to match the new return pattern.

-) -> tuple[Phonopy, dict[int, Atoms]]:
+) -> tuple[dict[str, dict[int, Atoms]], Phonopy]:

Additionally, the docstring on line 283 should be updated:

-        Tuple[Phonopy, Dict[int, Atoms]]: The Phonopy object and the dictionary of structures.
+        Tuple[Dict[str, Dict[int, Atoms]], Phonopy]: A dictionary keyed by calculation type containing structures, and the Phonopy object.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 491ff68 and 949de6c.

📒 Files selected for processing (12)
  • atomistics/workflows/elastic/helper.py (3 hunks)
  • atomistics/workflows/elastic/workflow.py (1 hunks)
  • atomistics/workflows/evcurve/helper.py (3 hunks)
  • atomistics/workflows/evcurve/workflow.py (3 hunks)
  • atomistics/workflows/phonons/helper.py (1 hunks)
  • atomistics/workflows/phonons/workflow.py (1 hunks)
  • atomistics/workflows/quasiharmonic.py (13 hunks)
  • tests/test_elastic_lammpslib_functional.py (1 hunks)
  • tests/test_evcurve_lammpslib_function_parallel.py (2 hunks)
  • tests/test_evcurve_lammpslib_functional.py (1 hunks)
  • tests/test_phonons_lammpslib_functional.py (2 hunks)
  • tests/test_quasiharmonic_lammpslib_functional.py (3 hunks)
🧬 Code Graph Analysis (5)
tests/test_phonons_lammpslib_functional.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
tests/test_evcurve_lammpslib_functional.py (2)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
atomistics/workflows/phonons/workflow.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
atomistics/workflows/elastic/workflow.py (1)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
atomistics/workflows/evcurve/workflow.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_tasks_for_energy_volume_curve (204-236)
🧰 Additional context used
🧬 Code Graph Analysis (5)
tests/test_phonons_lammpslib_functional.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
tests/test_evcurve_lammpslib_functional.py (2)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
atomistics/workflows/phonons/workflow.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
atomistics/workflows/elastic/workflow.py (1)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
atomistics/workflows/evcurve/workflow.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_tasks_for_energy_volume_curve (204-236)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: unittest_qe
  • GitHub Check: coverage
  • GitHub Check: unittest_gpaw
  • GitHub Check: unittest_sphinxdft
  • GitHub Check: notebooks
🔇 Additional comments (23)
tests/test_evcurve_lammpslib_function_parallel.py (1)

40-40: LGTM! Consistent variable renaming aligns with refactored data structure.

The variable rename from structure_dict to task_dict correctly reflects the updated return type from get_tasks_for_energy_volume_curve, which now returns a dictionary keyed by "calc_energy" containing the structure data. This improves code clarity and consistency across the workflow.

Also applies to: 49-49, 55-55

tests/test_elastic_lammpslib_functional.py (2)

34-34: LGTM! Unpacking order updated to match helper function changes.

The unpacking order correctly reflects the updated return signature of get_tasks_for_elastic_matrix, which now returns (task_dict, sym_dict) instead of (sym_dict, structure_dict).


42-42: LGTM! Direct usage of task_dict simplifies the code.

Passing task_dict directly to evaluate_with_lammpslib is cleaner than manually wrapping the structure dictionary, and aligns with the standardized task dictionary approach.

tests/test_evcurve_lammpslib_functional.py (1)

35-35: LGTM! Consistent variable renaming matches the refactored workflow.

The variable rename from structure_dict to task_dict is consistent with the parallel test version and correctly reflects the updated data structure returned by get_tasks_for_energy_volume_curve. The changes maintain the same test logic while using the standardized task dictionary approach.

Also applies to: 43-43, 48-48

tests/test_phonons_lammpslib_functional.py (2)

36-36: LGTM! Unpacking order updated to match helper function signature.

The unpacking order correctly reflects the updated return signature of get_tasks_for_harmonic_approximation, which now returns ({"calc_forces": structure_dict}, phonopy_obj) instead of (phonopy_obj, structure_dict).


45-45: LGTM! Direct usage of task_dict aligns with standardized approach.

Passing task_dict directly to evaluate_with_lammpslib eliminates the need to manually construct the task dictionary and aligns with the standardized task dictionary approach across workflows.

atomistics/workflows/phonons/workflow.py (2)

78-78: LGTM! Unpacking order updated to match helper function changes.

The unpacking order correctly reflects the updated return signature of get_tasks_for_harmonic_approximation, which now returns the task dictionary first, followed by the phonopy object.


86-86: LGTM! Direct return eliminates redundant dictionary wrapping.

Returning task_dict directly is cleaner since get_tasks_for_harmonic_approximation already returns a properly structured dictionary with the "calc_forces" key. This eliminates redundant dictionary construction and aligns with the standardized task dictionary approach.

atomistics/workflows/evcurve/workflow.py (3)

48-48: LGTM: Attribute renamed to reflect new data structure.

The rename from _structure_dict to _task_dict correctly reflects that the workflow now handles task dictionaries keyed by calculation types rather than raw structure dictionaries.


68-75: LGTM: Method correctly updated for new task dictionary pattern.

The changes properly implement the new pattern where get_tasks_for_energy_volume_curve returns a task dictionary with "calc_energy" key, and the method now returns this dictionary directly instead of wrapping it.


92-92: LGTM: Parameter name updated consistently.

The parameter change from structure_dict=self._structure_dict to task_dict=self._task_dict is consistent with the refactoring and matches the expected interface of the helper function.

atomistics/workflows/elastic/workflow.py (1)

49-58: LGTM: Method correctly updated to handle new task dictionary structure.

The changes properly implement the new pattern where:

  1. The helper function now returns (task_dict, sym_dict) instead of (sym_dict, structure_dict)
  2. Structure dictionary is extracted from task_dict["calc_energy"]
  3. The method returns the complete task_dict directly

This maintains consistency with the refactoring across other workflows.

atomistics/workflows/elastic/helper.py (2)

23-23: LGTM: Return type annotation correctly updated.

The type annotation properly reflects the new return structure where the first element is a dictionary keyed by calculation type containing structure dictionaries.


99-99: LGTM: Return statement updated correctly.

The return statement properly wraps the structure dictionary under the "calc_energy" key, consistent with the new task dictionary pattern.

atomistics/workflows/phonons/helper.py (1)

308-308: LGTM: Return statement correctly updated for new pattern.

The return statement properly wraps the structure dictionary under the "calc_forces" key and swaps the return order, which is consistent with the new task dictionary pattern used across workflows.

tests/test_quasiharmonic_lammpslib_functional.py (2)

35-44: LGTM: Test updated correctly for consolidated return values.

The unpacking change from four separate variables to two grouped dictionaries (task_dict, qh_dict) correctly reflects the updated interface of get_tasks_for_quasi_harmonic_approximation.


46-46: LGTM: Function calls consistently updated with new parameter structure.

All function calls have been properly updated to use the new task_dict and qh_dict parameters instead of the previous separate variables. This maintains consistency with the refactored interface while preserving the original test logic and assertions.

Also applies to: 50-50, 57-58, 94-95, 108-109

atomistics/workflows/evcurve/helper.py (2)

236-236: LGTM! Consistent with the new output pattern.

The function now returns a dictionary with "calc_energy" key, aligning with the standardized structure across workflows.


239-275: Parameter rename and nested access are correctly implemented.

The changes from structure_dict to task_dict and the nested access pattern task_dict["calc_energy"] are consistently applied throughout the function. This aligns with the new data organization pattern.

atomistics/workflows/quasiharmonic.py (4)

51-98: Function signature and implementation correctly updated for the new data structure.

The function now accepts task_dict and qh_dict parameters, and the implementation correctly accesses the nested structures:

  • task_dict["calc_energy"] for volume calculations
  • qh_dict["repeat_vector"] and qh_dict["phonopy_dict"] for quasi-harmonic calculations

366-433: Return value structure properly refactored.

The function now returns a tuple of dictionaries following the new pattern:

  • task_dict with keys "calc_energy" and "calc_forces"
  • qh_dict with keys "phonopy_dict" and "repeat_vector"

This encapsulation improves the organization of related data.


436-469: Function correctly updated to use qh_dict parameter.

The analyse_results_for_quasi_harmonic_approximation function now accepts qh_dict instead of separate parameters and correctly accesses qh_dict["phonopy_dict"] in the implementation.


519-621: QuasiHarmonicWorkflow class properly refactored.

The class has been updated to use the new data structures:

  • Replaced separate attributes with _qh_dict and _task_dict
  • Methods correctly handle the grouped dictionaries
  • generate_structures() returns _task_dict directly
  • All method implementations consistently use the new structure


Returns:
Tuple[Dict[str, int], Dict[str, ase.atoms.Atoms]]: A tuple containing the symmetry dictionary and the structure dictionary.
Dict[str, Dict[str, ase.atoms.Atoms]]], Tuple[Dict[str, int]: A tuple containing the symmetry dictionary and the structure dictionary.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix malformed docstring in Returns section.

The docstring appears to be incomplete or malformed. It should clearly describe both return values.

-        Dict[str, Dict[str, ase.atoms.Atoms]]], Tuple[Dict[str, int]: A tuple containing the symmetry dictionary and the structure dictionary.
+        Tuple containing:
+            - Dict[str, Dict[str, ase.atoms.Atoms]]: A dictionary keyed by calculation type (e.g., "calc_energy") 
+              containing sub-dictionaries keyed by job names with corresponding strained structures.
+            - Dict[str, int]: A symmetry dictionary with keys like "SGN", "v0", "LC", "Lag_strain_list", and "epss".
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Dict[str, Dict[str, ase.atoms.Atoms]]], Tuple[Dict[str, int]: A tuple containing the symmetry dictionary and the structure dictionary.
Tuple containing:
- Dict[str, Dict[str, ase.atoms.Atoms]]: A dictionary keyed by calculation type (e.g., "calc_energy")
containing sub-dictionaries keyed by job names with corresponding strained structures.
- Dict[str, int]: A symmetry dictionary with keys like "SGN", "v0", "LC", "Lag_strain_list", and "epss".
🤖 Prompt for AI Agents
In atomistics/workflows/elastic/helper.py at line 35, the Returns section of the
docstring is malformed and incomplete. Correct the docstring to clearly and
fully describe both return values, specifying the types and what each dictionary
in the tuple represents, ensuring proper syntax and clarity.

Copy link
Copy Markdown
Contributor

@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

🧹 Nitpick comments (3)
atomistics/workflows/elastic/helper.py (1)

35-35: Fix the docstring format.

The return type description has a syntax error with misplaced brackets and incomplete type information.

-        Dict[str, Dict[str, ase.atoms.Atoms]]], Tuple[Dict[str, int]: A tuple containing the symmetry dictionary and the structure dictionary.
+        tuple[dict[str, dict[str, ase.atoms.Atoms]], dict[str, int]]: A tuple containing the task dictionary and the symmetry dictionary.
atomistics/workflows/evcurve/workflow.py (1)

1-1: Consider removing unused import.

Since the workflow no longer wraps the task dictionary in an OrderedDict, verify if the import is still needed elsewhere in the file.

#!/bin/bash
# Description: Check if OrderedDict is still used in this file
rg "OrderedDict" atomistics/workflows/evcurve/workflow.py
atomistics/workflows/evcurve/helper.py (1)

251-251: Minor documentation inconsistency.

The docstring still refers to "structure dictionary" but the parameter is now named task_dict. Consider updating for clarity:

-        task_dict (dict): The structure dictionary containing structure keys.
+        task_dict (dict): The task dictionary containing structures under the "calc_energy" key.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 491ff68 and 949de6c.

📒 Files selected for processing (12)
  • atomistics/workflows/elastic/helper.py (3 hunks)
  • atomistics/workflows/elastic/workflow.py (1 hunks)
  • atomistics/workflows/evcurve/helper.py (3 hunks)
  • atomistics/workflows/evcurve/workflow.py (3 hunks)
  • atomistics/workflows/phonons/helper.py (1 hunks)
  • atomistics/workflows/phonons/workflow.py (1 hunks)
  • atomistics/workflows/quasiharmonic.py (13 hunks)
  • tests/test_elastic_lammpslib_functional.py (1 hunks)
  • tests/test_evcurve_lammpslib_function_parallel.py (2 hunks)
  • tests/test_evcurve_lammpslib_functional.py (1 hunks)
  • tests/test_phonons_lammpslib_functional.py (2 hunks)
  • tests/test_quasiharmonic_lammpslib_functional.py (3 hunks)
🧬 Code Graph Analysis (8)
tests/test_evcurve_lammpslib_functional.py (2)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
tests/test_evcurve_lammpslib_function_parallel.py (1)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/workflows/evcurve/workflow.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_tasks_for_energy_volume_curve (204-236)
atomistics/workflows/quasiharmonic.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_volume_lst (108-119)
atomistics/workflows/elastic/workflow.py (1)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
tests/test_elastic_lammpslib_functional.py (2)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
tests/test_phonons_lammpslib_functional.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
atomistics/workflows/phonons/workflow.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
🧰 Additional context used
🧬 Code Graph Analysis (8)
tests/test_evcurve_lammpslib_functional.py (2)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
tests/test_evcurve_lammpslib_function_parallel.py (1)
atomistics/workflows/evcurve/helper.py (2)
  • get_tasks_for_energy_volume_curve (204-236)
  • analyse_results_for_energy_volume_curve (239-274)
atomistics/workflows/evcurve/workflow.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_tasks_for_energy_volume_curve (204-236)
atomistics/workflows/quasiharmonic.py (1)
atomistics/workflows/evcurve/helper.py (1)
  • get_volume_lst (108-119)
atomistics/workflows/elastic/workflow.py (1)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
tests/test_elastic_lammpslib_functional.py (2)
atomistics/workflows/elastic/helper.py (1)
  • get_tasks_for_elastic_matrix (17-99)
atomistics/calculators/lammps/libcalculator.py (1)
  • evaluate_with_lammpslib (475-505)
tests/test_phonons_lammpslib_functional.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
atomistics/workflows/phonons/workflow.py (1)
atomistics/workflows/phonons/helper.py (1)
  • get_tasks_for_harmonic_approximation (263-308)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: unittest_qe
  • GitHub Check: coverage
  • GitHub Check: unittest_gpaw
  • GitHub Check: notebooks
🔇 Additional comments (20)
atomistics/workflows/elastic/helper.py (2)

23-23: LGTM! Function signature updated for standardization.

The return type annotation correctly reflects the new standardized output pattern where structures are grouped under the "calc_energy" key.


99-99: Return order change validated

All usages of get_tasks_for_elastic_matrix (in both the workflow and tests) destructure the return as (task_dict, sym_dict), which matches the new signature of ({"calc_energy": structure_dict}, sym_dict). No downstream references expect the old order, so this change is safe.

tests/test_evcurve_lammpslib_function_parallel.py (1)

40-56: LGTM! Variable renaming aligns with standardization.

The renaming from structure_dict to task_dict is consistent with the standardized output patterns across workflows. The functionality remains unchanged while improving naming consistency.

tests/test_evcurve_lammpslib_functional.py (1)

35-48: LGTM! Consistent variable renaming.

The variable renaming from structure_dict to task_dict maintains consistency with the standardized output patterns and aligns with similar changes in other test files.

tests/test_elastic_lammpslib_functional.py (2)

34-40: LGTM! Correctly adapted to new function signature.

The unpacking order has been correctly updated to match the new return signature of get_tasks_for_elastic_matrix, which now returns (task_dict, sym_dict) instead of (sym_dict, structure_dict).


42-42: LGTM! Consistent variable usage.

The use of task_dict instead of structure_dict correctly reflects the new standardized data structure format.

atomistics/workflows/evcurve/workflow.py (3)

48-48: LGTM! Attribute renamed for consistency.

The internal attribute renaming from _structure_dict to _task_dict aligns with the standardized task dictionary approach across workflows.


68-75: LGTM! Simplified task dictionary handling.

The method now directly assigns and returns the task dictionary from get_tasks_for_energy_volume_curve without additional wrapping, which is cleaner and consistent with the new standardized approach.


92-92: LGTM! Updated parameter name for consistency.

The parameter change from structure_dict=self._structure_dict to task_dict=self._task_dict correctly aligns with the updated function signature and naming conventions.

atomistics/workflows/elastic/workflow.py (1)

49-58: LGTM! Standardized task dictionary structure implementation.

The changes successfully implement the standardized output pattern by:

  1. Properly unpacking the tuple returned by get_tasks_for_elastic_matrix
  2. Extracting structures from the nested task_dict["calc_energy"] key
  3. Maintaining backward compatibility by setting the internal _structure_dict attribute correctly
  4. Returning the complete task_dict to maintain the unified structure

This aligns perfectly with the PR objective of reusing the same output patterns across workflows.

atomistics/workflows/evcurve/helper.py (2)

236-236: LGTM! Standardized return structure implementation.

The function now returns the structure dictionary wrapped under a "calc_energy" key, which aligns perfectly with the standardized output pattern used across other workflows like elastic matrix calculations.


241-241: LGTM! Consistent parameter naming and usage.

The parameter rename from structure_dict to task_dict and the corresponding updates to access task_dict["calc_energy"] properly implement the standardized task dictionary structure. The functionality remains intact while providing a unified interface pattern.

Also applies to: 264-270

atomistics/workflows/phonons/workflow.py (1)

78-86: LGTM! Correctly updated to match new helper function signature.

The changes properly reflect the updated return structure from get_tasks_for_harmonic_approximation where the task dictionary (now wrapped under the "calc_forces" key) is returned first, followed by the Phonopy object. The direct return of task_dict eliminates redundant wrapping since the helper function already provides the properly structured dictionary.

tests/test_phonons_lammpslib_functional.py (1)

36-47: LGTM! Test correctly updated for new function signature.

The test properly reflects the updated return structure from get_tasks_for_harmonic_approximation, correctly unpacking the task dictionary first and the Phonopy object second. The direct use of task_dict in the evaluation call is appropriate since it's already properly structured with the "calc_forces" key.

tests/test_quasiharmonic_lammpslib_functional.py (1)

35-109: LGTM! Test comprehensively updated for new consolidated data structures.

The test changes properly reflect the refactored function signatures that consolidate related data into grouped dictionaries. The transition from separate variables to task_dict and qh_dict improves data encapsulation and maintains consistency with the broader standardization effort across workflows. All downstream function calls are correctly updated to use the new parameter structure.

atomistics/workflows/phonons/helper.py (1)

308-308: LGTM! Correctly implements standardized output pattern.

The change properly wraps the structure dictionary under the "calc_forces" key and returns it as the first element, followed by the Phonopy object. This aligns with the broader standardization effort across workflows where task dictionaries are grouped under descriptive keys like "calc_forces" and "calc_energy".

atomistics/workflows/quasiharmonic.py (4)

53-97: LGTM! Successfully consolidated function parameters into grouped dictionaries.

The refactoring properly consolidates separate parameters into task_dict and qh_dict, improving data encapsulation. The updated data access patterns correctly use the new dictionary structure, such as accessing energy structures via task_dict["calc_energy"] and phonopy data via qh_dict["phonopy_dict"] and qh_dict["repeat_vector"].


416-433: LGTM! Correctly updated to return consolidated dictionaries.

The function now returns two properly structured dictionaries: task_dict containing calculation tasks under "calc_energy" and "calc_forces" keys, and qh_dict containing the phonopy objects and repeat vector. This aligns with the standardization effort and improves data organization compared to returning four separate variables.


437-467: LGTM! Analysis function properly updated for new data structure.

The function signature correctly changed to accept qh_dict instead of separate phonopy dictionary, and the implementation properly accesses phonopy objects through qh_dict["phonopy_dict"]. This maintains functional correctness while using the new consolidated data structure.


519-609: LGTM! Workflow class successfully updated for consolidated data structures.

The class properly replaced separate instance variables with _qh_dict and _task_dict, and all methods are correctly updated to use these new data structures. The parameter passing in method calls consistently uses the new dictionary format, maintaining the workflow's functionality while improving data organization.

@jan-janssen jan-janssen merged commit 26e3eac into main Jul 23, 2025
46 of 49 checks passed
@jan-janssen jan-janssen deleted the refactor branch July 23, 2025 14:56
@coderabbitai coderabbitai bot mentioned this pull request Jul 23, 2025
@coderabbitai coderabbitai bot mentioned this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant