From: Sadegh Faramarzi Ganjabad (safaramarziganjabad_at_mix.wvu.edu)
Date: Thu Apr 26 2018 - 23:30:21 CDT

Hello all,

I am trying to calculate RMSD of individual lipids in a protein-lipid
system. I found this code that aligns a single residue and gets the RMSD of
the entire trajectory.

# Prints the RMSD of the protein atoms between each timestep
        # and the first timestep for the given molecule id (default: top)
        proc print_rmsd_through_time {{mol top}} {
                # use frame 0 for the reference
                set reference [atomselect $mol "residue X" frame 0]
                # the frame being compared
                set compare [atomselect $mol "residue X"]

                set num_steps [molinfo $mol get numframes]
                for {set frame 0} {$frame < $num_steps} {incr frame} {
                        # get the correct frame
                        $compare frame $frame

                        # compute the transformation
                        set trans_mat [measure fit $compare $reference]
                        # do the alignment
                        $compare move $trans_mat
                        # compute the RMSD
                        set rmsd [measure rmsd $compare $reference]
                        # print the RMSD
                        puts "RMSD of $frame is $rmsd"
                }
        }

but when I iterate this code for all lipid residues it takes a lot of
memory and my computer freezes. I'm not sure why. Here is the code I'm
using

set selmode [[atomselect top "resname POPC"] get residue]
#gets stdin selmode
foreach r $selmode {

# selection
set reference [atomselect top "residue $r" frame 0]
set compare [atomselect top "residue $r"]
set num_steps [molinfo top get numframes]
set output [open "rmsd_$r.dat" w]
# rmsd calculation loop
for {set frame 0} {$frame < $num_steps} {incr frame} {
                        # get the correct frame
                        $compare frame $frame

                        # compute the transformation
                        set trans_mat [measure fit $compare $reference]
                        # do the alignment
                        $compare move $trans_mat
                        # compute the RMSD
                        set rmsd [measure rmsd $compare $reference]
                        # print the RMSD
                        #puts "$r"
                        puts $output "$rmsd"
                }

close $output

}

Does anybody know a better way of doing this?

Thanks,
Sadegh Faramarzi,

Research Assistant
West Virginia University, Department of Chemistry
Email:safaramarziganjabad_at_mix.wvu.edu