2 * mdrun.c - main code to run a md simulation
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
11 #include "potentials/harmonic_oscillator.h"
12 #include "potentials/lennard_jones.h"
13 #include "potentials/albe.h"
15 #include "potentials/tersoff_orig.h"
17 #include "potentials/tersoff.h"
26 int mdrun_usage(void) {
28 printf("%s usage:\n",ME);
33 int mdrun_parse_argv(t_mdrun *mdrun,int argc,char **argv) {
40 printf("%s unknown switch: %s\n",ME,argv[i]);
46 strncpy(mdrun->cfile,argv[++i],128);
49 strncpy(mdrun->sdir,argv[++i],128);
55 printf("%s unknown option: %s\n",ME,argv[i]);
65 int del_stages(t_mdrun *mdrun) {
78 stage=sl->current->data;
81 } while(list_next_f(sl)!=L_NO_NEXT_ELEMENT);
86 int add_stage(t_mdrun *mdrun,u8 type,void *params) {
93 case STAGE_DISPLACE_ATOM:
94 psize=sizeof(t_displace_atom_params);
96 case STAGE_INSERT_ATOMS:
97 psize=sizeof(t_insert_atoms_params);
99 case STAGE_INSERT_MIXED_ATOMS:
100 psize=sizeof(t_insert_mixed_atoms_params);
103 psize=sizeof(t_continue_params);
106 psize=sizeof(t_anneal_params);
109 psize=sizeof(t_chaattr_params);
112 psize=sizeof(t_chsattr_params);
115 printf("%s unknown stage type: %02x\n",ME,type);
119 stage=malloc(sizeof(t_stage));
121 perror("[mdrun] malloc (add stage)");
126 stage->executed=FALSE;
128 stage->params=malloc(psize);
129 if(stage->params==NULL) {
130 perror("[mdrun] malloc (stage params)");
134 memcpy(stage->params,params,psize);
136 list_add_immediate_f(&(mdrun->stage),stage);
141 int mdrun_parse_config(t_mdrun *mdrun) {
151 t_displace_atom_params dap;
152 t_insert_atoms_params iap;
153 t_insert_mixed_atoms_params imp;
154 t_continue_params cp;
156 t_chaattr_params cap;
157 t_chsattr_params csp;
159 /* open config file */
160 fd=open(mdrun->cfile,O_RDONLY);
162 snprintf(error,128,"%s open cfile %s",ME,mdrun->cfile);
167 /* read, parse, set */
172 ret=get_line(fd,line,128);
176 // ignore # lines and \n
177 if((line[0]=='#')|(ret==1))
181 memset(&iap,0,sizeof(t_insert_atoms_params));
182 memset(&imp,0,sizeof(t_insert_mixed_atoms_params));
183 memset(&cp,0,sizeof(t_continue_params));
184 memset(&ap,0,sizeof(t_anneal_params));
185 memset(&cap,0,sizeof(t_chaattr_params));
186 memset(&csp,0,sizeof(t_chsattr_params));
188 // get command + args
192 wptr=strtok(NULL," \t");
194 wptr=strtok(line," \t");
197 strncpy(word[wcnt],wptr,64);
201 if(!strncmp(word[0],"potential",9)) {
202 if(!strncmp(word[1],"albe",4))
203 mdrun->potential=MOLDYN_POTENTIAL_AM;
204 if(!strncmp(word[1],"tersoff",7))
205 mdrun->potential=MOLDYN_POTENTIAL_TM;
206 if(!strncmp(word[1],"ho",2))
207 mdrun->potential=MOLDYN_POTENTIAL_HO;
208 if(!strncmp(word[1],"lj",2))
209 mdrun->potential=MOLDYN_POTENTIAL_LJ;
211 else if(!strncmp(word[0],"continue",8))
212 strncpy(mdrun->continue_file,word[1],128);
213 else if(!strncmp(word[0],"cutoff",6))
214 mdrun->cutoff=atof(word[1]);
215 else if(!strncmp(word[0],"nnd",3))
216 mdrun->nnd=atof(word[1]);
217 else if(!strncmp(word[0],"intalgo",7)) {
218 if(!strncmp(word[1],"verlet",5))
219 mdrun->intalgo=MOLDYN_INTEGRATE_VERLET;
221 else if(!strncmp(word[0],"timestep",8))
222 mdrun->timestep=atof(word[1]);
223 else if(!strncmp(word[0],"volume",6)) {
224 mdrun->dim.x=atof(word[1]);
225 mdrun->dim.y=atof(word[2]);
226 mdrun->dim.z=atof(word[3]);
227 if(strncmp(word[4],"0",1))
230 else if(!strncmp(word[0],"pbc",3)) {
231 if(strncmp(word[1],"0",1))
235 if(strncmp(word[2],"0",1))
239 if(strncmp(word[3],"0",1))
244 else if(!strncmp(word[0],"temperature",11))
245 mdrun->temperature=atof(word[1]);
246 else if(!strncmp(word[0],"pressure",8))
247 mdrun->pressure=atof(word[1]);
248 else if(!strncmp(word[0],"lattice",7)) {
249 if(!strncmp(word[1],"zincblende",10))
250 mdrun->lattice=ZINCBLENDE;
251 if(!strncmp(word[1],"fcc",3))
253 if(!strncmp(word[1],"diamond",7))
254 mdrun->lattice=DIAMOND;
255 if(!strncmp(word[1],"none",4))
258 else if(!strncmp(word[0],"element1",8)) {
259 mdrun->element1=atoi(word[1]);
260 mdrun->m1=pse_mass[mdrun->element1];
262 else if(!strncmp(word[0],"element2",8)) {
263 mdrun->element2=atoi(word[1]);
264 mdrun->m2=pse_mass[mdrun->element2];
266 else if(!strncmp(word[0],"fill",6)) {
267 // only lc mode by now
268 mdrun->lx=atoi(word[2]);
269 mdrun->ly=atoi(word[3]);
270 mdrun->lz=atoi(word[4]);
271 mdrun->lc=atof(word[5]);
273 else if(!strncmp(word[0],"aattr",5)) {
274 // for aatrib line we need a special stage
275 // containing one schedule of 0 loops ...
276 for(i=0;i<strlen(word[1]);i++) {
279 cap.type|=CHAATTR_TOTALV;
282 cap.type|=CHAATTR_REGION;
285 cap.type|=CHAATTR_ELEMENT;
292 if(cap.type&CHAATTR_REGION) {
293 cap.x0=atof(word[1]);
294 cap.y0=atof(word[2]);
295 cap.z0=atof(word[3]);
296 cap.x1=atof(word[4]);
297 cap.y1=atof(word[5]);
298 cap.z1=atof(word[6]);
301 if(cap.type&CHAATTR_ELEMENT) {
302 cap.element=atoi(word[i]);
305 for(o=0;o<strlen(word[i]);o++) {
308 cap.attr|=ATOM_ATTR_VB;
311 cap.attr|=ATOM_ATTR_HB;
314 cap.attr|=ATOM_ATTR_VA;
317 cap.attr|=ATOM_ATTR_FP;
320 cap.attr|=ATOM_ATTR_1BP;
323 cap.attr|=ATOM_ATTR_2BP;
326 cap.attr|=ATOM_ATTR_3BP;
332 add_stage(mdrun,STAGE_CHAATTR,&cap);
334 else if(!strncmp(word[0],"sattr",5)) {
335 // for satrib line we need a special stage
336 // containing one schedule of 0 loops ...
338 for(i=1;i<wcnt;i++) {
339 if(!strncmp(word[i],"pctrl",5)) {
340 csp.ptau=0.01/(atof(word[++i])*GPA);
341 csp.type|=CHSATTR_PCTRL;
343 if(!strncmp(word[i],"tctrl",5)) {
344 csp.ttau=atof(word[++i]);
345 csp.type|=CHSATTR_TCTRL;
347 if(!strncmp(word[i],"prelax",6)) {
348 csp.dp=atof(word[++i])*BAR;
349 csp.type|=CHSATTR_PRELAX;
351 if(!strncmp(word[i],"trelax",6)) {
352 csp.dt=atof(word[++i]);
353 csp.type|=CHSATTR_TRELAX;
355 if(!strncmp(word[i],"rsteps",6)) {
356 csp.rsteps=atoi(word[++i]);
357 csp.type|=CHSATTR_RSTEPS;
359 if(!strncmp(word[i],"avgrst",6)) {
360 csp.avgrst=atoi(word[++i]);
361 csp.type|=CHSATTR_AVGRST;
364 add_stage(mdrun,STAGE_CHSATTR,&csp);
366 else if(!strncmp(word[0],"prerun",6))
367 mdrun->prerun=atoi(word[1]);
368 else if(!strncmp(word[0],"avgskip",7))
369 mdrun->avgskip=atoi(word[1]);
370 else if(!strncmp(word[0],"elog",4))
371 mdrun->elog=atoi(word[1]);
372 else if(!strncmp(word[0],"tlog",4))
373 mdrun->tlog=atoi(word[1]);
374 else if(!strncmp(word[0],"plog",4))
375 mdrun->plog=atoi(word[1]);
376 else if(!strncmp(word[0],"vlog",4))
377 mdrun->vlog=atoi(word[1]);
378 else if(!strncmp(word[0],"save",4))
379 mdrun->save=atoi(word[1]);
380 else if(!strncmp(word[0],"visualize",9))
381 mdrun->visualize=atoi(word[1]);
382 else if(!strncmp(word[0],"stage",5)) {
383 // for every stage line, add a stage
384 if(!strncmp(word[1],"displace",8)) {
385 dap.nr=atoi(word[2]);
386 dap.dx=atof(word[3]);
387 dap.dy=atof(word[4]);
388 dap.dz=atof(word[5]);
389 add_stage(mdrun,STAGE_DISPLACE_ATOM,&dap);
391 else if(!strncmp(word[1],"ins_atoms",9)) {
392 iap.ins_steps=atoi(word[2]);
393 iap.ins_atoms=atoi(word[3]);
394 iap.element=atoi(word[4]);
395 iap.brand=atoi(word[5]);
396 for(i=0;i<strlen(word[6]);i++) {
399 iap.attr|=ATOM_ATTR_VB;
402 iap.attr|=ATOM_ATTR_HB;
405 iap.attr|=ATOM_ATTR_VA;
408 iap.attr|=ATOM_ATTR_FP;
411 iap.attr|=ATOM_ATTR_1BP;
414 iap.attr|=ATOM_ATTR_2BP;
417 iap.attr|=ATOM_ATTR_3BP;
427 iap.x0=atof(word[8]);
428 iap.y0=atof(word[9]);
429 iap.z0=atof(word[10]);
432 if(word[8][0]=='t') {
434 iap.cr=atof(word[9]);
438 iap.x0=atof(word[8]);
439 iap.y0=atof(word[9]);
440 iap.z0=atof(word[10]);
441 iap.x1=atof(word[11]);
442 iap.y1=atof(word[12]);
443 iap.z1=atof(word[13]);
444 iap.cr=atof(word[14]);
449 add_stage(mdrun,STAGE_INSERT_ATOMS,&iap);
455 else if(!strncmp(word[1],"ins_m_atoms",11)) {
456 imp.element1=atoi(word[2]);
457 imp.element2=atoi(word[3]);
458 imp.amount1=atoi(word[4]);
459 imp.amount2=atoi(word[5]);
460 imp.brand1=atoi(word[6]);
461 imp.brand2=atoi(word[7]);
462 imp.cr=atof(word[8]);
464 for(i=0;i<strlen(word[8]);i++) {
467 imp.attr|=ATOM_ATTR_VB;
470 imp.attr|=ATOM_ATTR_HB;
473 imp.attr|=ATOM_ATTR_VA;
476 imp.attr|=ATOM_ATTR_FP;
479 imp.attr|=ATOM_ATTR_1BP;
482 imp.attr|=ATOM_ATTR_2BP;
485 imp.attr|=ATOM_ATTR_3BP;
492 imp.attr1=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP;
493 imp.attr2=ATOM_ATTR_HB|ATOM_ATTR_VA|ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP;
494 add_stage(mdrun,STAGE_INSERT_MIXED_ATOMS,&imp);
501 else if(!strncmp(word[1],"continue",8)) {
502 cp.runs=atoi(word[2]);
503 add_stage(mdrun,STAGE_CONTINUE,&cp);
505 else if(!strncmp(word[1],"anneal",6)) {
507 ap.runs=atoi(word[2]);
509 add_stage(mdrun,STAGE_ANNEAL,&ap);
512 printf("%s unknown stage type: %s\n",
518 printf("%s unknown keyword '%s', skipped!\n",
530 int check_pressure(t_moldyn *moldyn,t_mdrun *mdrun) {
534 if(!(mdrun->sattr&SATTR_PRELAX)) {
538 delta=moldyn->p_avg-moldyn->p_ref;
549 int check_temperature(t_moldyn *moldyn,t_mdrun *mdrun) {
553 if(!(mdrun->sattr&SATTR_TRELAX))
556 delta=moldyn->t_avg-moldyn->t_ref;
567 int displace_atom(t_moldyn *moldyn,t_mdrun *mdrun) {
569 t_displace_atom_params *dap;
573 stage=mdrun->stage.current->data;
576 atom=&(moldyn->atom[dap->nr]);
584 int insert_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
586 t_insert_atoms_params *iap;
596 stage=mdrun->stage.current->data;
601 v.x=0.0; v.y=0.0; v.z=0.0;
605 switch(mdrun->lattice) {
646 printf("%s unknown insertion mode: %02x\n",
652 while(cnt<iap->ins_atoms) {
655 if(iap->type!=INS_POS) {
656 r.x=rand_get_double(&(moldyn->random))*x;
657 r.y=rand_get_double(&(moldyn->random))*y;
658 r.z=rand_get_double(&(moldyn->random))*z;
669 if(iap->type!=INS_TOTAL) {
676 dmin=1000; // for sure too high!
677 for(i=0;i<moldyn->count;i++) {
678 atom=&(moldyn->atom[i]);
679 v3_sub(&dist,&(atom->r),&r);
680 check_per_bound(moldyn,&dist);
681 d=v3_absolute_square(&dist);
682 if(d<(iap->cr*iap->cr)) {
691 add_atom(moldyn,iap->element,pse_mass[iap->element],
692 iap->brand,iap->attr,&r,&v);
693 printf("%s atom inserted (%d/%d): %f %f %f\n",
694 ME,(iap->cnt_steps+1)*iap->ins_atoms,
695 iap->ins_steps*iap->ins_atoms,r.x,r.y,r.z);
696 printf(" -> d2 = %f/%f\n",dmin,iap->cr*iap->cr);
703 int insert_mixed_atoms(t_moldyn *moldyn,t_mdrun *mdrun) {
706 t_insert_mixed_atoms_params *imp;
708 double x,x0,y,y0,z,z0;
715 stage=mdrun->stage.current->data;
731 while(imp->amount1|imp->amount2) {
736 r.x=rand_get_double(&(moldyn->random))*x;
737 r.y=rand_get_double(&(moldyn->random))*y;
738 r.z=rand_get_double(&(moldyn->random))*z;
742 dmin=1000.0; // for sure too high!
743 for(i=0;i<moldyn->count;i++) {
744 atom=&(moldyn->atom[i]);
745 v3_sub(&dist,&(atom->r),&r);
746 check_per_bound(moldyn,&dist);
747 d=v3_absolute_square(&dist);
757 add_atom(moldyn,imp->element1,pse_mass[imp->element1],
758 imp->brand1,imp->attr1,&r,&v);
759 printf("%s (mixed) atom inserted (%d): %f %f %f\n",
760 ME,imp->amount1,r.x,r.y,r.z);
761 printf(" -> d2 = %f/%f\n",dmin,c);
768 r.x=rand_get_double(&(moldyn->random))*x;
769 r.y=rand_get_double(&(moldyn->random))*y;
770 r.z=rand_get_double(&(moldyn->random))*z;
774 dmin=1000.0; // for sure too high!
775 for(i=0;i<moldyn->count;i++) {
776 atom=&(moldyn->atom[i]);
777 v3_sub(&dist,&(atom->r),&r);
778 check_per_bound(moldyn,&dist);
779 d=v3_absolute_square(&dist);
789 add_atom(moldyn,imp->element2,pse_mass[imp->element2],
790 imp->brand2,imp->attr2,&r,&v);
791 printf("%s (mixed) atom inserted (%d): %f %f %f\n",
792 ME,imp->amount2,r.x,r.y,r.z);
793 printf(" -> d2 = %f/%f\n",dmin,c);
801 int chaatr(t_moldyn *moldyn,t_mdrun *mdrun) {
804 t_chaattr_params *cap;
808 stage=mdrun->stage.current->data;
811 for(i=0;i<moldyn->count;i++) {
812 atom=&(moldyn->atom[i]);
813 if(cap->type&CHAATTR_ELEMENT) {
814 if(cap->element!=atom->element)
817 if(cap->type&CHAATTR_REGION) {
818 if(cap->x0<atom->r.x)
820 if(cap->y0<atom->r.y)
822 if(cap->z0<atom->r.z)
824 if(cap->x1>atom->r.x)
826 if(cap->y1>atom->r.y)
828 if(cap->z1>atom->r.z)
831 atom->attr=cap->attr;
837 int chsattr(t_moldyn *moldyn,t_mdrun *mdrun) {
840 t_chsattr_params *csp;
842 stage=mdrun->stage.current->data;
845 if(csp->type&CHSATTR_PCTRL) {
847 set_p_scale(moldyn,P_SCALE_BERENDSEN,csp->ptau);
849 set_p_scale(moldyn,P_SCALE_BERENDSEN,csp->ptau);
851 if(csp->type&CHSATTR_TCTRL) {
853 set_t_scale(moldyn,T_SCALE_BERENDSEN,csp->ttau);
855 set_t_scale(moldyn,T_SCALE_BERENDSEN,csp->ttau);
857 if(csp->type&CHSATTR_PRELAX) {
859 mdrun->sattr&=(~(SATTR_PRELAX));
861 mdrun->sattr|=SATTR_PRELAX;
864 if(csp->type&CHSATTR_TRELAX) {
866 mdrun->sattr&=(~(SATTR_TRELAX));
868 mdrun->sattr|=SATTR_TRELAX;
871 if(csp->type&CHSATTR_AVGRST) {
873 mdrun->sattr|=SATTR_AVGRST;
875 mdrun->sattr&=(~(SATTR_AVGRST));
877 if(csp->type&CHSATTR_RSTEPS) {
878 mdrun->relax_steps=csp->rsteps;
884 #define stage_print(m) if(!(stage->executed)) \
887 int mdrun_hook(void *ptr1,void *ptr2) {
897 t_insert_atoms_params *iap;
898 t_insert_mixed_atoms_params *imp;
899 t_continue_params *cp;
909 /* return immediately if there are no more stage */
910 if(sl->current==NULL)
913 /* get stage description */
914 stage=sl->current->data;
916 /* default steps and tau values */
917 steps=mdrun->relax_steps;
920 /* check whether relaxation steps are necessary */
921 if((check_pressure(moldyn,mdrun)==TRUE)&\
922 (check_temperature(moldyn,mdrun)==TRUE)) {
925 stage_print("\n###########################\n");
926 stage_print("# [mdrun] executing stage #\n");
927 stage_print("###########################\n\n");
929 /* stage specific stuff */
930 switch(stage->type) {
931 case STAGE_DISPLACE_ATOM:
932 stage_print(" -> displace atom\n\n");
933 displace_atom(moldyn,mdrun);
936 case STAGE_INSERT_ATOMS:
937 stage_print(" -> insert atoms\n\n");
939 if(iap->cnt_steps==iap->ins_steps) {
943 insert_atoms(moldyn,mdrun);
949 case STAGE_INSERT_MIXED_ATOMS:
950 stage_print(" -> insert mixed atoms\n\n");
952 insert_mixed_atoms(moldyn,mdrun);
958 stage_print(" -> continue\n\n");
959 if(stage->executed==TRUE) {
967 stage_print(" -> anneal\n\n");
969 if(ap->count==ap->runs) {
973 if(moldyn->t_ref+ap->dt>=0.0)
974 set_temperature(moldyn,
975 moldyn->t_ref+ap->dt);
979 stage_print(" -> chaattr\n\n");
980 chaatr(moldyn,mdrun);
984 stage_print(" -> chsattr\n\n");
985 chsattr(moldyn,mdrun);
989 printf("%s unknwon stage type\n",ME);
993 /* mark as executed */
994 stage->executed=TRUE;
997 if(change_stage==TRUE) {
998 printf("%s finished stage\n",ME);
999 if(list_next_f(sl)==L_NO_NEXT_ELEMENT) {
1000 printf("%s no more stages\n",ME);
1004 tau=mdrun->timestep;
1011 if(mdrun->sattr&SATTR_AVGRST)
1012 average_reset(moldyn);
1016 /* continue simulation */
1017 moldyn_add_schedule(moldyn,steps,tau);
1022 int main(int argc,char **argv) {
1029 memset(&mdrun,0,sizeof(t_mdrun));
1030 memset(&moldyn,0,sizeof(t_moldyn));
1032 /* parse arguments */
1033 if(mdrun_parse_argv(&mdrun,argc,argv)<0)
1036 /* initialize list system */
1037 list_init_f(&(mdrun.stage));
1039 /* parse config file */
1040 mdrun_parse_config(&mdrun);
1042 /* reset the stage list */
1043 list_reset_f(&(mdrun.stage));
1047 /* prepare simulation */
1049 if(mdrun.continue_file[0]) {
1050 // read the save file
1051 moldyn_read_save_file(&moldyn,mdrun.continue_file);
1052 // manualaadjusting some stuff
1055 rand_init(&(moldyn.random),NULL,1);
1056 moldyn.random.status|=RAND_STAT_VERBOSE;
1059 moldyn_init(&moldyn,argc,argv);
1062 if(set_int_alg(&moldyn,mdrun.intalgo)<0)
1066 set_cutoff(&moldyn,mdrun.cutoff);
1067 if(set_potential(&moldyn,mdrun.potential)<0)
1069 switch(mdrun.potential) {
1070 case MOLDYN_POTENTIAL_AM:
1071 albe_mult_set_params(&moldyn,
1075 case MOLDYN_POTENTIAL_TM:
1076 tersoff_mult_set_params(&moldyn,
1080 case MOLDYN_POTENTIAL_HO:
1081 harmonic_oscillator_set_params(&moldyn,mdrun.element1);
1083 case MOLDYN_POTENTIAL_LJ:
1084 lennard_jones_set_params(&moldyn,mdrun.element1);
1087 printf("%s unknown potential: %02x\n",
1088 ME,mdrun.potential);
1092 /* if it is a continue run, reset schedule and skip lattice init */
1093 if(mdrun.continue_file[0]) {
1094 memset(&(moldyn.schedule),0,sizeof(t_moldyn_schedule));
1098 /* initial lattice and dimensions */
1099 set_dim(&moldyn,mdrun.dim.x,mdrun.dim.y,mdrun.dim.z,mdrun.vis);
1100 set_pbc(&moldyn,mdrun.pbcx,mdrun.pbcy,mdrun.pbcz);
1101 switch(mdrun.lattice) {
1103 create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1,
1104 mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
1105 mdrun.ly,mdrun.lz,NULL);
1108 create_lattice(&moldyn,DIAMOND,mdrun.lc,mdrun.element1,
1109 mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
1110 mdrun.ly,mdrun.lz,NULL);
1113 o.x=0.5*0.25*mdrun.lc; o.y=o.x; o.z=o.x;
1114 create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1,
1115 mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx,
1116 mdrun.ly,mdrun.lz,&o);
1117 o.x+=0.25*mdrun.lc; o.y=o.x; o.z=o.x;
1118 create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element2,
1119 mdrun.m2,DEFAULT_ATOM_ATTR,1,mdrun.lx,
1120 mdrun.ly,mdrun.lz,&o);
1125 printf("%s unknown lattice type: %02x\n",
1129 moldyn_bc_check(&moldyn);
1131 /* temperature and pressure */
1132 set_temperature(&moldyn,mdrun.temperature);
1133 set_pressure(&moldyn,mdrun.pressure);
1134 thermal_init(&moldyn,TRUE);
1137 /* first schedule */
1138 moldyn_add_schedule(&moldyn,mdrun.prerun,mdrun.timestep);
1141 moldyn_set_log_dir(&moldyn,mdrun.sdir);
1142 moldyn_set_report(&moldyn,"CHANGE ME","CHANGE ME TOO");
1144 moldyn_set_log(&moldyn,LOG_TOTAL_ENERGY,mdrun.elog);
1146 moldyn_set_log(&moldyn,LOG_TEMPERATURE,mdrun.tlog);
1148 moldyn_set_log(&moldyn,LOG_PRESSURE,mdrun.plog);
1150 moldyn_set_log(&moldyn,LOG_VOLUME,mdrun.vlog);
1152 moldyn_set_log(&moldyn,VISUAL_STEP,mdrun.visualize);
1154 moldyn_set_log(&moldyn,SAVE_STEP,mdrun.save);
1155 moldyn_set_log(&moldyn,CREATE_REPORT,0);
1156 set_avg_skip(&moldyn,mdrun.avgskip);
1158 /* prepare the hook function */
1159 moldyn_set_schedule_hook(&moldyn,&mdrun_hook,&mdrun);
1161 /* run the simulation */
1162 moldyn_integrate(&moldyn);
1165 moldyn_shutdown(&moldyn);
1167 list_destroy_f(&(mdrun.stage));