# Facing error while running cgenff\_charmm2gmx.py @ GROMACS

**URL:** <https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797>\
**Category:** User discussions\
**Tags:** analysis-tools\
**Created:** [July 10, 2023, 3:44pm UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797 "2023-07-10T15:44:20Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 10, 2023, 3:44pm UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/1 "2023-07-10T15:44:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Karis](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karis](https://gromacs.bioexcel.eu/u/Karis)\
**Post date:** [July 26, 2023, 9:00am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/2 "2023-07-26T09:00:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 6:02am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/3 "2023-07-27T06:02:20Z")

</div>

Dear Karis,

Thanks for the reply.

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

Regards,

Sunil

---

<div class="post-metadata">

**Author:** ![Karis](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karis](https://gromacs.bioexcel.eu/u/Karis)\
**Post date:** [July 27, 2023, 6:29am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/4 "2023-07-27T06:29:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 7:00am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/5 "2023-07-27T07:00:22Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Karis](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karis](https://gromacs.bioexcel.eu/u/Karis)\
**Post date:** [July 27, 2023, 7:08am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/6 "2023-07-27T07:08:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 7:09am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/7 "2023-07-27T07:09:39Z")

</div>

Dear Karis,

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

Regards,  
Sunil

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 7:22am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/8 "2023-07-27T07:22:19Z")

</div>

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](https://gromacs.bioexcel.eu/uploads/short-url/qyJVMe8H1Uc1zKZWsTZaVvQY35M.log) (2.98 KB)

[ELA\_str.log](https://gromacs.bioexcel.eu/uploads/short-url/h9HQHrOTBXoVl3rniFti2OfC015.log) (3.16 KB)

(Attachment ligand.mol2 is missing)

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 7:36am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/9 "2023-07-27T07:36:18Z")

</div>

[cgenff\_charmm2gmx\_py3\_nx21\_py.log](https://gromacs.bioexcel.eu/uploads/short-url/qII4aXh70b3ZwOx1aUHE84X10fj.log) (37.0 KB)  
[ligand\_fixed\_mol2.log](https://gromacs.bioexcel.eu/uploads/short-url/qyJVMe8H1Uc1zKZWsTZaVvQY35M.log) (3.0 KB)

---

<div class="post-metadata">

**Author:** ![Karis](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@Karis](https://gromacs.bioexcel.eu/u/Karis)\
**Post date:** [July 27, 2023, 8:08am UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/10 "2023-07-27T08:08:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sunilsthorat](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sunilsthorat](https://gromacs.bioexcel.eu/u/sunilsthorat)\
**Post date:** [July 27, 2023, 5:05pm UTC](https://gromacs.bioexcel.eu/t/facing-error-while-running-cgenff-charmm2gmx-py-gromacs/6797/11 "2023-07-27T17:05:07Z")

</div>

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
