How to use the ovito.io.import_file 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
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

node = import_file(sys.argv[1])
data = node.compute()
atoms = data_to_atoms(data)

atoms.positions[...] *= 1.1 # would be something more complex

node.remove_from_scene()