Beispiel #1
0
def get_inequivalent_sites(sub_lattice, lattice):
    """Given a sub lattice, returns symmetry unique sites for substitutions.

    Args:
        sub_lattice (list of lists): array containing Cartesian coordinates
            of the sub-lattice of interest

        lattice (ASE crystal): the total lattice

    Returns:
        List of sites
    """
    sg = get_sg(lattice)
    inequivalent_sites = []
    for site in sub_lattice:
        new_site = True
# Check against the existing members of the list of inequivalent sites
        if len(inequivalent_sites) > 0:
            for inequiv_site in inequivalent_sites:
                if smact.are_eq(site, inequiv_site) == True:
                    new_site = False
# Check against symmetry related members of the list of inequivalent sites
            equiv_inequiv_sites, _ = sg.equivalent_sites(inequiv_site)
            for equiv_inequiv_site in equiv_inequiv_sites:
                if smact.are_eq(site, equiv_inequiv_site) == True:
                    new_site = False

        if new_site == True:
            inequivalent_sites.append(site)

    return inequivalent_sites
Beispiel #2
0
def get_inequivalent_sites(sub_lattice, lattice):
    """Given a sub lattice, returns symmetry unique sites for substitutions.

    Args:
        sub_lattice (list of lists): array containing Cartesian coordinates
            of the sub-lattice of interest

        lattice (ASE crystal): the total lattice

    Returns:
        List of sites
    """
    sg = get_sg(lattice)
    inequivalent_sites = []
    for site in sub_lattice:
        new_site = True
# Check against the existing members of the list of inequivalent sites
        if len(inequivalent_sites) > 0:
            for inequiv_site in inequivalent_sites:
                if smact.are_eq(site, inequiv_site) == True:
                    new_site = False
# Check against symmetry related members of the list of inequivalent sites
            equiv_inequiv_sites, _ = sg.equivalent_sites(inequiv_site)
            for equiv_inequiv_site in equiv_inequiv_sites:
                if smact.are_eq(site, equiv_inequiv_site) == True:
                    new_site = False

        if new_site == True:
            inequivalent_sites.append(site)

    return inequivalent_sites
Beispiel #3
0
 def test_are_eq(self):
     self.assertTrue(
         smact.are_eq([1.00, 2.00, 3.00],
                      [1.001, 1.999, 3.00],
                      tolerance=1e-2))
     self.assertFalse(
         smact.are_eq([1.00, 2.00, 3.00],
                      [1.001, 1.999, 3.00]))
Beispiel #4
0
 def test_are_eq(self):
     self.assertTrue(
         smact.are_eq([1.00, 2.00, 3.00],
                      [1.001, 1.999, 3.00],
                      tolerance=1e-2))
     self.assertFalse(
         smact.are_eq([1.00, 2.00, 3.00],
                      [1.001, 1.999, 3.00]))
Beispiel #5
0
def make_substitution(lattice,site,new_species):
    """Change atomic species on lattice site to new_species.

    Args:
        lattice (ASE crystal): Input lattice
        site (list): Cartesian coordinates of the substitution site
        new_species (str): New species

    Returns:
        lattice
     """
    i = 0
    # NBNBNBNB  It is necessary to use deepcopy for objects, otherwise changes applied to a clone
    # will also apply to the parent object.
    new_lattice = copy.deepcopy(lattice)
    lattice_sites = new_lattice.get_scaled_positions()
    for lattice_site in lattice_sites:
        if smact.are_eq(lattice_site, site):
            new_lattice[i].symbol = new_species
        i = i + 1
    return new_lattice
Beispiel #6
0
def make_substitution(lattice,site,new_species):
    """Change atomic species on lattice site to new_species.

    Args:
        lattice (ASE crystal): Input lattice
        site (list): Cartesian coordinates of the substitution site
        new_species (str): New species

    Returns:
        lattice
     """
    i = 0
    # NBNBNBNB  It is necessary to use deepcopy for objects, otherwise changes applied to a clone
    # will also apply to the parent object.
    new_lattice = copy.deepcopy(lattice)
    lattice_sites = new_lattice.get_scaled_positions()
    for lattice_site in lattice_sites:
        if smact.are_eq(lattice_site, site):
            new_lattice[i].symbol = new_species
        i = i + 1
    return new_lattice