lammps / lammps

Public development project of the LAMMPS MD software package
https://www.lammps.org
GNU General Public License v2.0
2.13k stars 1.68k forks source link

[Feature Request] Add a new namespace "elements" for functions related to chemical elements #3686

Open akohlmey opened 1 year ago

akohlmey commented 1 year ago

Summary

Add new namespace "elements" with tables/maps and functions accessing them for a variety of mappings related to chemical elements and their properties like atomic number, atomic mass, covalent radius.

Detailed Description

There are several places where chemical elements are referred to or where it would be desirable to have some way to access information related to chemical elements or perform conversions/replacements. This new namespace would consolidate these functions and provide a common interface. Possible applications:

Suitable data and similar function exists already in VMD's TopoTools and molfile plugins for similar purposes and can be adapted for LAMMPS.

alphataubio commented 6 months ago

@akohlmey has anybody done anything on this issue yet ? id be willing to pitch in next if you give me some initial guidance on what path to follow. we can keep it in a draft pull request as i will struggle along for a learning experience about contributing code to lammps.

i looked at topotools inside VMD.app, all i saw is a few tcl scripts no data. i also read the topotools tutorial on your website, all i saw there were a few pdb files for ethane, hexane, and cyclohexane. i dont see anything in src/MOLFILE, or example/plugins.

i was thinking something like https://webbook.nist.gov/chemistry/ or https://pubchem.ncbi.nlm.nih.gov/docs/elements ...

akohlmey commented 6 months ago

This is not a good topic for the purpose. I have some very specific ideas in my mind already. I mostly put up the issue to indicate that I will be working on this (it is assigned to me after all) and to get some feedback. The key part is going to be to have some data structure that provides the mapping and then take advantage of that. A major challenge is going to be to prioritize the different kind of (more or less optional) data to be used for deriving elements and how to handle conflicts. Also, this needs to be make compatible with the various unit style choices.

The reference to molfile plugins does not refer to the MOLFILE package, but the actual source code in the vmd plugins sources. https://github.com/thatchristoph/vmd-cvs-github/blob/master/plugins/molfile_plugin/src/periodic_table.h I have adapted this in a minimal fashion for LAMMPS-GUI https://github.com/lammps/lammps/blob/develop/tools/lammps-gui/imageviewer.cpp#L120

Once the basics are done, the added functionality needs to be enabled in a variety of places. That would be something, where help from you could be useful.

If you want to do useful work and get to know the LAMMPS internals better, you could have a look at the projects proposed here: https://www.lammps.org/workshops/Aug22/ Most of what was proposed there is still incomplete.

alphataubio commented 6 months ago

Ok I'll reverse commit and close PR 4035

akohlmey commented 5 months ago

@sjplimp Here is an outline of the features that would be added and modifications done.

jrgissing commented 5 months ago

I like this idea, but I don't think it would generalize or supersede #3824. Note that #3824 simply allows reaxff/species to determine elements from the pair_coeff command, no matter how that element list was determined (e.g., perhaps by using this new "elements" namespace). Also, note that half of that PR is a bugfix related to deduplicating the reported chemical species