Skip to content

feature/SOF-7956 Feat: phonon DOS NB#347

Open
VsevolodX wants to merge 2 commits into
mainfrom
feature/SOF-7956
Open

feature/SOF-7956 Feat: phonon DOS NB#347
VsevolodX wants to merge 2 commits into
mainfrom
feature/SOF-7956

Conversation

@VsevolodX

@VsevolodX VsevolodX commented Jul 16, 2026

Copy link
Copy Markdown
Member
  • update: return ZPE NB
  • feat: add dos NB

Summary by CodeRabbit

  • New Features

    • Added a complete notebook workflow for calculating and visualizing phonon dispersion curves and phonon density of states.
    • Supports configurable material, relaxation, electronic, phonon, DOS, dispersion, workflow, and compute settings.
    • Enables submitting calculations and retrieving results for visualization.
  • Documentation

    • Updated the workflow contents to link to the new phonon DOS and dispersion notebook.

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@VsevolodX, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 900819c8-d97e-434f-841e-60ef1b8cb07c

📥 Commits

Reviewing files that changed from the base of the PR and between f6dcec1 and 46a47ec.

📒 Files selected for processing (1)
  • other/materials_designer/workflows/phonon_dos_dispersion.ipynb
📝 Walkthrough

Walkthrough

Changes

Phonon Workflow

Layer / File(s) Summary
Inputs, authentication, and material setup
other/materials_designer/workflows/Introduction.ipynb, other/materials_designer/workflows/phonon_dos_dispersion.ipynb
Adds configurable calculation inputs, platform authentication, project selection, and material loading or saving.
Workflow construction and customization
other/materials_designer/workflows/phonon_dos_dispersion.ipynb
Loads and saves a phonon workflow with optional relaxation, model propagation, grid and path settings, and plane-wave cutoffs.
Compute selection and job execution
other/materials_designer/workflows/phonon_dos_dispersion.ipynb
Selects compute resources, creates and submits a job, and waits asynchronously for completion.
Result retrieval and notebook packaging
other/materials_designer/workflows/phonon_dos_dispersion.ipynb
Retrieves and visualizes phonon dispersion and DOS properties, and adds notebook metadata.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Notebook
  participant Mat3ra API
  participant Standata
  participant Jobs API
  participant Compute cluster
  Notebook->>Mat3ra API: authenticate and select project
  Notebook->>Standata: load phonon workflow
  Notebook->>Mat3ra API: save material and customized workflow
  Notebook->>Jobs API: create and submit job
  Jobs API->>Compute cluster: run phonon calculation
  Compute cluster-->>Jobs API: report completion
  Jobs API-->>Notebook: return dispersion and DOS properties
Loading

Possibly related PRs

Suggested reviewers: timurbazhirov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly points to the main addition of the phonon DOS notebook.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/SOF-7956

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
other/materials_designer/workflows/phonon_dos_dispersion.ipynb (1)

411-422: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Fail when requested overrides cannot find their workflow units.

Each lookup silently does nothing when a unit name is missing, so the submitted job may use defaults despite the user explicitly setting grids, paths, or cutoffs. Raise a clear error—or at least warn—for requested overrides.

Example fail-fast handling
 def set_grid(subworkflow, unit_name, dimensions, name=None):
     unit = subworkflow.get_unit_by_name(name=unit_name)
-    if unit:
-        unit.add_context(PointsGridDataProvider(dimensions=dimensions, isEdited=True, **({"name": name} if name else {})).get_context_item_data())
-        subworkflow.set_unit(unit)
+    if unit is None:
+        raise ValueError(f"Workflow unit {unit_name!r} was not found")
+    unit.add_context(PointsGridDataProvider(dimensions=dimensions, isEdited=True, **({"name": name} if name else {})).get_context_item_data())
+    subworkflow.set_unit(unit)

Also applies to: 425-458

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@other/materials_designer/workflows/phonon_dos_dispersion.ipynb` around lines
411 - 422, Update set_grid, set_path, and the corresponding cutoff override
helpers to detect when get_unit_by_name cannot find the requested workflow unit.
For each explicitly requested override, raise a clear error (or emit a warning
if that workflow requires non-fatal handling) identifying the missing unit name
instead of silently returning; preserve the existing update behavior when the
unit is found.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@other/materials_designer/workflows/phonon_dos_dispersion.ipynb`:
- Around line 232-234: Handle an empty result from client.projects.list in the
project-selection flow before accessing projects[0]. When no default project
exists, exit or report the missing project cleanly instead of raising
IndexError; preserve the existing project_id assignment and success message for
accounts with a default project.
- Around line 538-544: Validate the cluster selection before constructing
Compute: handle an empty clusters collection and an unmatched CLUSTER_NAME by
reporting an explicit error and stopping execution. Preserve the existing
hostname match and default-to-first-cluster behavior when a valid cluster is
available, and ensure Compute receives only a confirmed cluster.

---

Nitpick comments:
In `@other/materials_designer/workflows/phonon_dos_dispersion.ipynb`:
- Around line 411-422: Update set_grid, set_path, and the corresponding cutoff
override helpers to detect when get_unit_by_name cannot find the requested
workflow unit. For each explicitly requested override, raise a clear error (or
emit a warning if that workflow requires non-fatal handling) identifying the
missing unit name instead of silently returning; preserve the existing update
behavior when the unit is found.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e41f15d8-c41c-43e8-b892-5ac89a11022f

📥 Commits

Reviewing files that changed from the base of the PR and between 6a6518d and f6dcec1.

📒 Files selected for processing (2)
  • other/materials_designer/workflows/Introduction.ipynb
  • other/materials_designer/workflows/phonon_dos_dispersion.ipynb

Comment on lines +232 to +234
"projects = client.projects.list({\"isDefault\": True, \"owner._id\": ACCOUNT_ID})\n",
"project_id = projects[0][\"_id\"]\n",
"print(f\"✅ Using project: {projects[0]['name']} ({project_id})\")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle accounts without a default project.

projects[0] raises IndexError when the selected account has no default project, stopping the notebook before job creation.

Proposed fix
 projects = client.projects.list({"isDefault": True, "owner._id": ACCOUNT_ID})
+if not projects:
+    raise RuntimeError(
+        f"No default project found for account {selected_account.name!r}."
+    )
 project_id = projects[0]["_id"]
📝 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
"projects = client.projects.list({\"isDefault\": True, \"owner._id\": ACCOUNT_ID})\n",
"project_id = projects[0][\"_id\"]\n",
"print(f\"✅ Using project: {projects[0]['name']} ({project_id})\")"
"projects = client.projects.list({\"isDefault\": True, \"owner._id\": ACCOUNT_ID})\n",
"if not projects:\n",
" raise RuntimeError(\n",
" f\"No default project found for account {selected_account.name!r}.\"\n",
" )\n",
"project_id = projects[0][\"_id\"]\n",
"print(f\"✅ Using project: {projects[0]['name']} ({project_id})\")"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@other/materials_designer/workflows/phonon_dos_dispersion.ipynb` around lines
232 - 234, Handle an empty result from client.projects.list in the
project-selection flow before accessing projects[0]. When no default project
exists, exit or report the missing project cleanly instead of raising
IndexError; preserve the existing project_id assignment and success message for
accounts with a default project.

Comment on lines +538 to +544
"if CLUSTER_NAME:\n",
" cluster = next((c for c in clusters if CLUSTER_NAME in c[\"hostname\"]), None)\n",
"else:\n",
" cluster = clusters[0]\n",
"\n",
"compute = Compute(cluster=cluster, queue=QUEUE_NAME, ppn=PPN)\n",
"print(f\"Using cluster: {compute.cluster.hostname}, queue: {QUEUE_NAME}, ppn: {PPN}\")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate cluster selection before constructing Compute.

An empty cluster list causes clusters[0] to fail, while an unmatched CLUSTER_NAME passes None into Compute. Report either condition explicitly.

Proposed fix
 if CLUSTER_NAME:
     cluster = next((c for c in clusters if CLUSTER_NAME in c["hostname"]), None)
+    if cluster is None:
+        raise ValueError(f"No cluster matches {CLUSTER_NAME!r}")
 else:
+    if not clusters:
+        raise RuntimeError("No compute clusters are available")
     cluster = clusters[0]
📝 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
"if CLUSTER_NAME:\n",
" cluster = next((c for c in clusters if CLUSTER_NAME in c[\"hostname\"]), None)\n",
"else:\n",
" cluster = clusters[0]\n",
"\n",
"compute = Compute(cluster=cluster, queue=QUEUE_NAME, ppn=PPN)\n",
"print(f\"Using cluster: {compute.cluster.hostname}, queue: {QUEUE_NAME}, ppn: {PPN}\")"
"if CLUSTER_NAME:\n",
" cluster = next((c for c in clusters if CLUSTER_NAME in c[\"hostname\"]), None)\n",
" if cluster is None:\n",
" raise ValueError(f\"No cluster matches {CLUSTER_NAME!r}\")\n",
"else:\n",
" if not clusters:\n",
" raise RuntimeError(\"No compute clusters are available\")\n",
" cluster = clusters[0]\n",
"\n",
"compute = Compute(cluster=cluster, queue=QUEUE_NAME, ppn=PPN)\n",
"print(f\"Using cluster: {compute.cluster.hostname}, queue: {QUEUE_NAME}, ppn: {PPN}\")"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@other/materials_designer/workflows/phonon_dos_dispersion.ipynb` around lines
538 - 544, Validate the cluster selection before constructing Compute: handle an
empty clusters collection and an unmatched CLUSTER_NAME by reporting an explicit
error and stopping execution. Preserve the existing hostname match and
default-to-first-cluster behavior when a valid cluster is available, and ensure
Compute receives only a confirmed cluster.

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