structures_to_state

torch_sim.io.structures_to_state(structure, device=None, dtype=None, *, system_extras_map=None, atom_extras_map=None)[source]

Create a SimState from pymatgen Structure(s).

Parameters:
  • structure (Structure | list[Structure]) – Single Structure or list of Structure objects

  • device (torch.device) – Device to create tensors on

  • dtype (torch.dtype) – Data type for tensors (typically torch.float32 or torch.float64)

  • system_extras_map (dict[SystemExtras, str] | None) – Map of {ts_key: pymatgen_key} controlling which pymatgen.properties entries are read into _system_extras. None (default) means no extras are read.

  • atom_extras_map (dict[AtomExtras, str] | None) – Map of {ts_key: pymatgen_key} controlling which pymatgen.site_properties entries are read into _atom_extras. None (default) means no extras are read.

Returns:

TorchSim SimState object.

Return type:

SimState

Raises:

ImportError – If Pymatgen is not installed

Notes

  • Input positions and cell should be in Å

  • Cell matrix follows ASE convention: [[ax,ay,az],[bx,by,bz],[cx,cy,cz]]

  • Assumes periodic boundary conditions from Structure