-
Notifications
You must be signed in to change notification settings - Fork 523
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
(fix) Make bias statistics complete for all elements #4496
base: devel
Are you sure you want to change the base?
Changes from 1 commit
32da243
adf2315
4f6f63d
b9bac38
1db3408
543a318
ba72382
26f9a17
25a803c
dc64307
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,18 @@ def __getitem__(self, index): | |
b_data["natoms"] = self._natoms_vec | ||
return b_data | ||
|
||
def _build_element_to_frames(self): | ||
"""Mapping element types to frame indexes""" | ||
element_to_frames = {element: [] for element in range(self._ntypes)} | ||
for frame_idx in range(len(self)): | ||
frame_data = self._data_system.get_item_torch(frame_idx) | ||
|
||
elements = frame_data["atype"] | ||
for element in set(elements): | ||
if len(element_to_frames[element]) < 10: | ||
element_to_frames[element].append(frame_idx) | ||
return element_to_frames | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix indentation error and consider making the max frame limit configurable. Example indentation fix: - def _build_element_to_frames(self):
- """Mapping element types to frame indexes"""
- element_to_frames = {element: [] for element in range(self._ntypes)}
+ def _build_element_to_frames(self):
+ """Mapping element types to frame indexes"""
+ element_to_frames = {element: [] for element in range(self._ntypes)}
🧰 Tools🪛 Ruff (0.8.2)44-44: SyntaxError: Expected an indented block after function definition |
||
def add_data_requirement(self, data_requirement: list[DataRequirementItem]) -> None: | ||
"""Add data requirement for this data system.""" | ||
for data_item in data_requirement: | ||
|
Check warning
Code scanning / CodeQL
Unreachable code Warning