GROMACS version: 2022.4
GROMACS modification: No
System: Ubuntu
Background:
I can run a md simulation with installed gmx.
I can run a md simulation using gmxapi if I have a .tpr file.
Hi, I have an issue making a .tpr file using gmx.commandline_operation.
Following is my code:
import gmxapi as gmx
import os
cmd_dir = “/home/user/test/”
grompp = gmx.commandline_operation(‘gmx’, [‘grompp’],
{‘-f’: os.path.join(cmd_dir, ‘minimization.mdp’),
‘-p’: os.path.join(cmd_dir,‘solutioin.top’),
‘-c’: os.path.join(cmd_dir,‘solution.gro’),},
{‘-o’: os.path.join(cmd_dir, ‘solution.tpr’)})
tpr_input = grompp.output.file[‘-o’].result()
This is the error I get.
Traceback (most recent call last):
File “/home/fswang/documents/md_network/test/test/test.py”, line 12, in
tpr_input = grompp.output.file[‘-o’].result()
File “/home/fswang/myvenv/lib/python3.10/site-packages/gmxapi/operation.py”, line 1602, in result
self.resource_manager.update_output()
File “/home/fswang/myvenv/lib/python3.10/site-packages/gmxapi/operation.py”, line 1120, in update_output
result = self.function(source)
File “/home/fswang/myvenv/lib/python3.10/site-packages/gmxapi/operation.py”, line 1682, in
function=lambda value, key=item: value[key])
KeyError: ‘-o’
I’m eager to know how to solve this issue.
Thanks,
Fu-Sheng