Commit 6672ac59 authored by Sergey Kireev's avatar Sergey Kireev
Browse files

scripts updated

parent 5a0c6ed1
#!/bin/bash
source ./do_parameters.sh
fromdir="dat_${nt}"
todir="png2d_${nt}"
[ ! -d ${fromdir} ] && { echo "Directory ${fromdir} does not exist!" ; exit ; }
[ -d ${todir} ] && { echo "Terget directory ${todir} already exist!" ; exit ; }
mkdir ${todir}
LC_NUMERIC="en_US.UTF-8"
count=0
for (( en100=${minn}; en100 <= ${maxn}; en100 += ${step} )); do
en1=`echo "scale=2; ${en100}/100" | bc`
en=`printf "%04.2f" ${en1}`
val[$count]=$en
count=$((count + 1))
done
for inn in `seq 0 $((count - 1))`; do
echo "en:" ${val[$inn]}
enn=${val[$inn]}
inls=`seq 0 $inn`
nls=`for i in $inls; do echo -n "${val[$i]} "; done`
ills=`seq 0 $inn`
lls=`for i in $ills; do echo -n "${val[$i]} "; done`
target="${todir}/en${enn}_enl_el"
#echo " nls: ${nls[*]}"
#echo " lls: ${lls[*]}"
gnuplot -e "name=\"${target}\"; nx=${nx}; ny=${ny}; ppp=${ppp}; \
rows=\"${nls}\"; cols=\"${lls}\"; rlabel=\"e_{nl}=\"; clabel=\"e_{l}=\"; \
format=\"${fromdir}/en${enn}_enl%s_el%s${suffix}\";" $script_png2d
# [ ! -d ${todir} ] && mkdir ${todir}
# mv ${name}.png ${todir}/
done
for inl in `seq 0 $((count - 1))`; do
echo "enl:" ${val[$inl]}
enl=${val[$inl]}
inns=`seq $inl $((count - 1))`
nns=`for i in $inns; do echo -n "${val[$i]} "; done`
ills=`seq 0 $inl`
lls=`for i in $ills; do echo -n "${val[$i]} "; done`
target="${todir}/en_enl${enl}_el"
#echo " nns: ${nns[*]}"
#echo " lls: ${lls[*]}"
gnuplot -e "name=\"${target}\"; nx=${nx}; ny=${ny}; ppp=${ppp}; \
rows=\"${nns}\"; cols=\"${lls}\"; rlabel=\"e_{n}=\"; clabel=\"e_{l}=\"; \
format=\"${fromdir}/en%s_enl${enl}_el%s${suffix}\";" $script_png2d
# [ ! -d ${todir} ] && mkdir ${todir}
# mv ${name}.png ${todir}/
done
for ill in `seq 0 $((count - 1))`; do
echo "el:" ${val[$ill]}
ell=${val[$ill]}
inls=`seq $ill $((count - 1))`
nls=`for i in $inls; do echo -n "${val[$i]} "; done`
inns=`seq $ill $((count - 1))`
nns=`for i in $inns; do echo -n "${val[$i]} "; done`
target="${todir}/en_enl_el${ell}"
#echo " nns: ${nns[*]}"
#echo " nls: ${nls[*]}"
gnuplot -e "name=\"${target}\"; nx=${nx}; ny=${ny}; ppp=${ppp}; \
rows=\"${nns}\"; cols=\"${nls}\"; rlabel=\"e_{n}=\"; clabel=\"e_{nl}=\"; \
format=\"${fromdir}/en%s_enl%s_el${ell}${suffix}\";" $script_png2d
# [ ! -d ${todir} ] && mkdir ${todir}
# mv ${name}.png ${todir}/
done
#!/bin/bash
source ./do_parameters.sh
renew=1
fromdir=${rootdir}/${datdir}
todir="dat_${nt}"
[ ! -d ${fromdir} ] && { echo "Directory ${fromdir} does not exist!" ; exit ; }
if [ $renew -ne 0 ]; then
[ -d ${todir} ] || mkdir ${todir}
else
[ -d ${todir} ] && { echo "Terget directory ${todir} already exist!" ; exit ; }
mkdir ${todir}
fi
tmpdir=$(mktemp -d)
echo $tmpdir
trap "rm -r $tmpdir" SIGINT SIGTERM
echo "Extracting $suffix files..."
init_iteration
while next_iteration; do
name=$(get_name)
datname=${name}_dat
dattgzfile=${fromdir}/$datname.tgz
target=$todir/${name}${suffix}
if [[ -f $dattgzfile ]]; then
[[ $renew -ne 0 && -f $target ]] && continue
filename=`printf "%s%08d%s" ${prefix} ${nt} ${suffix}`
tmpdatname=${datname}/${filename}
#echo "|$name|$datname|$dattgzfile|$filename|$tmpdatname|"
#echo "tar -C $tmpdir -xzf $dattgzfile $tmpdatname"
#echo "Extract file $tmpdatname from $dattgzfile to $tmpdir"
tar -C $tmpdir -xzf $dattgzfile $tmpdatname || { echo "tar -C $tmpdir -xzf $dattgzfile $tmpdatname : failed!"; exit; }
#echo "mv $tmpdir/$tmpdatname -> $target"
mv $tmpdir/$tmpdatname $target
rmdir $tmpdir/$datname
fi
done
rm -r $tmpdir
#!/bin/bash
source ./do_parameters.sh
renew=1
#nt=6400
fromdir=${rootdir}/${datdir}
todir=${rootdir}/png_${nt}
[ ! -d ${fromdir} ] && { echo "Directory ${fromdir} does not exist!" ; exit ; }
[ ! -d ${todir} ] && mkdir ${todir}
filename=`printf "%s%08d%s" ${prefix} ${nt} ${suffix}`
tmpdir=$(mktemp -d)
init_iteration
while next_iteration; do
name=$(get_name)
datname=${name}_dat
dattgzfile=${fromdir}/${datname}.tgz
tmpdatname=${datname}/${filename}
targetfile=${todir}/${datname}.png
if [[ -f $dattgzfile && ( $renew == 1 || !( -f $targetfile ) ) ]]; then
echo $name
title=$(get_title)
tar -C $tmpdir -xzf $dattgzfile ${tmpdatname} || { echo "tar -C $tmpdir -xzf $dattgzfile ${tmpdir}/${tmpdatname} : failed!"; exit; }
#mv ${tmpdatname} $targetfile
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts};
name=\"${tmpdir}/${tmpdatname}\";
title=\"${title}\"; sx=${pic_size_x}; sy=${pic_size_y};
colorn=\"${colorN}\"; colorl=\"${colorL}\"; colore=\"${colorE}\"" ${script_png}
# name=\"${fromdir}/${datname}\";
mv -f ${tmpdir}/${tmpdatname}.png $targetfile
rm ${tmpdir}/${tmpdatname}
rmdir ${tmpdir}/${datname}
fi
done
rmdir $tmpdir
......@@ -6,15 +6,15 @@
#export nle_args="-mgslog mgs.txt -sg"
# Cell geometry: square/hex
export cell=square
# Cell geometry: sqr4/sqr8/hex
export cell="sqr8"
# Nanocrystal size
export nsize=3
# Array sizes
export nx=500
export ny=500
export nx=400
export ny=400
# Number of simulation steps
export nt=100000
......@@ -72,34 +72,34 @@ export pngfindir="png_${nt}"
export executable="../../src/nle"
export gnuplot_scripts_dir="../gnuplot"
export mindl=20
export maxdl=480
export mindn=20
export maxdn=480
#export mindl=20
#export maxdl=480
#export mindn=20
#export maxdn=480
export step=20
#export min=0
#export max=500
export min=0
export max=500
#export minl=20
#export maxl=20
#export minnl=60
#export maxnl=60
#export minn=239
#export maxn=239
export minl=${min}
export maxl=${max}
export minnl=${min}
export maxnl=${max}
export minn=${min}
export maxn=${max}
#pixels per picture (for 2D) 500x500 : 251
export ppp=251
export ppp=201
################################################################################
LC_NUMERIC="en_US.UTF-8"
#get_name() { echo "en${en}_enl${enl}_el${el}"; }
#get_title() { echo "e_n=${en} e_{nl}=${enl} e_l=${el} Step: "; }
get_name() { echo "en${en}_enl${enl}_el${el}"; }
get_title() { echo "e_n=${en} e_{nl}=${enl} e_l=${el} Step: "; }
get_name() { echo "dn${dn}_dl${dl}"; }
get_title() { echo "e_n-e_{nl}=${dn} e_{nl}-e_l=${dl} Step: "; }
#get_name() { echo "dn${dn}_dl${dl}"; }
#get_title() { echo "e_n-e_{nl}=${dn} e_{nl}-e_l=${dl} Step: "; }
post_run() { true; }
#get_name() { echo "en${en}_enl${enl}_el${el}_ipn${ipn}"; }
......@@ -120,46 +120,55 @@ loop3_check() { (( el100 <= maxl )); return $?; }
loop3_next() { (( el100 += step )); }
loop_ipn_init() { (( ipn100 = min )); }
loop_ipn_check() { (( ipn100 <= max )); return $?; }
loop_ipn_next() { (( ipn100 += step )); }
#loop_ipn_init() { (( ipn100 = min )); }
#loop_ipn_check() { (( ipn100 <= max )); return $?; }
#loop_ipn_next() { (( ipn100 += step )); }
loop1_dnl_init() { (( dn100 = mindn )); loop2_dnl_init; }
loop1_dnl_check() { loop2_dnl_check; (( !$? && dn100 <= maxdn )); return $?; }
loop1_dnl_next() { loop2_dnl_next; if !(loop2_dnl_check); then (( dn100 += step )); loop2_dnl_init; fi; }
#loop1_dnl_init() { (( dn100 = mindn )); loop2_dnl_init; }
#loop1_dnl_check() { loop2_dnl_check; (( !$? && dn100 <= maxdn )); return $?; }
#loop1_dnl_next() { loop2_dnl_next; if !(loop2_dnl_check); then (( dn100 += step )); loop2_dnl_init; fi; }
loop2_dnl_init() { (( dl100 = mindl )); }
loop2_dnl_check() { (( dl100 <= maxdl )); return $?; }
loop2_dnl_next() { (( dl100 += step )); }
#loop2_dnl_init() { (( dl100 = mindl )); }
#loop2_dnl_check() { (( dl100 <= maxdl )); return $?; }
#loop2_dnl_next() { (( dl100 += step )); }
check_iteration() { (( el100 <= enl100 && enl100 <= en100 )); return $?; }
#check_iteration() { (( el100 < enl100 && enl100 < en100 )); return $?; }
check_iteration() { return 0; }
init_iteration() { loop1_dnl_init; first_iteration=1; }
#check_iteration() { return 0; }
init_iteration() { loop1_init; first_iteration=1; }
next_iteration() {
if (( !first_iteration )); then
loop1_dnl_next
loop1_next
else
first_iteration=0
fi
if !(loop1_dnl_check); then return 1; fi
if !(loop1_check); then return 1; fi
while !(check_iteration); do
loop1_dnl_next
if !(loop1_dnl_check); then return 1; fi
loop1_next
if !(loop1_check); then return 1; fi
done
LC_NUMERIC="en_US.UTF-8"
local dl1=`echo "scale=2; ${dl100}/100" | bc`
local dn1=`echo "scale=2; ${dn100}/100" | bc`
dl=`printf "%04.2f" ${dl1}`
dn=`printf "%04.2f" ${dn1}`
el100=0
# local dl1=`echo "scale=2; ${dl100}/100" | bc`
# local dn1=`echo "scale=2; ${dn100}/100" | bc`
# dl=`printf "%04.2f" ${dl1}`
# dn=`printf "%04.2f" ${dn1}`
# el100=0
# local el1=`echo "scale=2; ${el100}/100" | bc`
# local enl1=`echo "scale=2;(${el100}+${dl100})/100" | bc`
# local en1=`echo "scale=2; (${el100}+${dl100}+${dn100})/100" | bc`
# en=`printf "%04.2f" ${en1}`
# enl=`printf "%04.2f" ${enl1}`
# el=`printf "%04.2f" ${el1}`
local en1=`echo "scale=2; ${en100}/100" | bc`
local enl1=`echo "scale=2; ${enl100}/100" | bc`
local el1=`echo "scale=2; ${el100}/100" | bc`
local enl1=`echo "scale=2;(${el100}+${dl100})/100" | bc`
local en1=`echo "scale=2; (${el100}+${dl100}+${dn100})/100" | bc`
en=`printf "%04.2f" ${en1}`
enl=`printf "%04.2f" ${enl1}`
el=`printf "%04.2f" ${el1}`
# local ipn1=`echo "scale=2; ${ipn100}/100" | bc`
# local ipl1=`echo "scale=2; (100-${ipn100})/100" | bc`
# ipn=`printf "%04.2f" ${ipn1}`
......@@ -169,8 +178,11 @@ next_iteration() {
################################################################################
if [ "$cell" != "hex" ]; then
cell="square"
if [[ "$cell" != "hex" ]] && [[ "$cell" != "sqr8" ]]; then
cell="sqr4"
fi
if [[ "$cell" == "sqr4" ]] || [[ "$cell" == "sqr8" ]]; then
script_gif="${gnuplot_scripts_dir}/make_gif_sqr.plt"
script_png="${gnuplot_scripts_dir}/make_png_sqr.plt"
script_png2d="${gnuplot_scripts_dir}/make_png2d_sqr.plt"
......
......@@ -17,9 +17,12 @@ while next_iteration; do
name=$(get_name)
namepng=${name}_png
namedat=${name}_dat
namedattgz=${namedat}.tgz
title=$(get_title)
echo ${name}
[ -f $datdir/${namedattgz} ] && continue
#continue
# Run simulation
......@@ -60,7 +63,7 @@ while next_iteration; do
[ ! -d $datdir/${namedat} ] && mkdir $datdir/${namedat}
mv ${prefix}*${suffix} $datdir/${namedat}/
cd $datdir
tar czf ${namedat}.tgz ${namedat} && rm -r ${namedat}
tar czf ${namedattgz} ${namedat} && rm -r ${namedat}
cd ..
# Check if group data exists
......
#include "ca2d.h"
// TODO: check what parameter values are set (use LOG to print in constructors, setData(), etc.)
#define LOG 1
#define LOG 0
#define logfn(C,X) if (LOG) fprintf(stderr,"%s::%s(%s)\n",C,__FUNCTION__,X)
......@@ -1501,7 +1501,7 @@ class NLE_hex_CA : public NLE_CA_base<hood_hex> {
count[1] = snl;
count[2] = sll;
}
virtual double count_dH_move_NL(int bx,int by,int dir) {
double dH = 0;
for (int i=0;i<st[dir].size();i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment