LDFLAGS=-lm
-DEPS = moldyn.o visual/visual.o random/random.o list/list.o
+DEPS = moldyn.o random/random.o list/list.o
DEPS += potentials/lennard_jones.o potentials/harmonic_oscillator.o
DEPS += potentials/tersoff.o potentials/albe.o
#include "moldyn.h"
#include "report/report.h"
+/*
+ * global variables, pse and atom colors (only needed here)
+ */
+
+static char *pse_name[]={
+ "*",
+ "H",
+ "He",
+ "Li",
+ "Be",
+ "B",
+ "C",
+ "N",
+ "O",
+ "F",
+ "Ne",
+ "Na",
+ "Mg",
+ "Al",
+ "Si",
+ "P",
+ "S",
+ "Cl",
+ "Ar",
+};
+
+static char *pse_col[]={
+ "*",
+ "White",
+ "He",
+ "Li",
+ "Be",
+ "B",
+ "Gray",
+ "N",
+ "Blue",
+ "F",
+ "Ne",
+ "Na",
+ "Mg",
+ "Al",
+ "Yellow",
+ "P",
+ "S",
+ "Cl",
+ "Ar",
+};
+
+/*
+ * the moldyn functions
+ */
+
int moldyn_init(t_moldyn *moldyn,int argc,char **argv) {
printf("[moldyn] init\n");
moldyn->vlsdir);
system(sc);
}
- if(&(moldyn->vis)) visual_tini(&(moldyn->vis));
return 0;
}
+ return 0;
+}
+
+/*
+ * visualization code
+ */
+
+int visual_init(t_visual *v,char *filebase) {
+
+ char file[128+8];
+
+ strncpy(v->fb,filebase,128);
+ memset(file,0,128+8);
+
+ return 0;
+}
+
+int visual_atoms(t_visual *v,double time,t_atom *atom,int n) {
+
+ 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;
+
+ 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");
+ return -1;
+ }
+
+ /* write the actual data file */
+ 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,"%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,
+ dim.x/2,-dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,-dim.y/2,-dim.z/2,
+ -dim.x/2,dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ dim.x/2,dim.y/2,-dim.z/2,
+ dim.x/2,-dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,dim.y/2,-dim.z/2,
+ dim.x/2,dim.y/2,-dim.z/2);
+
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,-dim.y/2,dim.z/2,
+ dim.x/2,-dim.y/2,dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,-dim.y/2,dim.z/2,
+ -dim.x/2,dim.y/2,dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ dim.x/2,dim.y/2,dim.z/2,
+ dim.x/2,-dim.y/2,dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,dim.y/2,dim.z/2,
+ dim.x/2,dim.y/2,dim.z/2);
+
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,-dim.y/2,dim.z/2,
+ -dim.x/2,-dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ -dim.x/2,dim.y/2,dim.z/2,
+ -dim.x/2,dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ dim.x/2,-dim.y/2,dim.z/2,
+ dim.x/2,-dim.y/2,-dim.z/2);
+ dprintf(fd,"# [D] %f %f %f %f %f %f\n",
+ dim.x/2,dim.y/2,dim.z/2,
+ dim.x/2,dim.y/2,-dim.z/2);
+ }
+
+ close(fd);
+
return 0;
}
int dnlc; /* direct neighbour lists counter */
} t_linkcell;
-#include "visual/visual.h"
-
/* moldyn schedule structure */
typedef struct s_moldyn_schedule {
int count;
void *hook_params;
} t_moldyn_schedule;
+/* visualization structure */
+typedef struct s_visual {
+ int fd; /* rasmol script file descriptor */
+ char fb[128]; /* basename of the save files */
+ t_3dvec dim; /* dimensions of the simulation cell */
+} t_visual;
+
/* moldyn main structure */
typedef struct s_moldyn {
int argc; /* number of arguments */
#define FCC 0x02
#define DIAMOND 0x04
-
/*
*
* function prototypes
int get_line(int fd,char *line,int max);
+int visual_init(t_visual *v,char *filebase);
+int visual_atoms(t_visual *v,double time,t_atom *atom,int n);
+
#endif
+
// swapped out functions
#include "math/math.h"
#include "list/list.h"
-#include "visual/visual.h"
#include "random/random.h"
+// moldyn core functions
+#include "moldyn.h"
+
// potentials
#include "potentials/harmonic_oscillator.h"
#include "potentials/lennard_jones.h"
#include <math.h>
#include "moldyn.h"
-#include "posic.h"
/* potential */
#include "potentials/harmonic_oscillator.h"
#define INJ_OFFSET (ALBE_LC_SI/8.0)
#define RELAX_S 20
-#define LCNTX 5
-#define LCNTY 5
-#define LCNTZ 5
+#define LCNTX 9
+#define LCNTY 9
+#define LCNTZ 9
#define PRERUN 10
-#define POSTRUN 2000
+#define POSTRUN 4000
#define R_TITLE "Silicon self-interstitial"
#define LOG_E 10
char **argv; /* args */
} t_hp;
-int hook(void *moldyn,void *hook_params) {
+int hook_del_atom(void *moldyn,void *hook_params) {
+
+ t_moldyn *md;
+ t_hp *hp;
+
+ md=moldyn;
+ hp=hook_params;
+
+ set_pt_scale(md,0,0,T_SCALE_BERENDSEN,100.0);
+ del_atom(md,2);
+
+ return 0;
+}
+
+int hook_add_atom(void *moldyn,void *hook_params) {
t_moldyn *md;
t_3dvec r,v,dist;
for(j=0;j<NR_ATOMS;j++) {
run=1;
while(run) {
- r.x=(rand_get_double(&(md->random))-0.5)*INJ_LENX;
+ r.x=1.0/8.0*ALBE_LC_SI;
+ r.y=-1.0/8.0*ALBE_LC_SI;
+ r.z=-1.0/8.0*ALBE_LC_SI;
+ //r.x=(rand_get_double(&(md->random))-0.5)*INJ_LENX;
r.x+=INJ_OFFSET;
- r.y=(rand_get_double(&(md->random))-0.5)*INJ_LENY;
+ //r.y=(rand_get_double(&(md->random))-0.5)*INJ_LENY;
r.y+=INJ_OFFSET;
- r.z=(rand_get_double(&(md->random))-0.5)*INJ_LENZ;
+ //r.z=(rand_get_double(&(md->random))-0.5)*INJ_LENZ;
r.z+=INJ_OFFSET;
/* assume valid coordinates */
run=0;
memset(&hookparam,0,sizeof(t_hp));
hookparam.argc=argc;
hookparam.argv=argv;
- moldyn_set_schedule_hook(&md,&hook,&hookparam);
+ moldyn_set_schedule_hook(&md,&hook_add_atom,&hookparam);
+ //moldyn_set_schedule_hook(&md,&hook_del_atom,&hookparam);
+ //moldyn_add_schedule(&md,POSTRUN,1.0);
/* activate logging */
moldyn_set_log_dir(&md,argv[1]);
+++ /dev/null
-CC=gcc
-CFLAGS=-Wall
-
-all: visual.o ../math/math.o
-
-clean:
- rm -f *.o
+++ /dev/null
-/*
- * visual.c - visualization functions
- *
- * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
- *
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "visual.h"
-#include "../moldyn.h"
-#include "../math/math.h"
-
-/* the pse, only needed here */
-static char *pse_name[]={
- "*",
- "H",
- "He",
- "Li",
- "Be",
- "B",
- "C",
- "N",
- "O",
- "F",
- "Ne",
- "Na",
- "Mg",
- "Al",
- "Si",
- "P",
- "S",
- "Cl",
- "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); // 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 visual_atoms(t_visual *v,double time,t_atom *atom,int n) {
-
- 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;
-
- 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");
- return -1;
- }
-
- /* 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");
- dprintf(v->fd,"rotate y 10\n");
- dprintf(v->fd,"set ambient 20\n");
- dprintf(v->fd,"set specular on\n");
- dprintf(v->fd,"set boundbox on\n");
- //dprintf(v->fd,"label\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,"# [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,"%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,
- dim.x/2,-dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,-dim.y/2,-dim.z/2,
- -dim.x/2,dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- dim.x/2,dim.y/2,-dim.z/2,
- dim.x/2,-dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,dim.y/2,-dim.z/2,
- dim.x/2,dim.y/2,-dim.z/2);
-
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,-dim.y/2,dim.z/2,
- dim.x/2,-dim.y/2,dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,-dim.y/2,dim.z/2,
- -dim.x/2,dim.y/2,dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- dim.x/2,dim.y/2,dim.z/2,
- dim.x/2,-dim.y/2,dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,dim.y/2,dim.z/2,
- dim.x/2,dim.y/2,dim.z/2);
-
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,-dim.y/2,dim.z/2,
- -dim.x/2,-dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- -dim.x/2,dim.y/2,dim.z/2,
- -dim.x/2,dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- dim.x/2,-dim.y/2,dim.z/2,
- dim.x/2,-dim.y/2,-dim.z/2);
- dprintf(fd,"# [D] %f %f %f %f %f %f\n",
- dim.x/2,dim.y/2,dim.z/2,
- dim.x/2,dim.y/2,-dim.z/2);
- }
-
- close(fd);
-
- return 0;
-}
-
+++ /dev/null
-/*
- * visual.h - visualization header file
- *
- * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
- *
- */
-
-#ifndef VISUAL_H
-#define VISUAL_H
-
-#include "../math/math.h"
-
-/* datatypes */
-
-typedef struct s_visual {
- int fd; /* rasmol script file descriptor */
- char fb[128]; /* basename of the save files */
- t_3dvec dim; /* dimensions of the simulation cell */
-} t_visual;
-
-#include "../moldyn.h"
-
-/* function prototypes */
-
-int visual_init(t_visual *v,char *filebase);
-int visual_tini(t_visual *v);
-int visual_atoms(t_visual *v,double time,t_atom *atom,int n);
-
-#endif
-
-