print('usage <programe> <infile1> <temp> <infile2> <temp>') quit() infile1 = argv[1] temp1 = argv[2] infile2 = argv[3] temp2 = argv[4] pthrsh = math.sqrt(2 * 1.0) * math.sqrt( -1. * math.log(math.sqrt(2 * math.pi) * 1e-4)) # 4.07 rthrsh = 0.7 phase_space = phase_space() hamiltonian_obj = noML_hamiltonian() crsh_chker = check4particle_crash(rthrsh, pthrsh) linear_integrator_obj = linear_integrator( linear_velocity_verlet.linear_velocity_verlet, crsh_chker) terms = hamiltonian_obj.get_terms() # file1 data q_file1_shape, boxsize = load_anydata( infile1) # q_file1_shape is [nsamples, nparticle, DIM] u_term1 = terms[0].energy(phase_space) # file2 data q_file2_shape, _ = load_anydata( infile2) # q_file2_shape is [nsamples, nparticle, DIM] u_term2 = terms[0].energy(phase_space) # show_graph.u_fluctuation(u_term1, temp, q_train_shape[0], 'train') # show_graph.u_fluctuation(u_term2, temp, q_valid_shape[0], 'valid')
# ML variables load_model_file = ML_parameters.ML_chk_pt_filename phase_space = phase_space.phase_space() if crash_checker == 'yes': if crash_thrsh == 'yes': crsh_chker = check4particle_soft_crash(rthrsh0, pthrsh0, rthrsh, pthrsh, crash_path) else: crsh_chker = check4particle_hard_crash(rthrsh, pthrsh, crash_path) else: crsh_chker = check4particle_crash_dummy(rthrsh0, pthrsh0, rthrsh, pthrsh, crash_path) linear_integrator_obj = linear_integrator(MD_parameters.integrator_method, crsh_chker) hamiltonian_obj = make_hamiltonian(hamiltonian_type, tau_long, ML_parameters) if hamiltonian_type != "noML": # use prediction for ML chk_pt = checkpoint(hamiltonian_obj.get_netlist( )) # opt = None, sch = None ; for test, don't need opt, sch if load_model_file is not None: chk_pt.load_checkpoint(load_model_file) hamiltonian_obj.eval() hamiltonian_obj.requires_grad_false() init_qpl, _, _ = data_io.read_trajectory_qpl(MC_init_config_filename) # init_qp_bs.shape = [nsamples, 3=(q, p, boxsize), 1, nparticle, DIM] init_q = torch.squeeze(init_qpl[:, 0, 0, :, :], dim=1)
# ML variables load_model_file = ML_parameters.ML_chk_pt_filename phase_space = phase_space.phase_space() if crash_checker == 'yes': if crash_thrsh == 'yes': crsh_chker = check4particle_crash(rthrsh0, pthrsh0, rthrsh, pthrsh, crash_path) else: crsh_chker = check4particle_hard_crash(rthrsh, pthrsh, crash_path) else: crsh_chker = check4particle_crash_dummy(rthrsh0, pthrsh0, rthrsh, pthrsh, crash_path) linear_integrator_obj = linear_integrator(MD_parameters.integrator_method, crsh_chker) # don't check crash to make input into fhnn linear_integrator_dummy_obj = linear_integrator( MD_parameters.integrator_method, check4particle_crash_dummy(rthrsh0, pthrsh0, rthrsh, pthrsh, crash_path)) hamiltonian_obj = make_hamiltonian(hamiltonian_type, linear_integrator_dummy_obj, tau_short, tau_long, ML_parameters) if hamiltonian_type != "noML": # use crash chk_pt = checkpoint(hamiltonian_obj.get_netlist( )) # opt = None, sch = None ; for test, don't need opt, sch if load_model_file is not None: chk_pt.load_checkpoint(load_model_file)