Facing error while running cgenff_charmm2gmx.py @ GROMACS

GROMACS version:2023.1
GROMACS modification: No

I am running MD simulation for complex molecule from docking, while running python script following error occurred, can anyone please help me ? I have pasted the error message after running the python command. I am using Python 2.7.18 networkx=1.11.

Blockquote

(myenv) ws@ws2:~/simulation_n$ python cgenff_charmm2gmx.py MET ligand_fixed.mol2 MET.str charmm36-jul2022.ff/
NOTE1: Code tested with python 2.7.3. Your version: 2.7.18 (default, Jul 1 2022, 10:30:50)
[GCC 11.2.0]

NOTE2: Please be sure to use the same version of CGenFF in your simulations that was used during parameter generation:
–Version of CGenFF detected in MET.str : 4.6
–Version of CGenFF detected in charmm36-jul2022.ff//forcefield.doc : 4.6

NOTE3: In order to avoid duplicated parameters, do NOT select the ‘Include parameters that are already in CGenFF’ option when uploading a molecule into CGenFF.
Traceback (most recent call last):
File “cgenff_charmm2gmx.py”, line 797, in
m = atomgroup()
File “cgenff_charmm2gmx.py”, line 484, in init
self.G = nx.Graph()
NameError: global name ‘nx’ is not defined

Blockquote

Was the line ‘import networkx as nx’ in the python script?

Dear Karis,

Thanks for the reply.

Yes, there is a line at Number 54 'import networkx as nx’ in the python script.

Regards,

Sunil

Are you able to send the script you’re using?

Also, double-check that everything is installed in the same environment and see if upgrading to python 2.7.3 solves the issue

Dear Karis,

I am sending you the python script as well as as ligand_fixed.mol2 and ELA.str file which I am trying to use for the command:

python cgenff_charmm2gmx_py3_nx2.py ELA ligand_fixed_mol2 ELA.str charm36-july2023.ff
I have python 3.11.4, numpy 1.25.0 and networkx 2.8 installed on ubuntu.

Regards,
Sunil

(Attachment ELA.str is missing)

(Attachment ligand_fixed.mol2 is missing)

(Attachment cgenff_charmm2gmx_py3_nx2.py is missing)

The files appear to be missing for me, are you not able to attach them?

Dear Karis,

Kindly ignore the wrong attachment .XLS file. It was sent by mistake.
Apologies.

Regards,
Sunil

Dear Karis,

I was unable to attach files hence I converted into .log and attached. I will attach them again.

Thanks for prompt replies.

Sunil

ligand_fixed_mol2.log (2.98 KB)

ELA_str.log (3.16 KB)

(Attachment ligand.mol2 is missing)

cgenff_charmm2gmx_py3_nx21_py.log (37.0 KB)
ligand_fixed_mol2.log (3.0 KB)

I tried using these files and an environment with python 3.7.3, networkx 2.3 and numpy 1.21.6 and it seems to work for me (numpy version probably doesn’t matter as much), could you give that a try?

Dear Karis,

Thank you so much, I created an environment (networkx) at conda and there installed Python3.7.3 and networkx=2.3 as suggested by you and the python script WORKED.

Warm regards
Sunil