Loading docs/source/input_mods.rst +2 −0 Original line number Diff line number Diff line Loading @@ -91,3 +91,5 @@ Modify nbfix :math:`\sigma`/:math:`\varepsilon` nm HGA2 OG311 Note that 'n' refers to NBFIX-:math:`\sigma` and 'm' refers to NBFIX-:math:`\varepsilon`; other cases should be intuitive ('c' for charge, 's' for sigma etc.) No newline at end of file processing.py +13 −13 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ def run_gromacs(args): struct = structs_list[traj.top_num] tpr = top_core_name + '-rerun.tpr' if tpr not in os.listdir(folder_name): subprocess.call('{gmx} grompp -f {mdp} -p {top} -c {struct} -maxwarn 10 ' subprocess.call('{gmx} grompp -f {mdp} -p {top} -c {struct} -maxwarn 50 ' '-o {fname}/{tpr} >> rerun.log 2>&1'.format(mdp=dyn_mdp, top=top_path, gmx=gmx, struct=struct, fname=folder_name, tpr=tpr), shell=True) if not alch: Loading @@ -89,7 +89,8 @@ def run_gromacs(args): '-o {fname}/{tn}-energy >> rerun.log 2>&1'.format(gmx=gmx, fname=folder_name, tn=traj_alias, en=energy, pcode=pot_code), shell=True) else: print("in mod {fname} skipping trajectory {tn}, already calculated".format(fname=folder_name, tn=traj_alias)) print("in mod {fname} skipping trajectory {tn}, already calculated".format(fname=folder_name, tn=traj_alias)) else: if '{tn}-dhdl.xvg'.format(tn=traj_alias) not in os.listdir(folder_name): if tpr not in os.listdir(folder_name): Loading Loading @@ -213,6 +214,7 @@ def parse_input_line(line, top, td): subclass instances corresponding to the desired configuration. :param line: str, line from input :param top: a Top object that will be passed to create the instance :param td: the main ThermoDiff object :return: a list of Mod subclass instances """ line_list = line.split() Loading @@ -222,6 +224,7 @@ def parse_input_line(line, top, td): # case 1: dealing with charge/sigma/epsilon if all(x in 'cse' for x in mods): for mod in mods: ll = None if c == 0: ll = top.find_type(line_list[1]) if c == 2: Loading Loading @@ -255,8 +258,8 @@ def parse_input_line(line, top, td): else top[0].list_sections('angles') for s in sections: molname = [x for x in top[0].mols.keys() if s in top[0].mols[x]][0] for l in range(len(top[0].sections[s])): lspl = top[0].sections[s][l].split() for lnum in range(len(top[0].sections[s])): lspl = top[0].sections[s][lnum].split() if len(lspl) > (pars-1) and lspl[0][0] not in '[;' \ and check_line([top[0].nums_to_types[molname][lspl[i]] for i in range(pars)], ll): n.append(tuple(top[0].nums_to_names[molname][lspl[i]].split('-')[2] for i in range(pars))) Loading Loading @@ -345,6 +348,7 @@ def process_target_line(line, abs_path, trajset_dict, td): :param line: str, line to process :param abs_path: str, absolute path to target.dat :param trajset_dict: dict, binds trajectory indices to trajectory group names :param td: the main ThermoDiff object :return: a Target instance """ lspl = line.strip().split() Loading Loading @@ -399,6 +403,7 @@ def process_targets(input_file, trajs_input, td): target refinement :param input_file: str, input file for targets :param trajs_input: str, input file for trajectories :param td: the main ThermoDiff object :return: list, contains tuples of directives """ trajs, trajsets = read_traj_params(trajs_input) Loading Loading @@ -485,16 +490,11 @@ def check_line(list_line_to_check, list_entries): def plot_results(mods, q_num, axis): #q = mods[-1].qs[q_num] for m in range(len(mods)): axis.bar(x=m, height=mods[m].qs[q_num].target_improvement_per_unit_change, label=str(m)) axis.legend() # TODO draw profile # TODO draw histogram # if q.profile: # axis.plot(q.diff, label=str(m)) # else: # axis.bar(x=q_num, height=q.data, label=str(m)) class OptParserEmul: Loading Loading
docs/source/input_mods.rst +2 −0 Original line number Diff line number Diff line Loading @@ -91,3 +91,5 @@ Modify nbfix :math:`\sigma`/:math:`\varepsilon` nm HGA2 OG311 Note that 'n' refers to NBFIX-:math:`\sigma` and 'm' refers to NBFIX-:math:`\varepsilon`; other cases should be intuitive ('c' for charge, 's' for sigma etc.) No newline at end of file
processing.py +13 −13 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ def run_gromacs(args): struct = structs_list[traj.top_num] tpr = top_core_name + '-rerun.tpr' if tpr not in os.listdir(folder_name): subprocess.call('{gmx} grompp -f {mdp} -p {top} -c {struct} -maxwarn 10 ' subprocess.call('{gmx} grompp -f {mdp} -p {top} -c {struct} -maxwarn 50 ' '-o {fname}/{tpr} >> rerun.log 2>&1'.format(mdp=dyn_mdp, top=top_path, gmx=gmx, struct=struct, fname=folder_name, tpr=tpr), shell=True) if not alch: Loading @@ -89,7 +89,8 @@ def run_gromacs(args): '-o {fname}/{tn}-energy >> rerun.log 2>&1'.format(gmx=gmx, fname=folder_name, tn=traj_alias, en=energy, pcode=pot_code), shell=True) else: print("in mod {fname} skipping trajectory {tn}, already calculated".format(fname=folder_name, tn=traj_alias)) print("in mod {fname} skipping trajectory {tn}, already calculated".format(fname=folder_name, tn=traj_alias)) else: if '{tn}-dhdl.xvg'.format(tn=traj_alias) not in os.listdir(folder_name): if tpr not in os.listdir(folder_name): Loading Loading @@ -213,6 +214,7 @@ def parse_input_line(line, top, td): subclass instances corresponding to the desired configuration. :param line: str, line from input :param top: a Top object that will be passed to create the instance :param td: the main ThermoDiff object :return: a list of Mod subclass instances """ line_list = line.split() Loading @@ -222,6 +224,7 @@ def parse_input_line(line, top, td): # case 1: dealing with charge/sigma/epsilon if all(x in 'cse' for x in mods): for mod in mods: ll = None if c == 0: ll = top.find_type(line_list[1]) if c == 2: Loading Loading @@ -255,8 +258,8 @@ def parse_input_line(line, top, td): else top[0].list_sections('angles') for s in sections: molname = [x for x in top[0].mols.keys() if s in top[0].mols[x]][0] for l in range(len(top[0].sections[s])): lspl = top[0].sections[s][l].split() for lnum in range(len(top[0].sections[s])): lspl = top[0].sections[s][lnum].split() if len(lspl) > (pars-1) and lspl[0][0] not in '[;' \ and check_line([top[0].nums_to_types[molname][lspl[i]] for i in range(pars)], ll): n.append(tuple(top[0].nums_to_names[molname][lspl[i]].split('-')[2] for i in range(pars))) Loading Loading @@ -345,6 +348,7 @@ def process_target_line(line, abs_path, trajset_dict, td): :param line: str, line to process :param abs_path: str, absolute path to target.dat :param trajset_dict: dict, binds trajectory indices to trajectory group names :param td: the main ThermoDiff object :return: a Target instance """ lspl = line.strip().split() Loading Loading @@ -399,6 +403,7 @@ def process_targets(input_file, trajs_input, td): target refinement :param input_file: str, input file for targets :param trajs_input: str, input file for trajectories :param td: the main ThermoDiff object :return: list, contains tuples of directives """ trajs, trajsets = read_traj_params(trajs_input) Loading Loading @@ -485,16 +490,11 @@ def check_line(list_line_to_check, list_entries): def plot_results(mods, q_num, axis): #q = mods[-1].qs[q_num] for m in range(len(mods)): axis.bar(x=m, height=mods[m].qs[q_num].target_improvement_per_unit_change, label=str(m)) axis.legend() # TODO draw profile # TODO draw histogram # if q.profile: # axis.plot(q.diff, label=str(m)) # else: # axis.bar(x=q_num, height=q.data, label=str(m)) class OptParserEmul: Loading