Announcing gmxapi 0.2 Python package

Good news, everyone! The gmxapi 0.2 Python package is available for GROMACS 2021, and works best with the brand new release of GROMACS 2021.1.

After activating your new GROMACS installation ("source"ing your GMXRC), you should be able to just do pip install --upgrade gmxapi in your virtual environment. See also Full installation instructions — GROMACS 2021.1 documentation.

If you are using gmxapi to connect pluggable MD extension code to GROMACS simulations, continued compatibility should be easy, but may require some updates. The sample code at GitHub - kassonlab/sample_restraint has been confirmed to work with all gmxapi and supported GROMACS versions, and should be instructive.

For more information, email info@gmxapi.org or join the Slack workspace
Also, feel free to tag me in posts to this forum.

Enjoy!

Hi, @ericirrgang

I tried to install gmxapi following the instructions available on Full installation instructions — GROMACS 2021.5 documentation but it shows the following error.

> ERROR: Failed building wheel for gmxapi
> Failed to build gmxapi
> ERROR: Could not build wheels for gmxapi, which is required to install pyproject.toml-based projects

since I am new to it, could you please help me in guiding on how to fix this error.

Thanks

Hi, All.

The 0.2.3 version of the gmxapi package has been uploaded to pypi.org with a couple of small improvements, including a fix for a bug that prevented installation with double-precision builds of GROMACS.

@shivam1, if you had configured your GROMACS for full double-precision, try the newly uploaded 0.2.3 or 0.3.0 packages.

If CMake says that it cannot find GROMACS, make sure that you have “activated” GROMACS. The gmx binary (or gmx_mpi or gmx_d) should be on your path:

$ which gmx
/path/to/gromacs/bin/gmx

Check that GROMACS was installed with API support enabled.
ls /path/to/gromacs/lib should show libgromacs and libgmxapi.
ls /path/to/gromacs/share/cmake/gmxapi should show several ...cmake files.

If these are missing, you will need to re-build and re-install GROMACS. When configuring with CMake, use -DGMXAPI=ON. (This is usually the default, but setting it explicitly may produce helpful error messages if there is something incompatible about your build configuration.)

If the files are there, but pip couldn’t find them, you will need to provide additional hints to pip. For gmxapi 0.2.x, refer to these hints on gmxapi_DIR and GMXTOOLCHAINDIR. For gmxapi 0.3.x, refer to these notes on CMake hints.

If that doesn’t work, please start a topic with the gmxapi tag. Please copy and paste complete output from the terminal. (Paste text rather than a screenshot to help people with vision challenges.) If the error output mentions additional log files for full CMake output, please also include a copy of the file.

@ericirrgang Thank you so much.

so you mean i need to use


>  cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON -DGMXAPI=ON

while installing cmake

In CMake terminology, that is the “configure” step of a CMake-driven build process.

But, yes, try configuring with -DGMXAPI=ON to make sure that you will get a GROMACS installation with the required API for the Python package to build.

GMXAPI=ON is the default, but setting it explicitly will force additional output if there are problems.

Hi Eric,

I have been away from gromacs for a little while, and I’m excited to see that gmxapi now provides a mechanism for performing gmx command line operations. I believe this was not the case in 2020? At the time I used Gromacs Wrapper for this, but that package does not appear to be maintained any longer.

I do have a question about the future of the command line interface. In the 2022 PLoS Comp Bio paper you refer to gmx command line operations as “legacy”. Does this mean that at some point the various gmx tools will be replaced by gmxapi, and possibly python code written on top of gmxapi?

Thanks!
Roman

mechanism for performing gmx command line operations. I believe this was not the case in 2020?

I believe gmxapi.commandline_operation was added in gmxapi 0.1.0, which shipped with release-2020. I think it got a lot more useful in release-2022, though.

Does this mean that at some point the various gmx tools will be replaced by gmxapi, and possibly python code written on top of gmxapi?

Something like that will probably happen, for some tools, at least.

Some of the command line tools have been maintained and their code has been somewhat modernized, but more work is needed in the Options framework for Python bindings to make sense and be maintainable.

Other tools have had little maintenance and may never be updated, even to the current C++ patterns.

I wouldn’t expect the traditional command line use cases to be wholly unsupported any time soon. Improved support for Python as a principal entry point is actively being explored, but there might not be significantly expanded bindings for another development cycle or two.

Please consider continuing the discussion in the (relatively new) Developer discussions.

Thanks Eric, I will keep an eye on the developer discussions!