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


Python FaceCenteredCubic.get_center_of_mass方法代码示例

本文整理汇总了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
开发者ID:mattbierbaum,项目名称:openkim-testsuite,代码行数:31,代码来源:analysis.py

示例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)
开发者ID:shigueru,项目名称:nano,代码行数:32,代码来源:generador_fcc.py


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