Hi Sasha,
I think this will be slightly easier in ChimeraX.  My approach would be to open a structure of just the first frame (for use in aligning) as model 1, and open the trajectory as model 2.  There are commands for aligning the structures ("align"), changing to a specific frame ("coordset"), and finding the RMSD values ("rmsd").  The  code/pseudocode for the script would be:

from chimerax.atomic import all_atomic_structures
for s in all_atomic_structures(session):
if s.num_coordsets == 1:
ref = s
else:
traj = s
from chimerax.core.commands import run
for cs_id in traj.coordset_ids:
run(session, f"coordset {traj.atomspec} {cs_id}")
run(session, f"align {traj.atomspec}/A to {ref.atomspec}/A") # maybe further limited to backbone or CA atoms
for chain in ref.chains:
rmsd = run(session, f"rmsd {traj.atomspec}/{chain.chain_id} to {ref.atomspec}/{chain.chain_id}") # again, perhaps limited further
# code to either output the RMSD to a file now, or save it and output them collectively later

If you don't want all the commands the script is running to show up in the Log, you can add "log=False" to the run() calls.
--Eric

Eric Pettersen
UCSF Computer Graphics Lab




On Apr 29, 2025, at 11:21 AM, Alexandra Zahradnikova via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Dear All, 
I am working with a trajectory of a tetramer.
I would like to align the A chains in all frame of the trajectory and then calculate the rmsd of all chains in all frames relative to the respective chain of the first frame (i.e., align only chains A but calculate for all chains), and write the results to a text file. Is that possible? I can do a similar calculation with a script in old Chimera but don’t know how to do it in ChimeraX.
I attach the zipped script for old Chimera.
Best regards
Sasha
 
<rmsd_trajectory_Calpha_chains.zip>_______________________________________________
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/