MDAnalysis / mdanalysis

MDAnalysis is a Python library to analyze molecular dynamics simulations.
https://mdanalysis.org
Other
1.26k stars 641 forks source link

Error when setting up BAT after selecting only heavy atoms #4566

Closed helmutcarter closed 2 months ago

helmutcarter commented 2 months ago

Expected behavior

I expect to be able to compute internal coordinates for my solute regardless of whether or not it has hydrogens.

Actual behavior

When I try to set up BAT on an atom selection of only solute heavy atoms, I get an error in line 303 of MDAanalys/analysis/bat.py: "IndexError: list index out of range"

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.analysis.bat import BAT
from MDAnalysis.tests.datafiles import PSF, DCD,  GRO, PDB, TPR, XTC, TRR,  PRMncdf, NCDF

u = mda.Universe(PRMncdf, NCDF)
# Select first 10 atoms because BAT requires input atom group to have only one molecules, relevant for test system but not my real ones
heavy_atoms = u.select_atoms("index 0:10 and not name H* and not resname WAT and not resname HOH")
R = BAT(heavy_atoms)
R.run()

Current version of MDAnalysis

helmutcarter commented 2 months ago

I can see that my code to reproduce isn't working, I'll try again after I have some time to troubleshoot.