X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=moldyn.c;h=ed30815a6acb2b0d9cf151f990a18d3579067483;hb=815b8841eb76564b2f90421d4eae180253453106;hp=c27fc6215606df4d223290ea2e08e1798d64e95c;hpb=4b18a09781c27d786c32a5ada98929c4c2e38f4b;p=physik%2Fposic.git diff --git a/moldyn.c b/moldyn.c index c27fc62..ed30815 100644 --- a/moldyn.c +++ b/moldyn.c @@ -23,7 +23,7 @@ #include #endif -#ifdef PTHREADS +#if defined PTHREADS || defined VISUAL_THREAD #include #endif @@ -1670,7 +1670,7 @@ int moldyn_integrate(t_moldyn *moldyn) { struct timeval t1,t2; //double tp; -#ifdef PTHREADS +#ifdef VISUAL_THREAD u8 first,change; pthread_t io_thread; int ret; @@ -1730,7 +1730,7 @@ int moldyn_integrate(t_moldyn *moldyn) { moldyn->debug=0; /* zero & init moldyn copy */ -#ifdef PTHREADS +#ifdef VISUAL_THREAD memset(&md_copy,0,sizeof(t_moldyn)); atom_copy=malloc(moldyn->count*sizeof(t_atom)); if(atom_copy==NULL) { @@ -1838,7 +1838,7 @@ int moldyn_integrate(t_moldyn *moldyn) { } if(a) { if(!(moldyn->total_steps%a)) { -#ifdef PTHREADS +#ifdef VISUAL_THREAD /* check whether thread has not terminated yet */ if(!first) { ret=pthread_join(io_thread,NULL); @@ -1876,7 +1876,7 @@ int moldyn_integrate(t_moldyn *moldyn) { /* get current time */ gettimeofday(&t2,NULL); -printf("\rsched:%d, steps:%d/%d, T:%4.1f/%4.1f P:%4.1f/%4.1f V:%6.1f (%d)", +printf("sched:%d, steps:%d/%d, T:%4.1f/%4.1f P:%4.1f/%4.1f V:%6.1f (%d)\n", sched->count,i,moldyn->total_steps, moldyn->t,moldyn->t_avg, moldyn->p/BAR,moldyn->p_avg/BAR, @@ -3020,7 +3020,7 @@ int visual_bonds_process(t_moldyn *moldyn,t_atom *itom,t_atom *jtom, return 0; } -#ifdef PTHREADS +#ifdef VISUAL_THREAD void *visual_atoms(void *ptr) { #else int visual_atoms(t_moldyn *moldyn) { @@ -3033,7 +3033,7 @@ int visual_atoms(t_moldyn *moldyn) { t_visual *v; t_atom *atom; t_vb vb; -#ifdef PTHREADS +#ifdef VISUAL_THREAD t_moldyn *moldyn; moldyn=ptr; @@ -3051,7 +3051,7 @@ int visual_atoms(t_moldyn *moldyn) { vb.fd=open(file,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR); if(vb.fd<0) { perror("open visual save file fd"); -#ifndef PTHREADS +#ifndef VISUAL_THREAD return -1; #endif } @@ -3073,7 +3073,9 @@ int visual_atoms(t_moldyn *moldyn) { atom[i].ekin); // bonds between atoms +#ifndef VISUAL_THREAD process_2b_bonds(moldyn,&vb,visual_bonds_process); +#endif // boundaries if(dim.x) { @@ -3119,7 +3121,7 @@ int visual_atoms(t_moldyn *moldyn) { close(vb.fd); -#ifdef PTHREADS +#ifdef VISUAL_THREAD pthread_exit(NULL); }