Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def atoms_to_data(atoms):
data = DataCollection()
cell_matrix = np.zeros((3,4))
cell_matrix[:, :3] = atoms.get_cell()
cell_matrix[:, 3] = atoms.info.get('cell_origin',
[0., 0., 0.])
cell = SimulationCell(matrix=cell_matrix,
pbc=atoms.get_pbc())
data.addObject(cell)
position = ParticleProperty(name='Position',
type=Particles.ParticleProperty.Type.Position,
array=atoms.get_positions())
data.addObject(position)
return data