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


Python FaceCenteredCubic.get_volume方法代码示例

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


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

示例1: ReportTest

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_volume [as 别名]
    ReportTest("Local and global RDF are identical",
               max(abs(globalrdf - localrdf)), 0.0, 1e-6)
        
    shellpop = [12, 6, 24, 12, 24, -1]
    shell = [sqrt(i+1.0)/sqrt(2.0) for i in range(6)]
    print shell
    print shellpop
    n = 0

    dr = maxrdf/nbins

    for i in range(nbins):
        if (i+1)*dr >= shell[n] * latconst:
            if shellpop[n] == -1:
                print "Reached the end of the test data"
                break
            rho = len(atoms) / atoms.get_volume()
            expected = shellpop[n] / (4 * pi * ((i+0.5) * dr)**2 * dr * rho)
            maxerr = shellpop[n] / (8 * pi * ((i+0.5) * dr)**3 * rho)
            print "Shell", n+1, globalrdf[i]
            ReportTest(("Shell %d (%d)" % (n+1, i)), globalrdf[i],
                       expected, maxerr)
            n += 1
        else:
            ReportTest(("Between shells (%d)" % (i,)), globalrdf[i], 0, 0)


ReportTest.Summary()

开发者ID:auag92,项目名称:n2dm,代码行数:30,代码来源:RDF.py

示例2: HexagonalClosedPacked

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_volume [as 别名]
    # this did not work
    # maybe wrong setting of LAMMPS volume optimization for triclinic cell
    # 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
开发者ID:sridharkumarkannam,项目名称:ase-atomistic-potential-tests,代码行数:33,代码来源:monovac.py

示例3: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_volume [as 别名]
from vasp import Vasp
from ase.lattice.cubic import FaceCenteredCubic
import numpy as np
import matplotlib.pyplot as plt
DELTAS = np.linspace(-0.05, 0.05, 5)
calcs = []
volumes = []
for delta in DELTAS:
    atoms = FaceCenteredCubic(symbol='Al')
    cell = atoms.cell
    T = np.array([[1 + delta, 0, 0],
                  [0,1, 0],
                  [0, 0, 1]])
    newcell = np.dot(cell, T)
    atoms.set_cell(newcell, scale_atoms=True)
    volumes += [atoms.get_volume()]
    calcs += [Vasp('bulk/Al-c11-{}'.format(delta),
                xc='pbe',
                kpts=[12, 12, 12],
                encut=350,
                atoms=atoms)]
Vasp.run()
energies =  [calc.potential_energy for calc in calcs]
# fit a parabola
eos = np.polyfit(DELTAS, energies, 2)
# first derivative
d_eos = np.polyder(eos)
print(np.roots(d_eos))
xfit = np.linspace(min(DELTAS), max(DELTAS))
yfit = np.polyval(eos, xfit)
plt.plot(DELTAS, energies, 'bo', xfit, yfit, 'b-')
开发者ID:beeruyue,项目名称:dft-book,代码行数:33,代码来源:script-130.py


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