Calculation of distance between CA atoms of residues for all frames

20 views
Skip to first unread message

Deepshikha Ghosh 19310001

unread,
Aug 15, 2022, 12:02:13 AMAug 15
to MDnalysis discussion
Dear Users

I am trying to calculate the distance between CA atoms of residues for all frames using the following script:

import numpy as np
import MDAnalysis as mda
import pandas as pd
from MDAnalysis.lib.distances import distance_array

u= mda.Universe("protein_2000ns_autopsf.psf" , "protein_2000ns.dcd")
residues1 = u.atoms.select_atoms('protein and resid 1:85 and name CA')
residues2 = u.atoms.select_atoms('protein and resid 1:85 and name CA')
resnames = u.atoms[1:85].residues.resnames
resids = u.atoms[1:85].residues.resids
list(zip(resnames, resids))
print (list(zip(resnames, resids)))
dists = distance_array(residues1.positions, residues2.positions)
dists

But I am not getting the distances, it is just printing the residue positions. Any kind of help will be appreciated.

Thanks & Regards
Deepshikha Ghosh
IIT Gandhianagar

Hugo Macdermott-Opeskin

unread,
Aug 24, 2022, 7:17:17 PMAug 24
to MDnalysis discussion
Hi Deepshikha Ghosh

Your example script seems to work fine for me and print the distances.
Would you be able to  print(dists) to confirm?

Cheers

Hugo 


Reply all
Reply to author
Forward
0 new messages