Doing ligand preparation for flexible docking

GROMACS version: 2021.4
GROMACS modification: No
Here post your question

Hi everyone,
I hope anyone can help me to understand the error message that I got.

I typed: python3 cgenff_charmm2gmx_py3_nx2.py Z9 z9_fix.mol2 z9_fix.str charmm36-jul2022.ff

Traceback (most recent call last):
File"/mnt/c/Users/dominikatarina/OneDrive/Desktop/MD_ubuntu22/cgenff_charmm2gmx_py3_nx2.py", line 991, in
if(float(nx.version) < 2.0):
ValueError: could not convert string to float: ‘3.2.1’

The “cgenff_charmm2gmx_py3_nx2.py” file I downloaded from

Please help me to go through this error, I am not sure what should I revise
Thank you everyone

The networkx version MUST be in the 1.x series. Tested version: 1.11
what is your netwekx verision?

Hi @scinikhil thank you for your answer.
I searched on other website and found the answer.
I try changing the line:
if(float(nx.__ version__) < 2.0):
to something like this:
if (float(nx.__ version__[0:3])<2.0):

Networkx version that I used is 3.2.1. I uninstalled it and install a new one, 1.11 version.

Now, a new error has occured:
This script has been tested with NetworkX 2.3, and 2.4 is buggy.
Please install version 2.3 for best performance:
pip uninstall networkx
pip install networkx==2.3
NOTE 1: Code tested with Python 3.5.2 and 3.7.3. Your version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

NOTE 2: Code tested with NetworkX 2.3. Your version: 3.2.1

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

NOTE 4: To avoid duplicated parameters, do NOT select the ‘Include parameters that are already in CGenFF’ option when uploading a molecule into CGenFF.
Error in atomgroup.py: read_mol2_coor_only: no. of atoms in mol2 (75) and top (0) are unequal
Usually this means the specified residue name does not match between str and mol2 files

What should I change so that .str and .mol2 files can be matched? And also why atoms in mol2 and top files are unequal?

Thank you

please attach your str file and mol2, looks like your str residue name is not match with mol2 file.

Below attached the .mol2 file content:
@MOLECULE
Z9
75 80 0 0 0
SMALL
GASTEIGER

@ATOM
1 N 4.0856 -0.2362 0.6651 N.pl3 1 Z9 -0.3428
2 N -2.2492 1.8910 -1.7800 N.pl3 1 Z9 -0.3428
3 N 0.4406 -2.1361 1.4854 N.ar 1 Z9 -0.2466
4 N -3.6465 -1.3767 0.4421 N.ar 1 Z9 -0.2466
5 C 2.8757 2.8418 -2.7392 C.3 1 Z9 -0.0531
6 C 3.4117 2.6880 -1.3140 C.3 1 Z9 -0.0530
7 C 1.5907 3.6714 -2.7638 C.3 1 Z9 -0.0530
8 C 4.7174 1.8900 -1.2966 C.3 1 Z9 -0.0516
9 C 0.4801 3.0016 -1.9519 C.3 1 Z9 -0.0516
10 C 5.3352 1.7660 0.0985 C.3 1 Z9 -0.0375
11 C -0.7962 3.8488 -1.9531 C.3 1 Z9 -0.0375
12 C 4.4134 1.0965 1.1135 C.3 1 Z9 0.0091
13 C -1.9473 3.1803 -1.2063 C.3 1 Z9 0.0091
14 C 2.8806 -0.8643 0.9364 C.ar 1 Z9 0.0457
15 C -2.7113 0.8105 -1.0450 C.ar 1 Z9 0.0457
16 C 2.0565 -0.4305 2.0039 C.ar 1 Z9 0.0218
17 C -3.3125 0.9960 0.2239 C.ar 1 Z9 0.0218
18 C 2.4369 -1.9588 0.1542 C.ar 1 Z9 0.0218
19 C -2.5958 -0.5110 -1.5416 C.ar 1 Z9 0.0218
20 C 0.8428 -1.0970 2.2424 C.ar 1 Z9 0.0734
21 C -3.7667 -0.1283 0.9338 C.ar 1 Z9 0.0734
22 C 1.2083 -2.5655 0.4651 C.ar 1 Z9 0.0734
23 C -3.0780 -1.5763 -0.7626 C.ar 1 Z9 0.0734
24 C 2.4464 0.6509 2.8131 C.ar 1 Z9 -0.0508
25 C -3.4534 2.2854 0.7659 C.ar 1 Z9 -0.0508
26 C 3.2138 -2.4317 -0.9178 C.ar 1 Z9 -0.0508
27 C -2.0079 -0.7541 -2.7952 C.ar 1 Z9 -0.0508
28 C 0.0487 -0.6537 3.2967 C.ar 1 Z9 -0.0357
29 C -4.3544 0.0773 2.1792 C.ar 1 Z9 -0.0357
30 C 0.7921 -3.6395 -0.3170 C.ar 1 Z9 -0.0357
31 C -2.9543 -2.8669 -1.2703 C.ar 1 Z9 -0.0357
32 C 1.6344 1.0745 3.8608 C.ar 1 Z9 -0.0610
33 C -4.0447 2.4640 2.0130 C.ar 1 Z9 -0.0610
34 C 2.7751 -3.5072 -1.6843 C.ar 1 Z9 -0.0610
35 C -1.8962 -2.0539 -3.2799 C.ar 1 Z9 -0.0610
36 C 0.4331 0.4206 4.1029 C.ar 1 Z9 -0.0597
37 C -4.4960 1.3573 2.7208 C.ar 1 Z9 -0.0597
38 C 1.5617 -4.1121 -1.3830 C.ar 1 Z9 -0.0597
39 C -2.3705 -3.1122 -2.5155 C.ar 1 Z9 -0.0597
40 H 2.6897 1.8542 -3.1784 H 1 Z9 0.0265
41 H 3.6278 3.3363 -3.3653 H 1 Z9 0.0265
42 H 3.5700 3.6742 -0.8624 H 1 Z9 0.0265
43 H 2.6773 2.1533 -0.7091 H 1 Z9 0.0265
44 H 1.2653 3.7934 -3.8038 H 1 Z9 0.0265
45 H 1.7907 4.6747 -2.3690 H 1 Z9 0.0265
46 H 4.5482 0.8950 -1.7255 H 1 Z9 0.0266
47 H 5.4483 2.3842 -1.9491 H 1 Z9 0.0266
48 H 0.2877 2.0066 -2.3686 H 1 Z9 0.0266
49 H 0.7764 2.8675 -0.9075 H 1 Z9 0.0266
50 H 5.6089 2.7635 0.4642 H 1 Z9 0.0280
51 H 6.2690 1.1955 0.0141 H 1 Z9 0.0280
52 H -1.0999 4.0341 -2.9916 H 1 Z9 0.0280
53 H -0.5911 4.8276 -1.5021 H 1 Z9 0.0280
54 H 3.5666 1.7846 1.1659 H 1 Z9 0.0461
55 H 5.0085 1.0491 2.0332 H 1 Z9 0.0461
56 H -1.5338 3.1161 -0.1936 H 1 Z9 0.0461
57 H -2.7941 3.8654 -1.3251 H 1 Z9 0.0461
58 H 4.8009 -0.7408 0.1579 H 1 Z9 0.1461
59 H -2.1453 1.7983 -2.7819 H 1 Z9 0.1461
60 H 3.4058 1.1070 2.9357 H 1 Z9 0.0625
61 H -3.3830 3.2431 0.2964 H 1 Z9 0.0625
62 H 4.1620 -1.9866 -1.2024 H 1 Z9 0.0625
63 H -1.6100 0.0353 -3.4250 H 1 Z9 0.0625
64 H -0.8969 -1.1503 3.5070 H 1 Z9 0.0639
65 H -4.7177 -0.7737 2.7525 H 1 Z9 0.0639
66 H -0.1535 -4.1323 -0.0989 H 1 Z9 0.0639
67 H -3.3168 -3.7132 -0.6896 H 1 Z9 0.0639
68 H 1.9560 1.8773 4.5181 H 1 Z9 0.0618
69 H -4.1973 3.4621 2.4134 H 1 Z9 0.0618
70 H 3.3750 -3.8688 -2.5137 H 1 Z9 0.0618
71 H -1.4379 -2.2401 -4.2463 H 1 Z9 0.0618
72 H -0.2031 0.7360 4.9247 H 1 Z9 0.0618
73 H -4.9685 1.4862 3.6901 H 1 Z9 0.0618
74 H 1.2092 -4.9515 -1.9753 H 1 Z9 0.0618
75 H -2.2859 -4.1305 -2.8832 H 1 Z9 0.0618
@BOND
1 1 12 1
2 1 14 1
3 1 58 1
4 2 13 1
5 2 15 1
6 2 59 1
7 3 20 ar
8 3 22 ar
9 4 21 ar
10 4 23 ar
11 5 6 1
12 5 7 1
13 5 40 1
14 5 41 1
15 6 8 1
16 6 42 1
17 6 43 1
18 7 9 1
19 7 44 1
20 7 45 1
21 8 10 1
22 8 46 1
23 8 47 1
24 9 11 1
25 9 48 1
26 9 49 1
27 10 12 1
28 10 50 1
29 10 51 1
30 11 13 1
31 11 52 1
32 11 53 1
33 12 54 1
34 12 55 1
35 13 56 1
36 13 57 1
37 14 16 ar
38 14 18 ar
39 15 17 ar
40 15 19 ar
41 16 20 ar
42 16 24 ar
43 17 21 ar
44 17 25 ar
45 18 22 ar
46 18 26 ar
47 19 23 ar
48 19 27 ar
49 20 28 ar
50 21 29 ar
51 22 30 ar
52 23 31 ar
53 24 32 ar
54 24 60 1
55 25 33 ar
56 25 61 1
57 26 34 ar
58 26 62 1
59 27 35 ar
60 27 63 1
61 28 36 ar
62 28 64 1
63 29 37 ar
64 29 65 1
65 30 38 ar
66 30 66 1
67 31 39 ar
68 31 67 1
69 32 36 ar
70 32 68 1
71 33 37 ar
72 33 69 1
73 34 38 ar
74 34 70 1
75 35 39 ar
76 35 71 1
77 36 72 1
78 37 73 1
79 38 74 1
80 39 75 1

Below is attached .str file content:

  • Toppar stream file generated by
  • CHARMM General Force Field (CGenFF) program version 3.0
  • For use with CGenFF version 4.6

read rtf card append

  • Topologies generated by
  • CHARMM General Force Field (CGenFF) program version 3.0

36 1

! “penalty” is the highest penalty score of the associated parameters.
! Penalties lower than 10 indicate the analogy is fair; penalties between 10
! and 50 mean some basic validation is recommended; penalties higher than
! 50 indicate poor analogy and mandate extensive validation/optimization.

RESI 150390 0.000 ! param penalty= 4.000 ; charge penalty= 2.412
!RING * 6 C12 C16 C20 C24 C28 C32
!RING * 6 N3 C10 C12 C14 C16 C18
!RING * 6 C13 C17 C21 C25 C29 C33
!RING * 6 N4 C11 C13 C15 C17 C19
!RING * 6 C14 C18 C22 C26 C30 C34
!RING * 6 C15 C19 C23 C27 C31 C35
GROUP ! CHARGE CH_PENALTY Z EL NB NBE RNG1 TYP RNG2 TYP RNG3 TYP
ATOM N1 NG311 -0.556 ! 2.412 7 N 3 3
ATOM N2 NG311 -0.556 ! 2.412 7 N 3 3
ATOM N3 NG2R60 -0.684 ! 0.000 7 N 2 3 6 1
ATOM N4 NG2R60 -0.684 ! 0.000 7 N 2 3 6 1
ATOM C1 CG321 -0.180 ! 0.000 6 C 4 4
ATOM C2 CG321 -0.180 ! 0.000 6 C 4 4
ATOM C3 CG321 -0.180 ! 0.000 6 C 4 4
ATOM C4 CG321 -0.180 ! 0.030 6 C 4 4
ATOM C5 CG321 -0.180 ! 0.030 6 C 4 4
ATOM C6 CG321 -0.198 ! 1.283 6 C 4 4
ATOM C7 CG321 -0.198 ! 1.283 6 C 4 4
ATOM C8 CG321 0.018 ! 1.265 6 C 4 4
ATOM C9 CG321 0.018 ! 1.265 6 C 4 4
ATOM C10 CG2R61 -0.002 ! 2.403 6 C 3 4 6 1
ATOM C11 CG2R61 -0.002 ! 2.403 6 C 3 4 6 1
ATOM C12 CG2R61 -0.013 ! 0.000 6 C 3 4 6 1 6 1
ATOM C13 CG2R61 -0.013 ! 0.000 6 C 3 4 6 1 6 1
ATOM C14 CG2R61 -0.013 ! 0.000 6 C 3 4 6 1 6 1
ATOM C15 CG2R61 -0.013 ! 0.000 6 C 3 4 6 1 6 1
ATOM C16 CG2R61 0.352 ! 0.000 6 C 3 4 6 1 6 1
ATOM C17 CG2R61 0.352 ! 0.000 6 C 3 4 6 1 6 1
ATOM C18 CG2R61 0.352 ! 0.000 6 C 3 4 6 1 6 1
ATOM C19 CG2R61 0.352 ! 0.000 6 C 3 4 6 1 6 1
ATOM C20 CG2R61 -0.107 ! 0.000 6 C 3 4 6 1
ATOM C21 CG2R61 -0.107 ! 0.000 6 C 3 4 6 1
ATOM C22 CG2R61 -0.107 ! 0.000 6 C 3 4 6 1
ATOM C23 CG2R61 -0.107 ! 0.000 6 C 3 4 6 1
ATOM C24 CG2R61 -0.132 ! 0.000 6 C 3 4 6 1
ATOM C25 CG2R61 -0.132 ! 0.000 6 C 3 4 6 1
ATOM C26 CG2R61 -0.132 ! 0.000 6 C 3 4 6 1
ATOM C27 CG2R61 -0.132 ! 0.000 6 C 3 4 6 1
ATOM C28 CG2R61 -0.110 ! 0.000 6 C 3 4 6 1
ATOM C29 CG2R61 -0.110 ! 0.000 6 C 3 4 6 1
ATOM C30 CG2R61 -0.110 ! 0.000 6 C 3 4 6 1
ATOM C31 CG2R61 -0.110 ! 0.000 6 C 3 4 6 1
ATOM C32 CG2R61 -0.104 ! 0.000 6 C 3 4 6 1
ATOM C33 CG2R61 -0.104 ! 0.000 6 C 3 4 6 1
ATOM C34 CG2R61 -0.104 ! 0.000 6 C 3 4 6 1
ATOM C35 CG2R61 -0.104 ! 0.000 6 C 3 4 6 1
ATOM H1 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H2 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H3 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H4 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H5 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H6 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H7 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H8 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H9 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H10 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H11 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H12 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H13 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H14 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H15 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H16 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H17 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H18 HGA2 0.090 ! 0.000 1 H 1 1
ATOM H19 HGPAM1 0.370 ! 0.000 1 H 1 1
ATOM H20 HGPAM1 0.370 ! 0.000 1 H 1 1
ATOM H21 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H22 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H23 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H24 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H25 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H26 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H27 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H28 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H29 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H30 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H31 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H32 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H33 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H34 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H35 HGR61 0.115 ! 0.000 1 H 1 1
ATOM H36 HGR61 0.115 ! 0.000 1 H 1 1
! TYP INR
BOND N1 C8 ! 1 0
BOND N1 C10 ! 1 0
BOND N1 H19 ! 1 0
BOND N2 C9 ! 1 0
BOND N2 C11 ! 1 0
BOND N2 H20 ! 1 0
BOND N3 C16 ! 2 1
BOND N3 C18 ! 1 1
BOND N4 C17 ! 2 1
BOND N4 C19 ! 1 1
BOND C1 C2 ! 1 0
BOND C1 C3 ! 1 0
BOND C1 H1 ! 1 0
BOND C1 H2 ! 1 0
BOND C2 C4 ! 1 0
BOND C2 H3 ! 1 0
BOND C2 H4 ! 1 0
BOND C3 C5 ! 1 0
BOND C3 H5 ! 1 0
BOND C3 H6 ! 1 0
BOND C4 C6 ! 1 0
BOND C4 H7 ! 1 0
BOND C4 H8 ! 1 0
BOND C5 C7 ! 1 0
BOND C5 H9 ! 1 0
BOND C5 H10 ! 1 0
BOND C6 C8 ! 1 0
BOND C6 H11 ! 1 0
BOND C6 H12 ! 1 0
BOND C7 C9 ! 1 0
BOND C7 H13 ! 1 0
BOND C7 H14 ! 1 0
BOND C8 H15 ! 1 0
BOND C8 H16 ! 1 0
BOND C9 H17 ! 1 0
BOND C9 H18 ! 1 0
BOND C10 C12 ! 2 1
BOND C10 C14 ! 1 1
BOND C11 C13 ! 2 1
BOND C11 C15 ! 1 1
BOND C12 C16 ! 1 1
BOND C12 C20 ! 1 1
BOND C13 C17 ! 1 1
BOND C13 C21 ! 1 1
BOND C14 C18 ! 2 1
BOND C14 C22 ! 1 1
BOND C15 C19 ! 2 1
BOND C15 C23 ! 1 1
BOND C16 C24 ! 1 1
BOND C17 C25 ! 1 1
BOND C18 C26 ! 1 1
BOND C19 C27 ! 1 1
BOND C20 C28 ! 2 1
BOND C20 H21 ! 1 0
BOND C21 C29 ! 2 1
BOND C21 H22 ! 1 0
BOND C22 C30 ! 2 1
BOND C22 H23 ! 1 0
BOND C23 C31 ! 2 1
BOND C23 H24 ! 1 0
BOND C24 C32 ! 2 1
BOND C24 H25 ! 1 0
BOND C25 C33 ! 2 1
BOND C25 H26 ! 1 0
BOND C26 C34 ! 2 1
BOND C26 H27 ! 1 0
BOND C27 C35 ! 2 1
BOND C27 H28 ! 1 0
BOND C28 C32 ! 1 1
BOND C28 H29 ! 1 0
BOND C29 C33 ! 1 1
BOND C29 H30 ! 1 0
BOND C30 C34 ! 1 1
BOND C30 H31 ! 1 0
BOND C31 C35 ! 1 1
BOND C31 H32 ! 1 0
BOND C32 H33 ! 1 0
BOND C33 H34 ! 1 0
BOND C34 H35 ! 1 0
BOND C35 H36 ! 1 0

END

read param card flex append

  • Parameters generated by analogy by
  • CHARMM General Force Field (CGenFF) program version 3.0

! Penalties lower than 10 indicate the analogy is fair; penalties between 10
! and 50 mean some basic validation is recommended; penalties higher than
! 50 indicate poor analogy and mandate extensive validation/optimization.

BONDS

ANGLES

DIHEDRALS
CG321 CG321 NG311 CG2R61 0.8000 1 180.00 ! 150390 , from CG321 CG321 NG311 CG2R64, penalty= 4
CG321 CG321 NG311 CG2R61 1.1000 3 0.00 ! 150390 , from CG321 CG321 NG311 CG2R64, penalty= 4

IMPROPERS

END
RETURN

in str
RESI 150390
and in mol2

 @MOLECULE
Z9.

You need to make same name for both.

Thank you