# Path: pyqha/constants.py
# RY_KBAR          = 10.0 * AU_GPA / 2.0


from .constants import RY_KBAR
from math import pow
from scipy.optimize import curve_fit
from scipy import interpolate
import numpy as np
    """
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]*.
    """
    return a[0] - a[2]*a[1]/(a[3]-1.0) + V*a[2]/a[3]*( pow(a[1]/V,a[3])/(a[3]-1.0)+1.0 )

def P_Murn(V,a):
    """
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]* and it returns the pressure not the energy from the EOS.
    """
    return a[2]/a[3]*(pow(a[1]/V,a[3])-1.0)

def H_Murn(V,a):
    """ 
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]* and it returns the enthalpy not the energy from the EOS.
    """
    return E_Murn(V,a)+P_Murn(V,a)*V


################################################################################

def print_eos_data(x,y,a,chi,ylabel="Etot"):   
    """
    Print the data and the fitted results using the Murnaghan EOS. It can be used for
    different fitted quantities using the proper ylabel. ylabel can be "Etot", 
    "Fvib", etc.
    """
    print ("# Murnaghan EOS \t\t chi squared= {:.10e}".format(chi))

# Path: pyqha/constants.py
# RY_KBAR          = 10.0 * AU_GPA / 2.0


# Path: pyqha/eos.py
from .constants import RY_KBAR
from math import pow
from scipy.optimize import curve_fit
from scipy import interpolate
import numpy as np

    """
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]*.
    """
    return a[0] - a[2]*a[1]/(a[3]-1.0) + V*a[2]/a[3]*( pow(a[1]/V,a[3])/(a[3]-1.0)+1.0 )

def P_Murn(V,a):
    """
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]* and it returns the pressure not the energy from the EOS.
    """
    return a[2]/a[3]*(pow(a[1]/V,a[3])-1.0)

def H_Murn(V,a):
    """ 
    As :py:func:`E_MurnV` but input parameters are given as a single list 
    *a=[a0,a1,a2,a3]* and it returns the enthalpy not the energy from the EOS.
    """
    return E_Murn(V,a)+P_Murn(V,a)*V


################################################################################

def print_eos_data(x,y,a,chi,ylabel="Etot"):   
    """
    Print the data and the fitted results using the Murnaghan EOS. It can be used for
    different fitted quantities using the proper ylabel. ylabel can be "Etot", 
    "Fvib", etc.
    """
    print ("# Murnaghan EOS \t\t chi squared= {:.10e}".format(chi))

    print ("# "+ylabel+"min= {:.10e} Ry".format(a[0])+"\t Vmin= {:.10e} a.u.^3".format(a[1])+"\t B0= {:.10e} kbar".format(a[2]*RY_KBAR)