from chimerax.atomic import all_atomic_structures
for s in all_atomic_structures(session):
for r in s.residues:
if r.name != "HOH":
continue
for a in r.atoms:
for b in a.bonds:
if b.length > 5:
r.atoms.displays = False
break
else:
continue
break
else:
r.atoms.displays = True
On Jan 21, 2026, at 1:34 PM, Enrico Martinez via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:_______________________________________________Dear ChimeraX users!I am working on the visualization of an MD trajectory where some water molecules are broken due to PBC artifacts, causing oxygen and hydrogen atoms to be separated over large distances. To address this, I currently use the following workflow:
Remove all bonds in water molecules near the ligand.
Rebuild only reasonable bonds, avoiding artifactually long bonds.
Remove water atoms that have no bonds per frame:
perframe "~bond :HOH & :LIG :<5.0; bond :HOH & :LIG :<5.0 reasonable true; hide :HOH & @@num_bonds=0 target a" interval 1This works well to fix visualization artifacts, but the workflow is computationally heavy, as it rebuilds bonds in every frame. Is there a way to achieve the same in a single step by simply removing waters with stretched bonds?
Many thanks in advance!
Enrico
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/