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

Revisit shape of per-atom/molecule tensors #195

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

wiederm
Copy link
Member

@wiederm wiederm commented Jul 12, 2024

Description

While writing the style guide in the developer section of the documentation I noticed that we haven't been consistent with the shape of tensors. I recognize that it is difficult to stay consistent within a network implementation, but I think we can try to recommend a few general rules and note whenever modelforge deviates from them in specific places for performance reasons.

  • I believe tensors that describe per-ato, per-molecule or per-interaction properties/features should have the shape (nr_of_instances, nr_of_features). That means that the shape of the tensor that contains per-atom charge has shape (nr_of_atoms, 1), the tensor that defines the species shape (nr_of_atoms, 1), positions (nr_of_atoms, 3) and so on.

  • In contrast, index tensors should be arrays. So, e.g., atomic_subsystem_indices, which we use to reduce the per-atom energy (nr_of_atoms, 1) to per-molecule energy (nr_of_molecule, 1) has shape (nr_of_atoms). We are always indexing in the first dimension.

  • Todos

Notable points that this PR has either accomplished or will accomplish.

  • update dataloader
  • update dataclasses
  • update networks
  • update documentation

Status

  • Ready to go

@wiederm wiederm self-assigned this Jul 12, 2024
@wiederm wiederm added the documentation Improvements or additions to documentation label Jul 12, 2024
@wiederm wiederm changed the base branch from main to ref-postprocessing-and-loss July 15, 2024 11:13
Base automatically changed from ref-postprocessing-and-loss to main July 17, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant