TypeError: string indices must be integers

242 views
Skip to first unread message

Sara Pérez Figueroa

unread,
Nov 15, 2023, 5:37:06 PM11/15/23
to gmx_MMPBSA
Hi everybody,

I am encountering this error, will someone know what is happening, what I am doing wrong?
I would greatly appreciate the help

P.S. I already checked the comments for a similar error but I haven't been able to resolve it.

[saraperez@pc-218-020 Alpha-CHLOR]$ conda activate gmxMMPBSA
(gmxMMPBSA) [saraperez@pc-218-020 Alpha-CHLOR]$ gmx_MMPBSA -O -i mmpbsa.in -cs PROD.tpr -ci index.ndx -cg 2 3 -ct md_fit.xtc -cp topol.top -o FINAL_RESULTS_MMPBSA.dat -eo FINAL_RESULTS_MMPBSA.csv
[INFO   ] Starting gmx_MMPBSA v1.6.2
[INFO   ] Command-line
  gmx_MMPBSA -O -i mmpbsa.in -cs PROD.tpr -ci index.ndx -cg 2 3 -ct md_fit.xtc -cp topol.top -o FINAL_RESULTS_MMPBSA.dat -eo FINAL_RESULTS_MMPBSA.csv

tets
[INFO   ] Checking mmpbsa.in input file...
[INFO   ] Checking mmpbsa.in input file...Done.

[INFO   ] Checking external programs...
[INFO   ] cpptraj found! Using /home/saraperez/.conda/envs/gmxMMPBSA/bin/cpptraj
[INFO   ] tleap found! Using /home/saraperez/.conda/envs/gmxMMPBSA/bin/tleap
[INFO   ] parmchk2 found! Using /home/saraperez/.conda/envs/gmxMMPBSA/bin/parmchk2
[INFO   ] sander found! Using /home/saraperez/.conda/envs/gmxMMPBSA/bin/sander
[INFO   ] Using GROMACS version > 5.x.x!
[INFO   ] gmx found! Using /usr/bin/gmx
[INFO   ] Checking external programs...Done.

[INFO   ] Building AMBER topologies from GROMACS files...
[INFO   ] Get PDB files from GROMACS structures files...
[INFO   ] Making gmx_MMPBSA index for complex...
[INFO   ] Normal Complex: Saving group ACIC_ACHI (2_3) in _GMXMMPBSA_COM_index.ndx file as _GMXMMPBSA_COM.pdb
[INFO   ] No receptor structure file was defined. Using ST approach...
[INFO   ] Using receptor structure from complex to generate AMBER topology
[INFO   ] Normal Receptor: Saving group ACIC (2) in _GMXMMPBSA_COM_index.ndx file as _GMXMMPBSA_REC.pdb
[INFO   ] No ligand structure file was defined. Using ST approach...
[INFO   ] Using ligand structure from complex to generate AMBER topology
[INFO   ] Normal Ligand: Saving group ACHI (3) in _GMXMMPBSA_COM_index.ndx file as _GMXMMPBSA_LIG.pdb
  File "/home/saraperez/.conda/envs/gmxMMPBSA/bin/gmx_MMPBSA", line 8, in <module>
    sys.exit(gmxmmpbsa())
  File "/home/saraperez/.conda/envs/gmxMMPBSA/lib/python3.9/site-packages/GMXMMPBSA/app.py", line 98, in gmxmmpbsa
    app.make_prmtops()
  File "/home/saraperez/.conda/envs/gmxMMPBSA/lib/python3.9/site-packages/GMXMMPBSA/main.py", line 682, in make_prmtops
    self.FILES.mutant_receptor_prmtop, self.FILES.mutant_ligand_prmtop) = maketop.buildTopology()
  File "/home/saraperez/.conda/envs/gmxMMPBSA/lib/python3.9/site-packages/GMXMMPBSA/make_top.py", line 123, in buildTopology
    self.gmx2pdb()
  File "/home/saraperez/.conda/envs/gmxMMPBSA/lib/python3.9/site-packages/GMXMMPBSA/make_top.py", line 513, in gmx2pdb
    self.resi, self.resl, self.orderl = res2map(self.indexes, self.complex_str)
  File "/home/saraperez/.conda/envs/gmxMMPBSA/lib/python3.9/site-packages/GMXMMPBSA/utils.py", line 601, in res2map
    for e in value['num']:
TypeError: string indices must be integers
Exiting. All files have been retained.
gmx_MMPBSA.log

Mario E. Valdes-Tresanco

unread,
Nov 15, 2023, 6:11:39 PM11/15/23
to Sara Pérez Figueroa, gmx_MMPBSA
This error usually happens when there is some missmatch between indexes and starting structures or simply wrong index groups... If you tried everything suggested previously and still doesn't work, Please send us the files you are using to see if we find the issue 

--
You received this message because you are subscribed to the Google Groups "gmx_MMPBSA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmx_mmpbsa+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gmx_mmpbsa/212c1f79-daf3-4cd9-94b5-e29c62c79504n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sara Pérez Figueroa

unread,
Nov 15, 2023, 6:22:48 PM11/15/23
to gmx_MMPBSA
Thank you very much for your reply. According to me, I have tried everything and I have verified the indices, however, I am still doing something wrong, it is probably my mistake, but I don't know what I am doing incorrectly.

mmpbsa.in
topol.top
index.ndx

Sara Pérez Figueroa

unread,
Nov 15, 2023, 6:23:47 PM11/15/23
to gmx_MMPBSA
Charm36.zip

Sara Pérez Figueroa

unread,
Nov 15, 2023, 6:24:43 PM11/15/23
to gmx_MMPBSA
PROD.tpr

Sara Pérez Figueroa

unread,
Nov 15, 2023, 6:38:57 PM11/15/23
to gmx_MMPBSA
I tried to upload the xtc file, but it was not possible, I assume because of its size, so I put the link where you can download it



marioe911116

unread,
Nov 16, 2023, 10:26:51 AM11/16/23
to gmx_MMPBSA
In your topology:

#include "charmm36.ff/forcefield.itp"

; additional params for the molecule
#include "achi.prm"

#include "achi.itp"

#include "charmm36.ff/tip3p.itp"
#ifdef POSRES_WATER
; Position restraint for each water oxygen
[ position_restraints ]
;  i funct  fcx fcy    fcz
   1 1 1000    1000   1000
#endif

; Include topology for ions
#include "charmm36.ff/ions.itp"

[ system ]
; Name
mol

[ molecules ]
; Compound   #mols
ACHI 1

SOL              7000

there is only "ACHI" in the topology and in the tpr I see  "ACHI" as one entity (kinda of ligand boudn the a ring-like structure) however I don't see "ACIC" that is present in the index file. Can you comment on that? are these two entities that were parametrized as one?

Please, attach also "achi.prm" and "achi.itp" files

Sara Pérez Figueroa

unread,
Nov 16, 2023, 8:05:55 PM11/16/23
to gmx_MMPBSA
I made indices to be able to do the data processing and analysis, the ring type structure "ACIC" and the molecule inside this "ACHI" However for the initial calculation of the molecular dynamics this separation does not exist, but it is for the postprocessing
Could the problem come from those indices created after MD calculations?

achi.itp
achi.prm

Mario E. Valdes-Tresanco

unread,
Nov 17, 2023, 2:36:27 AM11/17/23
to Sara Pérez Figueroa, gmx_MMPBSA
I was checking your system and the issue is that the whole system is parametrized as one and the topology is unique the the entire complex as a unity. Unfortunately, this makes things a lot more complicated, and at this point, it will be better to generate topologies for both the receptor and the ligand separately, and then run the simulation. By doing this you will make the post-processing a lot easier...

--
You received this message because you are subscribed to the Google Groups "gmx_MMPBSA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmx_mmpbsa+...@googlegroups.com.

Sara Pérez Figueroa

unread,
Nov 18, 2023, 8:30:18 PM11/18/23
to gmx_MMPBSA
Thank you very much for the time dedicated

Sara Pérez Figueroa

unread,
Nov 18, 2023, 11:33:14 PM11/18/23
to gmx_MMPBSA


Hi marioe911116,


im here again. I was thinking about what you said, that the system was parameterized as a whole, in such a way that my labels (ACIC and ACHI) were not read or recognized correctly. Due to the above, I made labels with make_ndx, to the atoms that make up the aforementioned structures, calling the atoms as they are recognized in the itp file (achi.itp), however, even when I do this I still have the same error. I have attached the new index.ndx and the output .log file
I understand your previous recommendation, however, running 250 ns again is not very pragmatic at this precise moment of publication
index.ndx
gmx_MMPBSA.log

gmx_MMPBSA

unread,
Nov 22, 2023, 11:53:32 AM11/22/23
to gmx_MMPBSA
Well, there is a lot of work to do here to run the calculation... Let's go.
As Mario E says, the system was parametrized as a one. The problem here is the system has only one residue. There is no way to define the receptor and ligand from one residue. So, we need to change this.
Please, follow these steps:
  1.  Create consistent complex, receptor, and ligand groups in the index. Using the index file, remove the LP atom that isn't supported (assuming that only these groups are contained -> 0 System: 157 atoms  1 Other:   157 atoms  2 ACIC:   126 atoms  3 ACHI:    31 atoms)
    • gmx make_ndx -f PROD.tpr -n
    • splitat 3
    • 3&!34
    • del 4-34
    • name 4 lig
    • 2|4
    • name 5 com  -> you should get (0 System:   157 atoms   1 Other:   157 atoms   2 ACIC:   126 atoms  3 ACHI:    31 atoms  4 lig:    30 atoms  5 com:   156 atoms)
  2. Create the complex.pdb
    • gmx editconf -f PROD.tpr -n -o complex.pdb
    • select group 5 (com)
  3. Edit the complex.pdb
    • Open the complex.pdb with Kate or another text editor that allows column edition
    • change the residue number to atoms 127-156 for number 2 (lines 131-160)
  4. Edit the achi.itp to remove the LP atom information and renumber it
    • Open the complex.pdb with Kate or another text editor that allows column edition
    • remove the LP atom-related info and parameters (number 157). Note that the lines mentioned above are renumbered. It means that the number corresponds to the line number after removing the previous lines 
      • remove line 166 ([ atoms ] section)
      • remove line 713 ([ pairs ] section)
      • remove line 714 ([ pairs ] section)
      • remove line 715 ([ pairs ] section)
      • remove line 716 ([ pairs ] section)
      • remove [ virtual_sites2 ] and  [ exclusions ] sections
    • change the residue number to atoms 127-156 for number 2 (lines 136-165)
    • Check that every section is separated by one line
  5. Generate the trajectory without LP 
    • gmx trjconv -f md_fit.xtc -o md_fit_noLPH.xtc -s PROD.tpr -n
    • select group 5
  6. run de calculation
    • gmx_MMPBSA -O -i mmpbsa.in -cs com.pdb -ci index.ndx -cg 2 4 -ct md_fit_noLPH.xtc -cp topol.top
Let me know if you have any doubts
Mario S.

Sara Pérez Figueroa

unread,
Nov 24, 2023, 1:23:02 AM11/24/23
to gmx_MMPBSA
Many thanks 

I will try this and let you know if it works or if I have any doubts.


Sara 


Sara Pérez Figueroa

unread,
Dec 8, 2023, 12:56:43 AM12/8/23
to gmx_MMPBSA

i have a big doubt, in the step:
Create consistent complex, receptor, and ligand groups in the index. Using the index file, remove the LP atom that isn't supported (assuming that only these groups are contained -> 0 System: 157 atoms  1 Other:   157 atoms  2 ACIC:   126 atoms  3 ACHI:    31 atoms)
  • gmx make_ndx -f PROD.tpr -n
  • splitat 3
  • 3&!34
  • del 4-34
  • name 4 lig
  • 2|4
  • name 5 com  -> you should get (0 System:   157 atoms   1 Other:   157 atoms   2 ACIC:   126 atoms  3 ACHI:    31 atoms  4 lig:    30 atoms  5 com:   156 atoms)
Group 4, which is made up of 30 atoms, is the ligand, and group 5 is the complete complex (ligand plus ring (cyclodextrin)), but I wondered if group 5 should be just the ring ?

I find myself trying to calculate Protein-ligand binding free energy calculations (Single Trajectory method). 

Thanks

Mario Sergio Valdes

unread,
Dec 9, 2023, 5:24:09 PM12/9/23
to gmx_MMPBSA
In this case, group 5 is used only to generate the complex pdb... In the index file, the receptor is ACIC (group 2) and the ligand is the ACHI without the LP, the new group 4
Reply all
Reply to author
Forward
0 new messages