def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) traj_file = files.TxtTrajInpFile(args.traj_filename, system_file) dists = config_process.calc_end_to_end_dists(traj_file) np.savetxt(args.out_file, dists)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) traj_file = files.TxtTrajInpFile(args.traj_filename, system_file) ref_ext = args.ref_filename.split('.')[-1] if ref_ext == 'json': ref_file = files.JSONStructInpFile(args.ref_filename) elif ref_ext == 'trj': ref_file = files.TxtTrajInpFile(args.ref_filename, system_file) ref_config = np.array(ref_file.chains(args.step)) ref_positions = config_process.center_on_origin(ref_config) aligned_positions, rmsds = config_process.align_positions( traj_file, ref_config) np.savetxt(args.outfile, rmsds)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) traj_file = files.TxtTrajInpFile(args.traj_filename, system_file) rgs = config_process.calc_radius_of_gyration(traj_file) np.savetxt(args.out_file, rgs)
def main(): args = parse_args() sys_inp_file = files.JSONStructInpFile(args.sys_filename) traj_file = files.TxtTrajInpFile(args.trj_filename, sys_inp_file) chains = traj_file.get_chains(args.step) sys_out_filename = '{}.json'.format(args.out_filebase) sys_out_file = files.JSONStructOutFile(sys_out_filename, sys_inp_file) sys_out_file.write(chains)
def main(): args = parse_args() system_file = files.JSONStructInpFile(args.system_filename) domain_pairs = parse_domain_pairs(args.domain_pairs) fileformatter = construct_fileformatter() all_conditions = construct_conditions(args, fileformatter, system_file) inp_filebase = create_input_filepathbase(args) sim_collections = outputs.create_sim_collections(inp_filebase, all_conditions, args.reps) for sim_collection in sim_collections: for rep in sim_collection._reps: ops = sim_collection.get_reps_data('ops', concatenate=False) runs = len(ops[rep]) for run in range(runs): run_filebase = sim_collection.get_filebase(run, rep) trj_filename = '{}.trj'.format(run_filebase) trj_file = files.TxtTrajInpFile(trj_filename, system_file) ops = datatypes.OrderParams.from_file(run_filebase) all_dists = [[] for i in range(len(domain_pairs))] for i, step in enumerate(trj_file): config = np.array(step[0]['positions']) for j, domain_pair in enumerate(domain_pairs): pos_i = config[domain_pair[0]] pos_j = config[domain_pair[1]] all_dists[j].append( config_process.calc_dist(pos_i, pos_j)) for domain_pair, dists in zip(domain_pairs, all_dists): dist_tag = 'dist-d{}-d{}'.format(domain_pair[0], domain_pair[1]) if dist_tag in ops.tags: ops[dist_tag] = dists else: ops.add_column(dist_tag, dists) adj_tag = 'adj-d{}-d{}'.format(domain_pair[0], domain_pair[1]) adj_sites = np.array(dists) == 1 if adj_tag in ops.tags: ops[adj_tag] = adj_sites else: ops.add_column(adj_tag, adj_sites) dist_sum = np.sum(all_dists, axis=0) tag = 'dist-sum' if tag in ops.tags: ops[tag] = dist_sum else: ops.add_column(tag, dist_sum) ops.to_file(run_filebase)
def main(): args = parse_args() # random.seed(123450897) traj_file = files.TxtTrajInpFile(args.sim_filebase + '.trj', args.system_file) bias_tags, wins = us_process.read_windows_file(args.win_file) bias_functions = json.load(open(args.bias_functions_filename)) op_tags = us_process.get_op_tags_from_bias_functions( bias_functions, bias_tags) ops = datatypes.OrderParams.from_file(args.sim_filebase) op_to_config = sort_by_ops(ops, op_tags) for i, win in enumerate(wins): config = us_process.select_config_by_op_in_win(i, win, ops, op_to_config) win_filename = us_process.create_win_filename(win, args.out_filebase, args.ext) config_file = files.TxtTrajOutFile(win_filename) config_file.write_config(traj_file.get_chains(config), 0)