Skip to content

Conversation

@DunklesArchipel
Copy link
Member

@DunklesArchipel DunklesArchipel commented Nov 11, 2025

Checklist

  • Added an entry in doc/news/.
  • Added a test for this change.
  • Adapted the documentation for this change.

Fixes #101
Fixes #107

So far we have the following reference electrodes in the echemdb database for aqueous systems, which have to be accounted for:
['RHE', 'SHE', 'SCE', 'Ag/AgCl', 'Hg/HgO/0.1M NaOH']

  • Ag/AgCl might pose a problem, since the concentration is not given.
    • Add a custom AgAgCl electrode with a shift of 210 mV and raise a warning?
  • Hg/HgO/0.1M NaOH must be implemented. As long as we do not deconvolute the names, we should for the few cases simply add the offset. Reference values can be found here for all kinds of electrolytes: https://pubs.acs.org/doi/10.1021/acscatal.2c05655
  • Check all references (source) for the shifts in the potentials and provide a DOI.
  • move offset to unitpackage.entry.Entry
  • Adapt news
  • From linuxrider: CE is inconsistent with Ag/AgCl. We could always use Me/MeAnion: Hg/Hg2Cl2, CE could by a synonym. (-> Task in Improve reference electrode module #125)

"""
field_name = field_name or "E"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an arbitrary field_name necessary in the frame of echemdb?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, for example, you could have a potential given for a ring electrode or the counter electrode that you might want to shift as well.

@DunklesArchipel DunklesArchipel marked this pull request as ready for review December 17, 2025 21:58
Comment on lines +168 to +182
if filename or outdir:
if filename is None:
filename = "reference_electrode.json"
if outdir:
os.makedirs(outdir, exist_ok=True)
filepath = os.path.join(outdir, filename)
else:
filepath = filename
with open(filepath, "w", encoding="utf-8") as f:
json.dump(self.data, f, ensure_ascii=False, indent=4)
# json.dump does not save files with a newline, which compromises the tests
# where the output files are compared to an expected json.
f.write("\n")

return None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this can be omitted and leave it to the user how the data should be exported from json. For those not versed with JSON, we could include and example in the documentation.

full_name="0.5 M mercury / mercurous sulfate electrode",
temperature_dependence=[
{
"formula": "E = 0.63495 - 781.44E-6 * T - 426.89E-9 * T**2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we don't expect to be able to parse this some day?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have to decide how we should handle these cases. But that will be a matter of discussion in the future.


resource.custom["MutableResource"] = df_resource

# update offset in the fields
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't make sense of the code that follows. It's extremely complicated to me. I get what you're trying to do: record an offset in the resource and update the existing one if there's already one. But it's really hard to follow.

Copy link
Member

@saraedum saraedum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd try to simplify things a bit but in principle this looks totally fine to me.

@DunklesArchipel DunklesArchipel merged commit 0b4594f into echemdb:main Jan 15, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rename fields_fields to documentation add possibility to switch between between reference scales

3 participants