Source code for schrodinger.application.matsci.aseutils
"""
Utility functions to deal with ASE IO.
Copyright Schrodinger, LLC. All rights reserved.
"""
from ase import Atoms
from schrodinger.application.matsci.nano import xtal
[docs]def get_ase_atoms(struct):
    """
    Create an ASE Atoms object from a Schrodinger structure
    :param `schrodinger.structure.Structures` struct: The input structure
    :rtype: `ase.Atoms`
    :return: An `ase.Atoms` object representing the same structure as the input
        struct
    """
    ase_atoms = Atoms(numbers=[x.atomic_number for x in struct.atom],
                      positions=struct.getXYZ())
    if xtal.sync_pbc2(struct):
        ase_atoms.set_pbc((True, True, True))
        ase_atoms.set_cell(xtal.get_vectors_from_chorus(struct))
    return ase_atoms