Error in generating ligand topology using CGenFF python script

GROMACS version: 2023
GROMACS modification: No
Operating System: Ubuntu 22.10


This is an error I faced while following “Step Two: Prepare the Ligand Topology” of the Lemkul Labs’ GROMACS tutorial on Protein-Ligand Complex.

After using this command python3 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. from the MacKerell Lab website (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!