Пример #1
0
def plot_response_func(axis,
                       molecule,
                       charge_vals,
                       all_charges_result,
                       labels_to_monitor,
                       xlim1,
                       ylabel_see_legend=False):
    ylabel = "Charges on other atoms"
    if ylabel_see_legend:
        ylabel += " (see legend)"
    axis.set_ylabel(ylabel)

    colors = iter(['g', 'r', 'c', 'm', 'y'])
    for i, atom_charge in enumerate(zip(*all_charges_result)):
        if i + 1 in labels_to_monitor:
            axis.plot(charge_vals,
                      atom_charge,
                      color=next(colors),
                      label=get_atom_signature(molecule, i + 1))
    axis.legend()
    # Guiding line at zero y2
    # x-limits will be set to `xlim1` by the common code, so this is fine:
    axis.plot(xlim1, (0, 0), 'k:')
Пример #2
0
def plot_common(x_atom_label, y_atom_label, molecule, title):
    if title is not None:
        plt.title(title)
    plt.xlabel("Charge on " + get_atom_signature(molecule, x_atom_label))
    plt.ylabel("Charge on " + get_atom_signature(molecule, y_atom_label))
Пример #3
0
            (1 + level / 100) * resp_rrms, charge_vals, result, resp_args)
        flex_limits.append([sol1, sol2])
        if level == 10:
            charges1_at_10 = charges1
            charges2_at_10 = charges2
        # Difference also shown as percentage of charge on that atom
        print("{0:>3}% limits: {1: .5f}, {2: .5f}, diff: {3:.5f} ({4:.1f}%)".
              format(level, sol1, sol2, sol2 - sol1, 100 * abs(
                  (sol2 - sol1) / min_charge)))

    print("\nThe monitored charges at 10% flexibility limits:")
    i = 1
    for charge1, charge2 in zip(charges1_at_10, charges2_at_10):
        if i in labels_to_monitor:
            print("{0:>3}: {1: .5f}, {2: .5f}, diff: {3:.5f}".format(
                get_atom_signature(molecule, i), charge1, charge2,
                abs(charge1 - charge2)))
        i += 1

    shutil.rmtree(opt_output_path)

    fig, ax1 = plt.subplots()

    plot_response_func_curry = lambda axis, ylabel_see_legend: (
        plot_response_func(axis,
                           molecule,
                           charge_vals,
                           all_charges_result,
                           labels_to_monitor,
                           xlim1,
                           ylabel_see_legend=ylabel_see_legend))