Skip to content

Commit

Permalink
two api methods added
Browse files Browse the repository at this point in the history
  • Loading branch information
mauropalumbo75 committed Aug 31, 2017
1 parent adcb0f0 commit 450e7a4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions postqe/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 450e7a4

Please sign in to comment.