From 450e7a4ca2d2964e172045adf4fca2a70f0cc236 Mon Sep 17 00:00:00 2001 From: Mauro Palumbo Date: Thu, 31 Aug 2017 13:56:57 +0200 Subject: [PATCH] two api methods added --- postqe/api.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/postqe/api.py b/postqe/api.py index 4faaf07..b162d43 100644 --- a/postqe/api.py +++ b/postqe/api.py @@ -174,3 +174,31 @@ def get_potential(prefix, outdir=None, schema=None, pot_type='vtot'): potential.compute_potential(pot_type=pot_type) return potential + +def fit_and_write_eos(label, eos='murnaghan', filename='eos.out'): + """ + This function fits an Equation of state of type *eos* and writes the results into *filename*. + Different equation of states are available: Murnaghan, Birch, Vinet, etc. + + :param label: input file for volumes and energies (possibly including the full path) + :param eos: type of Equation of State (Murnaghan, Birch, Vinet, etc.) + :param filename: name of the output file + """ + + eos = get_eos(label, eos) + v0, e0, B = eos.fit() + eos.write(filename) + +def fit_and_plot_eos(label, eos='murnaghan', filename='EOSplot', show=None, ax=None): + """ + This function fits an Equation of state of type *eos* and writes the results into *filename*. + Different equation of states are available: Murnaghan, Birch, Vinet, etc. + + :param label: input file for volumes and energies (possibly including the full path) + :param eos: type of Equation of State (Murnaghan, Birch, Vinet, etc.) + :param filename: name of the output file + """ + + eos = get_eos(label, eos) + v0, e0, B = eos.fit() + fig = eos.plot(filename, show=show, ax=ax) \ No newline at end of file