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

Implement augmentation for rank-2 Cartesian tensors #547

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

frostedoyster
Copy link
Collaborator

@frostedoyster frostedoyster commented Apr 11, 2025

Allows training PET on rank-2 Cartesian tensors (stress, polarizability, etc.)

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

📚 Documentation preview 📚: https://metatrain--547.org.readthedocs.build/en/547/

Copy link

@Copilot 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.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/metatrain/utils/augmentation.py:319

  • [nitpick] Verify that the tensor dimensions and index ordering in the einsum call correctly implement the intended transformation for rank-2 Cartesian tensors.
new_tensor = torch.einsum("Aa,iabp,bB->iABp", transformation, tensor, transformation.T)

is_cartesian = False
if len(target_tmap.blocks()) == 1:
if len(target_tmap.block().components) > 0:
if "xyz" in target_tmap.block().components[0].names[0]:
Copy link
Preview

Copilot AI Apr 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Relying solely on a substring 'xyz' to detect Cartesian tensors might be fragile if the naming convention changes; consider using a more robust method or clearly document this assumption.

Suggested change
if "xyz" in target_tmap.block().components[0].names[0]:
if target_tmap.block().components[0].names[0] in CARTESIAN_TENSOR_NAMES:

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

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