plumed / plumed2

Development version of plumed 2
https://www.plumed.org
GNU Lesser General Public License v3.0
323 stars 269 forks source link

Added a simple module map #1063

Closed Iximiel closed 2 months ago

Iximiel commented 2 months ago
Description

@gtribello, @GiovanniBussi I have set up a simple module map It can be used as PLMD::getModuleMap().at("actionName")[^1] to return the name of the module that includes that action (even if the module is not active in the current installation)

for 2.10 it is possible to add also an extra function that returns a std::optional with the module name to not doing the .count("actionname") before calling the at (that may throw), since std::optional is c++17

Since regex are scary I put a link to a site tha visualize the one used in the new maketool script The new maketool script uses pure bash, I think there should not be problem between bash versions for the regex that I used, and I used pure bash to avoid having the user to install gawk or perl I do not know if you like the requirements for the .inc file [^1]:operator[] has no const overloads for std::map and std::unordered_map

Target release

I would like my code to appear in release 2.9

Type of contribution
Copyright
Tests
GiovanniBussi commented 2 months ago

I guess the script is not portable to different (non gnu) core utils

Iximiel commented 2 months ago

I changed the regex to something more restrictive, now accepts only standard whitespaces instead of \s that is "any kind of space" and it works. I still do not understand why ,\s* does not work but , * yes, since \s do not cause problem in any other place... But I guess that the important things is that it works