Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
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