How to use the ovito.data.SimulationCell function in ovito

To help you get started, we’ve selected a few ovito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libAtoms / matscipy / scripts / ase2ovito.py View on Github external
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