if [ "$?" == "0" ]; then
#./perms
if [ "$1" ] ; then
- ./visualize $1
+ ./visualize -d $1
#rasmol -32 -nodisplay < $1/visualize.scr > /dev/null 2>&1
./ppm2avi $1
fi
#define NR_ATOMS 1
#define R_C 1.0
#define T_C 10.0
-#define LCNT 3
+#define LCNT 5
+#define PRERUN 200
+#define POSTRUN 500
typedef struct s_hp {
int a_count; /* atom count */
/* last schedule add if there is enough carbon inside */
if(hp->a_count==(INJECT*NR_ATOMS)) {
hp->quit=1;
- moldyn_add_schedule(md,5000,1.0);
+ moldyn_add_schedule(md,POSTRUN,1.0);
return 0;
}
for(j=0;j<NR_ATOMS;j++) {
run=1;
while(run) {
+ /*
r.x=(rand_get_double(&(md->random))-0.5)*md->dim.x*0.37;
r.y=(rand_get_double(&(md->random))-0.5)*md->dim.y*0.37;
r.z=(rand_get_double(&(md->random))-0.5)*md->dim.z*0.37;
- //r.x=(1.0*atoi(hp->argv[3])-4.5)/9.0*ALBE_LC_SI;
- //r.y=(1.0*atoi(hp->argv[4])-4.5)/9.0*ALBE_LC_SI;
- //r.z=(1.0*atoi(hp->argv[5])-4.5)/9.0*ALBE_LC_SI;
+ r.x=(1.0*atoi(hp->argv[3])-4.5)/9.0*ALBE_LC_SI;
+ r.y=(1.0*atoi(hp->argv[4])-4.5)/9.0*ALBE_LC_SI;
+ r.z=(1.0*atoi(hp->argv[5])-4.5)/9.0*ALBE_LC_SI;
+ */
+ r.x=(rand_get_double(&(md->random))-0.5)*LC_SI;
+ r.y=(rand_get_double(&(md->random))-0.5)*LC_SI;
+ r.z=(rand_get_double(&(md->random))-0.5)*LC_SI;
/* assume valid coordinates */
run=0;
for(i=0;i<md->count;i++) {
t_tersoff_mult_params tp;
t_albe_mult_params ap;
- /* atom injection counter */
- int inject;
-
/* testing location & velocity vector */
t_3dvec r,v;
memset(&r,0,sizeof(t_3dvec));
set_pressure(&md,BAR);
/* set amount of steps to skip before average calc */
- set_avg_skip(&md,1000);
+ set_avg_skip(&md,PRERUN);
/* set p/t scaling */
//set_pt_scale(&md,0,0,T_SCALE_BERENDSEN,100.0);
thermal_init(&md,TRUE);
/* create the simulation schedule */
- moldyn_add_schedule(&md,1000,1.0);
- //moldyn_add_schedule(&md,1000,1.0);
- //moldyn_add_schedule(&md,1000,1.0);
- //moldyn_add_schedule(&md,1000,1.0);
- //moldyn_add_schedule(&md,1000,1.0);
- //moldyn_add_schedule(&md,1000,1.0);
- /* adding atoms */
- //for(inject=0;inject<INJECT;inject++) {
- // /* injecting atoms */
- // moldyn_add_schedule(&md,10,1.0);
- //}
+ moldyn_add_schedule(&md,PRERUN,1.0);
/* schedule hook function */
memset(&hookparam,0,sizeof(t_hp));
#include "../math/math.h"
/* the pse, only needed here */
-static char *pse[]={
+static char *pse_name[]={
"*",
"H",
"He",
"Ar",
};
+static char *pse_col[]={
+ "*",
+ "White",
+ "He",
+ "Li",
+ "Be",
+ "B",
+ "Gray",
+ "N",
+ "Blue",
+ "F",
+ "Ne",
+ "Na",
+ "Mg",
+ "Al",
+ "Yellow",
+ "P",
+ "S",
+ "Cl",
+ "Ar",
+};
+
int visual_init(t_visual *v,char *filebase) {
char file[128+8];
strncpy(v->fb,filebase,128);
memset(file,0,128+8);
- sprintf(file,"%s/visualize.scr",v->fb);
+ //sprintf(file,"%s/visualize.scr",v->fb); // obsolete!
+ /* obsolete!
v->fd=open(file,O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR);
if(v->fd<0) {
perror("open visual fd");
return -1;
}
dprintf(v->fd,"set write on\n");
+ */
return 0;
}
int visual_tini(t_visual *v) {
+ /* obsolete!
if(v->fd) {
dprintf(v->fd,"quit\n");
close(v->fd);
}
+ */
return 0;
}
int i,fd;
char file[128+64];
t_3dvec dim;
+ double help;
dim.x=v->dim.x;
dim.y=v->dim.y;
dim.z=v->dim.z;
- //sprintf(file,"%s/visualize_%07.f.xyz",v->fb,time);
- sprintf(file,"%s/povray_%07.f.in",v->fb,time);
+ help=(dim.x+dim.y);
+
+ sprintf(file,"%s/atomic_conf_%07.f.xyz",v->fb,time);
fd=open(file,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
if(fd<0) {
perror("open visual save file fd");
}
/* script file update */
+ /* obsolete!
dprintf(v->fd,"load xyz %s\n",file);
dprintf(v->fd,"spacefill 200\n");
dprintf(v->fd,"rotate x 100\n");
sprintf(file,"%s/visualize_%07.f.ppm",v->fb,time);
dprintf(v->fd,"write ppm %s\n",file);
dprintf(v->fd,"zap\n");
+ */
/* write the actual data file */
//dprintf(fd,"%d\n",(dim.x==0)?n:n+8);
- dprintf(fd,"# [C] %d\n",n);
- dprintf(fd,"# [T] %07.f\n",time);
- dprintf(fd,"# [L] <%f,%f,%f>\n",-1.0*dim.x/4.0,
- 1.5*dim.y,1.5*dim.z);
+ dprintf(fd,"# [P] %d %07.f <%f,%f,%f>\n",
+ n,time,help/40.0,help/40.0,-0.8*help);
for(i=0;i<n;i++)
- dprintf(fd,"0.5 %f %f %f\n",atom[i].r.x,
- atom[i].r.y,
- atom[i].r.z);
+ dprintf(fd,"%s %f %f %f %s %f\n",pse_name[atom[i].element],
+ atom[i].r.x,
+ atom[i].r.y,
+ atom[i].r.z,
+ pse_col[atom[i].element],
+ atom[i].ekin);
if(dim.x) {
dprintf(fd,"# [D] %f %f %f %f %f %f\n",
-dim.x/2,-dim.y/2,-dim.z/2,
#!/bin/sh
-if [ ! -d $1 ] ; then
- echo "no such directory -> $1"
- exit
+#
+# visualization script
+# author: frank.zirkelbach@physik.uni-augsburg.de
+#
+
+directory="doesnt_exist____for_sure"
+width="1024"
+height="768"
+radius="1.0"
+x0=""; y0=""; z0="";
+x1=""; y1=""; z1="";
+cx=""; cy=""; cz="";
+lx="0"; ly="-100"; lz="100";
+
+while [ "$1" ]; do
+ case "$1" in
+ -d) directory=$2; shift 2;;
+ -w) width=$2; shift 2;;
+ -h) height=$2; shift 2;;
+ -r) radius=$2; shift 2;;
+ -nll) x0=$2; y0=$3; z0=$4; shift 4;;
+ -fur) x1=$2; y1=$3; z1=$4; shift 4;;
+ -c) cx=$2; cy=$3; cz=$4; shift 4;;
+ -l) lx=$2; ly=$3; lz=$4; shift 4;;
+ -o) ortographic=1; shift 1;;
+ *)
+ echo "options:"
+ echo "########"
+ echo "directory to progress:"
+ echo " -d <directory> (mandatory)"
+ echo "png dim:"
+ echo " -w <width>"
+ echo " -h <height>"
+ echo "atom size:"
+ echo " -r <radius>"
+ echo "visualization volume:"
+ echo " -nll <x> <y> <z> (near lower left)"
+ echo " -fur <x> <y> <z> (far upper right)"
+ echo " -o (ortographic)"
+ echo "povray:"
+ echo " -c <x> <y> <z> (camera position)"
+ echo " -l <x> <y> <z> (light source)"
+ exit 1;;
+ esac
+done
+
+if [ ! -d $directory ] ; then
+ echo "no valid directory"
+ exit 1
fi
-POVRAY="povray -W1024 -H768 -d"
+POVRAY="povray -W${width} -H${height} -d"
-echo "processing $1 ..."
+for file in $directory/atomic_conf_*.xyz; do
-for file in $1/povray_*.in ; do
cat > temp.pov <<-EOF
#include "colors.inc"
#include "textures.inc"
EOF
# meta info
- count=`grep '# \[C\]' $file | awk '{ print $3 }'`
- time=`grep '# \[T\]' $file | awk '{ print $3 }'`
- camloc=`grep '# \[L\]' $file | awk '{ print $3 }'`
+ count=`grep '# \[P\]' $file | awk '{ print $3 }'`
+ time=`grep '# \[P\]' $file | awk '{ print $4 }'`
+ camloc=`grep '# \[P\]' $file | awk '{ print $5 }'`
+ [ -n "$cx" -a -n "$cy" -a -n "$cz" ] && camloc="<$cx,$cz,$cy>"
# atoms
- cat $file | grep -v '#' | while read radius x y z ; do #temp dis; do
- cat >> temp.pov <<-EOF
+ if [ -n "$x0" ]; then
+ export x0 y0 z0 x1 y1 z1 radius
+ cat $file | grep -v '#' | awk '\
+ BEGIN {
+ x0=ENVIRON["x0"]; y0==ENVIRON["y0"]; z0==ENVIRON["z0"];
+ x1=ENVIRON["x1"]; y0==ENVIRON["y1"]; z0==ENVIRON["z1"];
+ radius=ENVIRON["radius"];
+ }
+ {
+ if(($2>=x0)&&($3>=y0)&&($4>=z0)&&\
+ ($2<=x1)&&($3<=y1)&&($4<=z1)) {
+ print "sphere { <"$2","$4","$3">, "radius" ";
+ print "texture { pigment { color "$5" } ";
+ print "finish { phong 1, metallic } } }";
+ }
+ }' >> temp.pov
+ else
+ cat $file | grep -v '#' | while read name x y z color temp; do
+ cat >> temp.pov <<-EOF
sphere {
- <$x, $z, $y>, $radius
- texture {
- pigment { color Yellow }
- finish {
- phong 1
- metallic
- }
- }
+<$x, $z, $y>, $radius
+texture {
+pigment { color $color }
+finish {
+phong 1
+metallic
+}
+}
}
EOF
- done
+ done
+ fi
# boundaries
+ if [ -z "$x0" ]; then
cat $file | grep '# \[D\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do
cat >> temp.pov <<-EOF
cylinder {
- <$x1, $z1, $y1>, <$x2, $z2, $y2>, 0.05
- pigment { color White }
+<$x1, $z1, $y1>, <$x2, $z2, $y2>, 0.05
+pigment { color White }
}
EOF
done
+ fi
# add camera and light source
cat >> temp.pov <<-EOF
camera {
-// orthographic
- location $camloc
- look_at <0,0,0>
+EOF
+ if [ -n "$ortographic" ]; then cat >> temp.pov <<-EOF
+orthographic
+EOF
+ fi
+ cat >> temp.pov <<-EOF
+location $camloc
+look_at <0,0,0>
}
-light_source { <0,10000,0> color White shadowless }
+light_source { <0,100,-100> color White shadowless }
EOF
# mv png
$POVRAY temp.pov > /dev/null 2>&1
- mv temp.png `echo $file | sed 's/\.in/\.png/'`
+ mv temp.png `echo $file | sed 's/\.xyz/\.png/'`
done