int moldyn_shutdown(t_moldyn *moldyn) {
+ moldyn_log_shutdown(moldyn);
link_cell_shutdown(moldyn);
moldyn_log_shutdown(moldyn);
rand_close(&(moldyn->random));
return p_total;
}
-double estimate_time_step(t_moldyn *moldyn,double nn_dist,double t) {
+double estimate_time_step(t_moldyn *moldyn,double nn_dist) {
double tau;
- tau=0.05*nn_dist/(sqrt(3.0*K_BOLTZMANN*t/moldyn->atom[0].mass));
- tau*=1.0E-9;
- if(tau<moldyn->tau)
- printf("[moldyn] warning: time step (%f > %.15f)\n",
- moldyn->tau,tau);
+ /* nn_dist is the nearest neighbour distance */
+
+ if(moldyn->t==5.0) {
+ printf("[moldyn] i do not estimate timesteps below %f K!\n",
+ MOLDYN_CRITICAL_EST_TEMP);
+ return 23.42;
+ }
+
+ tau=(0.05*nn_dist*moldyn->atom[0].mass)/sqrt(3.0*K_BOLTZMANN*moldyn->t);
return tau;
}
/* reset energy */
moldyn->energy=0.0;
+printf("DEBUG: count = %d\n",count);
for(i=0;i<count;i++) {
/* reset force */
/* 2 body pair potential/force */
if(atom[i].attr&(ATOM_ATTR_2BP|ATOM_ATTR_3BP)) {
-
+
+printf("DEBUG: processing atom %d\n",i);
link_cell_neighbour_index(moldyn,
(atom[i].r.x+moldyn->dim.x/2)/lc->x,
(atom[i].r.y+moldyn->dim.y/2)/lc->y,
countn=lc->countn;
dnlc=lc->dnlc;
+printf("DEBUG: countn = %d - dnslc = %d\n",countn,dnlc);
for(j=0;j<countn;j++) {
this=&(neighbour[j]);
if((btom->attr&ATOM_ATTR_2BP)&
(atom[i].attr&ATOM_ATTR_2BP))
+printf("DEBUG: calling func2b\n");
moldyn->func2b(moldyn,
&(atom[i]),
btom,
t_random random; /* random interface */
} t_moldyn;
-#define MOLDYN_LVSTAT_TOTAL_E 0x01
-#define MOLDYN_LVSTAT_TOTAL_M 0x02
-#define MOLDYN_LVSTAT_SAVE 0x04
-#define MOLDYN_LVSTAT_VISUAL 0x08
-#define MOLDYN_LVSTAT_INITIALIZED 0x10
-
#define MOLDYN_STAT_PBX 0x08 /* periodic boudaries in x */
#define MOLDYN_STAT_PBY 0x10 /* y */
#define MOLDYN_STAT_PBZ 0x20 /* and z direction */
#define MOLDYN_CUTOFF 1.0e-9
#define MOLDYN_RUNS 1000000
+#define MOLDYN_CRITICAL_EST_TEMP 5.0
+
#define MOLDYN_INTEGRATE_VERLET 0x00
#define MOLDYN_INTEGRATE_DEFAULT MOLDYN_INTEGRATE_VERLET
double get_total_energy(t_moldyn *moldyn);
t_3dvec get_total_p(t_moldyn *moldyn);
-double estimate_time_step(t_moldyn *moldyn,double nn_dist,double t);
+double estimate_time_step(t_moldyn *moldyn,double nn_dist);
int link_cell_init(t_moldyn *moldyn);
int link_cell_update(t_moldyn *moldyn);
/* misc variables, mainly to initialize stuff */
t_3dvec r,v;
+ /* temperature */
+ double t;
+
/* initialize moldyn */
printf("[sic] moldyn init\n");
moldyn_init(&md,argc,argv);
/* create the simulation schedule */
printf("[sic] adding schedule\n");
- moldyn_add_schedule(&md,1000,1.0e-15);
+ moldyn_add_schedule(&md,10000,1.0e-12);
/* activate logging */
printf("[sic] activate logging\n");
moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",100);
- moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",50);
+ moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",100);
/*
* let's do the actual md algorithm now