Skip to content

Commit 836ba32

Browse files
authored
fix PBC on GPU bug in state_to_atoms (#346)
1 parent 563c7fd commit 836ba32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torch_sim/io.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def state_to_atoms(state: "ts.SimState") -> list["Atoms"]:
5353
cell = state.cell.detach().cpu().numpy() # Shape: (n_systems, 3, 3)
5454
atomic_numbers = state.atomic_numbers.detach().cpu().numpy()
5555
system_indices = state.system_idx.detach().cpu().numpy()
56+
pbc = state.pbc.detach().cpu().numpy()
5657

5758
atoms_list = []
5859
for sys_idx in np.unique(system_indices):
@@ -65,7 +66,7 @@ def state_to_atoms(state: "ts.SimState") -> list["Atoms"]:
6566
symbols = [chemical_symbols[z] for z in system_numbers]
6667

6768
atoms = Atoms(
68-
symbols=symbols, positions=system_positions, cell=system_cell, pbc=state.pbc
69+
symbols=symbols, positions=system_positions, cell=system_cell, pbc=pbc
6970
)
7071
atoms_list.append(atoms)
7172

0 commit comments

Comments
 (0)