args = cli.parse_args() trajlistname = args.trajListFns atom_indicesname = args.atomListFns trajext = args.iext File_TOP = args.topology homedir = args.homedir n_clusters = args.n_clusters n_macro_states = args.n_macro_states stride = args.stride # =========================================================================== # Reading Trajs from XTC files print("stride:", stride) trajreader = XTCReader(trajlistname, atom_indicesname, homedir, trajext, File_TOP, nSubSample=stride) trajs = trajreader.trajs traj_len = trajreader.traj_len np.savetxt("./traj_len.txt", traj_len, fmt="%d") if os.path.isfile( "./phi_angles.txt") and os.path.isfile("./psi_angles.txt") is True: phi_angles = np.loadtxt("./phi_angles.txt", dtype=np.float32) psi_angles = np.loadtxt("./psi_angles.txt", dtype=np.float32) phi_psi = np.column_stack((phi_angles, psi_angles)) else: phi_angles, psi_angles = trajreader.get_phipsi(trajs, psi=[6, 8, 14, 16], phi=[4, 6, 8, 14])
trajlistname = args.trajListFns atom_indicesname = args.atomListFns trajext = args.iext File_TOP = args.topology homedir = args.homedir n_clusters = args.n_clusters n_macro_states = args.n_macro_states # =========================================================================== # Reading phi angles and psi angles data from XTC files if os.path.isfile("./phi_angles.txt") and os.path.isfile("./psi_angles.txt") is True: phi_angles = np.loadtxt("./phi_angles.txt", dtype=np.float32) psi_angles = np.loadtxt("./psi_angles.txt", dtype=np.float32) phi_psi = np.column_stack((phi_angles, psi_angles)) else: trajreader = XTCReader(trajlistname, atom_indicesname, homedir, trajext, File_TOP) trajs = trajreader.trajs traj_len = trajreader.traj_len np.savetxt("./traj_len.txt", traj_len, fmt="%d") phi_angles, psi_angles = trajreader.get_phipsi(trajs, psi=[6, 8, 14, 16], phi=[4, 6, 8, 14]) phi_psi = np.column_stack((phi_angles, psi_angles)) np.savetxt("./phi_angles.txt", phi_angles, fmt="%f") np.savetxt("./psi_angles.txt", psi_angles, fmt="%f") # =========================================================================== # Reading split assignments and the length of each traj assignments_dir = args.assignments labels = np.loadtxt(assignments_dir, dtype=np.int32) if os.path.isfile(args.traj_len) is True: traj_len = np.loadtxt(args.traj_len, dtype=np.int32) else:
default=None, type=int) cli.add_argument('-l', '--alignment', default=False, type=bool) args = cli.parse_args() trajlistname = args.trajListFns atom_indicesname = args.atomListFns trajext = args.iext File_TOP = args.topology homedir = args.homedir n_clusters = args.n_clusters n_macro_states = args.n_macro_states stride = args.stride # =========================================================================== # Reading Trajs from XTC files print "stride:", stride trajreader = XTCReader(trajlistname, atom_indicesname, homedir, trajext, File_TOP, nSubSample=stride) trajs = trajreader.trajs traj_len = trajreader.traj_len np.savetxt("./traj_len.txt", traj_len, fmt="%d") # =========================================================================== ## get phi psi angles for Alanine Dipeptide #if os.path.isfile("./phi_angles.txt") and os.path.isfile("./psi_angles.txt") is True: # phi_angles = np.loadtxt("./phi_angles.txt", dtype=np.float32) # psi_angles = np.loadtxt("./psi_angles.txt", dtype=np.float32) # phi_psi = np.column_stack((phi_angles, psi_angles)) #else: # phi_angles, psi_angles = trajreader.get_phipsi(trajs, psi=[6, 8, 14, 16], phi=[4, 6, 8, 14]) # np.savetxt("./phi_angles.txt", phi_angles, fmt="%f") # np.savetxt("./psi_angles.txt", psi_angles, fmt="%f")