예제 #1
0
    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)
    # init_q.shape = [nsamples, nparticle, DIM]

    init_p = torch.squeeze(init_qpl[:, 1, 0, :, :], dim=1)
예제 #2
0
            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)
        hamiltonian_obj.eval()
        hamiltonian_obj.requires_grad_false()

    init_qp, _, _, boxsize = data_io.read_trajectory_qp(
        MC_init_config_filename)
    # init_qp.shape = [nsamples, (q, p), 1, nparticle, DIM]

    init_q = torch.squeeze(init_qp[:, 0, 0, :, :], dim=1)
    # init_q.shape = [nsamples, nparticle, DIM]