Skip to content

Conversation

@AsymmetryChou
Copy link
Contributor

@AsymmetryChou AsymmetryChou commented Sep 30, 2025

This pull request updates and expands the NEGF (Non-Equilibrium Green's Function) example input files for MoS₂, graphene, and hBN systems. The main changes include improvements to the k-point mesh and energy grid settings for better accuracy, renaming of structure files for consistency, and the addition of new benchmark examples for timing studies with corresponding structure files.

Key changes:

Parameter and Input Improvements:

  • Updated the kmesh settings in negf.json files for MoS₂, graphene, and hBN to use denser k-point sampling in the transport direction, improving calculation accuracy. [1] [2]
  • Refined the energy grid parameters (espacing, emin, emax) in examples/hBN/negf.json for finer energy resolution and a narrower energy window.

File Consistency and Naming:

  • Renamed structure file references from struct_negf.xyz to stru_negf.xyz in all relevant negf.json files for MoS₂, graphene, and hBN to maintain consistent naming conventions. [1] [2] [3]

New Benchmark Examples:

  • Added new NEGF timing benchmark input files: negf_time_bench.json for both graphene and hBN, including appropriate simulation parameters for benchmarking. [1] [2]
  • Included corresponding structure files for the new benchmarks: stru_negf_time_bench.xyz for both graphene and hBN, defining the atomic coordinates and lattice for the benchmark systems. [1] [2]

Summary by CodeRabbit

  • New Features

    • Added time-benchmark examples for graphene and hBN, including new configuration and structure files.
  • Documentation

    • Updated example NEGF configurations: renamed structure file references, adjusted k-point meshes (MoS2, graphene, hBN), and refined hBN energy range and spacing for improved resolution.
  • Chores

    • Expanded .gitignore to exclude additional generated outputs and cache files.

@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

Walkthrough

Updates example NEGf configurations and structures: adjusts structure filenames and k-point meshes, refines energy grid for hBN, adds time-benchmark example configs and XYZ structures for graphene and hBN, and expands .gitignore to exclude new output and cache paths.

Changes

Cohort / File(s) Summary
Repository ignores
./.gitignore
Added ignore rules for examples/hBN/negf_output_k100/self_energy/*, run_config.json, and __pycache__ under dpnegf/nnet and dpnegf/sktb.
Example config tweaks
examples/MoS2/negf.json, examples/graphene/negf.json, examples/hBN/negf.json
Switched structure path ./struct_negf.xyz./stru_negf.xyz. Adjusted kmesh: MoS2 [1,1,1]→[100,1,1], hBN [1,1,1]→[1,100,1]. hBN also: espacing 0.05→0.025, emin/emax -10/10→-2.5/2.5.
New time-bench examples (graphene)
examples/graphene/negf_time_bench.json, examples/graphene/stru_negf_time_bench.xyz
Added NEGf time-benchmark JSON with device/leads, kmesh, SGF, Poisson, density, and output flags. Added corresponding XYZ structure (112 atoms, periodic).
New time-bench examples (hBN)
examples/hBN/negf_time_bench.json, examples/hBN/stru_negf_time_bench.xyz
Added NEGf time-benchmark JSON mirroring graphene’s options with hBN parameters. Added layered B/N XYZ structure for benchmark.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit taps the kmesh drum—one hundred beats in line,
Slides the lattice, trims the waves, narrows energy’s spine.
Benchmarks bloom like clover bright, JSON stars align,
hBN and graphene dance, structures crisp and fine.
I stamp my paw: “ignore the crumbs”—outputs left behind.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Add trans with higher k in tutorial2” is vague and does not clearly reflect the main changes in the pull request, which involve increasing k-point sampling, renaming structure file references, and adding NEGF benchmark examples for multiple materials rather than anything specific to “tutorial2.” Update the title to succinctly describe the primary changes, for example: “Increase transport k-point sampling and add NEGF timing benchmarks for MoS₂, graphene, and hBN.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 414349b and ef4c47b.

📒 Files selected for processing (8)
  • .gitignore (1 hunks)
  • examples/MoS2/negf.json (2 hunks)
  • examples/graphene/negf.json (1 hunks)
  • examples/graphene/negf_time_bench.json (1 hunks)
  • examples/graphene/stru_negf_time_bench.xyz (1 hunks)
  • examples/hBN/negf.json (3 hunks)
  • examples/hBN/negf_time_bench.json (1 hunks)
  • examples/hBN/stru_negf_time_bench.xyz (1 hunks)
⏰ 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). (1)
  • GitHub Check: run-tests
🔇 Additional comments (20)
examples/graphene/negf.json (1)

2-2: Structure path update looks good.

The renaming from struct_negf.xyz to stru_negf.xyz aligns with the PR's file naming consistency objective.

examples/MoS2/negf.json (2)

2-2: Structure path update looks good.

The renaming to stru_negf.xyz aligns with the PR's file naming consistency objective.


14-14: Kmesh update correctly targets the transport direction.

The kmesh change from [1,1,1] to [100,1,1] appropriately increases k-point sampling along the x-axis (first dimension), which matches the transport direction indicated by pbc=[true, false, false] (Line 15). This improves calculation accuracy as stated in the PR objectives.

.gitignore (1)

37-37: Appropriate ignore patterns for generated artifacts.

The new entries correctly exclude generated NEGF outputs (negf_output_k100/self_energy/*) corresponding to the updated k-point sampling in hBN, and runtime configuration files (run_config.json).

Also applies to: 43-43

examples/hBN/negf.json (3)

2-2: Structure path update looks good.

The renaming to stru_negf.xyz aligns with the PR's file naming consistency objective.


15-15: Kmesh update correctly targets the transport direction.

The kmesh change from [1,1,1] to [1,100,1] appropriately increases k-point sampling along the y-axis (second dimension), which matches the transport direction indicated by pbc=[false, true, false] (Line 16). This improves calculation accuracy as stated in the PR objectives.


43-45: Energy grid refinement provides better resolution near Fermi level.

The changes refine the energy grid with:

  • espacing reduced from 0.05 to 0.025 eV (2× finer resolution)
  • Energy window narrowed from [-10, 10] to [-2.5, 2.5] eV

This focuses computational resources on the energy range near the Fermi level where transport properties are most relevant, while maintaining adequate resolution. The changes align with the PR objectives for refined energy grid parameters.

examples/hBN/stru_negf_time_bench.xyz (1)

1-115: New hBN time-benchmark structure looks well-formed.

The file defines a 112-atom hBN supercell structure in extended XYZ format with:

  • Appropriate lattice dimensions (30.0 × 4.337 × 75.12 Å)
  • Fully periodic boundary conditions
  • Alternating B and N atoms in a layered arrangement characteristic of hBN

The structure is suitable for the time-benchmark configuration referenced in the PR objectives.

examples/graphene/stru_negf_time_bench.xyz (2)

1-1: LGTM! Structure file format is correct.

The atom count (112) matches the number of coordinate entries, and all carbon atoms are properly formatted with consistent coordinate structure. The geometry represents a graphene nanoribbon configuration appropriate for transport calculations.

Also applies to: 3-114


2-2: No changes needed for boundary_condition syntax. The six “PERIODIC” entries denote the low/high faces for x, y, and z directions and are intentional—this format is consistent across all example files and aligns with the parser’s requirements.

examples/hBN/negf_time_bench.json (5)

2-9: LGTM! Basic task configuration is appropriate.

The structure reference, task type, and physical parameters (non-SCF NEGF, 300K temperature) are properly configured for a time-benchmark calculation.


10-33: LGTM! Structure options are physically consistent.

The atom partitioning (32+48+32=112), valence electron counts for hBN (B:3, N:5), and boundary conditions are appropriate for the transport geometry. The lead k-mesh sampling [1,50,20] provides reasonable resolution in the transport direction.


34-41: LGTM! Solver configurations are appropriate.

The Fiori density method with direct integration and FMM Poisson solver with 1e-5 error tolerance are suitable choices for NEGF benchmarking.


42-47: LGTM! Energy grid and SGF solver are well-configured.

The Sancho-Rubio algorithm with 0.025 eV energy spacing over a [-2, 2] eV window provides 160 energy points for the benchmark. The broadening parameters are set for high-resolution calculations.

Note: eta_device: 0.0 means zero broadening in the device region. Verify this is intended, as small finite broadening is sometimes needed for numerical stability.


48-51: LGTM! Output flags are appropriate for benchmarking.

Only transmission coefficient output is enabled (out_tc: true), which is suitable for time-benchmark purposes by minimizing I/O overhead.

examples/graphene/negf_time_bench.json (5)

2-9: LGTM! Task configuration mirrors hBN benchmark.

The structure reference and basic task parameters are identical to the hBN configuration, which is appropriate for comparative benchmarking across materials.


10-32: LGTM! Structure options are consistent and correct.

The valence electron count for carbon (4) is correct, and all geometric parameters (atom partitioning, PBC, k-mesh) match the hBN configuration for consistent benchmarking.


33-40: LGTM! Solver settings match hBN configuration.

Identical density and Poisson solver configurations ensure consistent benchmarking methodology across materials.


41-46: Verify the wider energy window for graphene.

The energy grid spans [-2.5, 2.5] eV (200 points) for graphene, compared to [-2, 2] eV (160 points) for hBN. While this could reflect differences in band structure or benchmark goals, please confirm this is intentional.

If the goal is to have identical computational loads for time comparison, consider matching the energy ranges. If the goal is to capture the relevant physics, the current settings may be appropriate.


47-50: LGTM! Output configuration matches hBN benchmark.

Output flags are identical to the hBN configuration, maintaining consistency for performance comparison.


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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances NEGF (Non-Equilibrium Green's Function) tutorial examples by improving calculation accuracy through denser k-point meshes and adding new timing benchmark examples for performance studies.

  • Updated k-point mesh settings for MoS₂, graphene, and hBN to use denser sampling in transport directions
  • Refined energy grid parameters in hBN example for better resolution
  • Added timing benchmark examples with corresponding structure files for graphene and hBN systems

Reviewed Changes

Copilot reviewed 7 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
examples/hBN/negf.json Updated structure filename and improved k-mesh/energy grid settings
examples/hBN/negf_time_bench.json New timing benchmark configuration for hBN
examples/hBN/stru_negf_time_bench.xyz Structure file for hBN timing benchmark
examples/graphene/negf.json Updated structure filename reference
examples/graphene/negf_time_bench.json New timing benchmark configuration for graphene
examples/graphene/stru_negf_time_bench.xyz Structure file for graphene timing benchmark
examples/MoS2/negf.json Updated structure filename and k-mesh settings

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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