Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#! /usr/bin/env python
import time
import smact
import itertools
from sys import stdout
from smact.screening import eneg_states_test
from multiprocessing import Pool
element_list = smact.ordered_elements(1, 103)
elements = smact.element_dictionary(element_list)
max_n = 4
neutral_stoichiometries_threshold = 8
include_pauling_test = True
pauling_test_threshold = 0.0
# Number of times to report progress during the counting loop.
count_progress_interval = 100
# Parameters for the threaded version of the code.
mp_use = True
mp_processes = 4
mp_chunk_size = 10
import smact
from smact.properties.Band_gap_simple import band_gap_simple
from smact.properties.compound_electroneg import compound_electroneg
import itertools
# Examine a subset of periodic table
search_space = ('Li', 'Be', 'Na', 'Mg', 'K', 'Ca', 'Rb', 'Sr', 'Cs', 'Ba',
'Al', 'Si', 'Ga', 'Ge', 'As', 'In', 'Sn', 'Sb', 'Te', 'Tl', 'Pb', 'Bi',
'Po', 'At', 'S', 'O', 'Se', 'F', 'Cl', 'Br', 'Zn', 'Cu', 'I')
elements = smact.element_dictionary(search_space)
# Set up a generator for charge-neutral binary compounds
def binary_generator(search_space, elements):
# Iterate over all binary combinations (e.g. (Li, Be), (Li, Na)...)
for el_a, el_b in itertools.combinations(search_space, 2):
# Read possible oxidation states from element dictionary
for ox_combo in itertools.product(elements[el_a].oxidation_states,
elements[el_b].oxidation_states):
# When a legal combination is found, yield it
# and move onto next binary combination
success, stoichs = smact.neutral_ratios(ox_combo)
if success:
yield (el_a, el_b, stoichs[0])
break
print "no. \tband gap \tMulliken e-neg \tinternuclear dist"
Returns :
Band_gap (float): Band gap in eV
"""
# Set constants
hbarsq_over_m = 7.62
# Get anion and cation
An = anion
Cat = cation
d = float(distance)
# Get elemental data:
elements_dict = smact.element_dictionary((An, Cat))
An, Cat = elements_dict[An], elements_dict[Cat]
# Calculate values of equation components
V1_Cat = (Cat.eig - Cat.eig_s)/4
V1_An = (An.eig - An.eig_s)/4
V1_bar = (V1_An + V1_Cat)/2
V2 = 2.16 * hbarsq_over_m / (d**2)
V3 = (Cat.eig - An.eig)/2
alpha_m = (1.11*V1_bar)/sqrt(V2**2 + V3**2)
# Calculate Band gap [(3-43) Harrison 1980 ]
Band_gap = (3.60/3.)*(sqrt(V2**2 + V3**2))*(1-alpha_m)
if verbose:
print("V1_bar = ", V1_bar)
print("V2 = ", V2)
print("alpha_m = ", alpha_m)
#! /usr/bin/env python
import smact
import itertools
elements = smact.element_dictionary()
def main():
oxidation_states = [element.oxidation_states for _, element in elements.iteritems()]
oxidation_states = set([state for sublist in oxidation_states for state in sublist])
oxidation_state_combinations = {n: list(
itertools.combinations_with_replacement(oxidation_states, n))
for n in range(2,5)}
# Sort combinations and cast to tuples for unambiguous keys
oxidation_state_combinations = {n: [tuple(sorted(x)) for x in l]
for n, l in oxidation_state_combinations.items()}
print "Combinations of known oxidation states:"
print "Binary: {0}".format(len(oxidation_state_combinations[2]))