diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..348cc93 --- /dev/null +++ b/clean.sh @@ -0,0 +1,8 @@ +#!/bin/tcsh + +foreach machine (cl001 cl002 cl003 cl004 cl005 cl006) + + echo $machine + ssh $machine /usr/local/bin/qclean-mx.sh + +end diff --git a/convert_coor_TRAJEC.lithium-no_com.pwscf b/convert_coor_TRAJEC.lithium-no_com.pwscf new file mode 100755 index 0000000..de785ad --- /dev/null +++ b/convert_coor_TRAJEC.lithium-no_com.pwscf @@ -0,0 +1,8 @@ +#!/bin/csh + +set acell=`grep celldm lithium.pw.inp | awk '{print $3}' | sed s/,//g` +set natoms=`grep nat lithium.pw.inp | tail -1 | awk '{print $3}' | sed s/,//g` + +touch output/fake.out + +grep -A $natoms ATOMIC_POSITIONS output/*.out | awk '/Li/{print $2," ",$3," ",$4}' | sed s/"\-"/" \-"/g | awk -f ~/scripts/utils/convert_coor_TRAJEC.awk acell=$acell natoms=$natoms > TRAJEC.xyz diff --git a/extract.sh b/extract.sh new file mode 100755 index 0000000..795fae2 --- /dev/null +++ b/extract.sh @@ -0,0 +1,3 @@ +#!/bin/csh + +grep -A 28 Summary output.log | grep "\." | awk '{print $2,$3 }' > energy.dat diff --git a/form.ch b/form.ch new file mode 100755 index 0000000..bf0a182 --- /dev/null +++ b/form.ch @@ -0,0 +1,8 @@ +#!/bin/tcsh + +set file=$1 + +setenv g09root /usr/local/gaussian +setenv GAUSS_SCRDIR /globalscratch/$USER/ +source /usr/local/gaussian/g09/bsd/g09.login +formchk $file diff --git a/gPressure.cpmd b/gPressure.cpmd new file mode 100755 index 0000000..3177436 --- /dev/null +++ b/gPressure.cpmd @@ -0,0 +1,39 @@ +#!/bin/tcsh + +set timeStep = $1 + +awk '/STRESS/{n+=1;a=0;getline;a=$1/10;getline;a+=$2/10;getline;a+=$3/10;print n " " a/3}' STRESS > outPressure_GPa + +ln -s outPressure_GPa outPressure_GPa.250 +ln -s outPressure_GPa outPressure_GPa.500 +ln -s outPressure_GPa outPressure_GPa.1000 + +~/scripts/utils/running-average.py outPressure_GPa.250 2 250 & +~/scripts/utils/running-average.py outPressure_GPa.500 2 500 & +~/scripts/utils/running-average.py outPressure_GPa.1000 2 1000 & + +wait + +set cmd="gnuplot.scr" +cat > $cmd << END +set data style linespoints +set xlabel "Time (ps)" +set ylabel "Pressure (GPa)" +set yrange [*:*] +set terminal png +set output 'pressure.png' +#plot "outPressure_GPa" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "pressure (GPa)" with linespoints, "outPressure_GPa.250.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 250 steps", "outPressure_GPa.500.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 500 steps", "outPressure_GPa.1000.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 1000 steps" +set terminal x11 +#plot "outPressure_GPa" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "pressure (GPa)" with linespoints, "outPressure_GPa.250.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 250 steps", "outPressure_GPa.500.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 500 steps", "outPressure_GPa.1000.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 1000 steps" +plot "outPressure_GPa" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "pressure (GPa)" with linespoints, "outPressure_GPa.250.running" u (\$1*$timeStep*2.4188E-17/1.0E-12):2 t "running pressure (GPa), 250 steps" +pause -1 "Showing pressure.\nPress enter to quit" +quit +END + +gnuplot $cmd + +\rm $cmd + +~/bin/blocker outPressure_GPa 2 | grep Final + +rm outPressure_GPa.* diff --git a/getEnergy.py b/getEnergy.py new file mode 100755 index 0000000..8a6ceda --- /dev/null +++ b/getEnergy.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import sys, commands + +combined_energy = float(commands.getoutput('grep "Convergence criterion met" ../output.out | tail -1 ').split()[1]) +iso_counter = int(commands.getoutput('grep "Convergence criterion met" output.out | wc -l ')) + +iso_energy_line = commands.getoutput('grep "Convergence criterion met" output.out').split() + +total = combined_energy + + + +iso_energy = [] + +for i in range(iso_counter): + + iso_energy.append(float(iso_energy_line[1 + i*6])) + total -= iso_energy[-1] + +print combined_energy, iso_energy +print -total*627.509469 + + diff --git a/machinesfilescript/hostlist.out b/machinesfilescript/hostlist.out new file mode 100644 index 0000000..9ce72cf --- /dev/null +++ b/machinesfilescript/hostlist.out @@ -0,0 +1,33 @@ +Warning: no access to tty; thus no job control in this shell... +Sun Microsystems Inc. SunOS 5.10 Generic January 2005 +Thu Aug 9 20:49:27 NDT 2007 +PE_HOSTFILE is /var/spool/sge/cl012/active_jobs/88217.1/pe_hostfile and contains: +----------------------------- +cl012 16 all.q@cl012 +----------------------------- +HOSTNAME is cl012 +NHOSTS is 1 +NSLOTS is 16 +TMPDIR is /tmp/88217.1.all.q +JOB_ID is 88217 +SGE_O_WORKDIR is /home/itamblyn/machinesfilescript +/tmp/88217.1.all.q/machines contains: +----------------------------- +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +cl012 +----------------------------- +logout diff --git a/machinesfilescript/hostlist.sh b/machinesfilescript/hostlist.sh new file mode 100755 index 0000000..0c697d1 --- /dev/null +++ b/machinesfilescript/hostlist.sh @@ -0,0 +1,25 @@ +#!/bin/sh +#$ -S /bin/csh +#$ -cwd +#$ -N hostlist +#$ -j y +#$ -o hostlist.out +#$ -pe openmp 16 +#$ -l h_vmem=250M,h_rt=00:01:00 +date +echo PE_HOSTFILE is $PE_HOSTFILE and contains: +echo ----------------------------- +cat $PE_HOSTFILE +echo ----------------------------- +echo HOSTNAME is $HOSTNAME +echo NHOSTS is $NHOSTS +echo NSLOTS is $NSLOTS +echo TMPDIR is $TMPDIR +echo JOB_ID is $JOB_ID +echo SGE_O_WORKDIR is $SGE_O_WORKDIR +# You might want to adjust this next path to your liking... +$SGE_O_WORKDIR/startmpi.sh $PE_HOSTFILE +echo $TMPDIR/machines contains: +echo ----------------------------- +cat $TMPDIR/machines +echo ----------------------------- diff --git a/machinesfilescript/startmpi.sh b/machinesfilescript/startmpi.sh new file mode 100755 index 0000000..04fcd73 --- /dev/null +++ b/machinesfilescript/startmpi.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# +# preparation of the mpi machine file +# +# usage: startmpi.sh +# + +PeHostfile2MachineFile() +{ + cat $1 | while read line; do + host=`echo $line|cut -f1 -d" "|cut -f1 -d"."` + nslots=`echo $line|cut -f2 -d" "` + i=1 + while [ $i -le $nslots ]; do + echo $host + i=`expr $i + 1` + done + done +} + +# +# on success the job will find a machine-file in $TMPDIR/machines +# + +me=`basename $0` + +# test number of args +if [ $# -ne 1 ]; then + echo "$me: got wrong number of arguments" >&2 + exit 1 +fi + +# get arguments +pe_hostfile=$1 + +# ensure pe_hostfile is readable +if [ ! -r $pe_hostfile ]; then + echo "$me: can't read $pe_hostfile" >&2 + exit 1 +fi + +machines="$TMPDIR/machines" +PeHostfile2MachineFile $pe_hostfile >> $machines + +# signal success to caller +exit 0 diff --git a/monitor.sh b/monitor.sh index 73e51c9..348cc93 100755 --- a/monitor.sh +++ b/monitor.sh @@ -1,9 +1,8 @@ #!/bin/tcsh -foreach machine ( selenium tellurium beryllium carbon neon nitrogen fluorine oxygen ) +foreach machine (cl001 cl002 cl003 cl004 cl005 cl006) - echo -n $machine " " - - ssh ${machine} top -b -n1 | awk '/load/{print $10, $11, $12, "(5 min)", $14, "(15 min)"}' | sed s/,//g + echo $machine + ssh $machine /usr/local/bin/qclean-mx.sh end diff --git a/myrinet b/myrinet new file mode 100755 index 0000000..344e56a --- /dev/null +++ b/myrinet @@ -0,0 +1,10 @@ +#!/bin/bash + +qstat -u \* -f | awk '/cl00/{print $0} /cl010/{print $0} /cl011/{print $0} /cl012/{print $0}' | awk '/short/{print $1, $3, $4}' > out.tmp +cat out.tmp +echo +echo -n "Total slots in use: " +sed s/@/" "/g out.tmp | sed s/"\/"/" "/g | awk '{nslots+=$3; print nslots}' | tail -1 +echo -n "Open slots: " +sed s/@/" "/g out.tmp | sed s/"\/"/" "/g | awk '{nslots+=$3; print 192 - nslots}' | tail -1 +rm out.tmp diff --git a/pdos.py b/pdos.py new file mode 100755 index 0000000..730bc07 --- /dev/null +++ b/pdos.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +import sys +sys.path.append("/usr/local/numpy.1.0.4/lib64/python2.3/site-packages/") +import numpy +import commands + +try: + input_filename = sys.argv[1] +except IndexError: + print '\nusage: ' + sys.argv[0] + ' input_filename' + print '\nexiting...\n' + sys.exit(0) + +core_valence_divide = 401 # <- this corresponds to -20 eV + +command_line_counter = commands.getoutput('wc -l ' + input_filename).split() + +if len(command_line_counter) != 2: + print 'Error determining file size' +else: + number_of_lines = int(command_line_counter[0]) + +outputFile_dos = open('dos.dat', 'w') +outputFile_pdos = open('pdos.dat', 'w') + +inputFile = open(input_filename, 'r') + +for i in range(5): + inputFile.readline() + +inline_total = inputFile.readline() + +emin_total = float(inline_total.split()[1]) +emax_total = float(inline_total.split()[0]) +enum_total = int(inline_total.split()[2]) +efermi_total = float(inline_total.split()[3]) + +dos = numpy.zeros((enum_total, 3), dtype = numpy.float) # E, dos, idos + +for i in range(enum_total): + inline_total = inputFile.readline().split() + dos[i][0] = float(inline_total[0]) #- efermi_total +# dos[i][0] = float(inline_total[0]) - efermi_total + dos[i][1], dos[i][2] = float(inline_total[1]), float(inline_total[2]) + +for row in dos: + for element in row: + outputFile_dos.write(str(element) + ' ') + outputFile_dos.write('\n') + +############ + +inline_project = inputFile.readline() + +emin_project = float(inline_project.split()[1]) +enum_project = int(inline_project.split()[2]) +efermi_project = float(inline_project.split()[3]) + +spacing = (emax_total - emin_total)/enum_total +efermi_bin = int((efermi_total - emin_total)/spacing) + +pdos = numpy.zeros((enum_project, 1 + 3*2), dtype = numpy.float) # E, s, p, d + +for i in range(len(pdos)): + + pdos[i][0] = dos[i][0] # fills in the E column of pdos + +for i in range(enum_project): + inline_project = inputFile.readline().split() + pdos[i][1] += float(inline_project[1]) + pdos[i][2] += float(inline_project[2]) + pdos[i][3] += float(inline_project[3]) + +for i in numpy.arange(1,enum_project): + pdos[i][4] = pdos[i - 1][4] + pdos[i][1] + pdos[i][5] = pdos[i - 1][5] + pdos[i][2] + pdos[i][6] = pdos[i - 1][6] + pdos[i][3] + + +energies = numpy.transpose(pdos)[0] +s_project = numpy.transpose(pdos)[1] +p_project = numpy.transpose(pdos)[2] +d_project = numpy.transpose(pdos)[3] + +energies_core = energies[0:core_valence_divide] +s_project_core = s_project[0:core_valence_divide] +p_project_core = p_project[0:core_valence_divide] +d_project_core = d_project[0:core_valence_divide] + + +energies_valence = energies[core_valence_divide:efermi_bin] +s_project_valence = s_project[core_valence_divide:efermi_bin] +p_project_valence = p_project[core_valence_divide:efermi_bin] +d_project_valence = d_project[core_valence_divide:efermi_bin] + +spd_sum_core = sum(s_project_core) + sum(p_project_core) + sum(d_project_core) +spd_sum_valence = sum(s_project_valence) + sum(p_project_valence) + sum(d_project_valence) + +s_fraction_core = sum(s_project_core)/spd_sum_core +p_fraction_core = sum(p_project_core)/spd_sum_core + +s_fraction_valence = sum(s_project_valence)/spd_sum_valence +p_fraction_valence = sum(p_project_valence)/spd_sum_valence + +print +print "%s core", s_fraction_core*100 +print "%p core", p_fraction_core*100 +print +print "%s valence", s_fraction_valence*100 +print "%p valence", p_fraction_valence*100 +print +print "efermi_total = ", efermi_total +print "spacing = ", spacing +print + +for row in pdos: + for element in row: + outputFile_pdos.write(str(element) + ' ') + outputFile_pdos.write('\n') diff --git a/pdos_us.py b/pdos_us.py new file mode 100755 index 0000000..5974db6 --- /dev/null +++ b/pdos_us.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python + +import sys +import commands +import numpy + +try: + input_filename = sys.argv[1] +except IndexError: + print '\nusage: ' + sys.argv[0] + ' input_filename' + print '\nexiting...\n' + sys.exit(0) + +core_valence_divide = -1000 # <- all valence + +command_line_counter = commands.getoutput('wc -l ' + input_filename).split() + +if len(command_line_counter) != 2: + print 'Error determining file size' +else: + number_of_lines = int(command_line_counter[0]) + +outputFile_dos = open('dos.dat', 'w') +outputFile_pdos = open('pdos.dat', 'w') + +inputFile = open(input_filename, 'r') + +natom = int(inputFile.readline().split()[0]) +natom = 16 + +for i in range(4): + inputFile.readline() + +inline_total = inputFile.readline() + +emin_total = float(inline_total.split()[1]) +emax_total = float(inline_total.split()[0]) +enum_total = int(inline_total.split()[2]) +efermi_total = float(inline_total.split()[3]) + +dos = numpy.zeros((enum_total, 3), dtype = numpy.float) # E, dos, idos + +for i in range(enum_total): + inline_total = inputFile.readline().split() +# dos[i][0] = float(inline_total[0]) + dos[i][0] = float(inline_total[0]) - efermi_total + dos[i][1], dos[i][2] = float(inline_total[1]), float(inline_total[2]) + +for row in dos: + for element in row: + outputFile_dos.write(str(element) + ' ') + outputFile_dos.write('\n') + +############ + + +enum_project = enum_total + +spacing = (emax_total - emin_total)/enum_total +efermi_bin = int((efermi_total - emin_total)/spacing) + +pdos = numpy.zeros((enum_project, 1 + 3*2), dtype = numpy.float) # E, s, p, d + +for i in range(len(pdos)): + + pdos[i][0] = dos[i][0] # fills in the E column of pdos + +for atoms in range(natom): + inline_project = inputFile.readline() + + for i in range(enum_project): + inline_project = inputFile.readline().split() + pdos[i][1] += float(inline_project[1]) # s + pdos[i][2] += float(inline_project[2]) + float(inline_project[3]) + float(inline_project[4]) # py pz px + pdos[i][3] += float(inline_project[5]) + float(inline_project[6]) + float(inline_project[7]) + float(inline_project[8]) + float(inline_project[9]) # dxy ... + +for i in numpy.arange(1,enum_project): + pdos[i][4] = pdos[i - 1][4] + pdos[i][1] + pdos[i][5] = pdos[i - 1][5] + pdos[i][2] + pdos[i][6] = pdos[i - 1][6] + pdos[i][3] + + +energies = numpy.transpose(pdos)[0] +s_project = numpy.transpose(pdos)[1] +p_project = numpy.transpose(pdos)[2] +d_project = numpy.transpose(pdos)[3] + +#energies_core = energies[0:core_valence_divide] +#s_project_core = s_project[0:core_valence_divide] +#p_project_core = p_project[0:core_valence_divide] +#d_project_core = d_project[0:core_valence_divide] + + +energies_valence = energies[core_valence_divide:efermi_bin] +s_project_valence = s_project[core_valence_divide:efermi_bin] +p_project_valence = p_project[core_valence_divide:efermi_bin] +d_project_valence = d_project[core_valence_divide:efermi_bin] + +#spd_sum_core = sum(s_project_core) + sum(p_project_core) + sum(d_project_core) +spd_sum_valence = sum(s_project_valence) + sum(p_project_valence) + sum(d_project_valence) + +#s_fraction_core = sum(s_project_core)/spd_sum_core +#p_fraction_core = sum(p_project_core)/spd_sum_core + +s_fraction_valence = sum(s_project_valence)/spd_sum_valence +p_fraction_valence = sum(p_project_valence)/spd_sum_valence +d_fraction_valence = sum(d_project_valence)/spd_sum_valence + +#print +#print "%s core", s_fraction_core*100 +#print "%p core", p_fraction_core*100 +print +print "%s valence", s_fraction_valence*100 +print "%p valence", p_fraction_valence*100 +print "%d valence", d_fraction_valence*100 +print +print "norm = ", str(s_fraction_valence + p_fraction_valence + d_fraction_valence) +print +print "efermi_total = ", efermi_total +print "spacing = ", spacing +print + +for row in pdos: + for element in row: + outputFile_pdos.write(str(element) + ' ') + outputFile_pdos.write('\n') diff --git a/qinfo b/qinfo index 4cbe6ae..d77267c 100755 --- a/qinfo +++ b/qinfo @@ -1,8 +1,4 @@ -#!/bin/tcsh +#!/bin/bash -set jobid=$1 - -qstat -f $jobid > ~/q.tmp -grep -A 2 WORKDIR ~/q.tmp | grep -v MANPATH -grep job_state ~/q.tmp -rm ~/q.tmp +export directory=`qstat -j $1 | grep sge_o_workdir | awk '{print $2}'` +echo $directory diff --git a/status b/status index 9f0faa2..2647846 100755 --- a/status +++ b/status @@ -1,3 +1,665 @@ #!/bin/bash +# +# status will reformat the output of the qstat command by SGE. +# +# Version 1.0 - 2004-08-23 Initial release +# This version supports SGE 5.x and 6.x +# +# Copyright (C) 2004 Reuti, email: reuti@staff.uni-marburg.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# -qstat -u itamblyn +# +# If there is an unrecoverable error: display a message and exit. +# + +function printExit +{ + case $1 in + [iI]) echo INFO: "$2" >&2 ;; + [wW]) echo WARNING: "$2" >&2 ;; + [eE]) echo ERROR: "$2" ; exit 1 >&2 ;; + *) echo $1 >&2 ;; + esac +} + +# +# System depended setups. +# + +platform=`uname -s` +case $platform in + + SunOS) awk_command=/usr/xpg4/bin/awk ;; + + *) awk_command=awk ;; + +esac +awk_path=`which $awk_command` +if [ ! -r "$awk_path" -o ! -x "$awk_path" ] ; then + printExit W "No executable awk program found." + printExit E "Please update the path to awk in \"status\" according to your installation." +fi + +# +# First define some functions. +# + +function usage +{ + cat <<-EOF + + NAME + status - Display the status of jobs + + SYNTAX + status [ options ] [ ] + + DESCRIPTION + Displays all the running and pending of your own by default. When + a is specified, only the jobs belonging to this user are + displayed. + + OPTIONS + + -a + Display the jobs of all users. May not be used, when there is + a dedicated user specified. This also implies the output of + the owner of the jobs. + + -c + Calculate a statistic of the listed jobs. + + -g + Group output by owner. Only applicable if the owner is listed, + either by the -o switch or implied by -a. This is a short form + of "-s owner,running". Can't be used together with the -s option. + + -h + Get this help page. + + -j + Include jobs which are suspended. + + -l + Suppress the output of the list of jobs. Maybe useful, in case + you are only interested in the statistic with the -c switch. + + -m + Display the machine instead of the name of the queue the job is + running in under the column "running in". Only meaningful for + SGE 6.0 or above. + + -n + Suppress the listing of the individual owner, mostly useful when + all jobs are listed. Take precedence of any other implied options. + If used togehther with -o, only the later one is relevant. + + -o + List the owner of the individual job. Take precedence of any + other implied option. If used together with -s, only the later + one is relevant. + + -s [ job | name | none | owner | running | slots | time ] + Sort the output according to the given columns. If you want to + sort inside 2 or more columns, you have to separate them by a + ",", i.e. "-s owner,running". + + The option "none" will supersede any other column names and + set the complete sort order to none. + + The column "owner" can only be used, if the owner of the + job is displayed at all. Otherwise it will be ignored. + + The sort by "running" will only be used for the running + jobs, not for the waiting once. + + This will overwrite the default sort order, which is: + + running jobs waiting jobs + ------------- ------------- + default: running none + -g: owner,running owner + + Version 1.0 23 August 2004 status(1) + EOF + exit 0 +} + +# +# Analyze the given parameters to the command. +# + +while getopts :acghjlmnos: options ; do + case $options in + + a) CMDOPT_A="1" ;; + + c) CMDOPT_C="1" ;; + + g) CMDOPT_G="1" ;; + + h) usage ;; + + j) CMDOPT_J="1" ;; + + l) CMDOPT_L="1" ;; + + m) CMDOPT_M="1" ;; + + n) CMDOPT_N="1" + unset CMDOPT_O ;; + + o) CMDOPT_O="1" + unset CMDOPT_N ;; + + s) CMDOPT_S="1" + sort_request="$OPTARG" ;; + + \?) printExit E "Invalid option: -$OPTARG." ;; + + esac +done + +# +# Shift the arguments up to the input without the option prefix "-". +# This should be the user name. +# + +shift $((OPTIND-1)) + +# +# Test, whether was a user specified. +# + +if [ -n "$CMDOPT_A" ] ; then + if [ -n "$1" ] ; then + printExit E "You may only specify -a *or* an user, but not both." + else + myuser="*" + listuser="1" + fi +else + if [ -n "$1" ] ; then + myuser="$1" + else + myuser="$USER" + fi +fi + +# +# Range of selected jobs to be included. +# + +if [ -n "$CMDOPT_J" ] ; then + jobrange="rs" +else + jobrange="r" +fi + +# +# Decide, whether the owner should be included in the output. +# + +if [ -n "$CMDOPT_N" ] ; then + unset listuser +fi + +if [ -n "$CMDOPT_O" ] ; then + listuser="1" +fi + +# +# Grouping of owner requested? +# + +if [ -n "$CMDOPT_G" -a -z "$listuser" ] ; then + printExit E "Option -g not applicable, without listing the owner of the jobs." +fi + +# +# Get the version of the installed SGE. +# + +version=`qstat -help 2>&1 | head -1 | cut -f 2 -d " "` +case $version in + + 5*) qstat_running='qstat -u "${myuser:-*}" -s "$jobrange" -r' + qstat_waiting='qstat -u "${myuser:-*}" -g d -s p -r' + running_in_column="all" + ;; + + 6*) qstat_running='qstat -u "${myuser:-*}" -g t -s "$jobrange" -r' + qstat_waiting='qstat -u "${myuser:-*}" -g d -s p -r' + if [ -n "$CMDOPT_M" ] ; then + running_in_column="machine" + else + running_in_column="queue" + fi + ;; + + *) printExit E "This version of SGE ($version) is not supported." + ;; + +esac + +# +# Assemble the sort commands as requested. +# + +if [ -n "$CMDOPT_G" ] ; then + if [ -n "$CMDOPT_S" ] ; then + printExit E "You can't use the -g (grouped) switch together with the -s (sort) option." + else + sort_request="owner,running" + fi +else + if [ -z "$CMDOPT_S" ] ; then + sort_request="running" + fi +fi + +sort_command=`$awk_command -v sort_request="$sort_request" -v listuser="$listuser" ' + + BEGIN { field_position["job"]=" -k 1,1" + field_position["name"]=" -k 3,3" + field_position["slots"]=" -k 2,2" + if (listuser) + { + field_position["owner"]=" -k 4,4" + field_position["running"]=" -k 7,7" + field_position["time"]=" -k 5,5 -k 6,6" + } + else + { + field_position["running"]=" -k 6,6" + field_position["time"]=" -k 4,4 -k 5,5" + } + + sort_count=split(sort_request, sort_fields, ",") + + for (field=1; field<=sort_count; field++) + { + if (sort_fields[field]=="none") + { + sort_command_running="" + sort_command_waiting="" + if (sort_count>1) + { printf "WARNING: Sort set to none, supersede all other column names given.\n" > "/dev/stderr" } + break + } + + if (sort_fields[field]=="owner" && ! listuser) + { + printf "WARNING: Sort by owner ignored, because owner not displayed.\n" > "/dev/stderr" + continue + } + + if (field_position[sort_fields[field]]=="") + { printf "WARNING: Sort column name \""sort_fields[field]"\" ignored.\n" > "/dev/stderr" } + else + { + sort_command_running=sort_command_running field_position[sort_fields[field]] + if (sort_fields[field] != "running") + { sort_command_waiting=sort_command_waiting field_position[sort_fields[field]] } + } + } + + if (sort_command_running) + { sort_command_running="sort -b " sort_command_running } + else + { sort_command_running="cat" } + if (sort_command_waiting) + { sort_command_waiting="sort -b " sort_command_waiting } + else + { sort_command_waiting="cat" } + + print sort_command_running"|"sort_command_waiting } '` + +sort_command_running=${sort_command%|*} +sort_command_waiting=${sort_command#*|} + +# +# Now do it. +# + +# +# First the already running jobs. +# + +eval $qstat_running | $awk_command ' + + BEGIN { firstrun=1 + ignore=0 + } + + function printy() + { + if (listuser) + { + printf "%6s %2d %-25s %-10s %19s %-10s %s\n", + jobid, procs, substr(jobname, 1, 25), owner, starttime, masternode, ext | sort_command + } + else + { + printf "%6s %2d %-25s %19s %-10s %s\n", + jobid, procs, substr(jobname, 1, 25), starttime, masternode, ext | sort_command + } + } + + /MASTER *[0-9]*$/ { if (firstrun) + { + if (listing) + { + if (listuser) + { + printf "Running jobs:\n" + printf "job-ID # name owner start time running in\n" + printf "-----------------------------------------------------------------------------\n" + } + else + { + printf "Running jobs for user: %s\n", user + printf "job-ID # name start time running in\n" + printf "------------------------------------------------------------------\n" + } + } + + firstrun=0 + } + else + { + if (listing) + { printy() } + } + + ignore=0 + jobid=$1 + owner=$4 + procs=1 + starttime=$6" "$7 + + if (running_in_column=="all") + { masternode=$8 } + else if (running_in_column=="machine") + { masternode=substr($8, index($8, "@")+1) } + else if (running_in_column=="queue") + { masternode=substr($8, 1, index($8, "@")-1) } + else + { masternode="Unknown" } + + ext=match($5, "d") ? "stalled" : "" + if (match($5, "s")) + { + if (ext) + { ext=ext", suspended" } + else + { ext="suspended"} + } + if (match($5, "S")) + { + if (ext) + { ext=ext", suspended by queue" } + else + { ext="suspended by queue"} + } + if (ext) + { ext="("ext")" } + + if (listuser) + { + serial[owner]++ + parallel[owner]+=0 + serial_slots[owner]++ + parallel_slots[owner]+=0 + } + else + { + serial[user]++ + parallel[user]+=0 + serial_slots[user]++ + parallel_slots[user]+=0 + } + } + + /SLAVE *[0-9]*$/ { ignore=1 } + + ignore { next } + + /^ *Full jobname:/ { jobname=$3 } + + /^ *Granted PE:/ { procs=$4 + if (listuser) + { + serial[owner]-- + parallel[owner]++ + serial_slots[owner]-- + parallel_slots[owner]+=procs + } + else + { + serial[user]-- + parallel[user]++ + serial_slots[user]-- + parallel_slots[user]+=procs + } + } + + END { if (! firstrun) + { + if (listing) + { + printy() + close(sort_command) + print "" + } + + if (statistic) + { + printf("\n") + printf(" running #jobs/#slots\n") + printf("Owner serial parallel total\n") + printf("---------------------------------------\n") + + if (listuser) + { + user_sort="sort -k 1,1" + for (owner in serial) + { + total_serial+=serial[owner] + total_parallel+=parallel[owner] + total_serial_slots+=serial_slots[owner] + total_parallel_slots+=parallel_slots[owner] + + printf("%-10s %3d/%3d %3d/%3d %3d/%3d\n", + owner, serial[owner], serial_slots[owner], parallel[owner], parallel_slots[owner], + serial[owner]+parallel[owner], serial_slots[owner]+parallel_slots[owner]) | user_sort + } + close(user_sort) + + printf("---------------------------------------\n") + printf("Sum %3d/%3d %3d/%3d %3d/%3d\n", + total_serial, total_serial_slots, total_parallel, total_parallel_slots, + total_serial+total_parallel, total_serial_slots+total_parallel_slots) + } + else + { + printf("%-10s %3d/%3d %3d/%3d %3d/%3d\n", + user, serial[user], serial_slots[user], parallel[user], parallel_slots[user], + serial[user]+parallel[user], serial_slots[user]+parallel_slots[user]) + } + print "" + } + + } + } ' user="$myuser" statistic="$CMDOPT_C" running_in_column="$running_in_column" \ + listuser="$listuser" sort_command="$sort_command_running" listing="$((1-${CMDOPT_L:-0}))" + +# +# Now the waiting jobs. +# + +eval $qstat_waiting | $awk_command ' + + BEGIN { firstrun=1 } + + function printy() + { + if (listuser) + { + printf "%6s %2d %-25s %-10s %19s %s\n", + jobid, procs, substr(jobname, 1, 25), owner, submittime, ext | sort_command + } + else + { + printf "%6s %2d %-25s %19s %s\n", + jobid, procs, substr(jobname, 1, 25), submittime, ext | sort_command + } + } + + /^ *[0-9]+ */ { if (firstrun) + { + if (listing) + { + if (listuser) + { + printf "Waiting jobs:\n" + printf "job-ID # name owner submit time \n" + printf "------------------------------------------------------------------\n" + } + else + { + printf "Waiting jobs for user: %s\n", user + printf "job-ID # name submit time \n" + printf "-------------------------------------------------------\n" + } + } + + firstrun=0 + } + else + { + if (listing) + { printy() } + } + + jobid=$1 + owner=$4 + procs=1 + submittime=$6" "$7 + + ext=match($5, "E") ? "Error" : "" + if (match($5, "h")) + { + if (ext) + { ext=ext", hold" } + else + { ext="hold"} + } + if (ext) + { ext="("ext")" } + + if (listuser) + { + serial[owner]++ + parallel[owner]+=0 + serial_slots[owner]++ + parallel_slots[owner]+=0 + } + else + { + serial[user]++ + parallel[user]+=0 + serial_slots[user]++ + parallel_slots[user]+=0 + } + } + + /^ *Full jobname:/ { jobname=$3 } + + /^ *Requested PE:/ { procs=$4 + if (listuser) + { + serial[owner]-- + parallel[owner]++ + serial_slots[owner]-- + parallel_slots[owner]+=procs + } + else + { + serial[user]-- + parallel[user]++ + serial_slots[user]-- + parallel_slots[user]+=procs + } + } + + + END { if (! firstrun) + { + if (listing) + { + printy() + close(sort_command) + print "" + } + + if (statistic) + { + printf("\n") + printf(" waiting #jobs/#slots\n") + printf("Owner serial parallel total\n") + printf("---------------------------------------\n") + + if (listuser) + { + user_sort="sort -k 1,1" + for (owner in serial) + { + total_serial+=serial[owner] + total_parallel+=parallel[owner] + total_serial_slots+=serial_slots[owner] + total_parallel_slots+=parallel_slots[owner] + + printf("%-10s %3d/%3d %3d/%3d %3d/%3d\n", + owner, serial[owner], serial_slots[owner], parallel[owner], parallel_slots[owner], + serial[owner]+parallel[owner], serial_slots[owner]+parallel_slots[owner]) | user_sort + } + close(user_sort) + + printf("---------------------------------------\n") + printf("Sum %3d/%3d %3d/%3d %3d/%3d\n", + total_serial, total_serial_slots, total_parallel, total_parallel_slots, + total_serial+total_parallel, total_serial_slots+total_parallel_slots) + } + else + { + printf("%-10s %3d/%3d %3d/%3d %3d/%3d\n", + user, serial[user], serial_slots[user], parallel[user], parallel_slots[user], + serial[user]+parallel[user], serial_slots[user]+parallel_slots[user]) + } + print "" + } + + } + } ' user="$myuser" statistic="$CMDOPT_C" \ + listuser="$listuser" sort_command="$sort_command_waiting" listing="$((1-${CMDOPT_L:-0}))" + +# +# So, that's all +# + +exit 0 diff --git a/subtract.sh b/subtract.sh new file mode 100755 index 0000000..96333c5 --- /dev/null +++ b/subtract.sh @@ -0,0 +1,12 @@ +#!/bin/csh + + +# subtract off energy of first configuration + +set first=`head -1 energy.dat | awk '{print $2}'` +echo "# dist energy ab_energy" > energy_sub.dat +awk '{print $1, $2 - '$first', $2}' energy.dat >> energy_sub.dat + +# calculate slope with numerical derivative + +awk '{print $1, -($2 - n);n=$2}' energy.dat | tail +2 > difference.dat diff --git a/utils/convert_coor_BOHR.awk b/utils/convert_coor_BOHR.awk new file mode 100644 index 0000000..ec58cb8 --- /dev/null +++ b/utils/convert_coor_BOHR.awk @@ -0,0 +1,5 @@ +{ + + print $1*acell, $2*acell, $3*acell + +} diff --git a/utils/convert_coor_TRAJEC.awk b/utils/convert_coor_TRAJEC.awk new file mode 100644 index 0000000..2e6a596 --- /dev/null +++ b/utils/convert_coor_TRAJEC.awk @@ -0,0 +1,16 @@ +{ + + if (step%natoms == 0) + + { + + print natoms + print int(step/natoms) + 1 + print "H", $1*acell*0.529177, $2*acell*0.529177, $3*acell*0.529177 + + } + + else print "H", $1*acell*0.529177, $2*acell*0.529177, $3*acell*0.529177 + step+=1 + +} diff --git a/utils/convert_coor_TRAJEC.py b/utils/convert_coor_TRAJEC.py new file mode 100755 index 0000000..20a5c2f --- /dev/null +++ b/utils/convert_coor_TRAJEC.py @@ -0,0 +1,107 @@ +#! /usr/bin/env python + +###### +### +## +## this script takes a file of numbers, and converts it to a TRAJEC.xyz file. +## It also subtracts off the center of mass motion, if there is any.... +## It's pretty slow... +## +### +###### + + +import sys + +number_of_particles = int(sys.argv[1]) +lattice_constant = float(sys.argv[2]) # lattice constant in Bohr + +lattice_constant *= 0.529177 + +inputFile = open ('md.coor','r') + +COOR_array = [] + +#read line into array +for line in inputFile.readlines(): + + # add a new sublist + COOR_array.append([]) + + # loop over the elemets, split by whitespace + for i in line.split(): + + # convert to integer and append to the last + # element of the list + COOR_array[-1].append(float(i)) + +inputFile.close() + +number_of_snapshots = int(len(COOR_array)/number_of_particles) + +element_symbol = 'H' + +# determine original COM position + +p = 0 + +xCOMi = 0.0 +yCOMi = 0.0 +zCOMi = 0.0 + +while p < number_of_particles: + + xCOMi += COOR_array[p][0]/number_of_particles + yCOMi += COOR_array[p][1]/number_of_particles + zCOMi += COOR_array[p][2]/number_of_particles + + p += 1 + +# translate each step back to orignal COM location + +s = 0 + +while s < number_of_snapshots: + + p = 0 + + xCOMt = 0.0 + yCOMt = 0.0 + zCOMt = 0.0 + + while p < number_of_particles: + + xCOMt += COOR_array[p + s*number_of_particles][0]/number_of_particles + yCOMt += COOR_array[p + s*number_of_particles][1]/number_of_particles + zCOMt += COOR_array[p + s*number_of_particles][2]/number_of_particles + + p+= 1 + + p = 0 + + while p < number_of_particles: + + COOR_array[p + s*number_of_particles][0] -= (xCOMt - xCOMi) + COOR_array[p + s*number_of_particles][1] -= (yCOMt - yCOMi) + COOR_array[p + s*number_of_particles][2] -= (zCOMt - zCOMi) + + p+= 1 + + s += 1 + +outputFile_TRAJEC = open('TRAJEC.xyz','w') + +s = 0 + +while s < number_of_snapshots: + + outputFile_TRAJEC.write(repr(int(number_of_particles)) + '\n' + repr(int(s+1)) + '\n') + + p = 0 + + while p < number_of_particles: + + outputFile_TRAJEC.write(element_symbol + ' ' + repr(COOR_array[s*number_of_particles + p][0]*lattice_constant) + ' ' + repr(COOR_array[s*number_of_particles + p][1]*lattice_constant) + ' ' + repr(COOR_array[s*number_of_particles + p][2]*lattice_constant) + '\n') + p += 1 + + s += 1 diff --git a/utils/convert_coor_TRAJEC_cell.awk b/utils/convert_coor_TRAJEC_cell.awk new file mode 100644 index 0000000..d357c12 --- /dev/null +++ b/utils/convert_coor_TRAJEC_cell.awk @@ -0,0 +1,16 @@ +{ + + if (step%natoms == 0) + + { + + print natoms + print acell*0.529177, acell*0.529177, acell*0.529177 + print "H", $1*acell*0.529177, $2*acell*0.529177, $3*acell*0.529177 + + } + + else print "H", $1*acell*0.529177, $2*acell*0.529177, $3*acell*0.529177 + step+=1 + +} diff --git a/utils/cube_to_array.py b/utils/cube_to_array.py new file mode 100755 index 0000000..614641d --- /dev/null +++ b/utils/cube_to_array.py @@ -0,0 +1,126 @@ +#! /usr/bin/env python + +import sys +import numpy + +inputFile = open (sys.argv[1],'r') + +inputFile.readline() +inputFile.readline() + +number_of_atoms = int(inputFile.readline().split()[0]) + +print number_of_atoms + +nx = int(inputFile.readline().split()[0]) +ny = int(inputFile.readline().split()[0]) +nz = int(inputFile.readline().split()[0]) + +print nx, ny, nz + +for i in range(number_of_atoms): + inputFile.readline() + +INPUT_array = [] + +#read line into array +for line in inputFile.readlines(): + + # loop over the elemets, split by whitespace + for i in line.split(): + + INPUT_array.append(float(i)) + +inputFile.close() + +OUTPUT_array = numpy.zeros((nx, ny, nz), dtype=numpy.float) + +max_value = 0.0 +min_value = 1E6 + +INPUT_counter = 0 + +for i in range(nx): + for j in range(ny): + for k in range(nz): + OUTPUT_array[i][j][k] = INPUT_array[INPUT_counter] + max_value = max(max_value, INPUT_array[INPUT_counter]) + min_value = min(min_value, INPUT_array[INPUT_counter]) + INPUT_counter +=1 + +# We now have a 3D array with all of the data + +print min_value, max_value + +# for i in range(nx): +# +# outputFile = open ('plane-YZ.' + str(i + 1) + '.dat', 'w') +# +# for j in range(ny): +# for k in range(nz): +# outputFile.write(repr(OUTPUT_array[i][j][k]) + ' ') +# outputFile.write('\n') +# +# outputFile.close() + + +OUTPUT_array -= min_value +OUTPUT_array /= max_value +OUTPUT_array *= 255 + +i = nx/2 + +outputFile = open('plane-YZ.' + str(i + 1) + '.pgm', 'w') +outputFile.write('P2\n') +outputFile.write('# comment line\n') +outputFile.write(str(nz) + ' ' + str(ny) + '\n') +outputFile.write('255\n') + +line_counter = 0 + +for j in range(ny): + for k in range(nz): + outputFile.write(str(int(OUTPUT_array[i][j][k])) + ' ') + line_counter += 1 + if (line_counter == 17): + outputFile.write('\n') + line_counter = 0 +outputFile.close() + +j = ny/2 + +outputFile = open('plane-XZ.' + str(i + 1) + '.pgm', 'w') +outputFile.write('P2\n') +outputFile.write('# comment line\n') +outputFile.write(str(nz) + ' ' + str(nx) + '\n') +outputFile.write('255\n') + +line_counter = 0 + +for i in range(nx): + for k in range(nz): + outputFile.write(str(int(OUTPUT_array[i][j][k])) + ' ') + line_counter += 1 + if (line_counter == 17): + outputFile.write('\n') + line_counter = 0 +outputFile.close() + +k = nz/2 + +outputFile = open('plane-XY.' + str(i + 1) + '.pgm', 'w') +outputFile.write('P2\n') +outputFile.write('# comment line\n') +outputFile.write(str(ny) + ' ' + str(nx) + '\n') +outputFile.write('255\n') + +line_counter = 0 + +for i in range(nx): + for j in range(ny): + outputFile.write(str(int(OUTPUT_array[i][j][k])) + ' ') + line_counter += 1 + if (line_counter == 17): + outputFile.write('\n') + line_counter = 0 +outputFile.close() diff --git a/utils/diffusion.py b/utils/diffusion.py new file mode 100755 index 0000000..de116a4 --- /dev/null +++ b/utils/diffusion.py @@ -0,0 +1,79 @@ +#! /usr/bin/env python + +# the nearest neighbour line/ceiling is based on a bcc, which might not always make sense + +import sys + +filename = sys.argv[1] +number_of_particles = int(sys.argv[2]) +acell = float(sys.argv[3]) +print "acell: " + repr(acell) + +particles_edge = (float(number_of_particles)/2.0)**(1.0/3.0) + +inputFile = open (filename,'r') + +TRAJECTORY_array = [] + +#read line into array +for line in inputFile.readlines(): + + # add a new sublist + TRAJECTORY_array.append([]) + + # loop over the elemets, split by whitespace + for i in line.split(): + + # convert to integer and append to the last + # element of the list + TRAJECTORY_array[-1].append(float(i)) + +inputFile.close() + +number_of_snapshots = len(TRAJECTORY_array)/float(number_of_particles) + +outputFile = open ('drift.dat', 'w') + +s = 0 # counts over snapshots + +max_displacement = 0.0 + +nn_distance = (1.0/particles_edge)*(3**(0.5)/2.0) + +while s < number_of_snapshots: + + average_counter = 0.0 + + p = 0 # counts over particles + + number_of_displaced_particles = 0 + + while p < number_of_particles: + + + dx = TRAJECTORY_array[p][0] - TRAJECTORY_array[s*number_of_particles + p][0] + dy = TRAJECTORY_array[p][1] - TRAJECTORY_array[s*number_of_particles + p][1] + dz = TRAJECTORY_array[p][2] - TRAJECTORY_array[s*number_of_particles + p][2] + + distance = (1/acell)*(dx**2 + dy**2 + dz**2)**(0.5) + + if (distance >= nn_distance): number_of_displaced_particles += 1 + + average_counter += distance + + p +=1 + + + average_displacement = float(average_counter)/float(number_of_particles) + + fraction_displaced_particles = float(number_of_displaced_particles)/float(number_of_particles) + + outputFile.write(repr(s) + ' ' + repr(average_displacement) + ' ' + repr(nn_distance) + ' ' + repr(fraction_displaced_particles) + '\n') + + if (average_displacement > max_displacement): max_displacement = average_displacement + + s += 1 + +outputFile.close() + +print "max_displacement: " + repr(int(round(max_displacement*100.0/nn_distance))) + "%" diff --git a/utils/forces.py b/utils/forces.py new file mode 100755 index 0000000..5cce24f --- /dev/null +++ b/utils/forces.py @@ -0,0 +1,55 @@ +#! /usr/bin/env python + +import sys + +filename = sys.argv[1] +number_of_particles = int(sys.argv[2]) + +inputFile = open (filename,'r') + +forces_array = [] + +#read line into array +for line in inputFile.readlines(): + + # add a new sublist + forces_array.append([]) + + # loop over the elemets, split by whitespace + for i in line.split(): + + # convert to integer and append to the last + # element of the list + forces_array[-1].append(float(i)) + +inputFile.close() + +number_of_snapshots = len(forces_array)/float(number_of_particles) + +outputFile = open ('forces.dat', 'w') + +s = 0 # counts over snapshots + +while s < number_of_snapshots: + + p = 0 # counts over particles + + fx = 0.0 + fy = 0.0 + fz = 0.0 + + while p < number_of_particles: + + fx += forces_array[int(p + s*number_of_particles)][0]**2 + fy += forces_array[int(p + s*number_of_particles)][1]**2 + fz += forces_array[int(p + s*number_of_particles)][2]**2 + + p +=1 + + average_net_force = (fx + fy + fz)/float(number_of_particles) + + outputFile.write(repr(s) + ' ' + repr(average_net_force) + '\n') + + s += 1 + +outputFile.close() diff --git a/utils/gPlotAverage-Internal b/utils/gPlotAverage-Internal new file mode 100755 index 0000000..aa18337 --- /dev/null +++ b/utils/gPlotAverage-Internal @@ -0,0 +1,30 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xrange [0:*] +set yrange [0:*] +set xlabel "time (ps)" +set ylabel "temperature (K)" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):2 t "running average of pressure (GPa)" +pause -1 "Showing temperature-moving average.\nPress enter to quit" +quit +END + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotAverage-Pressure b/utils/gPlotAverage-Pressure new file mode 100755 index 0000000..8b08101 --- /dev/null +++ b/utils/gPlotAverage-Pressure @@ -0,0 +1,30 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xrange [0:*] +set yrange [0:*] +set xlabel "time (ps)" +set ylabel "pressure (GPa)" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):(\$2/10) t "running average of pressure (GPa)" +pause -1 "Showing pressure-moving average.\nPress enter to quit" +quit +END + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotAverage-Temperature b/utils/gPlotAverage-Temperature new file mode 100755 index 0000000..aa18337 --- /dev/null +++ b/utils/gPlotAverage-Temperature @@ -0,0 +1,30 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xrange [0:*] +set yrange [0:*] +set xlabel "time (ps)" +set ylabel "temperature (K)" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):2 t "running average of pressure (GPa)" +pause -1 "Showing temperature-moving average.\nPress enter to quit" +quit +END + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotDiffusion b/utils/gPlotDiffusion new file mode 100755 index 0000000..e75ea9a --- /dev/null +++ b/utils/gPlotDiffusion @@ -0,0 +1,29 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xlabel "time (ps)" +set ylabel "average displacement" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):2 t "average displacement (A.U.)", "$file" u (\$1*$2*2.4188E-17/1.0E-12):3 t "nn_distance" +pause -1 "Showing displacements.\nPress enter to quit" +quit +END + + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotDisplaced b/utils/gPlotDisplaced new file mode 100755 index 0000000..7d0e73d --- /dev/null +++ b/utils/gPlotDisplaced @@ -0,0 +1,30 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set yrange [0:100] +set xlabel "time (ps)" +set ylabel "percentage displacement" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):(\$4*100) t "% displacement" +pause -1 "Showing % of displaced particles.\nPress enter to quit" +quit +END + + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotForces b/utils/gPlotForces new file mode 100755 index 0000000..16838b8 --- /dev/null +++ b/utils/gPlotForces @@ -0,0 +1,29 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the average displacement as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xlabel "time (ps)" +set ylabel "forces" +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):2 t "forces (A.U.)" +pause -1 "Showing forces.\nPress enter to quit" +quit +END + + +gnuplot $cmd + +\rm $cmd diff --git a/utils/gPlotPressure b/utils/gPlotPressure new file mode 100755 index 0000000..eadf921 --- /dev/null +++ b/utils/gPlotPressure @@ -0,0 +1,34 @@ +#!/bin/csh +#------------------------------------------------------------------------------- +# plot the pressure as a function of time +# I. Tamblyn C.I.W. 06-09-05 +# +# based on a script by: +# B. Militzer Livermore 04-23-01 +#------------------------------------------------------------------------------- +set file=$1 +set timeStep=$2 + +if (!(-e $1)) then + echo "Could not find file '" $1 "'" + exit(-1) +endif + +set cmd="gnuplot.scr" +cat > $cmd << END +set xlabel "Time (ps)" +set ylabel "Pressure (GPa)" +set yrange [*:*] +plot "$file" u (\$1*$2*2.4188E-17/1.0E-12):(\$2)/10 t "pressure (GPa)" +pause -1 "Showing pressure.\nPress enter to quit" +quit +END + + +gnuplot $cmd + +\rm $cmd + + +# "$file" u 1:3 t "ion temp" +# diff --git a/utils/running-average.py b/utils/running-average.py new file mode 100755 index 0000000..8e480eb --- /dev/null +++ b/utils/running-average.py @@ -0,0 +1,49 @@ +#!/usr/bin/python + +import sys + +# usage: running-average.py filename column average_over + +filename = sys.argv[1] +column = int(sys.argv[2]) - 1 +n = int(sys.argv[3]) + +inputFile = open (sys.argv[1],'r') + +data_array = [] + +#read line into array +for line in inputFile.readlines(): + + # add a new sublist + data_array.append([]) + + # loop over the elemets, split by whitespace + for i in line.split(): + + # convert to integer and append to the last + # element of the list + data_array[-1].append(float(i)) + +inputFile.close() + +outputFile = open(filename + '.running', 'w') + +t = n - 1 + +while t < len(data_array): + + i = t - (n - 1) + + average_count = float(0) + + while i <= t: + + average_count += data_array[i][column] + i += 1 + + outputFile.write(repr(t) + ' ' + repr(average_count/float(n)) + '\n') + + t += 1 + +outputFile.close() diff --git a/utils/wrap_TRAJEC.awk b/utils/wrap_TRAJEC.awk new file mode 100644 index 0000000..b06b91e --- /dev/null +++ b/utils/wrap_TRAJEC.awk @@ -0,0 +1 @@ +awk '! /H/{print $0} /H/{L=15.031741;N=1000000;x=$2-(int($2/L+N+0.5)-N)*L;y=$3-(int($3/L+N+0.5)-N)*L;z=$4-(int($4/L+N+0.5)-N)*L;print "C",x,y,z;}' TRAJEC.xyz > TRAJEC_C_pbc.xyz diff --git a/utils/xyzReader.python b/utils/xyzReader.python new file mode 100644 index 0000000..c3ea388 --- /dev/null +++ b/utils/xyzReader.python @@ -0,0 +1,21 @@ +number_of_particles = int(xyzFile.readline()) + +atom_mass_list = {'H': 1.0, 'He': 4.0, 'Li' : 7.0, 'K' : 39.09830} + +CELL_array = [] +POSITION_array = [] + +for line in xyzFile: + if len(line.split()) == 4: + + POSITION_array.append([]) + atom_mass = atom_mass_list[line.split()[0]] + POSITION_array[-1].append(atom_mass) + position_vector = [float(line.split()[1])/(0.529177), float(line.split()[2])/(0.529177),float(line.split()[3])/(0.529177)] + POSITION_array[-1].append(position_vector) + + elif len(line.split()) == 3: + CELL_array.append([]) + for i in line.split(): + CELL_array[-1].append(float(i)/(0.529177*scale)) +xyzFile.close()