Skip to content

Commit

Permalink
fix a few images
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-24 committed Jun 12, 2024
1 parent 169389d commit b125c27
Show file tree
Hide file tree
Showing 17 changed files with 8,491 additions and 1,189 deletions.
7,722 changes: 7,486 additions & 236 deletions Figure12.eps

Large diffs are not rendered by default.

Binary file modified Figure7.eps
Binary file not shown.
20 changes: 13 additions & 7 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@
- [x] Use $E^f$ in Fig. 15 (and check discussion, especially **4**)
- [x] Fig. 16: $E_{SHE}$ → $E^0_{abs}$
- [x] Conclude & abstract & keywords
- [x] xx in Fig. 12?
- [x] Aknowledgements
- [x] Clean up the bibliography, check for duplicates

- [ ] pack the geometries
- [ ] prepare a TOC
- [ ] Research highlight
- [ ] mark (and address) missing values in Tables
- [ ] tries to move labels as much as possible in graphs
- [ ] PACS code, MSC code?
- [ ] Fig. or Figure?
- [ ] Fig. S7: not $E^f$
- [ ] Title of the SI
- [x] Fig. S7: not $E^f$
- [x] Title of the SI
- [ ] Check NC → N-C+, etc.
- [ ] xx in Fig. 12?
- [ ] Use correct hammet parameters
- [ ] Figs. S3 & S4
- [ ] Entropy in cplx
- [ ] Sign $U_q$
- [ ] Extra explanation solv. (diff of $\varepsilon$ is not enough)

- [ ] Fig. or Figure?
- [ ] PACS code, MSC code?
- [ ] tries to move labels as much as possible in graphs
- [ ] pack the geometries
20 changes: 10 additions & 10 deletions analyses/plot_cplx_Kx1.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def plot_Kx1(ax, data: pandas.DataFrame, family: str, color: str):

x = [int(x.replace('mol_', '')) for x in subdata['name']]

pK01 = numpy.log10(subdata['k01'])
pK11 = numpy.log10(subdata['k11'])
pK21 = numpy.log10(subdata['k21'])
pK01 = -numpy.log10(subdata['k01'])
pK11 = -numpy.log10(subdata['k11'])
pK21 = -numpy.log10(subdata['k21'])

ax.plot(x, pK01, 'o', color=color, label=family.replace('Family.', ''))
ax.plot(x, pK11, '^', color=color)
Expand All @@ -50,12 +50,12 @@ def plot_Kx1(ax, data: pandas.DataFrame, family: str, color: str):

def plot_helpline(ax, data):
x = [int(x.replace('mol_', '')) for x in data['name']]
ax.plot(x, numpy.log10(data['k01']), '--', color='black', linewidth=0.8)

pK01 = numpy.log10(data['k01'])
pK11 = numpy.log10(data['k11'])
pK21 = numpy.log10(data['k21'])
pK01 = -numpy.log10(data['k01'])
pK11 = -numpy.log10(data['k11'])
pK21 = -numpy.log10(data['k21'])

ax.plot(x, pK01, '--', color='black', linewidth=0.8)
print('{} & {:.2f} $\\pm$ {:.2f} & {:.2f} $\\pm$ {:.2f} & {:.2f} $\\pm$ {:.2f} \\\\'.format('Total', numpy.mean(pK01), numpy.std(pK01), numpy.mean(pK11), numpy.std(pK11), numpy.mean(pK21), numpy.std(pK21)))

def make_table(f, data: pandas.DataFrame, solvent: str):
Expand Down Expand Up @@ -101,7 +101,7 @@ def make_table(f, data: pandas.DataFrame, solvent: str):

ax1.legend(ncols=5)
ax1.set_xlim(0.5,61.5)
ax1.text(38, 0.5, "Water", fontsize=18)
ax1.text(38, 8, "Water", fontsize=18)
ax1.xaxis.set_minor_locator(MultipleLocator(2))
ax1.grid(which='both', axis='x')
ax1.plot([0, 62], [0, 0], '-', color='grey')
Expand All @@ -116,12 +116,12 @@ def make_table(f, data: pandas.DataFrame, solvent: str):

ax2.set_xlabel('Molecule id')
ax2.set_xlim(0.5, 61.5)
ax2.text(38, 0.5, "Acetonitrile", fontsize=18)
ax2.text(38, 8, "Acetonitrile", fontsize=18)
ax2.xaxis.set_minor_locator(MultipleLocator(2))
ax2.grid(which='both', axis='x')
ax2.plot([0, 62], [0, 0], '-', color='grey')

[ax.set_ylabel('log$_{10}$(K)') for ax in [ax1, ax2]]
[ax.set_ylabel('pK$_{x1}$') for ax in [ax1, ax2]]

plt.tight_layout()
figure.savefig(args.output)
Expand Down
16 changes: 8 additions & 8 deletions analyses/plot_cplx_Kx2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def plot_Kx2(ax, data: pandas.DataFrame, family: str, color: str):

x = [int(x.replace('mol_', '')) for x in subdata['name']]

ax.plot(x, numpy.log10(subdata['k02']), 'o', color=color, label=family.replace('Family.', ''))
ax.plot(x, numpy.log10(subdata['k12']), '^', color=color)
ax.plot(x, numpy.log10(subdata['k22']), 's', color=color)
ax.plot(x, -numpy.log10(subdata['k02']), 'o', color=color, label=family.replace('Family.', ''))
ax.plot(x, -numpy.log10(subdata['k12']), '^', color=color)
ax.plot(x, -numpy.log10(subdata['k22']), 's', color=color)

def plot_helpline(ax, data):
x = [int(x.replace('mol_', '')) for x in data['name']]
ax.plot(x, numpy.log10(data['k02']), '--', color='black', linewidth=0.8)
ax.plot(x, -numpy.log10(data['k02']), '--', color='black', linewidth=0.8)

def make_table(f, data: pandas.DataFrame, solvent: str):
subdata = data[data['solvent'] == solvent]
Expand Down Expand Up @@ -88,12 +88,12 @@ def make_table(f, data: pandas.DataFrame, solvent: str):

ax1.legend(ncols=5)
ax1.set_xlim(0.5,61.5)
ax1.text(38, -2, "Water", fontsize=18)
ax1.text(38, 2, "Water", fontsize=18)
ax1.xaxis.set_minor_locator(MultipleLocator(2))
ax1.grid(which='both', axis='x')
ax1.plot([0, 62], [0, 0], '-', color='grey')

ax1.legend()
ax1.legend(ncols=5)

subdata_ac = prepare_data(data, 'acetonitrile')
plot_helpline(ax2, subdata_ac)
Expand All @@ -105,12 +105,12 @@ def make_table(f, data: pandas.DataFrame, solvent: str):

ax2.set_xlabel('Molecule id')
ax2.set_xlim(0.5,61.5)
ax2.text(38, -2, "Acetonitrile", fontsize=18)
ax2.text(38, 2, "Acetonitrile", fontsize=18)
ax2.xaxis.set_minor_locator(MultipleLocator(2))
ax2.grid(which='both', axis='x')
ax2.plot([0, 62], [0, 0], '-', color='grey')

[ax.set_ylabel('log$_{10}$(K)') for ax in [ax1, ax2]]
[ax.set_ylabel('pK$_{x2}$') for ax in [ax1, ax2]]

plt.tight_layout()
figure.savefig(args.output)
Expand Down
98 changes: 50 additions & 48 deletions analyses/plot_pot_er.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from nitroxides.commons import dG_DH, AU_TO_ANG, LabelPositioner, AU_TO_EV
from nitroxides.tex import format_longtable

LABELS = {'E_ox': [], 'E_red': []}
POINTS_POSITION ={'E_ox': [], 'E_red': []}
LABELS_KWARGS = {'E_ox': [], 'E_red': []}
LABELS_PATH = {'E_ox': pathlib.Path('pot_er_ox.pos'), 'E_red': pathlib.Path('pot_er_red.pos')}
LABELS = {'Ef_ox': [], 'Ef_red': []}
POINTS_POSITION ={'Ef_ox': [], 'Ef_red': []}
LABELS_KWARGS = {'Ef_ox': [], 'Ef_red': []}
LABELS_PATH = {'Ef_ox': pathlib.Path('pot_er_ox.pos'), 'Ef_red': pathlib.Path('pot_er_red.pos')}

AU_TO_DEBYE = 1 / 0.3934303

Expand All @@ -23,42 +23,43 @@
56, 58, # ?!?
]

def plot_Er(ax, data: pandas.DataFrame, column: str, family: str, color: str):
subdata = data[(data['solvent'] == 'water') & (data['family'] == family) & data['px'].notnull()]
def prepare_data(data: pandas.DataFrame):
subdata = data[(data['solvent'] == 'water') & data['px'].notnull()]

dG_DH_ox = dG_DH(subdata['z'] + 1, subdata['z'], subdata['r_ox'] / AU_TO_ANG, subdata['r_rad'] / AU_TO_ANG, 80, 0) * AU_TO_EV
dG_DH_red = dG_DH(subdata['z'], subdata['z'] - 1, subdata['r_rad'] / AU_TO_ANG, subdata['r_red'] / AU_TO_ANG, 80, 0) * AU_TO_EV

if column == 'E_ox':
dG_DH_ = dG_DH(subdata['z'] + 1, subdata['z'], subdata['r_ox'] / AU_TO_ANG, subdata['r_rad'] / AU_TO_ANG, 80, 0) * AU_TO_EV
else:
dG_DH_ = dG_DH(subdata['z'], subdata['z'] - 1, subdata['r_rad'] / AU_TO_ANG, subdata['r_red'] / AU_TO_ANG, 80, 0) * AU_TO_EV
subdata.insert(1, 'Ef_ox', subdata['E_ox'] - dG_DH_ox)
subdata.insert(1, 'Ef_red', subdata['E_red'] - dG_DH_red)

Er = subdata['px'] / subdata['r'] ** 2 + subdata['Qxx'] / subdata['r'] ** 3
r = subdata['r'] / AU_TO_ANG
Er = (subdata['px'] / AU_TO_DEBYE / r ** 2 + subdata['Qxx'] / AU_TO_DEBYE / AU_TO_ANG / r ** 3) * AU_TO_EV
subdata.insert(1, 'Er', Er)

return subdata

def plot_Er(ax, data: pandas.DataFrame, column: str, family: str, color: str):
subdata = data[data['family'] == family]

excluded_ = [int(x.replace('mol_', '')) in EXCLUDE for x in subdata['name']]
not_excluded_ = [not x for x in excluded_]

ax.plot(Er[not_excluded_], subdata[not_excluded_][column] - dG_DH_[not_excluded_], 'o', color=color, label=family.replace('Family.', ''))
ax.plot(Er[excluded_], subdata[excluded_][column] - dG_DH_[excluded_], '^', color=color)
ax.plot(subdata[not_excluded_]['Er'], subdata[not_excluded_][column], 'o', color=color, label=family.replace('Family.', ''))
ax.plot(subdata[excluded_]['Er'], subdata[excluded_][column], '^', color=color)

for name, er, e in zip(subdata['name'], Er, subdata[column] - dG_DH_):
for name, er, e in zip(subdata['name'], subdata['Er'], subdata[column]):
name = name.replace('mol_', '')
LABELS[column].append(name)
POINTS_POSITION[column].append((er, e))
LABELS_KWARGS[column].append(dict(color=color, ha='center', va='center'))

def plot_corr_Er(ax, data: pandas.DataFrame, column: str):
subdata = data[(data['solvent'] == 'water') & data['px'].notnull()]
subdata = subdata[[int(x.replace('mol_', '')) not in EXCLUDE for x in subdata['name']]]

if column == 'E_ox':
dG_DH_ = dG_DH(subdata['z'] + 1, subdata['z'], subdata['r_ox'] / AU_TO_ANG, subdata['r_rad'] / AU_TO_ANG, 80, 0) * AU_TO_EV
else:
dG_DH_ = dG_DH(subdata['z'], subdata['z'] - 1, subdata['r_rad'] / AU_TO_ANG, subdata['r_red'] / AU_TO_ANG, 80, 0) * AU_TO_EV

result = scipy.stats.linregress(subdata['px'] / subdata['r'] ** 2 + subdata['Qxx'] / subdata['r'] ** 3, subdata[column] - dG_DH_)
subdata = data[[int(x.replace('mol_', '')) not in EXCLUDE for x in data['name']]]
result = scipy.stats.linregress(subdata['Er'], subdata[column])

x = numpy.array([-.2, 1.5])
x = numpy.array([-.2, 4])
ax.plot(x, result.slope*x + result.intercept, 'k--')
ax.text(1.2, 1.2*result.slope+result.intercept+.05, '$R^2$={:.2f}'.format(result.rvalue **2))
ax.text(3., 3.*result.slope+result.intercept+.05, '$R^2$={:.2f}'.format(result.rvalue **2))

def make_table(f, data: pandas.DataFrame, solvent: str):
subdata = data[(data['solvent'] == solvent) & data['px'].notnull()]
Expand All @@ -83,51 +84,52 @@ def make_table(f, data: pandas.DataFrame, solvent: str):
args = parser.parse_args()

data = pandas.read_csv(args.input)
data = prepare_data(data)

figure = plt.figure(figsize=(7, 10))
ax3, ax4 = figure.subplots(2, 1)

plot_Er(ax3, data, 'E_ox', 'Family.P6O', 'tab:blue')
plot_Er(ax3, data, 'E_ox', 'Family.P5O', 'black')
plot_Er(ax3, data, 'E_ox', 'Family.IIO', 'tab:green')
plot_Er(ax3, data, 'E_ox', 'Family.APO', 'tab:red')
plot_corr_Er(ax3, data, 'E_ox')
plot_Er(ax3, data, 'Ef_ox', 'Family.P6O', 'tab:blue')
plot_Er(ax3, data, 'Ef_ox', 'Family.P5O', 'black')
plot_Er(ax3, data, 'Ef_ox', 'Family.IIO', 'tab:green')
plot_Er(ax3, data, 'Ef_ox', 'Family.APO', 'tab:red')
plot_corr_Er(ax3, data, 'Ef_ox')

ax3.legend()

positioner = LabelPositioner.from_file(
LABELS_PATH['E_ox'],
numpy.array(POINTS_POSITION['E_ox']),
LABELS['E_ox'],
labels_kwargs=LABELS_KWARGS['E_ox']
LABELS_PATH['Ef_ox'],
numpy.array(POINTS_POSITION['Ef_ox']),
LABELS['Ef_ox'],
labels_kwargs=LABELS_KWARGS['Ef_ox']
)

if args.reposition_labels:
positioner.optimize(dx=1e-3, beta=1e4, krep=1, kspring=10000, c=0.02, b0=0.015, scale=(.2, 1))
positioner.save(LABELS_PATH['E_ox'])
positioner.optimize(dx=1e-3, beta=1e4, krep=1, kspring=10000, c=0.02, b0=0.015, scale=(.1, 1))
positioner.save(LABELS_PATH['Ef_ox'])

positioner.add_labels(ax3)

plot_Er(ax4, data, 'E_red', 'Family.P6O', 'tab:blue')
plot_Er(ax4, data, 'E_red', 'Family.P5O', 'black')
plot_Er(ax4, data, 'E_red', 'Family.IIO', 'tab:green')
plot_Er(ax4, data, 'E_red', 'Family.APO', 'tab:red')
plot_corr_Er(ax4, data, 'E_red')
plot_Er(ax4, data, 'Ef_red', 'Family.P6O', 'tab:blue')
plot_Er(ax4, data, 'Ef_red', 'Family.P5O', 'black')
plot_Er(ax4, data, 'Ef_red', 'Family.IIO', 'tab:green')
plot_Er(ax4, data, 'Ef_red', 'Family.APO', 'tab:red')
plot_corr_Er(ax4, data, 'Ef_red')

positioner = LabelPositioner.from_file(
LABELS_PATH['E_red'],
numpy.array(POINTS_POSITION['E_red']),
LABELS['E_red'],
labels_kwargs=LABELS_KWARGS['E_red']
LABELS_PATH['Ef_red'],
numpy.array(POINTS_POSITION['Ef_red']),
LABELS['Ef_red'],
labels_kwargs=LABELS_KWARGS['Ef_red']
)

if args.reposition_labels:
positioner.optimize(dx=1e-3, beta=1e4, krep=1, kspring=10000, c=0.02, b0=0.015, scale=(.2, 1))
positioner.save(LABELS_PATH['E_red'])
positioner.optimize(dx=1e-3, beta=1e4, krep=1, kspring=10000, c=0.02, b0=0.015, scale=(.1, 1))
positioner.save(LABELS_PATH['Ef_red'])

positioner.add_labels(ax4)

[ax.set_xlabel('Electrostatic potential $\\mu_x/r^2 + Q_{xx}/r^3$ (D Å$^{-2}$)') for ax in [ax3, ax4]]
[ax.set_xlabel('Electrostatic potential $U_q$ (V)') for ax in [ax3, ax4]]
ax3.set_ylabel('$E^0_{abs}(N^+|N^\\bullet)$ (V)')
ax4.set_ylabel('$E^0_{abs}(N^\\bullet|N^-)$ (V)')

Expand Down
11 changes: 8 additions & 3 deletions analyses/plot_pot_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
ax.plot(x, result.slope*x + result.intercept, 'k--')

x = x.min()
ax.text(x + .05, result.slope*x + result.intercept, '{:.2f} $\\times E^f_{{rel}}$ + {:.2f}\n($R^2$={:.2f}, MAE={:.2f} V)'.format(result.slope, result.intercept,result.rvalue **2, mae))
ax.text(x + .05, result.slope*x + result.intercept, '{:.2f} $\\times E^f_{{rel}}$ + {:.2f} V\n($R^2$={:.2f}, MAE={:.2f} V)'.format(result.slope, result.intercept,result.rvalue **2, mae))

parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', default='../data/Data_pot.csv')
Expand All @@ -110,9 +110,14 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):

plot_exp_vs_theo(ax1, subdata_wa, 'water', 'Family.P6O', 'tab:blue')
plot_exp_vs_theo(ax1, subdata_wa, 'water', 'Family.P5O', 'black')
plot_exp_vs_theo(ax1, subdata_wa, 'water', 'Family.IIO', 'tab:green')
plot_exp_vs_theo(ax1, subdata_wa, 'water', 'Family.APO', 'tab:red')

plot_corr(ax1, subdata_wa, 'water')

ax1.legend()
ax1.text(0.85, 0.95, 'Water', fontsize=18)

positioner = LabelPositioner.from_file(
LABELS_PATH['water'],
numpy.array(POINTS_POSITION['water']),
Expand All @@ -134,6 +139,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
plot_exp_vs_theo(ax2, subdata_ac, 'acetonitrile', 'Family.APO', 'tab:red')

plot_corr(ax2, subdata_ac, 'acetonitrile')
ax2.text(0.5, 1.15, 'Acetonitrile', fontsize=18)

positioner = LabelPositioner.from_file(
LABELS_PATH['acetonitrile'],
Expand All @@ -147,8 +153,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
positioner.save(LABELS_PATH['acetonitrile'])

positioner.add_labels(ax2)

ax2.legend()
ax2.xaxis.set_major_formatter('{x:.2f}')
[ax.set_xlabel('Computed $E^f_{rel}(N^+|N^\\bullet)$ (V)') for ax in (ax1, ax2)]
[ax.set_ylabel('Experimental $E^0_{rel}(N^+|N^\\bullet)$ (V)') for ax in (ax1, ax2)]

Expand Down
5 changes: 4 additions & 1 deletion analyses/plot_pot_matsui.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
ax.plot(x, result.slope*x + result.intercept, 'k--')

x = x.min()
ax.text(x + .05, result.slope*x + result.intercept, '{:.2f} $\\times E^P_{{rel}}$ + {:.2f}\n($R^2$={:.2f}, MAE={:.2f} V)'.format(result.slope, result.intercept, result.rvalue **2, mae))
ax.text(x + .05, result.slope*x + result.intercept, '{:.2f} $\\times E^{{Mat}}_{{rel}}$ + {:.2f} V\n($R^2$={:.2f}, MAE={:.2f} V)'.format(result.slope, result.intercept, result.rvalue **2, mae))

parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', default='../data/Data_pot.csv')
Expand All @@ -101,6 +101,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
plot_exp_vs_matsui(ax1, subdata_wa, 'water', 'Family.P5O', 'black')

plot_corr(ax1, subdata_wa, 'water')
ax1.text(0.75, 0.9, 'Water', fontsize=18)

positioner = LabelPositioner.from_file(
LABELS_PATH['water'],
Expand All @@ -125,6 +126,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
plot_exp_vs_matsui(ax2, subdata_ac, 'acetonitrile', 'Family.APO', 'tab:red')

plot_corr(ax2, subdata_ac, 'acetonitrile')
ax2.text(0.8, 1.15, 'Acetonitrile', fontsize=18)

positioner = LabelPositioner.from_file(
LABELS_PATH['acetonitrile'],
Expand All @@ -140,6 +142,7 @@ def plot_corr(ax, data: pandas.DataFrame, solvent: str):
positioner.add_labels(ax2)

ax2.legend()
ax2.xaxis.set_major_formatter('{x:.2f}')
[ax.set_xlabel('Computed $E^P_{rel}(N^+|N^\\bullet)$ (V)') for ax in (ax1, ax2)]
[ax.set_ylabel('Experimental $E^0_{rel}(N^+|N^\\bullet)$ (V)') for ax in (ax1, ax2)]

Expand Down
Loading

0 comments on commit b125c27

Please sign in to comment.