GROMACS version: 2023
GROMACS modification: No
Operating System: Ubuntu 22.10
Hello!
This is an error I faced while following “Step Two: Prepare the Ligand Topology” of the Lemkul Labs’ GROMACS tutorial on Protein-Ligand Complex.http://www.mdtutorials.com/gmx/complex/02_topology.html
After using this command python3 cgenff_charmm2gmx.py JZ4 jz4_fixed.mol2 jz4.str charmm36-mar2019.ff
I get the following error:
My networkx version is 1.11, python version is 3.10.7 and I downloaded the corresponding python script i.e. cgenff_charmm2gmx_py3_nx1.py from the MacKerell Lab website http://mackerell.umaryland.edu/charmm_ff.shtml#gromacs (I have renamed this script to the one given in the command above)
I have followed all the previous steps exactly as instructed in the tutorial, except that I used OpenBabel to convert the ligand (JZ4) pdb file to mol2 and add the hydrogens instead of doing the same with Avogadro. I have no idea what is causing this error and how to fix it.
Any help I receive will be much appreciated
Thank you
PS: I would really like to know if there is any alternative method for generating the ligand’s topology using CHARMM that, hopefully, does not lead to errors like this.
We are fighting a never-ending battle against changing Python and NetworkX versions, so I apologize for little hiccups like this but we would have to issue a lot of different (version-specific) iterations of the conversion script for various changes.
Basically, as of Python 3.9, the use of fractions.gcd
has been replaced by math.gcd
so if you just replace the text as noted here (python - Import Error: can't import name gcd from fractions - Stack Overflow) it should run fine.
1 Like
Thank you so much Professor Lemkul for the reply.
I did as you said and the python script worked well except for the following warning:
Will it cause any more problems going forward? If yes, then can I please get some directions on how to solve it?
Thank you
PS: I honestly did not expect to get a reply from the very author of the tutorials. But I am glad that he did.
Hello @FreaX_997,
I am new to using GROMACS. I am facing the same issue. Can you please tell me in detail about what you did? Did you downgrade the Python version? Also, where did you change the code?
Thanks in advance!
Hi @FreaX_997 @jalemkul , I got the same error and am unable to rectify it. I have python 3.10.12 version and gromacs 2024. How did you solve this issue? Did you change the syntax or downgraded the python version? Where should i change the syntax?
Hi.I modified as you indicated. But still, the same problem.
GROMACS - gmx, 2021.4-Ubuntu-2021.4-2
usto@usto:~/complexe19$ python3 cgenff_charmm2gmx_py3_nx2.py SAG SAG_fix.mol2 SAG_fix.str charmm36-jul2022.ff
Traceback (most recent call last):
File “/home/usto/complexe19/cgenff_charmm2gmx_py3_nx2.py”, line 54, in
import networkx as nx
File “/home/usto/.local/lib/python3.10/site-packages/networkx/init.py”, line 114, in
import networkx.generators
File “/home/usto/.local/lib/python3.10/site-packages/networkx/generators/init.py”, line 14, in
from networkx.generators.intersection import *
File “/home/usto/.local/lib/python3.10/site-packages/networkx/generators/intersection.py”, line 13, in
from networkx.algorithms import bipartite
File “/home/usto/.local/lib/python3.10/site-packages/networkx/algorithms/init.py”, line 16, in
from networkx.algorithms.dag import *
File “/home/usto/.local/lib/python3.10/site-packages/networkx/algorithms/dag.py”, line 23
from math.gcd(a, b)
^
SyntaxError: invalid syntax
Thank you
Hi friend,
I believe im in the same situation as you…
Im using the exact same python with networkx 2.3 and numpy 1.26.4.
When i run cgenff_charmm2gmx_py3_nx2.py, for some reason my .prm file is not as expected, this is how it shows:
[ bondtypes ]
; i j func b0 kb
[ angletypes ]
; i j k func theta0 ktheta ub0 kub
[ dihedraltypes ]
; i j k l func phi0 kphi mult
[ dihedraltypes ]
; ‘improper’ dihedrals
; i j k l func phi0 kphi
Anyone knows how to fix it?
Thanks!
A blank .prm
file means your topology does not require any new parameters; everything is already within the core CGenFF and therefore in the parent force field.