<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 For high dpi displays.
Step1:  0. General note
This notebook shows how to calculate thermal pressure and associated terms in the constant q approach.
Step2:  1. Calculate Debye energy with uncertainties
Assign uncertainties to x. Note that
Step3:  2. Calculate Gruneisen parameter
You may get some help on how to call the function using help() command.  constq_grun calculates Gruneisen $(\gamma)$ parameter with error propagation based on the following relation
Step4:  Calculate Gruneisen parameter without error bar.
Step5:  The cell below shows how to do error propagation.
Step6:  If you need a pretty table.
Step7:  You do not need to provide uncertainties for all the parameters.  The cell below shows a case where we do not have error bars for the parameters.  In this case, we have uncertainties for volume.
Step8:  3. Calculate Debye temperature and thermal pressure
You can get the Debye temperatures with error bars.
Step9:  You can get thermal pressures with error bars.
<ASSISTANT_TASK:>
Python Code:
%config InlineBackend.figure_format = 'retina'
Explanation: For high dpi displays.
End of explanation
import numpy as np
import matplotlib.pyplot as plt
import uncertainties as uct
from uncertainties import unumpy as unp
import pandas as pd
import pytheos as eos
Explanation: 0. General note
This notebook shows how to calculate thermal pressure and associated terms in the constant q approach.
End of explanation
x = unp.uarray(np.linspace(0.01,15.,20), np.ones(20)*0.5) # 0.1,7.25
energy = eos.debye_E(x)
plt.plot(unp.nominal_values(x), unp.nominal_values(energy))
plt.xlabel('x'); plt.ylabel('Energy')
plt.errorbar(unp.nominal_values(x), unp.nominal_values(energy), 
             xerr = unp.std_devs(x), yerr = unp.std_devs(energy));
Explanation: 1. Calculate Debye energy with uncertainties
Assign uncertainties to x. Note that:
$$ x = \dfrac{\theta}{T} $$
where $\theta$ is the Debye temperature.
End of explanation
help(eos.constq_grun)
Explanation: 2. Calculate Gruneisen parameter
You may get some help on how to call the function using help() command.  constq_grun calculates Gruneisen $(\gamma)$ parameter with error propagation based on the following relation:
$$\dfrac{\gamma}{\gamma_0} = \left( \dfrac{V}{V_0} \right)^q$$
where $\gamma_0$ is the Gruneisen parameter at reference conditions and $V$ is the volume.  $q$ is the logarithmic volume dependence of Gruneisen parameter.
End of explanation
v0 = 162.3
v = np.linspace(v0, v0*0.8, 20)
grun = eos.constq_grun(v, v0, 1.5, 2)
plt.plot(v, grun)
plt.xlabel('Unit-cell volume ($\mathrm{\AA}^3$)'); plt.ylabel('$\gamma$');
Explanation: Calculate Gruneisen parameter without error bar.
End of explanation
s_v = np.random.uniform(0., 0.1, 20)
v_u = unp.uarray(v, s_v)
gamma = eos.constq_grun(v_u, uct.ufloat(v0, 0.01), 
                        uct.ufloat(1.5, 0.1), uct.ufloat(2.,0.5))
gamma
Explanation: The cell below shows how to do error propagation.
End of explanation
df = pd.DataFrame()
df['volume'] = v_u
df['gamma'] = gamma
df
# print(df.to_string(index=False))
plt.errorbar(unp.nominal_values(v_u), 
             unp.nominal_values(gamma), xerr=unp.std_devs(v_u), 
             yerr=unp.std_devs(gamma))
plt.xlabel('Unit-cell volume ($\mathrm{\AA}^3$)'); plt.ylabel('$\gamma$');
Explanation: If you need a pretty table.
End of explanation
eos.constq_grun(v_u, v0, 1.5, 2.)
Explanation: You do not need to provide uncertainties for all the parameters.  The cell below shows a case where we do not have error bars for the parameters.  In this case, we have uncertainties for volume.
End of explanation
help(eos.constq_debyetemp)
eos.constq_debyetemp(v_u, v0, 1.5, 2., 1000.)
Explanation: 3. Calculate Debye temperature and thermal pressure
You can get the Debye temperatures with error bars.
End of explanation
help(eos.constq_pth)
p_th = eos.constq_pth(v_u, unp.uarray(np.ones_like(v)*2000., np.ones_like(v)*100), v0, 1.5, 2., 1000., 5, 4)
p_th
plt.errorbar(unp.nominal_values(v_u), unp.nominal_values(p_th),
            xerr=unp.std_devs(v_u), yerr=unp.std_devs(p_th))
plt.xlabel('Unit-cell volume ($\mathrm{\AA}^3$)'); plt.ylabel('Thermal pressure (GPa)');
Explanation: You can get thermal pressures with error bars.
End of explanation
<END_TASK>