本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.set_constraint方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.set_constraint方法的具体用法?Python FaceCenteredCubic.set_constraint怎么用?Python FaceCenteredCubic.set_constraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.set_constraint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_constraint [as 别名]
from asap3 import *
from asap3.constraints import FixAtoms
from ase.lattice.cubic import FaceCenteredCubic
from ase.io import read, write
from asap3.io.trajectory import PickleTrajectory
fn = "testconstraint.traj"
atoms = FaceCenteredCubic(symbol='Cu', size=(3,3,3))
c = FixAtoms(indices=(2,3))
atoms.set_constraint(c)
write(fn, atoms)
atoms2 = read(fn)
c2 = atoms2.constraints[0]
print "Original class:", c.__class__
print "New class:", c2.__class__
assert c.__class__ is c2.__class__
print "Test passed."
示例2: view
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_constraint [as 别名]
view(slab)
#some positions needed to place the atom in the correct place
x1 = 1.379
x2 = 4.137
x3 = 2.759
y1 = 0.0
y2 = 2.238
z1 = 7.165
z2 = 6.439
#Add the adatom to the list of atoms and set constraints of surface atoms.
slab += Atoms('N', [ ((x2+x1)/2,y1,z1+1.5)])
mask = [atom.symbol == 'Pt' for atom in slab]
slab.set_constraint(FixAtoms(mask=mask))
#optimise the initial state
# Atom below step
initial = slab.copy()
initial.set_calculator(EMT())
relax = QuasiNewton(initial)
relax.run(fmax=0.05)
view(initial)
#optimise the initial state
# Atom above step
slab[-1].position = (x3,y2+1,z2+3.5)
final = slab.copy()
final.set_calculator(EMT())
relax = QuasiNewton(final)