Birch-Murnaghan Equation of State
Birch-Murnaghan Equation of State
"""
Created on Fri May 29 16:53:17 2020
@author: RicardoGC
"""
# Folder & Files manipulation
import os # Miscellaneous operating system interfaces:
https://docs.python.org/3/library/os.html
import re # Regular expression operations:
https://docs.python.org/3/library/re.html
import sys # System-specific parameters and functions:
https://docs.python.org/3/library/sys.html
import subprocess # It allows to use shell commands:
https://docs.python.org/3/library/subprocess.html
import glob # Finds all the pathnames matching a specified
pattern according to Unix shell rules
import math
import csv
from pandas import ExcelWriter
from pandas import ExcelFile
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import leastsq
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
#%% Scratch1
if opp==1:
#Murnaghan equation
def objective(pars, y, x):
"""To minimize a function"""
err = y - Murnaghan(pars, x)
return err
x0 = [ -56.0, 0.54, 2.0, 16.5] #initial guess of parameters
elif opp==2:
#Birch Murnaghan equation
def objective(pars, y, x):
"""To minimize a function"""
err = y - Birch_Murnaghan(pars, x)
return err
x0 = [ energies.mean(), 1, 2.0, vols.mean()] #initial guess of parameters
plt.plot(vols,energies, 'ro')