本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.get_chemical_symbols方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.get_chemical_symbols方法的具体用法?Python FaceCenteredCubic.get_chemical_symbols怎么用?Python FaceCenteredCubic.get_chemical_symbols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.get_chemical_symbols方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_CuAg
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_chemical_symbols [as 别名]
def test_CuAg(self):
a = FaceCenteredCubic('Cu', size=[2,2,2])
calc = EAM('CuAg.eam.alloy')
a.set_calculator(calc)
FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e_Cu = a.get_potential_energy()/len(a)
a = FaceCenteredCubic('Ag', size=[2,2,2])
a.set_calculator(calc)
FIRE(StrainFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e_Ag = a.get_potential_energy()/len(a)
self.assertTrue(abs(e_Ag+2.85)<1e-6)
a = L1_2(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
a.set_calculator(calc)
FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e = a.get_potential_energy()
syms = np.array(a.get_chemical_symbols())
self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
(syms=='Ag').sum()*e_Ag)/len(a)-0.096)<0.0005)
a = B1(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
a.set_calculator(calc)
FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e = a.get_potential_energy()
syms = np.array(a.get_chemical_symbols())
self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
(syms=='Ag').sum()*e_Ag)/len(a)-0.516)<0.0005)
a = B2(['Ag', 'Cu'], size=[2,2,2], latticeconstant=4.0)
a.set_calculator(calc)
FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e = a.get_potential_energy()
syms = np.array(a.get_chemical_symbols())
self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
(syms=='Ag').sum()*e_Ag)/len(a)-0.177)<0.0003)
a = L1_2(['Cu', 'Ag'], size=[2,2,2], latticeconstant=4.0)
a.set_calculator(calc)
FIRE(UnitCellFilter(a, mask=[1,1,1,0,0,0]), logfile=None).run(fmax=0.001)
e = a.get_potential_energy()
syms = np.array(a.get_chemical_symbols())
self.assertTrue(abs((e-(syms=='Cu').sum()*e_Cu-
(syms=='Ag').sum()*e_Ag)/len(a)-0.083)<0.0005)
示例2: float
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_chemical_symbols [as 别名]
from ase.lattice.cubic import FaceCenteredCubic
from ase.io import *
from ase.visualize import view
import math
a = float(input("Ingrese parametro de red : "))
arc = open("fcc_108000.txt","w")
atomos = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
size=(30,30,30),symbol='Cu',pbc=(1,1,1),latticeconstant=a)
posi = atomos.get_positions()
simbol = atomos.get_chemical_symbols()
arc.write(str(len(simbol))+"\n")
for i in range(len(simbol)):
arc.write(str(posi[i,0])+" ")
arc.write(str(posi[i,1])+" ")
arc.write(str(posi[i,2])+"\n")
#----Luego borrar----#
#write('fcc_108000.txt',atomos,format='xyz')
pos = atomos.get_positions()
c_m = atomos.get_center_of_mass()
coor_x = pos[:,0]
coor_y = pos[:,1]
coor_z = pos[:,2]
print "posicion de cero",pos[0]
print "centro de masa", c_m
print "x_max y x_min:",coor_x.max(),coor_x.min()