本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.set_pbc方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.set_pbc方法的具体用法?Python FaceCenteredCubic.set_pbc怎么用?Python FaceCenteredCubic.set_pbc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.set_pbc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_pbc [as 别名]
from kimcalculator import *
from numpy import *
symbol = 'Ar'
cells = 15
ar = FaceCenteredCubic(symbol, pbc=[(1,1,1)], directions=[[1,0,0],[0,1,0],[0,0,1]], size=[cells,cells,1])
for m in listmodels():
if symbol in m:
try:
print "Try model: ", m
calc1 = KIMCalculator(m)
ar.set_calculator(calc1)
N = ar.get_number_of_atoms()
ar.set_pbc([(1,1,1)])
bulk_energy = ar.get_potential_energy() / N
ar.set_pbc([(1,1,0)])
surf_energy = ar.get_potential_energy() / N
print "\tsurface = ", surf_energy - bulk_energy
#virial = ar.get_stresses()
#print "\tvirial = ", virial
print
except SupportError, e:
print "\tskipping ", m, "\n\t", e, " ...\n"
continue
示例2: print_version
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_pbc [as 别名]
from asap3 import *
from ase.lattice.cubic import FaceCenteredCubic
from numpy import *
from asap3.testtools import ReportTest
print_version(1)
#set_verbose(1)
atoms = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]], size=(6,6,6),
symbol="Cu", pbc=(1,1,0))
atoms.set_calculator(EMT())
ecorrect = atoms.get_potential_energy()
atoms2 = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]], size=(6,6,6),
symbol="Cu", pbc=(0,0,0))
atoms2.set_pbc((1,1,0))
atoms2.set_calculator(EMT())
e1= atoms2.get_potential_energy()
ReportTest("e1 correct", e1, ecorrect, 0.001)
atoms.set_pbc((0,1,0))
atoms.set_pbc((1,1,0))
e2 = atoms.get_potential_energy()
ReportTest("e2 correct", e2, ecorrect, 0.001)
print "Setting pbc"
atoms.set_pbc((0,1,0))
print "Calculating energy"
dummy = atoms.get_potential_energy()
assert(fabs(dummy - ecorrect) > 1.0)
atoms.set_pbc((1,1,0))
示例3: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_pbc [as 别名]
if nbltype.startswith("MI_OPBC"):
boundaries = ((1,1,1),)
elif nbltype == "CLUSTER":
boundaries = ((0,0,0),)
else:
boundaries = ((1,1,1), (0,0,0), (0,0,1))
for pbc in boundaries:
txt = nbltype + (" PBC=%1i%1i%1i " % pbc)
# Test that EMT reimported through OpenKIM gives the right results.
atoms_kim = FaceCenteredCubic(size=(10,10,10), symbol='Cu')
#atoms_kim = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
# size=(30, 30, 30),
# symbol="Cu")
natoms = len(atoms_kim)
atoms_kim.set_pbc(pbc)
r = atoms_kim.get_positions()
r.flat[:] += 0.1 * np.sin(np.arange(3*natoms))
atoms_kim.set_positions(r)
atoms_emt = atoms_kim.copy()
kim = OpenKIMcalculator(openkimmodel, allowed=nbltype)
emt = EMT()
emt.set_subtractE0(False)
atoms_kim.set_calculator(kim)
atoms_emt.set_calculator(emt)
ek = atoms_kim.get_potential_energy()
ee = atoms_emt.get_potential_energy()
ReportTest(txt+"Total energy", ek, ee, 1e-8)
ek = atoms_kim.get_potential_energies()
ee = atoms_emt.get_potential_energies()
for i in range(0, natoms, step):