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


Python FaceCenteredCubic.get_number_of_atoms方法代码示例

本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.get_number_of_atoms方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.get_number_of_atoms方法的具体用法?Python FaceCenteredCubic.get_number_of_atoms怎么用?Python FaceCenteredCubic.get_number_of_atoms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ase.lattice.cubic.FaceCenteredCubic的用法示例。


在下文中一共展示了FaceCenteredCubic.get_number_of_atoms方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HexagonalClosedPacked

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_number_of_atoms [as 别名]
    # from ase.lattice.hexagonal import HexagonalClosedPacked
    # atoms = HexagonalClosedPacked(symbol=el1,latticeconstant=(lp,c),size=(5,5,5))
    atoms = HCPO(symbol=el1, latticeconstant=(a, b, c), size=(8, 4, 4))

else:
    raise RuntimeError, 'unknown structure "' + str + '"'

atoms.set_calculator(calc)

print "el:", el1, "str:", str, "lp:", lp
if str == "hcp":
    print "catoi:", catoi

v1 = atoms.get_volume()
print "v1:", v1
n1 = atoms.get_number_of_atoms()
print "n1:", n1
v1pa = v1 / n1
print "v1pa:", v1pa

# initial
ene0 = atoms.get_potential_energy()
print "ene0:", ene0
print "ene0pa:", ene0 / atoms.get_number_of_atoms()
ene0pa = ene0 / atoms.get_number_of_atoms()

# vacancy
atoms.pop(0)
nm1 = n1 - 1
ene1nm = atoms.get_potential_energy()
print "ene1nm:", ene1nm
开发者ID:sridharkumarkannam,项目名称:ase-atomistic-potential-tests,代码行数:33,代码来源:monovac.py

示例2: ValueError

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_number_of_atoms [as 别名]
elif ncpu == 8:
    layout = (2,2,2)
else:
    raise ValueError("Cannot run on %i CPUs." % ncpu)
   
if cmd == "M":
    if world.rank == 0:
        atoms = FaceCenteredCubic(size=size*layout, symbol='Cu')
    else:
        atoms = None
    atoms = MakeParallelAtoms(atoms, layout)
else:
    atoms = FaceCenteredCubic(size=size*layout, symbol='Cu')

atoms.set_calculator(EMT())
natoms = atoms.get_number_of_atoms()
print "Number of atoms:", natoms
assert natoms == ncpu * 500000
print "Potential energy:", atoms.get_potential_energy()
start = time.time()

d = 0.1

for i in range(nsteps):
    atoms.arrays['positions'][50][0] += d
    d = -d
    f = atoms.get_forces()
    
wall = time.time() - start
if cmd in "SM":
    master = world.rank == 0
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:ForceTiming.py

示例3: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_number_of_atoms [as 别名]
from ase.visualize import view
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,代码行数:31,代码来源:test_surface_energy.py

示例4: RuntimeError

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_number_of_atoms [as 别名]
else:
    raise RuntimeError("Cannot run on %i CPUs" % (world.size,))

if ismaster:
    print_version(1)

if not hasattr(NPT, '_npt_version'):
    print "Skipping test: NP dynamics does not work in parallel with this old version of ASE."
else:
    if ismaster:
        atoms = FaceCenteredCubic(size=(30,15,15), symbol="Cu", pbc=True)
    else:
        atoms = None
    atoms = MakeParallelAtoms(atoms, cpulayout)
    atoms.set_calculator(EMT())
    print "Number of atoms:", atoms.get_number_of_atoms()

    print "Heating to %d K using Langevin" % T_goal
    lgv = Langevin(atoms, 5 * units.fs, temperature=2*T_goal*units.kB, friction=0.05)

    while atoms.get_kinetic_energy() < 1.5 * atoms.get_number_of_atoms() * T_goal * units.kB:
        lgv.run(5)
        T = atoms.get_kinetic_energy() / (1.5 * atoms.get_number_of_atoms() * units.kB)
        print "Temperature is now %.2f K" % (T,)
    print "Desired temperature reached!"

    lgv.set_temperature(T_goal*units.kB)

    for i in range(2):
        lgv.run(20)
        s = atoms.get_stress()
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:parallelNPT.py

示例5: MakeParallelAtoms

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_number_of_atoms [as 别名]
    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)
        atoms.get_forces()
        traj.write()
else:
    dyn = VelocityVerlet(atoms, 5*units.fs)
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:UnBalance.py


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