1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
from ase.calculators.emt import EMT
from ase.optimize import QuasiNewton
from ase.phonons import Phonons
from ase.spacegroup import crystal
from ase.thermochemistry import CrystalThermo
# Set up gold bulk and attach EMT calculator
a = 4.078
atoms = crystal(
'Au',
(0.0, 0.0, 0.0),
spacegroup=225,
cellpar=[a, a, a, 90, 90, 90],
pbc=(1, 1, 1),
)
calc = EMT()
atoms.calc = calc
qn = QuasiNewton(atoms)
qn.run(fmax=0.05)
potentialenergy = atoms.get_potential_energy()
# Phonon analysis
N = 5
ph = Phonons(atoms, calc, supercell=(N, N, N), delta=0.05)
try:
ph.run()
ph.read(acoustic=True)
finally:
ph.clean()
dos = ph.get_dos(kpts=(40, 40, 40)).sample_grid(npts=3000, width=5e-4, xmin=0.0)
phonon_energies = dos.get_energies()
phonon_DOS = dos.get_weights()
# Calculate the Helmholtz free energy
thermo = CrystalThermo(
phonon_energies=phonon_energies,
phonon_DOS=phonon_DOS,
potentialenergy=potentialenergy,
formula_units=4,
)
F = thermo.get_helmholtz_energy(temperature=298.15)
|