File: Al-QHA.py

package info (click to toggle)
phonopy 2.48.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,556 kB
  • sloc: python: 44,403; xml: 12,080; ansic: 3,227; cpp: 525; sh: 213; makefile: 20
file content (49 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
"""Example of QHA calculation by Al."""

import numpy as np
import yaml
from yaml import CLoader as Loader

from phonopy import PhonopyQHA

volumes = []
energies = []
for line in open("e-v.dat"):
    v, e = line.split()
    volumes.append(float(v))
    energies.append(float(e))

entropy = []
cv = []
fe = []
for index in range(-5, 6):
    filename = "thermal_properties.yaml-%d" % index
    print("Reading %s" % filename)
    thermal_properties = yaml.load(open(filename), Loader=Loader)["thermal_properties"]
    temperatures = [v["temperature"] for v in thermal_properties]
    cv.append([v["heat_capacity"] for v in thermal_properties])
    entropy.append([v["entropy"] for v in thermal_properties])
    fe.append([v["free_energy"] for v in thermal_properties])

qha = PhonopyQHA(
    volumes,
    energies,
    temperatures=temperatures,
    free_energy=np.transpose(fe),
    cv=np.transpose(cv),
    entropy=np.transpose(entropy),
    t_max=400,
    verbose=True,
)

# qha.plot_helmholtz_volume().show()
# qha.plot_volume_temperature().show()
qha.plot_thermal_expansion().show()
# plot = qha.plot_volume_expansion()
# if plot:
#     plot.show()
# qha.plot_gibbs_temperature().show()
# qha.plot_bulk_modulus_temperature().show()
# qha.plot_heat_capacity_P_numerical().show()
# qha.plot_heat_capacity_P_polyfit().show()
# qha.plot_gruneisen_temperature().show()