shirtsgroup / InterMol

Conversion tool for molecular simulations
MIT License
185 stars 53 forks source link

Error converting amber file #362

Closed askusay closed 2 years ago

askusay commented 4 years ago

Hello,

I have consistently run into an issue when trying to convert amber systems into any other format, where in which this error is printed:

  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 811, in <module>
    main()
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 231, in main
    system, prefix, prmtop_in, crd_in, amb_structure = _load_amber(amber_files=args['amb_in'])
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 655, in _load_amber
    system = gmx.load(fromamber_top_in, fromamber_gro_in)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 38, in load
    return parser.read()
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 419, in read
    self.create_moleculetype(top_moltype, mol_name, mol_count)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 727, in create_moleculetype
    self.create_bond(bond)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in create_bond
    atoms = [int(n) for n in bond[:n_atoms]]
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in <listcomp>
    atoms = [int(n) for n in bond[:n_atoms]]
ValueError: invalid literal for int() with base 10: 'cC'

The command I have used is:

python $INTERMOL/convert.py --amb_in step5_input.parm7 step5_input.crd --gromacs --oname test_gro

Info about the system: Solvated membrane system generated from charmm GUI

Things I have tried without success:

  1. convert parm7 to prmtop using parmed
  2. export the charmm_gui structure with amber parameters and amber format
  3. generate amber parameters using tleap
  4. convert to other formats i.e. desmond, charmm, amber

I would appreciate your advice, please find attached files if needed

files.tar.gz

mrshirts commented 4 years ago

If you are converting AMBER to GROMACS, I would suggest using ParmEd directly (https://parmed.github.io/ParmEd/html/index.html), which is more robust than InterMol, and if it has a problem, will probably have better error messages.

If you are working to convert to something else, repost the issue with those errors!

askusay commented 4 years ago

Hi Michael,

I should have clarified that my target is a desmond .cms file and so Intermol is essential for this conversion. As far as parmed goes, there were certainly no issues converting the amber file to the gromacs format.

I have tried to use the converted .top and .gro files to convert to desmond format attached but a similar message was produced:

python $INTERMOL/convert.py --gro_in parmed_conv.top parmed_conv.gro --desmond --oname from_gro
INFO 2020-05-10 10:17:15 Beginning InterMol conversion

INFO 2020-05-10 10:17:15 InterMol is research software. If you make use of InterMol in scientific publications please cite the following reference:
Shirts, M.R., Klein, C., Swails, J.M. et al. J Comput Aided Mol Des (2016). doi:10.1007/s10822-016-9977-1

Traceback (most recent call last):
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 811, in <module>
    main()
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 223, in main
    system, prefix, gro_in, top_in = _load_gromacs(gromacs_files=args['gro_in'])
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 573, in _load_gromacs
    system = gmx.load(top_in, gro_in)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 38, in load
    return parser.read()
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 419, in read
    self.create_moleculetype(top_moltype, mol_name, mol_count)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 727, in create_moleculetype
    self.create_bond(bond)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in create_bond
    atoms = [int(n) for n in bond[:n_atoms]]
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in <listcomp>
    atoms = [int(n) for n in bond[:n_atoms]]
ValueError: invalid literal for int() with base 10: 'cC'

This is the output for converting amber into desmond:

python $INTERMOL/convert.py  --amb_in parmed_conv.prmtop step5_input.crd --desmond --oname test_desmond
INFO 2020-05-10 13:02:42 Beginning InterMol conversion

INFO 2020-05-10 13:02:42 InterMol is research software. If you make use of InterMol in scientific publications please cite the following reference:
Shirts, M.R., Klein, C., Swails, J.M. et al. J Comput Aided Mol Des (2016). doi:10.1007/s10822-016-9977-1

/home/ali/Documents/REST/github_issu/parmed_conv.prmtop /home/ali/Documents/REST/github_issu/step5_input.crd
Traceback (most recent call last):
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 811, in <module>
    main()
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 231, in main
    system, prefix, prmtop_in, crd_in, amb_structure = _load_amber(amber_files=args['amb_in'])
  File "/home/ali/Downloads/InterMol/intermol/convert.py", line 655, in _load_amber
    system = gmx.load(fromamber_top_in, fromamber_gro_in)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 38, in load
    return parser.read()
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 419, in read
    self.create_moleculetype(top_moltype, mol_name, mol_count)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 727, in create_moleculetype
    self.create_bond(bond)
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in create_bond
    atoms = [int(n) for n in bond[:n_atoms]]
  File "/home/ali/anaconda3/envs/ali_conda/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in <listcomp>
    atoms = [int(n) for n in bond[:n_atoms]]
ValueError: invalid literal for int() with base 10: 'cC'
rajatkrpal commented 2 years ago

I am having the similar issue when trying to convert AMBER topology and coordinates to desmond cms file. It is a membrane topology. The command I used is : python /anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/convert.py --amb_in bilayer_propanol.prmtop bilayer_propanol.inpcrd --desmond

The error is similar to one posted above File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/convert.py", line 811, in main() File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/convert.py", line 231, in main system, prefix, prmtop_in, crd_in, amb_structure = _load_amber(amber_files=args['amb_in']) File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/convert.py", line 655, in _load_amber system = gmx.load(fromamber_top_in, fromamber_gro_in) File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 38, in load return parser.read() File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 419, in read self.create_moleculetype(top_moltype, mol_name, mol_count) File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 727, in create_moleculetype self.create_bond(bond) File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in create_bond atoms = [int(n) for n in bond[:n_atoms]] File "/anaconda3/envs/openmm-system-prep/lib/python3.7/site-packages/intermol/gromacs/gromacs_parser.py", line 804, in atoms = [int(n) for n in bond[:n_atoms]] ValueError: invalid literal for int() with base 10: 'cD'

askusay commented 2 years ago

Hi rajatkrpal, I eventually solved this issue.

For me, it was the result of membrane residue atoms being scattered around the file i.e. not in one block. Say you are using a POPC membrane with cholesterol in it. You need to ensure that all POPC residues are part of one block and that all cholesterol residues are part of one block. Same with ions, waters and ligands that have the same residue name. This issue happens when the prmtop file is converted to the gromacs format which can have issues when residues are scattered since it lists the molecule types as part of topology file.

If your issue stems from the same source, then this should solve it