本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.set_tags方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.set_tags方法的具体用法?Python FaceCenteredCubic.set_tags怎么用?Python FaceCenteredCubic.set_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.set_tags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_tags [as 别名]
if world.size == 1:
cpulayout = None
elif world.size == 2:
cpulayout = [2,1,1]
elif world.size == 3:
cpulayout = [1,3,1]
elif world.size == 4:
cpulayout = [2,1,2]
if ismaster:
init = FaceCenteredCubic(size=(10,10,10), symbol='Cu', pbc=False)
z = init.get_positions()[:,2]
fixedatoms = np.less(z, 0.501*z.max())
print len(init), sum(fixedatoms)
MaxwellBoltzmannDistribution(init, 6000*units.kB)
init.set_tags(fixedatoms)
else:
init = None
print
print "Running simulation with Filter"
atoms1 = MakeParallelAtoms(init, cpulayout)
atoms1.arrays['r_init'] = atoms1.get_positions()
atoms1.set_calculator(EMT())
atoms1a = Filter(atoms1, mask=np.logical_not(atoms1.get_tags()))
dyn = VelocityVerlet(atoms1a, 3*units.fs)
dyn.run(100)
print
print "Running simulation with Asap's FixAtoms"
示例2: len
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_tags [as 别名]
atoms.center(vacuum=10.0, axis=2)
atoms.set_momenta(np.zeros((len(atoms),3)))
# Select an atom to get a kick
r = atoms.get_positions()
uc = atoms.get_cell()
x = r[:,0] - 0.5 * uc[0,0]
y = r[:,1] - 0.5 * uc[1,1]
z = r[:,2]
zprime = z - 0.01 * (x * x + y * y)
n = np.argmax(zprime)
#a = atoms[n]
#dp = np.sqrt(2 * a.mass * 1000.0)
#a.momentum = np.array([0, 0, dp])
t = np.zeros(len(atoms), int)
t[n] = 1
atoms.set_tags(t)
else:
atoms = None
atoms = MakeParallelAtoms(atoms, cpulayout)
print len(atoms), atoms.get_number_of_atoms()
atoms.set_calculator(EMT())
traj = PickleTrajectory("UnBalance.traj", "w", atoms)
if fast:
atoms.get_forces()
traj.write()
for i in range(50):
print "\n\n\n\n*** STEP %i ***\n\n\n\n\n" % (i,)
r = atoms.get_positions()
r += atoms.get_tags().reshape((-1,1)) * np.array([[0, 0, 20.0],])
atoms.set_positions(r)