Becksteinlab / GromacsWrapper

GromacsWrapper wraps system calls to GROMACS tools into thin Python classes (GROMACS 4.6.5 - 2024 supported).

Home Page:https://gromacswrapper.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new function or data `gromacs.gmx_release` to indicate Gromacs release

orbeckst opened this issue · comments

As discussed in #159 (comment) the user should have a way to learn which release of Gromacs she is running. This could be a module level attribute

gromacs.gmx_release

or a function

gromacs.gmx_release()

that returns the release string from Gromacs, such as "2018.2" or "5.1.2" or "4.6.5".

Intended use

Allow user code to make decisions based on the Gromacs version.

if gromacs.gmx_release.startswith("4"):
  # do something for classic Gromacs
else:
  # do it the modern way

Mock implementation

(written in bash... we can write this properly with gromacs.GromacsCommand and the detected driver command and pipes later...):

For Gromacs 4.x and

grompp -version 2>/dev/null | awk -F : '/G[rR][oO][mM][aA][cC][sS] version:/ {sub("[^0-9]*", "", $2); print $2}'

gives 4.6.5

For Gromacs 2018.2 and 5.x

gmx -version 2>/dev/null | awk -F : '/G[rR][oO][mM][aA][cC][sS] version:/ {sub("[^0-9]*", "", $2); print $2}'

gives 2018.2 or 5.1.2.