Skip to content

Conversation

@Luthaf
Copy link
Member

@Luthaf Luthaf commented Nov 19, 2025

This was tested against the ASE version.

Fix #6

It is slower and nobody was using it
Comment on lines +59 to +64
auto a = cell[periodic_idx_1];
auto b = torch::tensor({0, 1, 0}, cell.options());
if (torch::abs(torch::dot(a / a.norm(), b)).item<double>() > 0.9) {
b = torch::tensor({0, 0, 1}, cell.options());
}
auto c = torch::cross(a, b);

Choose a reason for hiding this comment

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

Are we sure this still works if the existing cell vector is aligned along y?

Choose a reason for hiding this comment

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

My bad, yes it works

Copy link
Member Author

Choose a reason for hiding this comment

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

If it's aligned along y, we hit the if line 61, and change b to be along z. So with a along y and b along z, we create c along x.

@Luthaf Luthaf merged commit 90b6deb into metatensor:metatomic Dec 2, 2025
@Luthaf Luthaf deleted the mixed-pbc branch December 2, 2025 12:48
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.

Add support for mixed PBC systems and non-periodic systems

2 participants