def main(): # Define list of pair potentials pairPotentials = [ Potential('Al', 'Al', ppfuncAlAl), Potential('Al', 'Fe', ppfuncAlFe), Potential('Fe', 'Fe', ppfuncFeFe)] # Assemble the EAMPotential objects eamPotentials = [ # Al EAMPotential('Al', 13, 26.98154, AlEmbedFunction, {'Al': AlAlDensityFunction, 'Fe': FeAlDensityFunction}, latticeConstant=4.04527, latticeType='fcc'), # Fe EAMPotential('Fe', 26, 55.845, FeEmbedFunction, {'Al': FeAlDensityFunction, 'Fe': FeFeDensityFunction}, latticeConstant=2.855312, latticeType='bcc')] # Number of grid points and cut-offs for tabulation. cutoff_rho = 300.0 nrho = 10000 cutoff = 6.5 nr = 10000 tabulation = TABEAM_FinnisSinclair_EAMTabulation( pairPotentials, eamPotentials, cutoff, nr, cutoff_rho, nrho) with open("TABEAM", "w") as outfile: tabulation.write(outfile)
def makePotentialObjects(): # O-O Interaction: # Buckingham # A = 1633.00510, rho = 0.327022, C = 3.948790 f_OO = potentialforms.buck(1633.00510, 0.327022, 3.948790) # U-U Interaction: # Buckingham # A = 294.640000, rho = 0.327022, C = 0.0 f_UU = potentialforms.buck(294.640000, 0.327022, 0.0) # O-U Interaction # Buckingham + Morse. # Buckingham: # A = 693.648700, rho = 693.648700, C = 0.0 # Morse: # D0 = 0.577190, alpha = 1.6500, r0 = 2.36900 buck_OU = potentialforms.buck(693.648700, 0.327022, 0.0) morse_OU = potentialforms.morse(1.6500, 2.36900, 0.577190) # Compose the buckingham and morse functions into a single function # using the atsim.potentials.plus() function f_OU = plus(buck_OU, morse_OU) # Construct list of Potential objects potential_objects = [ Potential('O', 'O', f_OO), Potential('U', 'U', f_UU), Potential('O', 'U', f_OU) ] return potential_objects
def createSetFlPairPots(self): fdict = self.createSetFlFuncs() pair_AlAl = fdict['pair_AlAl'] pair_CuCu = fdict['pair_CuCu'] pair_AlCu = fdict['pair_AlCu'] pairPotentials = [ Potential('Al', 'Al', pair_AlAl), Potential('Cu', 'Cu', pair_CuCu), Potential('Al', 'Cu', pair_AlCu)] return pairPotentials
def testWriteSetFL(self): """Test creation of DYNAMO setfl formatted file for use with lammps pair_style eam/alloy""" with open( os.path.join(_getResourceDirectory(), 'AlCu.eam.alloy'), 'r') as infile: expectEAMTable = _parseSetFL(infile) comments = [ '##Al-Cu EAM potentials from J. Cai and Y.Y. Ye##', '##Phys. Rev. B 54, 8398-8410 (1996).############', '################################################'] alEmbedFunc = TableReader(_openResource('setfl_AlEmbed.table')) alElectronDensity = TableReader(_openResource('setfl_AlDensity.table')) cuEmbedFunc = TableReader(_openResource('setfl_CuEmbed.table')) cuElectronDensity = TableReader(_openResource('setfl_CuDensity.table')) pairpot_Al_Al = TableReader(_openResource('setfl_AlAlPair.table')) pairpot_Cu_Al = TableReader(_openResource('setfl_CuAlPair.table')) pairpot_Cu_Cu = TableReader(_openResource('setfl_CuCuPair.table')) eampots = [ potentials.EAMPotential('Al', 13, 26.982, alEmbedFunc, alElectronDensity, latticeConstant = 4.05, latticeType = 'FCC'), potentials.EAMPotential('Cu', 29, 63.546, cuEmbedFunc, cuElectronDensity, latticeConstant = 3.615, latticeType = 'FCC')] pairpots = [ Potential('Al', 'Al', pairpot_Al_Al), Potential('Cu', 'Al', pairpot_Cu_Al), Potential('Cu', 'Cu', pairpot_Cu_Cu) ] nrho = 1000 drho = 1.0396723078e+00 nr = 3000 dr = 2.2282427476e-03 cutoff = 6.6825000000e+00 actualEAMTable = StringIO() potentials.writeSetFL( nrho, drho, nr, dr, eampots, pairpots, comments = comments, out = actualEAMTable, cutoff = cutoff) actualEAMTable.seek(0) actualEAMTable = _parseSetFL(actualEAMTable) from . import testutil testutil.compareCollection(self,expectEAMTable, actualEAMTable, places = 3)
def main(): # Create EAMPotential eamPotentials = [EAMPotential("U", 92, 238.03, embed, density)] pairPotentials = [Potential('U', 'U', pair_UU)] cutoff = 8.0 #nrho = 962 # n points density nrho = 5000 # n points density #drho = 0.00103950 # distance points density drho = 0.02 # distance points density #nr = 1462 # n points embed & Vpair nr = 5000 # n points embed & Vpair dr = cutoff / nr # distance points embed & Vpair from atsim.potentials import writeFuncFL with open("U2.eam", 'wb') as outfile: writeSetFL(nrho, drho, nr, dr, eamPotentials, pairPotentials, out=outfile, comments=['Spline Uranium as U.eam', '', ''])
def getPairPotentials(self): self.pairE1E2() for e in self.ES: E1 = self.myParameters[e] self.pairPotentials.append( Potential(E1['symbol'], E1['symbol'], E1['pair'])) return self.pairPotentials
def pairE1E2(self): for i, e in enumerate(self.ES): for j in range(i + 1, len(self.ES)): E1 = self.myParameters[self.ES[i]] E2 = self.myParameters[self.ES[j]] #print ES[i],ES[j], E1['symbol'], E2['symbol'] pair_E1E2 = self.makePairPotAB(E2['dens'], E2['pair'], E1['dens'], E1['pair']) self.pairPotentials.append( Potential(E1['symbol'], E2['symbol'], pair_E1E2))
def main(): # Define list of pair potentials pairPotentials = [ Potential('Al', 'Al', ppfuncAlAl), Potential('Al', 'Fe', ppfuncAlFe), Potential('Fe', 'Fe', ppfuncFeFe) ] # Assemble the EAMPotential objects eamPotentials = [ #Al EAMPotential('Al', 13, 26.98154, AlEmbedFunction, { 'Al': AlAlDensityFunction, 'Fe': FeAlDensityFunction }, latticeConstant=4.04527, latticeType='fcc'), #Fe EAMPotential('Fe', 26, 55.845, FeEmbedFunction, { 'Al': FeAlDensityFunction, 'Fe': FeFeDensityFunction }, latticeConstant=2.855312, latticeType='bcc') ] # Number of grid points and cut-offs for tabulation. nrho = 10000 drho = 3.00000000000000E-2 nr = 10000 dr = 6.50000000000000E-4 cutoff = 6.5 with open("TABEAM", "w") as outfile: writeTABEAMFinnisSinclair(nrho, drho, nr, dr, eamPotentials, pairPotentials, outfile)
def testWriteFuncflPair(self): """Test that unit conversions for pair potential tabulation by writeFuncFL() are correct""" shutil.copyfile(os.path.join(_getResourceDirectory(), "writefuncfl_pair.lmpstruct"), os.path.join(self.tempdir,"structure.lmpstruct")) shutil.copyfile(os.path.join(_getResourceDirectory(), "calc_energy.lmpin"), os.path.join(self.tempdir,"calc_energy.lmpin")) oldpwd = os.getcwd() os.chdir(self.tempdir) try: with open("potentials.lmpinc", "w") as potfile: potfile.write("pair_style eam\n") potfile.write("pair_coeff 1 1 Ag.eam") def embed(rho): return 0.0 def density(rij): return 0.0 def pair_AgAg(rij): if rij == 0: return 0.0 return (2.485883762/rij) ** 12 pairPotentials = [ Potential('Ag', 'Ag', pair_AgAg) ] # Create EAMPotential eamPotentials = [ EAMPotential("Ag", 47, 107.8682, embed, density) ] nrho = 50000 drho = 0.001 nr = 12000 dr = 0.001 from atsim.potentials import writeFuncFL with open("Ag.eam", 'w') as outfile: writeFuncFL( nrho, drho, nr, dr, eamPotentials, pairPotentials, title='Sutton Chen Ag', out= outfile) runLAMMPS() energy = extractLAMMPSEnergy() self.assertAlmostEqual(982.2756583, energy) finally: os.chdir(oldpwd)
def testWriteFuncflDensity(self): """Test writeFuncFL() writing of density function correct""" shutil.copyfile(os.path.join(_getResourceDirectory(), "writefuncfl_pair.lmpstruct"), os.path.join(self.tempdir,"structure.lmpstruct")) shutil.copyfile(os.path.join(_getResourceDirectory(), "calc_energy.lmpin"), os.path.join(self.tempdir,"calc_energy.lmpin")) oldpwd = os.getcwd() os.chdir(self.tempdir) try: with open("potentials.lmpinc", "w") as potfile: potfile.write("pair_style eam\n") potfile.write("pair_coeff 1 1 Ag.eam\n") def embed(rho): return rho def density(rij): if rij == 0: return 0.0 return (2.928323832 / rij) ** 6.0 def pair_AgAg(rij): return 0.0 pairPotentials = [ Potential('Ag', 'Ag', pair_AgAg) ] # Create EAMPotential eamPotentials = [ EAMPotential("Ag", 47, 107.8682, embed, density) ] nrho = 200000 drho = 0.0005 nr = 5000 dr = 0.001 from atsim.potentials import writeFuncFL with open("Ag.eam", 'w') as outfile: writeFuncFL( nrho, drho, nr, dr, eamPotentials, pairPotentials, title='Sutton Chen Ag', out= outfile) runLAMMPS() energy = extractLAMMPSEnergy() self.assertAlmostEqual(83.7425918012, energy/2.0, places = 5) finally: os.chdir(oldpwd)
def testWriteFuncflAgU3EAM(self): """Test that lammps.writeEAMTable can reproduce a DYNAMO funcfl EAM file from the standard LAMMPS distribution here Ag_u3.eam""" #Read the expected table from the .eam file with open(os.path.join(_getResourceDirectory(), 'Ag_u3.eam'),'r') as infile: expectTable = _parseEAMTable(infile) #Create the potential callables to be passed into writeEAMTable() embeddingFunction = potentials.TableReader( open(os.path.join(_getResourceDirectory(), 'AgU3embedding.table'), 'r')) effectiveChargeFunction = potentials.TableReader( open(os.path.join(_getResourceDirectory(), 'AgU3effectivecharge.table'), 'r')) def effectiveChargeFunction_eV(rij): v = effectiveChargeFunction(rij) v *= v v *= 27.2 * 0.529 if rij != 0.0: v /= rij return v densityFunction = potentials.TableReader( open(os.path.join(_getResourceDirectory(), 'AgU3density.table'), 'r')) title = "Ag functions (universal 3), SM Foiles et al, PRB, 33, 7983 (1986)" atomicNumber = 47 mass = 107.87 latticeConstant = 4.09 latticeType = 'FCC' nrho = 500 drho = 5.0100200400801306e-04 nr = 500 dr = 1.1212121212121229e-02 eampotlist = [EAMPotential("Ag", atomicNumber, mass, embeddingFunction, densityFunction, latticeConstant, latticeType)] potlist = [Potential("Ag", "Ag", effectiveChargeFunction_eV)] actualTable = StringIO() potentials.writeFuncFL( nrho, drho, nr, dr, eampotlist, potlist, title = title, out = actualTable) actualTable.seek(0) actualTable = _parseEAMTable(actualTable) from . import testutil testutil.compareCollection(self,expectTable, actualTable, places = 3)
def main(): # Create EAMPotential eam_potentials = [EAMPotential("Ag", 47, 107.8682, embed, density)] pair_potentials = [Potential('Ag', 'Ag', pair_AgAg)] cutoff_rho = 50.0 nrho = 50000 cutoff = 12.0 nr = 12000 tabulation = SetFL_EAMTabulation( pair_potentials, eam_potentials, cutoff, nr, cutoff_rho, nrho) with open("Ag.eam.alloy", 'w') as outfile: tabulation.write(outfile)
def test_single_pair(tmpdir): gulp_input = u"""single cell 50.0 50.0 50.0 90.0 90.0 90.0 cartesian Au 25.0 25.0 25.0 B {} 25.0 25.0 species Au 0.0 B 0.0 include potentials.lib""" buck = potentialforms.buck(1000.0, 0.23, 11.6) mrdefn = Multi_Range_Defn(">", 0, buck) mrpot = create_Multi_Range_Potential_Form(mrdefn) pot = Potential(u"Au", u"B", mrpot) tabulation = pair_tabulation.GULP_PairTabulation([pot], 10.0, 500) with tmpdir.join("potentials.lib").open("w") as potfile: tabulation.write(potfile) # Reproduce a buckingham potential at sepns of 0.1 1.1 2.1 and 3.1 for x in [0.6, 1.1, 2.1, 3.1]: gulp_infile = io.StringIO(gulp_input.format(x + 25.0)) gulp_infile.seek(0) expect = pytest.approx(buck(x), rel=1e-4) gulp_outfile = io.StringIO() runGULP(gulp_infile, gulp_outfile, cwd=tmpdir.strpath) gulp_outfile.seek(0) actual = extractGULPEnergy(gulp_outfile) assert expect == actual
def main(): # Create EAMPotential eamPotentials = [EAMPotential("Ag", 47, 107.8682, embed, density)] pairPotentials = [Potential('Ag', 'Ag', pair_AgAg)] nrho = 50000 drho = 0.001 nr = 12000 dr = 0.001 from atsim.potentials import writeFuncFL with open("Ag.eam", 'w') as outfile: writeFuncFL(nrho, drho, nr, dr, eamPotentials, pairPotentials, out=outfile, title='Sutton Chen Ag')
def main(): # Create EAMPotential f_UU = buck(294.640000, 0.327022, 0.0) eamPotentials = [EAMPotential("U", 92, 238.03, embed, density)] pairPotentials = [Potential('U', 'U', f_UU)] nrho = 50000 drho = 0.001 nr = 12000 dr = 0.001 from atsim.potentials import writeFuncFL with open("U.eam", 'wb') as outfile: writeSetFL(nrho, drho, nr, dr, eamPotentials, pairPotentials, out=outfile, comments=['Buckingham Uranium as U.eam', '', ''])
def makePotentialObjects(): # Potential parameters r_eCu = 2.556162 f_eCu = 1.554485 gamma_Cu = 8.127620 omega_Cu = 4.334731 A_Cu = 0.396620 B_Cu = 0.548085 kappa_Cu = 0.308782 lambda_Cu = 0.756515 rho_e_Cu = 21.175871 rho_s_Cu = 21.175395 F_ni_Cu = [-2.170269, -0.263788, 1.088878, -0.817603] F_i_Cu = [-2.19, 0.0, 0.561830, -2.100595] eta_Cu = 0.310490 F_e_Cu = -2.186568 r_eAl = 2.863924 f_eAl = 1.403115 gamma_Al = 6.613165 omega_Al = 3.527021 # A_Al = 0.134873 A_Al = 0.314873 B_Al = 0.365551 kappa_Al = 0.379846 lambda_Al = 0.759692 rho_e_Al = 20.418205 rho_s_Al = 23.195740 F_ni_Al = [-2.807602, -0.301435, 1.258562, -1.247604] F_i_Al = [-2.83, 0.0, 0.622245, -2.488244] eta_Al = 0.785902 F_e_Al = -2.824528 # Define the density functions dens_Cu = makeFunc(f_eCu, omega_Cu, r_eCu, lambda_Cu) dens_Al = makeFunc(f_eAl, omega_Al, r_eAl, lambda_Al) # Finally, define embedding functions for each species embed_Cu = makeEmbed(rho_e_Cu, rho_s_Cu, F_ni_Cu, F_i_Cu, F_e_Cu, eta_Cu) embed_Al = makeEmbed(rho_e_Al, rho_s_Al, F_ni_Al, F_i_Al, F_e_Al, eta_Al) # Wrap them in EAMPotential objects eam_potentials = [ EAMPotential("Al", 13, 26.98, embed_Al, dens_Al), EAMPotential("Cu", 29, 63.55, embed_Cu, dens_Cu) ] # Define pair functions pair_CuCu = makePairPotAA(A_Cu, gamma_Cu, r_eCu, kappa_Cu, B_Cu, omega_Cu, lambda_Cu) pair_AlAl = makePairPotAA(A_Al, gamma_Al, r_eAl, kappa_Al, B_Al, omega_Al, lambda_Al) pair_AlCu = makePairPotAB(dens_Cu, pair_CuCu, dens_Al, pair_AlAl) # Wrap them in Potential objects pair_potentials = [ Potential('Al', 'Al', pair_AlAl), Potential('Cu', 'Cu', pair_CuCu), Potential('Al', 'Cu', pair_AlCu) ] return eam_potentials, pair_potentials
def testExampleA_Density(self): """Test density functions correctly defined for EAM tabulation documentation example 2a""" exampleModule = _loadModule(self.test_nameA) shutil.copyfile( os.path.join(_getLAMMPSResourceDirectory(), "setfl_pair.lmpstruct"), os.path.join(self.tempdir, "structure.lmpstruct")) shutil.copyfile( os.path.join(_getLAMMPSResourceDirectory(), "calc_energy.lmpin"), os.path.join(self.tempdir, "calc_energy.lmpin")) oldpwd = os.getcwd() os.chdir(self.tempdir) try: def nullfunc(r): return 0.0 eamPotentials, pairPotentials = exampleModule.makePotentialObjects( ) pairPotentials = None pairPotentials = [ Potential("Cu", "Cu", nullfunc), Potential("Al", "Al", nullfunc), Potential("Al", "Cu", nullfunc) ] # Create EAMPotential def embed(rho): return rho for epot in eamPotentials: epot.embeddingFunction = embed nrho = 50000 drho = 0.001 nr = 12000 dr = 0.001 from atsim.potentials import writeSetFL with open("table.set", 'w') as outfile: writeSetFL(nrho, drho, nr, dr, eamPotentials, pairPotentials, comments=['Zhou Al Cu', "", ""], out=outfile) inputExpect = [ (2.0 * 1.218017211, "Cu Cu"), # Cu Cu (2.0 * 1.716990097, "Al Al"), # Al Al (1.218017211 + 1.716990097, "Al Cu") # Al Cu ] for expect, potmap in inputExpect: with open("potentials.lmpinc", "w") as potfile: potfile.write("pair_style eam/alloy\n") potfile.write("pair_coeff * * table.set " + potmap + "\n") runLAMMPS() energy = extractLAMMPSEnergy() self.assertAlmostEqual(expect, energy, msg=potmap) # Now repeat for triplet of atoms shutil.copyfile( os.path.join(_getLAMMPSResourceDirectory(), "setfl_triplet.lmpstruct"), os.path.join(self.tempdir, "structure.lmpstruct")) dens_Cu = [ p.electronDensityFunction for p in eamPotentials if p.species == "Cu" ][0] dens_Al = [ p.electronDensityFunction for p in eamPotentials if p.species == "Al" ][0] hyp = 3.818376618407357 inputExpect = [ (4 * dens_Cu(2.7) + 2 * dens_Cu(hyp), "Cu Cu"), # Cu Cu (4 * dens_Al(2.7) + 2 * dens_Al(hyp), "Al Al"), # Al Al (2 * dens_Cu(2.7) + 2 * dens_Cu(hyp) + \ 2*dens_Al(2.7), "Al Cu"), # Al Cu (2 * dens_Al(2.7) + 2 * dens_Al(hyp) + \ 2*dens_Cu(2.7), "Cu Al") # Cu Al ] for expect, potmap in inputExpect: with open("potentials.lmpinc", "w") as potfile: potfile.write("pair_style eam/alloy\n") potfile.write("pair_coeff * * table.set " + potmap + "\n") runLAMMPS() energy = extractLAMMPSEnergy() self.assertAlmostEqual(expect, energy, msg=potmap) finally: os.chdir(oldpwd)
def test_structure(tmpdir): gulp_input = u"""single cell 5.468 5.468 5.468 90.0 90.0 90.0 frac U 0 0 0 U 1/2 1/2 0 U 1/2 0 1/2 U 0 1/2 1/2 O 1/4 1/4 1/4 O 1/4 3/4 1/4 O 3/4 3/4 1/4 O 3/4 1/4 1/4 O 1/4 1/4 3/4 O 1/4 3/4 3/4 O 3/4 3/4 3/4 O 3/4 1/4 3/4 species U 4.0 O -2.0 include potentials.lib""" # First calculate the expected energy using GULP's built-in analytical potentials with tmpdir.join("potentials.lib").open("w") as potfile: potfile.write("buck\n") potfile.write("O O 9547.96 0.2192 32.0 15.0\n") potfile.write("O U 1761.775 0.35642 0.0 15.0\n") gulp_infile = io.StringIO(gulp_input) gulp_infile.seek(0) gulp_outfile = io.StringIO() runGULP(gulp_infile, gulp_outfile, cwd=tmpdir.strpath) gulp_outfile.seek(0) expect = extractGULPEnergy(gulp_outfile) tmpdir.join("potentials.lib").remove() assert not tmpdir.join("potentials.lib").exists() # Now build a potential model and tabulate it - then re-run the calculation and check the energies match. pot_OO = Potential( "O", "O", create_Multi_Range_Potential_Form( Multi_Range_Defn(">", 0, potentialforms.buck(9547.96, 0.2192, 32.0)))) pot_UO = Potential( "U", "O", create_Multi_Range_Potential_Form( Multi_Range_Defn(">", 0, potentialforms.bornmayer(1761.775, 0.35642)))) potlist = [pot_OO, pot_UO] tabulation = pair_tabulation.GULP_PairTabulation(potlist, 15.0, 500) with tmpdir.join("potentials.lib").open("w") as potfile: tabulation.write(potfile) gulp_infile.seek(0) gulp_outfile = io.StringIO() runGULP(gulp_infile, gulp_outfile, cwd=tmpdir.strpath) gulp_outfile.seek(0) actual = extractGULPEnergy(gulp_outfile) assert pytest.approx(expect) == actual tmpdir.join("potentials.lib").remove() assert not tmpdir.join("potentials.lib").exists() # Now do the same again but use the procedural interface with tmpdir.join("potentials.lib").open("w") as potfile: writePotentials("GULP", potlist, 15.0, 500, out=potfile) gulp_infile.seek(0) gulp_outfile = io.StringIO() runGULP(gulp_infile, gulp_outfile, cwd=tmpdir.strpath) gulp_outfile.seek(0) actual = extractGULPEnergy(gulp_outfile) assert pytest.approx(expect) == actual
def tabulate(self, filename, atomic_numbers, atomic_masses, lattice_constants=dict(), lattice_types=dict(), cutoff_rho=120.0, nrho=10000, cutoff=6.2, nr=10000): """ Uses the atsim module to tabulate the potential for use in LAMMPS or similar programs. filename: str path of the output file. Note that the extension .eam.fs is added atomic_numbers: dict containing the atomic_numbers of all self.atom_types atomic_masses: dict containing the atomic mass of all self.atom_types """ from atsim.potentials import EAMPotential, Potential from atsim.potentials.eam_tabulation import SetFL_FS_EAMTabulation warnings.warn('Long range behavior of the tabulated potentials differs' ' from the tensorflow implementation!') def pair_wrapper(fun): def wrapped_fun(x): return 2 * fun(tf.reshape(x, (1, 1))) return wrapped_fun def rho_wrapper(fun): def wrapped_fun(x): return tf.math.square(fun(tf.reshape(x, (1, 1)))) return wrapped_fun def F_wrapper(fun): def wrapped_fun(x): return fun(tf.reshape(x, (1, 1))) return wrapped_fun pair_potentials = [] pair_densities = {t: {} for t in self.atom_types} for (t1, t2) in combinations_with_replacement(self.atom_types, 2): pair_type = ''.join([t1, t2]) def pair_pot(x): return self.pair_potentials[pair_type](tf.reshape(x, (1, 1))) pair_potentials.append( Potential( t1, t2, pair_wrapper(self.pair_potentials[pair_type]) #lambda x: self.pair_potentials[pair_type]( # x*tf.ones((1, 1))) )) pair_densities[t1][t2] = rho_wrapper(self.pair_rho[pair_type]) pair_densities[t2][t1] = rho_wrapper(self.pair_rho[pair_type]) eam_potentials = [] for t in self.atom_types: eam_potentials.append( EAMPotential(t, atomic_numbers[t], atomic_masses[t], F_wrapper(self.embedding_functions[t]), pair_densities[t], latticeConstant=lattice_constants.get(t, 0.0), latticeType=lattice_types.get(t, 'fcc'))) tabulation = SetFL_FS_EAMTabulation(pair_potentials, eam_potentials, cutoff, nr, cutoff_rho, nrho) with open(''.join([filename, '.eam.fs']), 'w') as outfile: tabulation.write(outfile)
def main(): params = { ('A', 'PtPt'): 0.1602, ('A', 'NiPt'): 0.1346, ('A', 'NiNi'): 0.0845, ('xi', 'PtPt'): 2.1855, ('xi', 'NiPt'): 2.3338, ('xi', 'NiNi'): 1.405, ('p', 'PtPt'): 13.00, ('p', 'NiPt'): 14.838, ('p', 'NiNi'): 11.73, ('q', 'PtPt'): 3.13, ('q', 'NiPt'): 3.036, ('q', 'NiNi'): 1.93, ('r0', 'PtPt'): 2.77, ('r0', 'NiPt'): 2.63, ('r0', 'NiNi'): 2.49, ('cut_a', 'PtPt'): 4.08707719, ('cut_b', 'PtPt'): 5.0056268338740553, ('cut_a', 'NiPt'): 4.08707719, ('cut_b', 'NiPt'): 4.4340500673763259, ('cut_a', 'NiNi'): 3.62038672, ('cut_b', 'NiNi'): 4.4340500673763259} # Create EAMPotential eam_potentials = [EAMPotential('Ni', 28, 58.6934, embedding_function, {'Ni': make_density( params[('xi', 'NiNi')], params[('q', 'NiNi')], params[('r0', 'NiNi')], params[('cut_a', 'NiNi')], params[('cut_b', 'NiNi')]), 'Pt': make_density( params[('xi', 'NiPt')], params[('q', 'NiPt')], params[('r0', 'NiPt')], params[('cut_a', 'NiPt')], params[('cut_b', 'NiPt')])}, latticeConstant=3.524, latticeType='fcc'), EAMPotential('Pt', 78, 195.084, embedding_function, {'Ni': make_density( params[('xi', 'NiPt')], params[('q', 'NiPt')], params[('r0', 'NiPt')], params[('cut_a', 'NiPt')], params[('cut_b', 'NiPt')]), 'Pt': make_density( params[('xi', 'PtPt')], params[('q', 'PtPt')], params[('r0', 'PtPt')], params[('cut_a', 'PtPt')], params[('cut_b', 'PtPt')])}, latticeConstant=3.9242, latticeType='fcc')] pair_potentials = [Potential('Ni', 'Ni', make_pair_pot(params[('A', 'NiNi')], params[('p', 'NiNi')], params[('r0', 'NiNi')], params[('cut_a', 'NiNi')], params[('cut_b', 'NiNi')])), Potential('Ni', 'Pt', make_pair_pot(params[('A', 'NiPt')], params[('p', 'NiPt')], params[('r0', 'NiPt')], params[('cut_a', 'NiPt')], params[('cut_b', 'NiPt')])), Potential('Pt', 'Pt', make_pair_pot(params[('A', 'PtPt')], params[('p', 'PtPt')], params[('r0', 'PtPt')], params[('cut_a', 'PtPt')], params[('cut_b', 'PtPt')]))] # Number of grid points and cut-offs for tabulation. cutoff_rho = 100.0 nrho = 10000 cutoff = 6.0 nr = 10000 tabulation = SetFL_FS_EAMTabulation( pair_potentials, eam_potentials, cutoff, nr, cutoff_rho, nrho) with open("NiPt.eam.fs", "w") as outfile: tabulation.write(outfile)