From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Jun 18 2012 - 06:27:10 CDT

On Mon, Jun 18, 2012 at 1:29 AM, XY <windyvalley_at_gmail.com> wrote:
>
> Hello,
>
> I am trying to use tcl commands to repeatedly read a few lammps dump files
> and visualize the atoms, using same viewing angles and drawing methods.
>
> However, the obtained figures have different viewing angles as shown in the
> following figures.
>
> http://web.ics.purdue.edu/~yang99/01.jpg
> http://web.ics.purdue.edu/~yang99/02.jpg
>
> It seems that the screen origin (the three colored axes) was placed at
> different location for different lammps dump files. It results in different
> viewing angles, after the rotate and translate commands were executed.
>
> The dimensions of the simulation box of all lammps dump files are same.
>
> Is there a way of fixing the viewing angle or move the screen origin to a
> fixed place?

you cannot fix it, but you can store the properties of a view that you
like and then reset to that at a later point. you can check out the
save_state.tcl script that ships with VMD for an example. basically it
calls

molinfo <molid> get {center_matrix rotate_matrix scale_matrix global_matrix}

to get all relevant parameters and stores them away so that upon loading
they can be reset to the original values with molinfo set.

axel.

> The tcl script I use is listed below. The sample lammps dump files can be
> downloaded from the following link, if needed.
>
> http://web.ics.purdue.edu/~yang99/all.zip
>
> Thanks a lot for your help.
>
>
>
>
>
> set frames 2 ; # total frames
> set tsinc    15000000 ; # timestep increase between frames
> set tsstart 0 ; # starting time step
> set fn_prefix  cml_ConW300K_C100eV3000. ;         # filename prefix
> set fn_postfix .lammpstrj ;           # filename suffix
>
> display resize 500 700
>
> # ---- LOOP ---- begin
> for {set ii 0} {$ii < $frames} {incr ii}  {
> puts "Frames: [expr $ii + 1] of $frames"
> mol delete all
> set timestep [expr $tsstart+$tsinc*$ii]
> set filename $fn_prefix$timestep$fn_postfix
> mol new $filename
> set mid [molinfo index 0]
> mol delrep all $mid
> axes location off
>
> mol selection {type 1}
> mol addrep top
> mol modstyle 0 $mid vdw 0.25 100
> mol modcolor 0 $mid colorid 8
>
> mol selection {type 2}
> mol addrep top
> mol modstyle 1 $mid vdw 0.4 100
> mol modcolor 1 $mid colorid 1
>
> translate by -0.05 -1. 0
> rotate x to -90
> rotate y by 30
> rotate x by 20
> scale to 0.04
>
> #set impact [expr $timestep/5000]
> #graphics $mid color white
> #graphics $mid text {-1 0 16} "Impacts: $impact" size 3 thickness 2
> graphics $mid color cyan
> graphics $mid line {0 0 0} {25.32 0 0} width 5 ; # draw box outline
> graphics $mid line {25.32 0 0} {25.32 25.32 0} width 5
> graphics $mid line {25.32 25.32 0} {0 25.32 0} width 5
> graphics $mid line {0 25.32 0} {0 0 0} width 5
> graphics $mid line {0 0 0} {0 0 -80} width 5
> graphics $mid line {25.32 0 0} {25.32 0 -80} width 5
> graphics $mid line {0 25.32 0} {0 25.32 -80} width 5
> graphics $mid line {25.32 25.32 0} {25.32 25.32 -80} width 5
> render snapshot $fn_prefix$timestep.bmp
>
> }
>
> Xue
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
College of Science and Technology
Temple University, Philadelphia PA, USA.