本文整理汇总了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()
示例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
示例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-')