VTerr[0,i+1*n] = Verrhit[i+1*n] VT[0,i+2*n] = Vhit[i+2*n] VTerr[0,i+2*n] = Verrhit[i+2*n] VT[1,i+0*n] = 1000. # Hi-T's VTerr[1,i+0*n] = 10. VT[1,i+1*n] = 1500. VTerr[1,i+1*n] = 20. VT[1,i+2*n] = 2000. VTerr[1,i+2*n] = 30. # Generate pressures A = np.zeros(3, dtype=float) A[0] = 700. # ThetaD0 A[1] = 1.5 # gD0 A[2] = 1. # q D = GEOST_thermo.debye([20, ref_Biso[-1], 273.]) # Instantiate debye Phit = D.P_thermal(A, VT) + np.random.normal(0,0.5,3*n) print 'Phit', Phit Perrhit = abs(np.random.normal(0,1,3*n)) Perrhit = np.sort(Perrhit) print "Thermal EOS refinement using Debye" print "True values & initial guesses:", A # ODR SETUP for isothermal EOS # model contains information about the ODR functions. # fcn = model function to refine parameters from # fjacb = derivatives of fcn w.r.t. parameters # fjacd = derivatives of fcn w.r.t. independent var. odr_model = odrpack.Model(fcn=D.P_thermal) odr_data = odrpack.RealData(x=VT, y=Phit, sx=VTerr, sy=Perrhit) odr = odrpack.ODR(odr_data, odr_model, beta0=A, maxit=100)
#!/usr/bin/env python import numpy as np import GEOST_thermo as thermo import matplotlib.pyplot as plt kB = 8.6173324E-05 #eV/K B = [1, 100., 300.] D = thermo.debye(B) X = np.zeros((2,24), dtype=float) for i in range(X.shape[1]): X[0,i] = 100. - float(i) X[1,i] = 1000. B = np.zeros(3) B[0] = 1000. B[1] = 1.5 B[2] = 1. TD = np.zeros(X.shape[1]) U = np.zeros(X.shape[1]) Cv = np.zeros(X.shape[1]) for i in range(U.shape[0]): TD[i] = 1000.*np.exp(B[1] - B[1]*(100./X[0,i])**(-B[2])) U[i] = D.U(TD[i], X[1,i]) Cv[i] = D.Cv(TD[i], X[1,i]) plt.figure() plt.subplot(221) plt.title(r'$\Theta_{D}$') plt.xlabel("Volume")
A = np.zeros(3) # Debye setup A[0] = 20. # No. atoms/cell A[1] = B[1] # V0 A[2] = 273. # Reference temperature (K) data273 = data(N,B) X273 = np.zeros((2,N), dtype=float) # Volume X273[0,:] = data(N,B).V X273[1,:] = 273. Y273 = data(N,B).P e273 = np.zeros((2,N), dtype=float) # errs e273[0,:] = data(N,B).Verr e273[1,:] = data(N,B).Perr debye273 = thermo.debye(A) C = np.zeros(3) C[0] = 1000. C[1] = 1.5 C[2] = 1. ### # 700 K N = 24 K0 = 100. V0 = 202. B = np.ones(2) # isothermal EOS initial parameters B[0] = K0 # K0 B[1] = V0 # V0