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

Fixed energy logging for multiple molecules #386

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/schnetpack/md/data/hdf5_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _load_molecule_data(self):

# Extract energies
entry_start = 0
entry_stop = 1
entry_stop = self.n_molecules
self.properties[f"{properties.energy}_system"] = raw_positions[
:, :, entry_start:entry_stop
].reshape(self.entries, self.n_replicas, self.n_molecules)
Expand Down
6 changes: 4 additions & 2 deletions src/schnetpack/md/simulation_hooks/callback_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ def _init_data_stream(self, simulator: Simulator):
simulator (schnetpack.md.Simulator): Simulator class used in the molecular dynamics simulation.
"""
# Account for potential energy and positions
data_dimension = 1 + simulator.system.total_n_atoms * 3
data_dimension = (
simulator.system.n_molecules + simulator.system.total_n_atoms * 3
)

# If requested, also store velocities
if self.store_velocities:
Expand Down Expand Up @@ -267,7 +269,7 @@ def update_buffer(self, buffer_position: int, simulator: Simulator):

# Store energies
start = 0
stop = 1
stop = simulator.system.n_molecules
self.buffer[
buffer_position : buffer_position + 1, :, start:stop
] = simulator.system.energy.view(simulator.system.n_replicas, -1).detach()
Expand Down