diff --git a/mod_config_1d.py b/mod_config_1d.py index 887f455..590a4eb 100644 --- a/mod_config_1d.py +++ b/mod_config_1d.py @@ -53,6 +53,16 @@ plot_phase=True, # plot real an imaginary or phase increase_precision=True, # use Runge-Kutta or Euler rk_method='DOP853', # RK method 'RK23', 'RK45', or 'DOP853' + high_res=True, # enable high resolution simulation + plot=True, # enable plotting + compute=True, # enable computations + animate=True, # enable animations + load_data=False, # load data from a file + save_data=False, # save data to a file + data_folder='data/simul', # folder for data files + animation_format='mp4', # format for animations + total_duration=6, # total duration of the simulation + fps=30, # frames per second for the animation verbose=False ) diff --git a/schrodinger_1d.py b/schrodinger_1d.py index 93ccf61..ef3f888 100644 --- a/schrodinger_1d.py +++ b/schrodinger_1d.py @@ -488,18 +488,20 @@ def plot_update(self, cur_step: int): def make_plot(outfile: str): global cfg, p params = { - 'high_res': True, + # fixed parameters 'ggplot': False, 'dark_background': False, - 'do_plot': True, - 'do_compute': True, - 'do_animation': True, - 'load_data': False, - 'save_data': False, - 'data_folder': 'data/simul', - 'animation_format': 'mp4', - 'total_duration': 6, - 'fps': 30 + # configuarable parameters + 'high_res': cfg.high_res, + 'do_plot': cfg.plot, + 'do_compute': cfg.compute, + 'do_animation': cfg.animate, + 'load_data': cfg.load_data, + 'save_data': cfg.save_data, + 'data_folder': cfg.data_folder, + 'animation_format': cfg.animation_format, + 'total_duration': cfg.total_duration, + 'fps': cfg.fps } # init data so a plot can be done without computing x = np.arange(-p.x_max, p.x_max, p.dx) @@ -522,7 +524,8 @@ def make_plot(outfile: str): with open(simul_dir + '/config.pkl', 'rb') as file: cfg = pickle.load(file) p = pickle.load(file) - if params['do_compute']: + # Do not compute if load + else: t, psi = compute( x, t, psi, v, params['total_duration'] * params['fps']) # serialize data