How to use the smact.core.Element function in SMACT

To help you get started, we’ve selected a few SMACT examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WMD-group / SMACT / smact / core.py View on Github external
# # Load ionic radii data from data table by iterating through CSV file
        # with open(smact_directory + 'data/ionic_radii.csv','r') as f:
        #     while True:
        #         l=f.readline()
        #         if l.split(",")[0] == symbol:
        #             self.ionic = float(l.split(",")[1])
        #             break
        #         # Check for end of file
        #         elif not l:
        #             print 'WARNING: Element {0} not found in ionic_radii.csv'.format(symbol)
        #             self.ionic = False
        #             break

#------------------------------------------------------------------------------------------

class Species(Element):
    """
    Class providing data for elements in a given chemical environment

    In addition to the standard properties from the periodic table (inherited from the 
    Element class), Species objects use the oxidation state and coordination environment
    to provide further properties.

    Attributes: 
        Species.symbol: Elemental symbol used to retrieve data

        Species.name: Full name of element

        Species.oxidation: Oxidation state of species (signed integer)

        Species.coordination: Coordination number of species (integer)
github WMD-group / SMACT / smact / wurtzite.py View on Github external
else:    # Use Shannon radius
                for b_element in b_elements:
                    b_formal_charge = formal_charge(b_element)  ## check again
                    if b_formal_charge: 
                        # Check for charge-neutral combinations and write to array
                        for b_ox in b_formal_charge:
                            if radius_shannon(b_element,b_ox) == False:
                                if a_ox+b_ox==lattice_charge:                       ## Charge of lattice
                                    b_cov=radius_covalent(b_element)
                                    #print a_cov,b_cov
                                    g=[float(a_cov),float(b_cov)]
                                    #print g
                                    method="covalent radii"
                                    a,b,c,alpha,beta,gamma,inner_space = wurtzite(g)
                                    hhi_a=core.Element(a_element).HHI_p
                                    hhi_b=core.Element(b_element).HHI_p
                                    hhi_rp=(float(hhi_a)*float(hhi_b))**0.5
                                    holes[all_elements.index(a_element),all_elements.index(b_element)]=inner_space
                                    matrix_hhi[all_elements.index(a_element),all_elements.index(b_element)]=hhi_rp
                                    output.append([a_element,b_element,hhi_rp,method,a,b,c,inner_space])
                                    
                                    
                            else:   ### Shannon radius
                                b_shan=radius_shannon(b_element,b_ox)
                                if a_ox+b_ox==lattice_charge:
                                    g=[float(a_shan),float(b_shan)]
                                    method="shannon radii"
                                    a,b,c,alpha,beta,gamma,inner_space = wurtzite(g)
                                    hhi_a=core.Element(a_element).HHI_p
                                    hhi_b=core.Element(b_element).HHI_p
                                    hhi_rp=(float(hhi_a)*float(hhi_b))**0.5
github WMD-group / SMACT / smact / wurtzite.py View on Github external
else:    # Use Shannon radius
                for b_element in b_elements:
                    b_formal_charge = formal_charge(b_element)  ## check again
                    if b_formal_charge: 
                        # Check for charge-neutral combinations and write to array
                        for b_ox in b_formal_charge:
                            if radius_shannon(b_element,b_ox) == False:
                                if a_ox+b_ox==lattice_charge:                       ## Charge of lattice
                                    b_cov=radius_covalent(b_element)
                                    #print a_cov,b_cov
                                    g=[float(a_cov),float(b_cov)]
                                    #print g
                                    method="covalent radii"
                                    a,b,c,alpha,beta,gamma,inner_space = wurtzite(g)
                                    hhi_a=core.Element(a_element).HHI_p
                                    hhi_b=core.Element(b_element).HHI_p
                                    hhi_rp=(float(hhi_a)*float(hhi_b))**0.5
                                    holes[all_elements.index(a_element),all_elements.index(b_element)]=inner_space
                                    matrix_hhi[all_elements.index(a_element),all_elements.index(b_element)]=hhi_rp
                                    output.append([a_element,b_element,hhi_rp,method,a,b,c,inner_space])
                                    
                                    
                            else:   ### Shannon radius
                                b_shan=radius_shannon(b_element,b_ox)
                                if a_ox+b_ox==lattice_charge:
                                    g=[float(a_shan),float(b_shan)]
                                    method="shannon radii"
                                    a,b,c,alpha,beta,gamma,inner_space = wurtzite(g)
                                    hhi_a=core.Element(a_element).HHI_p
                                    hhi_b=core.Element(b_element).HHI_p
                                    hhi_rp=(float(hhi_a)*float(hhi_b))**0.5
                                    holes[all_elements.index(a_element),all_elements.index(b_element)]=inner_space
github WMD-group / SMACT / smact / core.py View on Github external
def __init__(self,symbol,oxidation,coordination):
        Element.__init__(self,symbol)
        self.oxidation = oxidation
        self.coordination = coordination
        # Load shannon radii
        with open(smact_directory + 'data/shannon_radii.csv','rU') as f:
            reader = csv.reader(f)
            for row in reader:
                if row[0] == symbol and int(row[1]) == oxidation and row[2] == coordination:
                    shannon_radius = row[3]

        self.shannon_radius = shannon_radius
github WMD-group / SMACT / smact / wurtzite.py View on Github external
for a_ox in a_formal_charge:
            a_shan=radius_shannon(a_element,a_ox)

            if a_shan == False:  # Fall back to covalent radius if Shannon unavailable
                for b_element in b_elements:
                    b_formal_charge = formal_charge(b_element)  ## check again
                    if b_formal_charge: #i.e. b_formal_charge has a value
                        # Check for charge-neutral combinations and write to array
                        # Note that only the elements are recorded; 
                        # multiple charge combinations for one element pair will be overwritten
                        for b_ox in (x for x in b_formal_charge if x+a_ox==lattice_charge):
                            b_cov=radius_covalent(b_element)
                            g=[float(a_cov),float(b_cov)]
                            method="covalent radii"
                            a,b,c,alpha,beta,gamma,inner_space = wurtzite(g)
                            hhi_a=core.Element(a_element).HHI_p
                            hhi_b=core.Element(b_element).HHI_p
                            hhi_rp=(float(hhi_a)*float(hhi_b))**0.5
                            holes[all_elements.index(a_element),all_elements.index(b_element)]=inner_space
                            matrix_hhi[all_elements.index(a_element),all_elements.index(b_element)]=hhi_rp
                            output.append([a_element,b_element,hhi_rp,method,a,b,c,inner_space])
                            
            else:    # Use Shannon radius
                for b_element in b_elements:
                    b_formal_charge = formal_charge(b_element)  ## check again
                    if b_formal_charge: 
                        # Check for charge-neutral combinations and write to array
                        for b_ox in b_formal_charge:
                            if radius_shannon(b_element,b_ox) == False:
                                if a_ox+b_ox==lattice_charge:                       ## Charge of lattice
                                    b_cov=radius_covalent(b_element)
                                    #print a_cov,b_cov