# Imports from eosfit import EOS, EOSmodel import numpy as np # Data V = np.array([8., 8.5, 9., 9.6, 10.2, 10.9, 11.6, 12.2, 13., 13.8, 14.5]) # [Ang^3] E = np.array([-4.65, -5.05, -5.3, -5.48, -5.57, -5.59, -5.575, -5.5, -5.4, -5.3, -5.18]) # [eV/atom] plotflag = True # MU4 model eos1 = EOS(V, E, ID='MU4') p0 = [12., -3., 1., 5.] # Order [V0, E0, B0, B0'] V0_MU4, E0_MU4, B0_MU4 = eos1.fit(p0) # Initial guess required (nonlinear model) ci_MU4 = eos1.get_ci() E_MU4 = eos1.eval() R2_MU4 = eos1.get_rsquared() if plotflag: eos1.plot(filename='eosfit_example_MU4.png') print '''MU4 === V0 = {0} Ang^3 E0 = {1} eV/atom B0 = {2} GPa ci = {3} E = {4} eV/atom R^2 = {5} '''.format(V0_MU4, E0_MU4, B0_MU4*160.217, ci_MU4, E_MU4, R2_MU4) # BM5 model eos2 = EOS(V, E, ID='BM5', model=EOSmodel.BM5)