Introduction+to+xmgrace

=Using xmgrace (grace) to generate plots=

Here I include a BASH script and the xmgrace master file I've made (and use the BASH script to modify). Unfortunately, I've got myself stuck in a rut with poorly chosen file naming conventions and so not every ounce of the process is automatable. I simply have to open the files created in part 1 of the BASH scripts, then change the name of the ion in the title... everything else is automated and fine.

code format="bash"
 * 1) !/bin/bash

RUNHOME=~/Desktop/deltarho_data RUNNUMBER=3 IONS="a b c d e f"

for i in $IONS do       cp master_grace.bfile $i.tmp perl -pe 's/xyz/'$RUNNUMBER-$i'/g' < $i.tmp > $i.tmp2 perl -pe 's/ion/'$i'/g' < $i.tmp2 > $RUNNUMBER-$i.bfile rm *.tmp* done

echo "Pausing for you to change the titles... hit any key when done" read dummy

for i in $IONS do       xmgrace -batch $RUNNUMBER-$i.bfile -nosafe -hardcopy done code Here you see a familiar script framework (if you've seen the BASH scripts page) and I use it to modify the following master bfile and then run xmgrace. Batch mode means I can run commands from the bfile and don't have to interact with the GUI, nosafe means it does not use safe mode (always used it, never looked into what it meant), and hardcopy means it will output the plot without the popup. You'll need that if you are doing many, many plots. code READ XY "a-deltarho.dat"             # data, 2 columns, 1st column is X, 2nd column is Y READ XY "b-deltarho.dat" READ XY "c-deltarho.dat" READ XY "iona"                       # I wanted to color by atom type (anions all one color, oxygens same, H's same) READ XY "oa" READ XY "ha"

s0 line color 1                      # black s0 line linewidth 2                  # line is twice as thick s1 line color 2                      # red s1 line linewidth 2 s2 line color 4                      # blue s2 line linewidth 2

s3 symbol 1                          # circle s3 symbol size 0.6                   # 60% default size s3 symbol fill 1                     # fill inside of circle with color (hides line behind the dot) s3 symbol color 1                    # adds black ring outside of circle s3 symbol fill color 3               # fills circle with light green s3 linestyle 0                       # I think this means it doesn't try to put a line between your circles

s4 symbol 1 s4 symbol size 0.6 s4 symbol fill 1 s4 symbol color 1 s4 symbol fill color 2 s4 linestyle 0

s5 symbol 1 s5 symbol size 0.6 s5 symbol fill 1 s5 symbol color 1 s5 symbol fill color 0 s5 linestyle 0

world xmin -6                        # axes were x= -6, 6; y = -220, 0 world xmax 6 world ymin -220 world ymax 0 xaxis label "r (\cE\C)"              # r(Angstrom symbol) xaxis label char size 1.50000        # 1.5x default size (for papers) xaxis ticklabel char size 1.50000 yaxis label "\f{Symbol}D\f{}q (me)"  # Delta symbol yaxis label char size 1.50000 yaxis ticklabel char size 1.500000 PRINT TO "anion.eps"                 # Save to file DEVICE "EPS" OP "level2"             # Call drivers to save as .eps
 * 1) PRINT

code

TPP 08/27/2012 code code