Tcl/Tk script of VMD for Molecular Weight.

I forgot the source of the script, it might be got from VMD online manual, sorry about that. Anyhow, it is very convenient for calculating molecular weight. I have tried this for polymer which contains more than 5,000 atoms, this will cost it about 1-2s. For small molecules, it’s very fast that you could ignore the calculation time.

The part of atomselect can be changed according to your demands.

########################################################

set selection [atomselect top "resname RESIDUE_NAME"]
set sum 0
foreach mass [$selection get mass] {
set sum [expr {$sum + $mass}]
}
return $sum

########################################################

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s