Example #1
0
    def can_mix(self, radii_diff=0.2):
        """
    	judge whether struc1 and struc2 can mix or not. 

    	1\ Consider structure matching. 

        2\ We only allow mixing at one set of symmetrically equivalent sites,
         at these sites, the mixing element should have similar atomic radii.
         At all other site, the element should be the same.

        Args: 
            radii_diff(Angstrom): the difference in atomic radii should be less than radii_diff. 
    
    	Returns:
    		boolean
    	"""
        if not self.can_match():
            return False
        else:
            sym_struc1 = SpacegroupAnalyzer(
                self.struc1).get_symmetrized_structure()
            sym_struc2 = SpacegroupAnalyzer(
                self.struc2).get_symmetrized_structure()

            sites_searched = []
            num_slight_diff = 0
            for site1, site2 in zip(sym_struc1.sites, sym_struc2.sites):
                if site1 not in sites_searched:
                    if site1.specie.symbol != site2.specie.symbol:
                        abs_diff = abs(site1.specie.atomic_radius -
                                       site2.specie.atomic_radius)
                        #print(site1.specie.atomic_radius, site2.specie.atomic_radius)
                        #print(abs_diff)
                        if abs_diff < radii_diff:
                            num_slight_diff += 1
                        else:
                            return False
                sites_searched += sym_struc1.find_equivalent_sites(site1)
            if num_slight_diff == 1:
                return True
            else:
                return False