basename = 'example' filename = None else: filename = basename + '.dat' (x,y) = pot.load_data(filename) x_len = max(x) # Solve for inital potential using bspline interpolation... print "Solving kink nucleation problem with inital potential using bspline interp" (xfine_interp, yfine_interp, sigma_p, zdiff, u_0, u_max, H_kp, Un, \ zdiff_kp, yderfine, sigma_b, sigma_p_index, kink_energy2) = kinker(x,y,G=60E9) # Now do it again using a function... (func, p0) = pot.choose_func(params=True) # Fit this data to a sin function print "Fitting initial potential to function" opt_p = pot.fit_pot(p0, x, y, x_len, func) # Initial solution with this function (xfine_init, yfine, sigma_p, zdiff_init, u_0_init, u_max, H_kp, Un_init, \ zdiff_kp, yderfine_init, sigma_b_init, sigma_p_index, kink_energy2_init) = kinker(x,y,G=60E9,method=func,params=opt_p) # Load experimental data exptdata = raw_input("Expt data (input is basname.dat): ") (T_n,expt_tau) = pot.load_data(exptdata) # Convert from MPa to Pa and subtract tau_crit (15 MPa, T_crit is 500 K, handled in error func.) tau_n = expt_tau*1E6
xmax_input = None else: xmax_input = float(xmax_input) Na = 6.022E23 # Avagadro's number # Load data set, x is the displacment (u) and y is the energy (U) #(x,y) = load_data(None) # For test data (x,y) = load_data(filename) (xfine, yfine, sigma_p, zdiff, u_0, u_max, H_kp, Un, \ zdiff_kp, yderfine, sigma_b, sigma_p_index, kink_energy2) = kinker(x,y, maxx=xmax_input) # Now do it again using a function... func = pot.choose_func() # Fit this data to a sin function print "Fitting initial potential to sin function" #p0 = [2.4E-10, 2.4E-10, 1, 2, 1, 2, 3, 4, 1, 2] p0 = [2.4, 0.001, 0.001, 2.0, 2.0, 2.0] opt_p = pot.fit_pot(p0, x, y, max(x), func) # Initial solution with this function (xfine_init, yfine, sigma_p, zdiff_init, u_0_init, u_max, H_kp, Un_init, \ zdiff_kp, yderfine_init, sigma_b_init, sigma_p_index, kink_energy2_init) = kinker(x,y,G=60E9,method=func,params=opt_p) # Load experimental data exptdata = raw_input("Expt data (input is basname.dat): ") (T_n,expt_tau) = load_data(exptdata)