From: Felipe Merino (felipe.merino_at_mpi-muenster.mpg.de)
Date: Fri Mar 27 2015 - 08:30:05 CDT

Hi,

This is a usual problem you are going to get if create an atomselection
inside a loop. Once you are done with you $sel variable in the for loop
delete with "$sel delete". That should solve your memory issues.

Felipe

On 27/03/15 13:33, Bharat Sharma wrote:
> 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]"
> }
>
> -----------------------------------------------------------------------------------------------
>
>
>
>
>
>
>
>
>
>
>
>