Skip to content

Commit

Permalink
Merge pull request #214 from mariavd/scripts-update
Browse files Browse the repository at this point in the history
Scripts bug fixes
  • Loading branch information
heikef committed Feb 13, 2019
2 parents 5b59069 + 4c59e96 commit 554d8e6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion jobscripts/src/crit_pts.sh.in
Expand Up @@ -161,7 +161,7 @@ x0z=$(A2bohr ${crd0[2]})
x1z=$(A2bohr ${crd1[2]})
dz=$(awk -v z0=$x0z -v z1=$x1z 'BEGIN{dz = z0-z1; print dz;}')

echo dz = $dz
#echo dz = $dz

length=$( echo $x0A $x1A | point_dist )
length=$(A2bohr $length)
Expand Down
60 changes: 32 additions & 28 deletions jobscripts/src/current-profile-header
Expand Up @@ -30,6 +30,35 @@ function createInpTemplate()
fi
}

function printSummary() {
cat /dev/null > ./$dirname/calculation.dat
echo atom1=$atom1 >> ./$dirname/calculation.dat
echo atom2=$atom2 >> ./$dirname/calculation.dat
echo distance=$distance >> ./$dirname/calculation.dat
echo in=$start out=$out up=$up down=$down >> ./$dirname/calculation.dat
echo fixed point: Fx=$Fx Fy=$Fy Fz=$Fz >> ./$dirname/calculation.dat
echo delta=$delta nsteps=$nsteps >> ./$dirname/calculation.dat
#echo spacing: spacingX=$spacingX spacingY=$spacingY spacingZ=$spacingZ >> ./$dirname/calculation.dat
echo spacing: spacingX=$spacingX spacingY=$spacingY >> ./$dirname/calculation.dat
echo magnetic field: MFx=$MFx MFy=$MFy MFz=$MFz >> ./$dirname/calculation.dat
echo rotation angles: rotX=$rotX rotY=$rotY rotZ=$rotZ >> ./$dirname/calculation.dat

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

printf "\n\n*****************************************************************************\n\nSUMMARY\n\n"
printf "Bond: ["$bond"], distance = $distance\n\n"
echo "Integration plane coordinates"
printf "in = $start out = $out up = $up down = $down \n"
printf "Split into $nsteps slices with width $delta and grid spacing [$spacingX; $spacingY] \n"
printf "Fixed coordinate: ( $Fx; $Fy; $Fz )\n"
printf "Magnetic field direction: ( $MFx; $MFy; $MFz ) \n"
printf "Rotation angles: ( $rotX; $rotY; $rotZ ) \n\n"

printf "\n*****************************************************************************\n\n"
}

checkGimic

checkIfInputExists

printf "\nSTARTING CURRENT PROFILE ANALYSIS\n"
Expand Down Expand Up @@ -312,31 +341,7 @@ then
fi
fi


cat /dev/null > ./$dirname/calculation.dat
echo atom1=$atom1 >> ./$dirname/calculation.dat
echo atom2=$atom2 >> ./$dirname/calculation.dat
echo distance=$distance >> ./$dirname/calculation.dat
echo in=$start out=$out up=$up down=$down >> ./$dirname/calculation.dat
echo fixed point: Fx=$Fx Fy=$Fy Fz=$Fz >> ./$dirname/calculation.dat
echo delta=$delta nsteps=$nsteps >> ./$dirname/calculation.dat
#echo spacing: spacingX=$spacingX spacingY=$spacingY spacingZ=$spacingZ >> ./$dirname/calculation.dat
echo spacing: spacingX=$spacingX spacingY=$spacingY >> ./$dirname/calculation.dat
echo magnetic field: MFx=$MFx MFy=$MFy MFz=$MFz >> ./$dirname/calculation.dat
echo rotation angles: rotX=$rotX rotY=$rotY rotZ=$rotZ >> ./$dirname/calculation.dat

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

printf "\n\n*****************************************************************************\n\nSUMMARY\n\n"
printf "Bond: ["$bond"], distance = $distance\n\n"
echo "Integration plane coordinates"
printf "in = $start out = $out up = $up down = $down \n"
printf "Split into $nsteps slices with width $delta and grid spacing [$spacingX; $spacingY] \n"
printf "Fixed coordinate: ( $Fx; $Fy; $Fz )\n"
printf "Magnetic field direction: ( $MFx; $MFy; $MFz ) \n"
printf "Rotation angles: ( $rotX; $rotY; $rotZ ) \n\n"

printf "\n*****************************************************************************\n\n"
printSummary # print to stdout and to calculation.dat


# Preparing the input files
Expand Down Expand Up @@ -379,11 +384,9 @@ do
# gimic.0.inp already exists; create gimic.$last.inp
start_last=$( awk -v xstart=$xstart -v delta=$delta -v nsteps=$nsteps 'BEGIN{ last = xstart + delta*nsteps; print last }')
checkIfEmpty start_last $start_last
echo "start_last = " $start_last

end_last=$( awk -v start_last=$start_last -v delta=$delta 'BEGIN{ end = start_last + delta; print end }')
checkIfEmpty xend_last $end_last
echo "end_last = " $end_last

lstring="s/@up@/$up/; s/@down@/$down/; s/@start@/$start_last/; s/@end@/$end_last/"
sed -e "$lstring" ./$dirname/gimic.Inp > ./$dirname/gimic.last.inp
Expand All @@ -404,7 +407,8 @@ do

if [ -z $accept ]
then
echo "skipping further plane checks and dry runs"
echo "Skipping further plane checks and dry runs"
printSummary
checkPlane=""
doDryRun=""
elif [ $accept == "y" ]
Expand Down
7 changes: 6 additions & 1 deletion jobscripts/src/functions-def
Expand Up @@ -206,6 +206,11 @@ function checkIfPreviousCalculationExists() {
}


function checkGimic() {
command -v gimic >/dev/null 2>&1 || { echo >&2 "GIMIC not found. Load the module or check your \$PATH."; exit 1; }
}


function calculateFixedCoord() {
# calculate the rotation matrix for 2D rotation with respect to the z axis such that the rotation will be counterclockwise
# multiply the vector originating at (0;0;A2z) and ending at the second atom with coords (A2x; A2y; A2z).
Expand Down Expand Up @@ -284,7 +289,7 @@ function planeSanityCheck() {
#$last=$( (cd ./$dirname/ && find . -maxdepth 1 -type f -name '*.inp' | wc -l ) )
#$last=$(( $last -1 ))
#$checkIfEmpty last $last
(cd ./$dirname/ && gimic --dryrun gimic.last.inp > /dev/null )
(cd ./$dirname/ && gimic --dryrun gimic.last.inp > /dev/null && rm -rf gimic.last.inp )

# take the coords of the end of the int plane
grep X ./$dirname/grid.xyz | awk '{ if (NR <=2) {print $0} }' >> ./$dirname/grid.check.xyz
Expand Down
5 changes: 5 additions & 0 deletions jobscripts/src/jobscript.IN
Expand Up @@ -26,6 +26,11 @@ echo "SLURM_JOB_ID is" $SLURM_JOB_ID
echo
echo "Current profile calculation"

# parallelization is ensured in a poor man's way
export OMP_NUM_THREADS=1

module load gimic

wrkdir=$( echo $1 )
checkIfEmpty wrkdir $wrkdir

Expand Down

0 comments on commit 554d8e6

Please sign in to comment.