indices = np.round(indices) indices = indices.astype(int) return indices free_energies_pmfs_files = [ os.path.join(args.pull_data_dir, f) for f in args.free_energies_pmfs_files.split() ] print("free_energies_pmfs_files", free_energies_pmfs_files) print("us_fe_file", args.us_fe_file) print("us_pmf_file", args.us_pmf_file) fe_us = pickle.load(open(args.us_fe_file, "r")) fe_us["fe"] = first_to_zero(fe_us["fe"]) if args.system_type == "asymmetric": fe_us["lambdas"] = replicate(fe_us["lambdas"], "as_is", exclude_last_in_first_half=True) fe_us["fe"] = replicate(fe_us["fe"], "as_is", exclude_last_in_first_half=True) pmf_us = dict() pmf_us["pmf"] = np.loadtxt(args.us_pmf_file)[:, 1] pmf_us["pmf"] *= BETA # kcal/mol to KT/mol or RT pmf_us["pmf"] = min_to_zero(pmf_us["pmf"]) data_estimator_pairs = args.data_estimator_pairs.split() if len(data_estimator_pairs) != len(free_energies_pmfs_files):
fes_pmfs_files = {} for label, matching in zip(data_estimator_pairs, fes_pmfs_file_matching): fes_pmfs_files[label] = glob.glob(os.path.join(args.data_dir, matching)) number_of_files = [len(files) for files in fes_pmfs_files.values()] if np.unique(number_of_files).shape[0] != 1: raise ValueError("different labels do not have the same number of files") num_fe_file = os.path.join(args.data_dir, args.num_fe_file) print("num_fe_file", num_fe_file) exact_pmf_file = os.path.join(args.data_dir, args.exact_pmf_file) print("exact_pmf_file", exact_pmf_file) fe_num = pickle.load(open(num_fe_file, "r")) fe_num["fe"] = first_to_zero(fe_num["fe"]) pmf_exact = pickle.load(open(exact_pmf_file, "r")) pmf_exact["pmf"] = min_to_zero(pmf_exact["pmf"]) fe_rmse = {} pmf_rmse = {} for label in data_estimator_pairs: print("label", label) fe_rmse[label] = [] pmf_rmse[label] = [] for fes_pmfs_file in fes_pmfs_files[label]: print("processing file", fes_pmfs_file) data = pickle.load(open(fes_pmfs_file, "r"))