当前位置: 首页>>代码示例>>Python>>正文


Python FaceCenteredCubic.set_pbc方法代码示例

本文整理汇总了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 


开发者ID:mattbierbaum,项目名称:openkim-kimcalculator-ase,代码行数:30,代码来源:test_surface_energy.py

示例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))
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:ChangePeriodicity.py

示例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):
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:OpenKIM_EMT.py


注:本文中的ase.lattice.cubic.FaceCenteredCubic.set_pbc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。