<jupyter_start><jupyter_text>READMEThis notebook creates a plot of q(mRESP) - q(RESP) as a function of topological distance between an atom and the halogen. The distance is represented by the number of covalent bonds.<jupyter_code># read
dfs = {"cl": pd.read_csv("../chlorine/nbonds.csv"),
        "br": pd.read_csv("../bromine/nbonds.csv"),
        "i": pd.read_csv("../iodine/nbonds.csv")}
"done"
dfs["cl"].head()<jupyter_output><empty_output><jupyter_text>Number of atoms<jupyter_code># styling plots
matplotlib.rcParams["font.family"] = "Open Sans"
matplotlib.rcParams["font.size"] = 6
matplotlib.rcParams["lines.linewidth"] = 1
matplotlib.rcParams["axes.grid"] = True
matplotlib.rcParams["axes.grid.axis"] = "y"
matplotlib.rcParams["axes.spines.top"] = False
matplotlib.rcParams["axes.spines.right"] = False
matplotlib.rcParams["axes.spines.left"] = False
matplotlib.rcParams["grid.color"] = "grey"
matplotlib.rcParams["grid.linestyle"] = "dotted"
#some setup
hals = "cl br i".split()
colors = "black dodgerblue red".split()


# initialize figure
fig, axs = plt.subplots(ncols=3, nrows=1, figsize=(4,1.5), sharey=True)

for hal_id, hal in enumerate(hals):

    color = colors[hal_id]
    ax = axs[hal_id]
    
    # initialize container
    dists = [0, 1, 2, 3, 4]
    dqs = []
    
    # fill the containers
    for dist in dists:
        dqs.append(dfs[hal][f"d{dist}mean"])
        
    vp_stats = ax.violinplot(dqs, positions=dists, showmeans=False, showextrema=False)
    #ax.boxplot(dqs)
    
    for body in vp_stats["bodies"]:
        body.set_facecolor(color)
        body.set_edgecolor(color)
        body.set_alpha(0.8)
        
    # layout
    ax.set_ylim(-0.55,0.55)
    if hal_id == 0:
        ax.set_ylabel(f"Δq / e")
    ax.set_xlabel("N bonds")
    ax.set_title(hal.capitalize())
    ax.tick_params(length=0, axis="y")
    ax.set_xticks(dists)

plt.tight_layout()
for ext in "pdf png".split():
    plt.savefig(f"../dq-vs-nbonds.{ext}", dpi=300)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15923885828743115, 'fraction_numerical': 0.012518778167250876, 'mean_word_length': 3.837772397094431, 'pattern_counts': {'":': 3, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '638605', 'license': 'MIT', 'n_tokens_mistral': 795, 'n_tokens_neox': 757, 'n_words': 143, 'path': 'scripts/figureNBonds.ipynb', 'repo_name': 'mhkoscience/leskourova-offcenter', 'size': '1997'}