Exemplo n.º 1
0
def analyse_ovito_cna_adaptive(atoms, mode="total"):
    """
    Use Ovito's common neighbor analysis binding.

    Args:
        atoms (pyrion.structure.atoms.Atoms): The structure to analyze.
        mode ("total"/"numeric"/"str"): Controls the style and level of detail of the output. (Default is "total", only
            return a summary of the values in the structure.)

    Returns:
        (depends on `mode`)
    """
    s.publication_add(publication())
    if not mode in ["total", "numeric", "str"]:
        raise ValueError("Unsupported mode")
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(
        CommonNeighborAnalysisModifier(
            mode=CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff))
    output = node.compute()
    if mode == "total":
        return output.attributes
    else:
        atoms_output = output.to_ase_atoms()
        if mode == "numeric":
            return atoms_output.get_array("Structure Type")
        elif mode == "str":
            cna_property = output.particle_properties.structure_type
            return np.array([
                cna_property.get_type_by_id(cnatype).name
                for cnatype in atoms_output.get_array("Structure Type")
            ])
Exemplo n.º 2
0
def analyse_ovito_cna_adaptive(atoms, mode='total'):
    """

    Args:
        atoms:
        mode:

    Returns:

    """
    if not mode in ['total', 'numeric', 'str']:
        raise ValueError('Unsupported mode')
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(CommonNeighborAnalysisModifier(mode=CommonNeighborAnalysisModifier.Mode.AdaptiveCutoff))
    output = node.compute()
    if mode == 'total':
        return output.attributes
    else:
        atoms_output = output.to_ase_atoms()
        if mode == 'numeric':
            return atoms_output.get_array("Structure Type")
        elif mode == 'str':
            cna_property = output.particle_properties.structure_type
            return np.array([cna_property.get_type_by_id(cnatype).name
                             for cnatype in atoms_output.get_array("Structure Type")])
Exemplo n.º 3
0
def analyse_ovito_voronoi_volume(atoms):
    """
    Args:
        mode (str): ['total', 'numeric', 'str']
    """
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(VoronoiAnalysisModifier())
    output = node.compute()
    return output.particle_properties['Atomic Volume'].array
Exemplo n.º 4
0
def analyse_ovito_centro_symmetry(atoms, num_neighbors=12):
    """
    Args:
        mode (str): ['total', 'numeric', 'str']
    """
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(CentroSymmetryModifier(num_neighbors = num_neighbors))
    output = node.compute()
    return output.particle_properties['Centrosymmetry'].array
Exemplo n.º 5
0
def analyse_ovito_voronoi_volume(atoms):
    """

    Args:
        atoms:

    Returns:

    """
    s.publication_add(publication())
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(VoronoiAnalysisModifier())
    output = node.compute()
    return output.particle_properties["Atomic Volume"].array
Exemplo n.º 6
0
def analyse_ovito_centro_symmetry(atoms, num_neighbors=12):
    """

    Args:
        atoms:
        num_neighbors:

    Returns:

    """
    s.publication_add(publication())
    data = DataCollection.create_from_ase_atoms(atoms.copy())
    node = ObjectNode()
    node.source = data
    node.modifiers.append(CentroSymmetryModifier(num_neighbors=num_neighbors))
    output = node.compute()
    return output.particle_properties["Centrosymmetry"].array