本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.get_center_of_mass方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.get_center_of_mass方法的具体用法?Python FaceCenteredCubic.get_center_of_mass怎么用?Python FaceCenteredCubic.get_center_of_mass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.get_center_of_mass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: equilShape
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_center_of_mass [as 别名]
def equilShape(element,params,size=(10,10,10),distance=25.0,corrections=0,structure='fcc'):
"""
this is to use the ratio of energies to calculate the equilibrium crystal shape, cycle through a bunch of (h,k,l) indices
"""
slab = FaceCenteredCubic(element,directions=([[1,0,0],[0,1,0],[0,0,1]]),size=(10,10,10))
energy100 = fitFunction([1,0,0],params,corrections,structure)
h100 = distance
orig_positions = slab.get_positions()
kept_positions = list(orig_positions)
center = slab.get_center_of_mass()
for h in range(-12,12):
for k in range(0,9):
for l in range(0,9):
nvector=list([h,k,l]/numpy.sqrt(h**2+k**2+l**2))
energyhkl = fitFunction(nvector,params,corrections,structure)
distancehkl = energyhkl/energy100*h100
for i in range(0,len(kept_positions)):
list_to_pop = []
if numpy.dot(kept_positions[i],nvector) > distancehkl:
list_to_pop.append(i)
for i in list_to_pop:
kept_positions.pop(i)
# set up new slab with new positions
number_of_atoms = len(kept_positions)
elstring = str(number_of_atoms)+'Pt'
new_slab = Atoms(elstring,positions=kept_positions)
return new_slab
示例2: float
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_center_of_mass [as 别名]
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()
#view(atoms)