def load_anydata(infile1): ''' load train or valid or train data''' init_qp, _, _, boxsize = data_io.read_trajectory_qp(infile1) # init_qp_train.shape = [nsamples, (q, p), 1, nparticle, DIM] init_q = torch.squeeze(init_qp[:, 0, :, :, :], dim=1) init_p = torch.squeeze(init_qp[:, 1, :, :, :], dim=1) phase_space.set_q(init_q) phase_space.set_p(init_p) phase_space.set_boxsize(boxsize) return init_q.shape, boxsize
tau_long = infile['tau_long'] boxsize = infile['boxsize'] qp_traj = infile['qp_trajectory'] init_qp = qp_traj[:, :, 0, :, :] # init_qp.shape = [nsamples, (q, p), nparticle, DIM] qp_strike_append = qp_traj[:, :, 1, :, :] # qp_strike_append.shape = [nsamples, (q, p), nparticle, DIM] _, _, npar, DIM = init_qp.shape terms = hamiltonian_obj.get_terms() # initial state phase_space.set_q(init_qp[:, 0, :, :]) phase_space.set_p(init_qp[:, 1, :, :]) phase_space.set_boxsize(boxsize) init_u = terms[0].energy(phase_space) / npar init_e = hamiltonian_obj.total_energy(phase_space) / npar # init_e.shape = [nsamples] ########################### thrsh ################################## q_list = init_qp[:, 0, :, :] / boxsize _, d = phase_space.paired_distance_reduced(q_list, npar, DIM) d = d * boxsize rthrsh = torch.min(d) pothrsh = 4 * (1 / (rthrsh) ** 12 - 1 / (rthrsh) ** 6) dhdqthrsh = 4 * ((-12) / (rthrsh) ** 13) - 4 * ((-6) / (rthrsh) ** 7)