From: Bharat Sharma (bharatsolbridge_at_gmail.com)
Date: Fri Mar 27 2015 - 07:33:56 CDT

Hello Everyone,
I am trying to calculate MSD using following script. I just realize that it
need a lot of memory to complete the calculation for reasonably good size
of system. I think the most time consuming part is calculating MSD and
putting in to an array.

Here is my script. Can anyone help me to play my code to save some memory?

Appreciate you suggestions.

Thank you.

Bharat

Here is the scripts (I am only showing some parts of the blocks, please
ignore some syntax errors coming from missing braces)
---------------------------------------------------------------------------------------------
for {set k [expr $i]} {$k <[expr $i+$msdlength]} {incr k} {
set msd 0.0
foreach idx $idxlist {

    set sel [atomselect top "index $idx"]
$sel frame $i
set ref [measure center $sel]
$sel frame [expr $k]
set poslist [measure center $sel]
set msd [expr $msd + [veclength2 [vecsub $ref $poslist]]]
 }
# change
set msdarray($i,$k) [expr $msd]

}

for {set l 0} {$l <$msdlength} {incr l} {

for {set m 0} {$m <$msdlength} {incr m} {
set search [lsearch $missing_i $m]
if {$search == -1} {
set sum($l) [expr $sum($l)+$msdarray($m,[expr $m+$l])]
}
}
set t [expr $l * 0.0025* $step]

# change
puts $msdfile "$count00 $t [expr $sum($l)/$count00]"
}

-----------------------------------------------------------------------------------------------