From: Vermaas, Joshua (
Date: Fri Aug 18 2017 - 14:35:14 CDT

Hi Manish,

Do you have velocities saved? Technically velocities aren't temperatures exactly, but you can visualize them directly, and would be the easiest way of getting coloring that is at least loosely related to temperature. You need the instantaneous velocities to calculate temperature anyway, so this shouldn't be a big burden. If it were me, here is how this would be scripted:

set allsel [atomselect top "all"]
set massvec [$allsel get mass]
for { set f 0 } { $f < [molinfo top get numframes] } { incr f } {
    $allsel frame $f
    set velocities [$allsel get {vx vy vz}]
    set vmags [list ]
    foreach vec $velocities {
        lappend vmags [veclength2 $vec] ; #Note the veclength2, which gets us the magnitude of v^2
    $allsel set user [vecmul $vmags $massvec] ; #Temperature is proportional to mv^2

This puts a temperature-like quantity into the user field (although the units are really weird. You can figure out the conversion on your own), but it needs velocities to be defined before it will give you a non-zero answer.

On 08/18/2017 12:06 PM, Manish Gupta wrote:


I'm running my simulation with LAMMPS. My simulation has varied temperature in domain and I want to visualize the simulation based on temperature distribution.

Since the trajectory file does not contain any information about ensemble properties like temperature, I can not get the colors based on it.

I think one way of doing it would be to write a reader in Tcl and assign the properties to user in VMD, but I'm not sure how to do it. Also, is there any other simpler way to get temperature based coloring? I would appreciate any help.

Thank you