def McSim(row): Temp=int(row[:-1]) conc_name=int(row[-1:]) print("Temperature is %s"%Temp, ",Concentration is %s"%conc_name, "\nChecking for files and directories") db_name="FixedCell.db" pathid="%sK"%Temp+"_Parallel" default_path="/panfs/pfs.local/home/s376r951/Latest_Project/VASPDFT/StartingFresh/ParallelStorage" #Default path home_path="/panfs/pfs.local/home/s376r951/Latest_Project/VASPDFT/StartingFresh" dirname="{}".format(pathid) dirpath=os.path.join(default_path, dirname) os.chdir(home_path) conc=Concentration(basis_elements=[['Au', 'Cu']]) settings=CEBulk(crystalstructure='fcc', a=3.8, size=[3,3,3], concentration=conc, db_name=db_name, max_cluster_size=4, max_cluster_dia=[6.0,5.0,5.0]) os.mkdir(default_path+"%s"%pathid) os.chdir(dirpath) os.mkdir(dirpath+"/MeanEnergy") os.mkdir(dirpath+"/EnergyEvol") os.mkdir(dirpath+"/Variance")
def main(argv): option = argv[0] N = 4 conc = Concentration(basis_elements=[["Al", "Mg", "Si", "X"]]) kwargs = dict(crystalstructure="fcc", a=4.05, size=[N,N,N], db_name=db_name, max_cluster_size=4, max_cluster_dia=[0.0, 0.0, 5.0, 4.1, 4.1], concentration=conc) ceBulk = BulkCrystal(**kwargs) struc_generator = GenerateStructures( ceBulk, struct_per_gen=10, generation_number=100 ) if option == "reconfig_settings": ceBulk.reconfigure_settings() elif option == "insert": fname = argv[1] struc_generator.insert_structure(init_struct=fname) elif option == "random": atoms = get_random_structure() struc_generator.insert_structure(init_struct=atoms) elif option == "evaluate": evaluate(ceBulk) elif option == "newdb": new_db_name = argv[1] new_db(kwargs, new_db_name) elif option == "reconfig_db": corr_func = CorrFunction(ceBulk, parallel=True) scond = [("calculator", "!=", "gpaw"), ("name", "!=", "information"), ("name", "!=", "template"), ("converged", "=", 1)] corr_func.reconfigure_db_entries(select_cond=scond) elif option == "gs": get_gs_allgs(ceBulk, struc_generator)
def main(argv): option = argv[0] atoms = bulk("Al") N = 4 atoms = atoms*(N, N, N) conc = Concentration(basis_elements=[["Al","Mg","Si"]]) kwargs = dict(crystalstructure="fcc", a=4.05, size=[N, N, N], \ db_name=db_name, max_cluster_size=4, concentration=conc, basis_function="sanchez", max_cluster_dia=[7.8, 5.0, 5.0]) ceBulk = BulkCrystal(**kwargs) #ceBulk.reconfigure_settings() #print (ceBulk.basis_functions) #cf = CorrFunction( ceBulk, parallel=True) #cf.reconfigure_db_entries(select_cond=[("converged","=","1")]) #exit() #print(ceBulk.basis_functions) struc_generator = GenerateStructures( ceBulk, struct_per_gen=10 ) if ( option == "generateNew" ): struc_generator.generate_probe_structure() elif ( option == "eval" ): #evaluate(ceBulk) #evaluate_l1(ceBulk) evaluate_test(ceBulk) #evaluate_car(ceBulk) #evaluate_sklearn(ceBulk) elif option == "skew": insert_skewed_full(struc_generator, size1=int(argv[1]), size2=int(argv[2])) elif ( option == "insert" ): fname = argv[1] atoms = read(fname) struc_generator.insert_structure( init_struct=atoms ) #insert_specific_structure( ceBulk, struc_generator, atoms ) elif ( option == "formation" ): enthalpy_of_formation(ceBulk) elif ( option == "gsstruct" ): if ( len(argv) != 3 ): raise ValueError( "If option is gsstruct. The arguments has to be gsstruct mg_conc si_conc" ) mg_conc = float( argv[1] ) si_conc = float( argv[2] ) find_gs_structure( ceBulk, mg_conc, si_conc ) elif ( option == "update_conc_range" ): update_in_conc_range() elif ( option == "allgs" ): find_all_gs( ceBulk, struc_generator ) elif( option == "cv_hist" ): lambdas = np.logspace(-7,-3,8) history = CVScoreHistory(setting=ceBulk, penalization="L1", select_cond=[("in_conc_range","=","1")] ) history.get_history( lambdas=lambdas ) history.plot() plt.show() elif( option == "chempot" ): estimate_chemical_potentials(ceBulk) elif (option == "convert2cubic"): convert_to_cubic(ceBulk) elif option == "new_db": new_db_name = argv[1] new_db(kwargs, new_db_name)
def initialize_db(): db_name = "data/almgsiX_clease_voldep.db" settings = CEBulk( Concentration(basis_elements=[['Al', 'Mg', 'Si', 'X']]), crystalstructure='fcc', a=4.05, size=[1, 1, 1], max_cluster_size=3, max_cluster_dia=[5.0, 5.0], db_name=db_name ) settings.basis_func_type = 'binary_linear' newStruct = NewStructures(settings) # Insert all initial structures counter = 0 with connect(db_local) as db: for row in db.select(): counter += 1 print(f"Inserting structure {counter}") name = f"group{row.group}" atoms = row.toatoms() newStruct.insert_structure(atoms, name=name) data = pd.read_csv("data/bulk_mod_fit.csv") db = connect(settings.db_name) counter = 0 for row in data.itertuples(): print(f"Inserting final structure {counter}") counter += 1 try: name = f"group{row[1]}" #print(name) #exit() E = row[2] B = row[3] V = row[4] dBdP = row[5] L = V**(1.0/3.0) atoms = Atoms(cell=[L, L, L]) calc = SinglePointCalculator(atoms, energy=E) atoms.set_calculator(calc) print(name) init_id = db.get([('name', '=', name)]).id update_db(init_id, final_struct=atoms, db_name=settings.db_name, custom_kvp_init={'bulk_mod': B, 'dBdP': dBdP}) except Exception as exc: print(exc) traceback.print_exc() settings.save("data/settings_almgsiX_voldev.json")
def main(argv): conc = Concentration(basis_elements=[["Al", "Mg", "Si"]]) kwargs = dict(crystalstructure="fcc", a=4.05, size=[4, 4, 4], db_name=db_name, max_cluster_size=4, concentration=conc, basis_function="sanchez", max_cluster_dia=[7.8, 5.0, 5.0]) setting = CEBulk(**kwargs) # insert_from_db("almgsi.db", setting) evaluate(setting)
def main(): conc = Concentration(basis_elements=[['Al', 'Mg']], A_lb=[[10, 0]], b_lb=[7]) settings = CEBulk(conc, crystalstructure='fcc', a=4.05, size=[4, 4, 4], max_cluster_size=4, max_cluster_dia=[4.1, 4.1, 4.1], db_name='almg_ce.db') # Generate 30 structures new_struct = NewStructures(settings, struct_per_gen=30) new_struct.generate_random_structures()
from clease import Concentration from clease import CECrystal basis_elements = [['Fe', 'X'], ['Fe'], ['O']] conc = Concentration(basis_elements=basis_elements) conc.set_conc_ranges[[(0.83333, 0.83333), (0.16667, 0.16667)], [(1, 1)], [(1, 1)]] print(conc.get_random_concentration()) bsg = CECrystal(basis=[(0.5, 0.5, 0.5), (0.1250, 0.1250, 0.1250), (0.2549, 0.2549, 0.2549)], cellpar=[5.9355, 5.9355, 5.9355, 60.0000, 60.0000, 60.0000], supercell_factor=92, concentration=conc, db_name="clusterexpansion.db", max_cluster_size=4, max_cluster_dia=[7.6, 7.6, 4.0], ignore_background_atoms=True)
from scipy.spatial import ConvexHull # from atomtools.ce import ChemicalPotentialEstimator from ase.calculators.singlepoint import SinglePointCalculator from ase.visualize import view from clease import Concentration eci_fname = "data/almgsi_fcc_eci_newconfig.json" #db_name = "almgsi_newconfig.db" #db_name = "almgsi_multiple_templates.db" #db_name = "almgsi_multiple_templates_dec10.db" #db_name = "almgsi_sluiter.db" #eci_fname = "data/almgsi_fcc_eci_sluiter.json" # db_name_cubic = "almgsi_cubic.db" db_name = "almgsi.db" conc_fit = Concentration(basis_elements=[["Al", "Mg", "Si"]]) conc_fit.set_conc_ranges([[(0, 1), (0, 1), (0, 0.55)]]) def main(argv): option = argv[0] atoms = bulk("Al") N = 4 atoms = atoms*(N, N, N) conc = Concentration(basis_elements=[["Al","Mg","Si"]]) kwargs = dict(crystalstructure="fcc", a=4.05, size=[N, N, N], \ db_name=db_name, max_cluster_size=4, concentration=conc, basis_function="sanchez", max_cluster_dia=[7.8, 5.0, 5.0]) ceBulk = BulkCrystal(**kwargs) #ceBulk.reconfigure_settings() #print (ceBulk.basis_functions)