Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
168 stars 38 forks source link

RMSD perres ignoring ions #1580

Open d-beltran opened 3 years ago

d-beltran commented 3 years ago

Hi,

I just found out rmsd_perres is ignoring some ions (not always all ions). Those ions are an independent residue with 1 unique atom each. I can provide a pair of examples to reproduce the error if needed.

And by the way, rmsd_perres always prints this message although it works fine: "Error: Range::SetRange(None): Range is -1 for None"

¿Any ideas?

Thank you for maintaining pytraj :)

hainm commented 3 years ago

I can provide a pair of examples to reproduce the error if needed.

@d-beltran Please. Thanks.

d-beltran commented 3 years ago

I attached 2 pdb and 2 xtc trajectory files.

In the first example there is only 1 zinc atom. it is the penultimate residue in the pdb.

Run this code to reproduce the problem:

import pytraj as pt

pt_trajectory = pt.iterload('test.xtc', 'test.pdb')
rmsds = pt.rmsd_perres(pt_trajectory)

# Print last 3 residues in topology
topology_residues = list(pt_trajectory.topology.residues)
for residue in topology_residues[-3:]:
    print(residue)

# Print last 3 residues in the analysis output
for residue in rmsds[-3:]:
    print(residue.key)

As you will see, when I load the trajectory and pdb files the zinc ion is there. However the results of rmsd_perres do not include the zinc residue rmsd.

At the second example there are 4 ions: 2 zinc and 2 magnesium. rmsd_perres returns data only for 1 of the magnesium ions.

tests.zip

hainm commented 3 years ago

hi @d-beltran: I will look at the issue but I don't think I can resolve this soon. Just want to let you know. Thanks for your files. Cheers.

d-beltran commented 3 years ago

Sure. No problem. Thank you @hainm :)