Commit b3771653 authored by Sergey Kireev's avatar Sergey Kireev
Browse files

scripts updated, scripts for windows added

parent 6a6c12b5
......@@ -40,7 +40,7 @@ unset colorbox
fmt=prefix."%08d".suffix
do for [it=nt0:nt:nts] {
do for [it=nt0:nt0+nt:nts] {
str=sprintf(fmt,it);
tit=sprintf("%s%08d",title,it)
set title tit
......
......@@ -39,7 +39,7 @@ unset colorbox
fmt=prefix."%08d".suffix
do for [it=nt0:nt:nts] {
do for [it=nt0:nt0+nt:nts] {
str=sprintf(fmt,it);
tit=sprintf("%s%08d",title,it)
set title tit
......
......@@ -43,7 +43,7 @@ if (exists("name")) {
plot name binary array=(2*nx+1,ny) format="%d" with image
} else {
if (!exists("format")) { format=prefix."%08d".suffix }
do for [it=nt0:nt:nts] {
do for [it=nt0:nt0+nt:nts] {
str=sprintf(format,it);
set output str.".png"
tit=sprintf("%s%08d",title,it)
......
......@@ -42,7 +42,7 @@ if (exists("name")) {
plot name binary array=(nx,ny) format="%d" with image
} else {
if (!exists("format")) { format=prefix."%08d".suffix }
do for [it=nt0:nt:nts] {
do for [it=nt0:nt0+nt:nts] {
str=sprintf(format,it);
set output str.".png"
tit=sprintf("%s%08d",title,it)
......
#!/bin/bash
initial_step=0
# Check command line parameters
if [ $# -lt 1 ]; then
echo "Usage: $0 <filename> [<initial_step_number>]"
exit
fi
file_to_load=$1
if [ $# -gt 1 ]; then
initial_step=$2
fi
initial_step=0
if [ $# -gt 1 ]; then initial_step=$2; fi
echo "File to load: $file_to_load Initial step: ${initial_step}"
......@@ -30,37 +28,31 @@ if [ ! -x $executable ]; then
exit
fi
# Set cell geometry
if [ "$cell" != "hex" ]; then
cell="square"
script_png="$scripts_dir/make_png_sqr.plt"
script_gif="$scripts_dir/make_gif_sqr.plt"
else
script_png="$scripts_dir/make_png_hex.plt"
script_gif="$scripts_dir/make_gif_hex.plt"
fi
echo "Name: ${name}"
mkdir $name
cp ./parameters.sh $name/
mv $file_to_load $name/
# Run simulation
./${executable} -nx $nx -ny $ny -nt $nt -nts $nts -ntp $ntp -nsize $nsize -$cell \
-en $en -el $el -enl $enl -kt $kt -mu $mu -evap $evap -cond $cond \
-ipn $ipn -ipl $ipl -ipe $ipe \
-load $file_to_load -it $initial_step \
-ofp $prefix -ofs $suffix | tee ${name}/${name}.txt
-en $en -el $el -enl $enl -kt $kt -mu $mu -evap $evap -cond $cond -g $pgroup \
-ipn $ipn -ipl $ipl -ipe $ipe -ofp $prefix -ofs $suffix \
-load $name/$file_to_load -it $initial_step \
${nle_args} | tee ${name}/${name}.txt
# check exit code
[ ${PIPESTATUS[0]} -eq 0 ] || { rm -r $name ; exit ; }
[ ${PIPESTATUS[0]} -eq 0 ] || { mv $name/$file_to_load . ; rm -r $name ; exit ; }
echo "Making gif..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
colorn=\"${colorN}\"; colorl=\"${colorL}\"; colore=\"${colorE}\"" ${script_gif}
mv ${prefix}.gif ${name}/${name}.gif
echo "Making png..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
colorn=\"${colorN}\"; colorl=\"${colorL}\"; colore=\"${colorE}\"" ${script_png}
......@@ -70,3 +62,4 @@ mv *.png ${name}/png
echo "Moving dat..."
[ ! -d ${name}/dat ] && mkdir ${name}/dat
mv *.dat ${name}/dat
mv $name/$file_to_load .
......@@ -19,14 +19,14 @@ fi
cd ${name}/dat
echo "Making gif..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
colorn=\"${colorN}\"; colorl=\"${colorL}\"; colore=\"${colorE}\"" ../../${script_gif}
mv -f ${prefix}.gif ../${name}.gif
echo "Making png..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
colorn=\"${colorN}\"; colorl=\"${colorL}\"; colore=\"${colorE}\"" ../../${script_png}
......
......@@ -21,14 +21,14 @@ fi
cd ${name}/dat
echo "Making gif..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
defaultpalette=1" ../../${script_gif}
mv -f ${prefix}.gif ../${name}.group.gif
echo "Making png..."
gnuplot -e "nx=${nx}; ny=${ny}; nt=${initial_step}+${nt}; nts=${nts}; nt0=${initial_step};
gnuplot -e "nx=${nx}; ny=${ny}; nt=${nt}; nts=${nts}; nt0=${initial_step};
prefix=\"${prefix}\"; suffix=\"${suffix}\";
title=\"${pic_title}\"; sx=${pic_size_x}; sy=${pic_size_y};
defaultpalette=1" ../../${script_png}
......
......@@ -5,7 +5,7 @@
#------------------------------------------------------------
# Additional program arguments
#export nle_args="-sg -fd"
#export nle_args="-gstlog gst.txt -gstmin 10"
# Name of the run
export name="run01"
......
......@@ -5,7 +5,7 @@ source ./parameters.sh
# Check if directory with the same name exist
if [ -d $name ]; then
echo "Directory '$name' already exist!"
echo "Delete or rename it, or change the name in the top of the $0 file."
echo "Delete or rename it, or change the name in the top of the 'parameters.sh' file."
exit
fi
......@@ -17,13 +17,14 @@ if [ ! -x $executable ]; then
fi
echo "Name: ${name}"
mkdir $name
mkdir ${name}
cp ./parameters.sh ${name}
# Run simulation
${executable} -nx $nx -ny $ny -nt $nt -nts $nts -ntp $ntp -nsize $nsize -$cell \
-en $en -el $el -enl $enl -kt $kt -mu $mu -evap $evap -cond $cond -g $pgroup \
-ipn $ipn -ipl $ipl -ipe $ipe -ofp $prefix -ofs $suffix \
${nle_args} | tee ${name}/${name}.txt
./${executable} -nx $nx -ny $ny -nt $nt -nts $nts -ntp $ntp -nsize $nsize -$cell \
-en $en -el $el -enl $enl -kt $kt -mu $mu -evap $evap -cond $cond -g $pgroup \
-ipn $ipn -ipl $ipl -ipe $ipe -ofp $prefix -ofs $suffix \
${nle_args} | tee ${name}/${name}.txt
# check exit code
[ ${PIPESTATUS[0]} -eq 0 ] || { rm -r $name ; exit ; }
......
@call set_path.bat
@set SRCDIR=../src
@set TARGET=%SRCDIR%/nle.exe
@g++ -std=c++17 -O3 -march=native -I%SRCDIR% -o %TARGET% %SRCDIR%/main.cpp %SRCDIR%/param.cpp
@if exist %TARGET% ( echo Done! ) else ( echo Failed! )
@echo off
rem Check command line parameters
set cnt=0
for %%a in (%*) do set /a cnt+=1
if %cnt% lss 1 (
echo Usage: %0 ^<filename^> [^<initial_step_number^>]
exit
)
set file_to_load=%1
set initial_step=0
if %cnt% gtr 1 set initial_step=%2
echo File to load: %file_to_load% Initial step: %initial_step%
call ../set_path.bat
call parameters.bat
rem Check if directory with the same name exist
if exist %name% (
echo Directory '%name%' already exist!
echo Delete or rename it, or change the name in the 'parameters.bat' file.
exit
)
rem Check if executable is present
if not exist %executable% (
echo Error: executable file '%executable%' not found!
echo Please, run \"../build_nle.bat\" to built the executable.
exit
)
echo Name: %name%
mkdir %name%
copy parameters.bat %name% >NUL
move %file_to_load% %name%\ >NUL
rem Run simulation
%executable% -nx %nx% -ny %ny% -nt %nt% -nts %nts% -ntp %ntp% -nsize %nsize% -%cell% ^
-en %en% -el %el% -enl %enl% -kt %kt% -mu %mu% -evap %evap% -cond %cond% -g %pgroup% ^
-ipn %ipn% -ipl %ipl% -ipe %ipe% -ofp %prefix% -ofs %suffix% ^
-load %name%/%file_to_load% -it %initial_step% ^
%nle_args%
if %errorlevel% neq 0 (
move %name%/%file_to_load% %file_to_load%
echo Error!
exit
)
echo Making gif...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" %script_gif%
move %prefix%.gif %name%/%name%.gif >NUL
echo Making png...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" %script_png%
if not exist %name%\png mkdir %name%\png
move *.png %name%/png >NUL
echo Moving dat...
if not exist %name%\dat mkdir %name%\dat
move *.dat %name%\dat >NUL
move %name%\%file_to_load% %file_to_load% >NUL
@echo off
rem Check command line parameters
set cnt=0
for %%a in (%*) do set /a cnt+=1
set initial_step=0
if %cnt% gtr 0 set initial_step=%1
echo Initial step: %initial_step%
call ../set_path.bat
call parameters.bat
rem Check if directory with the same name exist
if not exist %name% (
echo Directory '%name%' does not exist!
exit
)
cd %name%\dat
echo Making gif...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" ..\..\%script_gif%
move %prefix%.gif ..\%name%.gif >NUL
echo Making png...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" ..\..\%script_png%
if not exist ..\png mkdir ..\png
move *.png ..\png >NUL
cd ../..
@echo off
rem Check command line parameters
set cnt=0
for %%a in (%*) do set /a cnt+=1
set initial_step=0
if %cnt% gtr 0 set initial_step=%1
echo Initial step: %initial_step%
call ../set_path.bat
call parameters.bat
set prefix=group
set suffix=.dat
rem Check if directory with the same name exist
if not exist %name% (
echo Directory '%name%' does not exist!
exit
)
cd %name%\dat
echo Making gif...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"; defaultpalette=1" ..\..\%script_gif%
move %prefix%.gif ..\%name%.group.gif >NUL
echo Making png...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=%initial_step%; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"; defaultpalette=1" ..\..\%script_png%
if not exist ..\png.group mkdir ..\png.group
move *.png ..\png.group >NUL
cd ../..
@echo off
rem ------------------------------------------------------------
rem Simulation parameters
rem ------------------------------------------------------------
rem Additional program arguments
rem set nle_args=-gstlog gst.txt -gstmin 10
rem Name of the run
set name=run01
rem Cell geometry: sqr4/sqr8/hex
set cell=sqr8
rem Nanocrystal size
set nsize=3
rem Array sizes
set nx=300
set ny=300
rem Number of simulation steps
set nt=10000
rem Steps between saving to file
set nts=100
rem Steps between printing output
set ntp=1000
rem Model parameters
set en=3.4
set enl=3.4
set el=2.8
set kt=1.0
set mu=-2.25
rem Probabitity of evaporation and condensation
set evap=0.0
set cond=0.0
rem Probability of group movement
set pgroup=0.0
rem Initial fraction of N,L,E
set ipn=0.4
set ipl=0.6
set ipe=0.0
rem Parts of the names of the output files
set prefix=data
set suffix=.dat
rem Picture sizes, pixels
set pic_size_x=698
set pic_size_y=698
rem Picture colors (https://www.google.ru/search?q=gnuplot+color+names)
set colorN=yellow
set colorL=#b52000
set colorE=black
rem Picture title
set pic_title=e_n=%en% e_{nl}=%enl% e_l=%el% Step:
rem Directories
set executable="../../src/nle.exe"
set gnuplot_scripts_dir=../../scripts/gnuplot
rem ###############################################################################
if %cell% == hex6 set cell=hex
if %cell% neq hex if %cell% neq sqr8 set cell=sqr4
if %cell% == sqr4 (
set script_gif=%gnuplot_scripts_dir%/make_gif_sqr.plt
set script_png=%gnuplot_scripts_dir%/make_png_sqr.plt
) else (
if %cell% == sqr8 (
set script_gif=%gnuplot_scripts_dir%/make_gif_sqr.plt
set script_png=%gnuplot_scripts_dir%/make_png_sqr.plt
) else (
set script_gif=%gnuplot_scripts_dir%/make_gif_hex.plt
set script_png=%gnuplot_scripts_dir%/make_png_hex.plt
)
)
@echo off
call ../set_path.bat
call parameters.bat
rem Check if directory with the same name exist
if exist %name% (
echo Directory '%name%' already exist!
echo Delete or rename it, or change the name in the 'parameters.bat' file.
exit
)
rem Check if executable is present
if not exist %executable% (
echo Error: executable file '%executable%' not found!
echo Please, run \"../build_nle.bat\" to built the executable.
exit
)
echo Name: %name%
mkdir %name%
copy parameters.bat %name% >NUL
rem Run simulation
%executable% -nx %nx% -ny %ny% -nt %nt% -nts %nts% -ntp %ntp% -nsize %nsize% -%cell% ^
-en %en% -el %el% -enl %enl% -kt %kt% -mu %mu% -evap %evap% -cond %cond% -g %pgroup% ^
-ipn %ipn% -ipl %ipl% -ipe %ipe% -ofp %prefix% -ofs %suffix% ^
%nle_args%
if %errorlevel% neq 0 (
echo Error!
exit
)
echo Making gif...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=0; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" %script_gif%
move %prefix%.gif %name%/%name%.gif >NUL
echo Making png...
gnuplot -e "nx=%nx%; ny=%ny%; nt=%nt%; nts=%nts%; nt0=0; prefix=\"%prefix%\"; suffix=\"%suffix%\"; title=\"%pic_title%\"; sx=%pic_size_x%; sy=%pic_size_y%; colorn=\"%colorN%\"; colorl=\"%colorL%\"; colore=\"%colorE%\"" %script_png%
if not exist %name%\png mkdir %name%\png
move *.png %name%/png >NUL
echo Moving dat...
if not exist %name%\dat mkdir %name%\dat
move *.dat %name%\dat >NUL
@PATH=%PATH%;C:\mingw64\bin;C:\Program Files\gnuplot\bin
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