dpdata icon indicating copy to clipboard operation
dpdata copied to clipboard

quipGapXYZ: add unit convert and tag synonym matching

Open SchrodingersCattt opened this issue 1 year ago • 3 comments

Many datasets using the exyz format have different formats for units and tags. This PR aims to address the situation with multiple possible datasets.

Summary by CodeRabbit

  • New Features
    • Introduced energy and force unit conversions for more accurate calculations.
    • Enhanced error handling and unit conversions for fields like species, positions, atomic numbers, forces, and tags within processing functions.

SchrodingersCattt avatar Jul 03 '24 10:07 SchrodingersCattt

Walkthrough

Walkthrough

The changes in quip_gap_xyz.py entail the addition of energy and force unit conversions, adjustments in handling various fields within the handle_single_xyz_frame function, and parsing of energy and force units for accurate calculations. Key entities and error handling improvements have also been included to enhance the robustness and functionality of the data processing.

Changes

File Change Summary
dpdata/xyz/quip_gap_xyz.py Added energy and force unit conversions, adjustments in handling fields (species, pos, Z, force, tags) within handle_single_xyz_frame function, and modifications in parsing energy and force units for calculations. Introduced variables e_conv_kcalpermol2eV, e_conv_au2eV, f_conv_kcalpermolperang2eVperang, f_conv_auperang2eVperang, f_conv_kcalpermolperbohr2eVperang, f_conv_au2eVperang.

[!TIP]

AI model upgrade

gpt-4o model for reviews and chat is now live

OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our Discord Community to provide any feedback or to report any issues.


Recent review details

Configuration used: CodeRabbit UI Review profile: CHILL

Commits

Files that changed from the base of the PR and between 37b96b8cce07a27022cd6b18e253505591de2f66 and 81a27d84b7cc74553e87078863f115063860369e.

Files selected for processing (1)
  • dpdata/xyz/quip_gap_xyz.py (3 hunks)
Additional context used
Ruff
dpdata/xyz/quip_gap_xyz.py

133-133: Local variable Z_array is assigned to but never used

Remove assignment to unused variable Z_array

(F841)


252-252: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

Additional comments not posted (5)
dpdata/xyz/quip_gap_xyz.py (5)

10-11: Imports and constants for unit conversions.

The import statement and constants for unit conversions are correctly added. Ensure that EnergyConversion and ForceConversion are defined in unit module.


12-21: Unit conversion constants are correctly defined.

The constants for energy and force unit conversions are correctly defined using EnergyConversion and ForceConversion.


216-234: Proper handling of energy units.

The changes correctly handle various energy units and populate info_dict["energies"]. Ensure that all possible energy units are covered.


285-285: Handling of virials is correct.

The handling of virials is correctly implemented.


289-303: Handling of Lattice and nopbc fields is correct.

The handling of Lattice and nopbc fields is correctly implemented.


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

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configration File (.coderabbit.yaml)

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

Documentation and Community

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

coderabbitai[bot] avatar Jul 03 '24 10:07 coderabbitai[bot]

CodSpeed Performance Report

Merging #678 will not alter performance

Comparing SchrodingersCattt:devel (81a27d8) with devel (e429d9a)

Summary

✅ 2 untouched benchmarks

codspeed-hq[bot] avatar Jul 03 '24 10:07 codspeed-hq[bot]

Codecov Report

Attention: Patch coverage is 61.79775% with 34 lines in your changes missing coverage. Please review.

Project coverage is 84.12%. Comparing base (e429d9a) to head (81a27d8).

Files Patch % Lines
dpdata/xyz/quip_gap_xyz.py 61.79% 34 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #678      +/-   ##
==========================================
- Coverage   84.42%   84.12%   -0.30%     
==========================================
  Files          81       81              
  Lines        7144     7202      +58     
==========================================
+ Hits         6031     6059      +28     
- Misses       1113     1143      +30     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 03 '24 10:07 codecov[bot]