本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.get_stress方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.get_stress方法的具体用法?Python FaceCenteredCubic.get_stress怎么用?Python FaceCenteredCubic.get_stress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.lattice.cubic.FaceCenteredCubic
的用法示例。
在下文中一共展示了FaceCenteredCubic.get_stress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stress
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_stress [as 别名]
def test_stress(self):
a = FaceCenteredCubic('Au', size=[2,2,2])
calc = EAM('Au-Grochola-JCP05.eam.alloy')
a.set_calculator(calc)
self.assertArrayAlmostEqual(a.get_stress(), calc.calculate_numerical_stress(a), tol=self.tol)
sx, sy, sz = a.cell.diagonal()
a.set_cell([sx, 0.9*sy, 1.2*sz], scale_atoms=True)
self.assertArrayAlmostEqual(a.get_stress(), calc.calculate_numerical_stress(a), tol=self.tol)
a.set_cell([[sx, 0.1*sx, 0], [0, 0.9*sy, 0], [0, -0.1*sy, 1.2*sz]], scale_atoms=True)
self.assertArrayAlmostEqual(a.get_stress(), calc.calculate_numerical_stress(a), tol=self.tol)
示例2: Langevin
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_stress [as 别名]
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()
p = -(s[0] + s[1] + s[2])/3.0 / units.GPa
T = atoms.get_kinetic_energy() / (1.5 * atoms.get_number_of_atoms() * units.kB)
print "Pressure is %f GPa, desired pressure is %f GPa (T = %.2f K)" % (p, p_goal, T)
dv = (p - p_goal) / bulk
print "Adjusting volume by", dv
cell = atoms.get_cell()
atoms.set_cell(cell * (1.0 + dv/3.0))
T = atoms.get_kinetic_energy() / (1.5 * atoms.get_number_of_atoms() * units.kB)
print "Temperature is now %.2f K" % (T,)
stressstate = array([-2, -1, 0, 0, 0, 0])*p_goal*units.GPa
dyn = NPT(atoms, 5 * units.fs, T_goal*units.kB, stressstate,
ttime*units.fs, (ptime*units.fs)**2 * bulk * units.GPa)
traj = PickleTrajectory("NPT-atoms.traj", "w", atoms)
示例3: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_stress [as 别名]
#set_verbose(1)
atoms = FaceCenteredCubic(directions=((1,0,0), (0,1,0), (0,0,1)),
size=(15,15,15), symbol="Cu", pbc=True)
atoms.set_calculator(EMT())
atoms.get_forces()
atoms.get_forces()
MaxwellBoltzmannDistribution(atoms, 300 * units.kB)
atoms.get_forces()
atoms.get_forces()
atoms = FaceCenteredCubic(directions=((1,0,0), (0,1,0), (0,0,1)),
size=(15,15,15), symbol="Cu", pbc=True)
atoms.set_calculator(EMT())
s = atoms.get_stress()
print
print "Stress:", s
s = atoms.get_stress()
print
print "Stress:", s
MaxwellBoltzmannDistribution(atoms, 300 * units.kB)
s = atoms.get_stress()
print
print "Stress:", s
s = atoms.get_stress()
print
print "Stress:", s
MaxwellBoltzmannDistribution(atoms, 300 * units.kB)
s = atoms.get_stress()
print
示例4: FaceCenteredCubic
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_stress [as 别名]
#!/usr/bin/env python
from jasp import *
from ase.lattice.cubic import FaceCenteredCubic
atoms = FaceCenteredCubic(symbol='Al')
with jasp('bulk/Al-bulk',
xc='PBE',
kpts=(12, 12, 12),
encut=350,
prec='High',
isif=3,
nsw=30,
ibrion=1,
atoms=atoms) as calc:
print atoms.get_potential_energy()
print atoms.get_stress()
示例5: EMT
# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import get_stress [as 别名]
emt = EMT()
emt.set_subtractE0(False)
atoms_kim.set_calculator(kim)
atoms_emt.set_calculator(emt)
ek = atoms_kim.get_potential_energy()
ee = atoms_emt.get_potential_energy()
ReportTest(txt+"Total energy", ek, ee, 1e-8)
ek = atoms_kim.get_potential_energies()
ee = atoms_emt.get_potential_energies()
for i in range(0, natoms, step):
ReportTest(txt+"Energy of atom %i" % (i,), ek[i], ee[i], 1e-8)
fk = atoms_kim.get_forces()
fe = atoms_emt.get_forces()
n = 0
for i in range(0, natoms, step):
n = (n + 1) % 3
ReportTest(txt+"Force(%i) of atom %i" % (n, i), fk[i, n], fe[i, n], 1e-8)
sk = atoms_kim.get_stress()
se = atoms_emt.get_stress()
for i in range(6):
ReportTest(txt+"Stress(%i)" % (i,), sk[i], se[i], 1e-8)
sk = atoms_kim.get_stresses()
se = atoms_emt.get_stresses()
for i in range(0, natoms, step):
n = (n + 1) % 6
# Volume per atom is not defined the same way: greater tolerance needed
ReportTest(txt+"Stress(%i) of atom %i" % (n, i), sk[i, n], se[i, n], 1e-3)
ReportTest.Summary()