diff -Nr -u5 pmemd_orig/src/remd_exchg.F90 pmemd_dump/src/remd_exchg.F90 --- pmemd_orig/src/remd_exchg.F90 2012-12-15 19:57:56.000000000 +0100 +++ pmemd_dump/src/remd_exchg.F90 2012-12-16 21:04:24.000000000 +0100 @@ -436,10 +436,15 @@ type(pme_pot_ene_rec) :: my_new_pme_ene ! pme energy record for THEIR coords type(ene_temp) :: my_ene_temp type(ene_temp) :: neighbor_ene_temp type(ene_temp) :: ene_temp_buffer(numgroups) ! to collect/print REMD data + logical, save :: force_not_dumped = .true. + logical, save :: force_not_reduced = .true. + double precision, dimension(:,:), allocatable :: f_buff + character(80) dump_name + ! Get coordinates and forces from GPU #ifdef CUDA call gpu_download_crd(crd) call gpu_download_frc(frc) @@ -524,10 +529,38 @@ my_atm_lst, .true., .true., .false., my_new_pme_ene, & virial, ekcmt, pme_err_est) my_ene_temp%energy_2 = my_new_pme_ene%total + if (force_not_reduced) then + allocate(f_buff(3, atm_cnt)) + call MPI_Reduce(frc_temp, f_buff, atm_cnt*3, MPI_DOUBLE_PRECISION, & + MPI_SUM, 0, pmemd_comm, err_code_mpi) + force_not_reduced = .false. + end if + if (force_not_dumped) then + if (master) then + write(6, '(/"dumping neighbour forces"/)') + !write(dump_name, '("array_dump."i3.3)') master_rank + 1 + !open(95, file = dump_name, status = 'old', position = 'append', action = 'write') + write(95, '("neighbour coordinates")') + write(95, *) crd_temp + write(95, '("end")') + write(95, '("neighbour forces")') + write(95, *) frc_temp + write(95, '("end")') + write(95, '("neighbour forces after reduction")') + write(95, *) f_buff + write(95, '("end")') + close(95) + deallocate(f_buff) + else + deallocate(f_buff) + end if + force_not_dumped = .false. + end if + end if #ifdef CUDA ! Update the results from the GPU diff -Nr -u5 pmemd_orig/src/runmd.F90 pmemd_dump/src/runmd.F90 --- pmemd_orig/src/runmd.F90 2012-12-15 19:57:56.000000000 +0100 +++ pmemd_dump/src/runmd.F90 2012-12-16 21:04:03.000000000 +0100 @@ -101,10 +101,15 @@ #ifdef MPI double precision :: remd_ptot double precision :: new_list_cnt double precision, save :: reduce_buf_in(7) double precision, save :: reduce_buf_out(7) + + logical, save :: force_not_dumped = .true. + logical, save :: force_not_reduced = .true. + double precision, dimension(:,:), allocatable :: f_buff + character(80) dump_name #endif double precision :: fac(3) double precision :: rmu(3) double precision :: factt double precision :: pconv @@ -604,10 +609,38 @@ my_atm_lst, new_list, need_pot_enes, need_virials, & pme_pot_ene, virial, ekcmt, pme_err_est) remd_ptot = pme_pot_ene%total + if (force_not_reduced) then + allocate(f_buff(3, atm_cnt)) + call MPI_Reduce(frc, f_buff, atm_cnt*3, MPI_DOUBLE_PRECISION, & + MPI_SUM, 0, pmemd_comm, err_code_mpi) + force_not_reduced = .false. + end if + if (force_not_dumped) then + if (master) then + write(6, '(/"dumping own forces"/)') + write(dump_name, '("array_dump."i3.3)') master_rank + 1 + open(95, file = dump_name, status = 'replace', action = 'write') + write(95, '("own coordinates")') + write(95, *) crd + write(95, '("end")') + write(95, '("own forces")') + write(95, *) frc + write(95, '("end")') + write(95, '("own forces after reduction")') + write(95, *) f_buff + write(95, '("end")') + !close(95) + deallocate(f_buff) + else + deallocate(f_buff) + end if + force_not_dumped = .false. + end if + else if (using_gb_potential) then call gb_force(atm_cnt, crd, frc, gb_pot_ene, irespa, need_pot_enes) remd_ptot = gb_pot_ene%total