# Using pdb2gmx as a lib

**URL:** <https://gromacs.bioexcel.eu/t/using-pdb2gmx-as-a-lib/9931>\
**Category:** User discussions\
**Tags:** pdb2gmx, gmx-trjconv, simulation-setup\
**Created:** [August 20, 2024, 2:03pm UTC](https://gromacs.bioexcel.eu/t/using-pdb2gmx-as-a-lib/9931 "2024-08-20T14:03:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentin](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valentin](https://gromacs.bioexcel.eu/u/valentin)\
**Post date:** [August 20, 2024, 2:03pm UTC](https://gromacs.bioexcel.eu/t/using-pdb2gmx-as-a-lib/9931/1 "2024-08-20T14:03:03Z")

</div>

GROMACS version: 2024.1  
GROMACS modification: No

I intend to write a tool in C++ that allow to visually prepare a system for Gromacs.  
I’m aware of the [“gromacs as a lib”](https://manual.gromacs.org/documentation/2022/doxygen/html-user/page_usinglibrary.xhtml) project. But my issue is to make it work with _pdb2gmx_ and _trjconv_ interactive command line input. (e.g. when you need to specify protonation states during _pdb2gmx_).

Thus, I resorted to use the shell to execute Gromacs commands, so I could deal with _pdb2gmx_ and _trjconv_ interactive command line behavior by reading what Gromacs write and writing into the input buffer.

I could make it work but I was wondering if there was a cleaner way to achieve it.  
It is quite frustrating to get down to the shell to interact with another C++ program I’m compiling.
