Skip to content

Water density grid generation fails for GROMACS water naming (WAT/O) #77

@EngAsal

Description

@EngAsal

Hi,

I am running molecular dynamics simulations in GROMACS and analyzing the trajectories with PENSA to evaluate structural differences across ensembles. I’m running into a consistent failure when generating the water density grid, and that error propagates to read_water_features.

The error raised by extract_combined_grid is:

ValueError: No atoms in AtomGroup at input time frame. 
Grid for density could not be automatically generated. 
If this is expected, a user defined grid will need to be provided instead.

My system comes from GROMACS, so the water molecules are named:
resname: WAT
oxygen atom: O
hydrogens: H1, H2

PENSA assumes CHARMM-style naming (e.g. TIP3, OH2), so the default atom selection fails.

To work around this, I modified extract_combined_grid by changing the atom selection from name-based to resname-based, and used "WAT" when calling extract_combined_group. This allows me to generate combined.mymemap file successfully.

A simplified version of my modified selection logic:

if prot_prox is True:
    _selection = "resname " + atomgroup + " and around 3.5 protein"
    density_atomgroup = combined_conditions.select_atoms(_selection, updating=True)
else:
    density_atomgroup = combined_conditions.select_atoms("resname " + atomgroup)

counts = []
for ts in combined_conditions.trajectory:
    counts.append(len(density_atomgroup))
print("Min atoms per frame:", min(counts))
print("Max atoms per frame:", max(counts))
print("Number of atoms in selection:", len(density_atomgroup))

Although this fixes extract_combined_grid, I still get the same ValueError when running read_water_features from water_feature.py, which appears to use a similar assumption about CHARMM water naming.

What is the correct way to adapt PENSA’s water-selection logic for GROMACS-style waters (WAT/O)? Is there a recommended selector (resname, type, etc.) that preserves PENSA’s expected behaviour?

Also, does read_water_features require a CHARMM naming scheme, or should it work with arbitrary water residue/atom names if the grid is generated correctly?

Any guidance or confirmation on how water naming is intended to be handled would be very helpful.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions