conda-forge / ambertools-feedstock

A conda-smithy repository for ambertools.
BSD 3-Clause "New" or "Revised" License
8 stars 14 forks source link

input_parser.py ValueError: invalid literal for int() with base 10: '' #123

Closed mainguyenanhvu closed 1 year ago

mainguyenanhvu commented 1 year ago

Comment:

Hi,

I am trying to calculate MMPBSA and MMGBSA by using Ambertools and OpenMM in Google colab from this notebook. The code below is what I run:

import os
!conda install -c conda-forge -c openbabel -c bioconda -y openmm openmm-setup openbabel ambertools compilers pdbfixer gromacs

os.environ['AMBERHOME'] = "/usr/local"
!echo $AMBERHOME
!source "$AMBERHOME/amber.sh"
!MMPBSA.py -O -i mmpbsa.in -o FINAL_RESULTS_MMPBSA_decomposition.dat -sp  complex.prmtop -cp com.prmtop -rp rec.prmtop -lp ligand.prmtop -y prot_lig_prod_all.dcd

I create mmpbsa.in by using:

f = open("mmpbsa.in", "w")
f.write("""&general """  + "\n"
"""  endframe=""" + """,  interval=""" + """, strip_mask=:WAT:Na+:Cl-:Mg+:K+, """ + "\n"
"""/ """ + "\n"
"""&gb """ + "\n"
""" igb=""" +  """, saltcon=""" +  """, """ + "\n"
"""/""")
f.close()

The error is:

  File "/usr/local/bin/MMPBSA.py", line 90, in <module>
    app.read_input_file()
  File "/usr/local/lib/python3.10/site-packages/MMPBSA_mods/main.py", line 762, in read_input_file
    self.INPUT = self.input_file.Parse(infile)
  File "/usr/local/lib/python3.10/site-packages/MMPBSA_mods/input_parser.py", line 443, in Parse
    SetValue(var[1])
  File "/usr/local/lib/python3.10/site-packages/MMPBSA_mods/input_parser.py", line 112, in SetValue
    self.value = self.datatype(value)
ValueError: invalid literal for int() with base 10: ''

Fatal Error! 
All files have been retained for your error investigation: 
You should begin by examining the output files of the first failed calculation.
Consult the "Temporary Files" subsection of the MMPBSA.py chapter in the
manual for file naming conventions.

My files here: MMGBSA_input.zip

Please help me to fix this error. Thank you very much,

jaimergp commented 1 year ago

I reformatted your code so it's a bit easier to read (triple quotes allow newlines!):

with open("mmpbsa.in", "w") as f:
    f.write("""
&general
endframe=,  interval=, strip_mask=:WAT:Na+:Cl-:Mg+:K+,
/
&gb
igb=, saltcon=,
/
""")

I think the problem here is that you are missing the values next to endframe, interval, igb, saltcon, etc. Ambertools expects a number (int), but instead receives an empty string (""), hence the conversion error.

That said, this is not an Ambertools support forum; we are only concerned with the packaging aspects of the project. For usage help, please refer to https://ambermd.org/Contact.php, where you will find the support mailing lists.