def write_eam_setfl_file(self,parameters,potential,setfl_fn): from pypospack.potential import EamPotential is_debug = False assert isinstance(parameters,OrderedDict) assert isinstance(potential,OrderedDict) assert isinstance(setfl_fn,str) if is_debug: print(parameters) print(potential) print(setfl_fn) p = EamPotential( symbols=potential['symbols'], func_pair=potential['pair_type'], func_density=potential['density_type'], func_embedding=potential['embedding_type'] ) p.write_setfl_file( filename=setfl_fn, symbols=potential['symbols'], Nr=potential['N_r'], rmax=potential['r_max'], rcut=potential['r_cut'], Nrho=potential['N_rho'], rhomax=potential['rho_max'], parameters=parameters )
for name in datafile.parameter_names: parameters[name] = subselect_df[name].values[0] # plotting portion copied from pypospack.tests.tests_integration.eamtools.EamSetflFile.dev_EamSetflFile setfl_fn = "Ni__eam__born_exp_fs.eam.alloy" n_r = 2000 r_max = 10.0 r_cut = 10.0 n_rho = 2000 rho_max = 10.0 eam_potential.write_setfl_file(filename=setfl_fn, symbols=symbols, Nr=n_r, rmax=r_max, rcut=r_cut, Nrho=n_rho, rhomax=rho_max, parameters=parameters) setfl_file = EamSetflFile() setfl_file.read(setfl_fn) r = setfl_file.r rho = setfl_file.rho pair = setfl_file.func_pairpotential['Ni.Ni'] embed = setfl_file.func_embedding['Ni'] dens = setfl_file.func_density['Ni'] fig, axes = plt.subplots(3, 1) r_low = 1
_pair = [p for p in rho] for p in _pair: for s in sites: print("{s:^10}{N_s:^10}{da:^10.4f}{rho:^15.4e}{ttl_rho:^15.4e}".format( s=s, N_s=N[s], da=da[s], rho=rho[p][s], ttl_rho=N[s]*rho[p][s])) sites_lte_1NN = ['1NN'] rho_lte_1NN = 0. filename = "Ni.eam.alloy" Nr = configuration['potential']['N_r'] rmax = configuration['potential']['r_max'] rcut = configuration['potential']['r_cut'] Nrho = configuration['potential']['N_rho'] rhomax = configuration['potential']['rho_max'] eam.write_setfl_file( filename=filename, symbols=symbols, Nr=Nr, rmax=rmax, rcut=rcut, Nrho=Nrho, rhomax=rhomax, parameters=parameters) assert os.path.isfile(filename)