From: hackbard Date: Tue, 28 Nov 2006 10:36:04 +0000 (+0000) Subject: added sic example code X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=739b15653fb12151e0fafd3998c5d13a423aa754;p=physik%2Fposic.git added sic example code --- diff --git a/sic.c b/sic.c new file mode 100644 index 0000000..47ba596 --- /dev/null +++ b/sic.c @@ -0,0 +1,102 @@ +/* + * sic.c - investigation of the sic precipitation process of silicon carbide + * + * author: Frank Zirkelbach + * + */ + +#include + +#include "moldyn.h" +#include "math/math.h" +#include "init/init.h" +#include "visual/visual.h" + +#include "posic.h" + +#define TRUE 1 +#define FALSE 0 + +int main(int argc,char **argv) { + + /* main moldyn structure */ + t_moldyn md; + + /* potential parameters */ + t_lj_params lj; + t_ho_params ho; + t_tersoff_mult_params tp; + + /* misc variables, mainly to initialize stuff */ + t_3dvec r,v; + + /* initialize moldyn */ + moldyn_init(&md,argc,argv); + + /* choose integration algorithm */ + set_int_alg(&md,MOLDYN_INTEGRATE_VERLET); + + /* choose potential */ + //set_potential(&md,MOLDYN_1BP,tersoff_mult_1bp,&tp); + //set_potential(&md,MOLDYN_2BP,tersoff_mult_2bp,&tp); + //set_potential(&md,MOLDYN_3BP,tersoff_mult_3bp,&tp); + set_potential(&md,MOLDYN_2BP,lennard_jones,&lj); + + /* + * potential parameters + */ + + /* lennard jones */ + lj.sigma6=LJ_SIGMA_SI*LJ_SIGMA_SI*LJ_SIGMA; + lj.sigma6*=lj.sigma6; + lj.sigma12=lj.sigma6*lj.sigma6; + lj.epsilon4=4.0*LJ_EPSILON_SI; + + /* harmonic oscillator */ + ho.equilibrium_distance=0.25*sqrt(3.0)*LC_SI; + ho.spring_constant=1; + + /* cutoff radius */ + set_cutoff(&md,LC_SI); + + /* set (initial) dimensions of simulation volume */ + set_dim(&md,10*LC_SI,10*LC_SI,10*LC_SI,TRUE); + + /* set periodic boundary conditions in all directions */ + set_pbc(&md,TRUE,TRUE,TRUE); + + /* create the lattice / place atoms */ + memset(&v,0,sizeof(t_3dvec)); + r.y=0; + r.z=0; + r.x=0.23*sqrt(3.0)*LC_SI/2.0; + add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); + r.x=-r.x; + add_atom(&md,SI,M_SI,0,ATOM_ATTR_2BP,&r,&v); + + /* set temperature */ + set_temperature(&md,0.0); + + /* initial thermal fluctuations of particles */ + thermal_init(&md); + + /* create the simulation schedule */ + moldyn_add_schedule(&md,10000,1.0e-15); + + /* + * let's do the actual md algorithm now + * + * integration of newtons equations + */ + + moldyn_integrate(&md); + + /* close */ + + link_cell_shutdown(&md); + + moldyn_shutdown(&md); + + return 0; +} +