********> update.14 Authors: Vinicius Wilian D. Cruzeiro Date: May 21, 2018 Programs: pmemd Description: Adds an error message when users run REMD and the box sizes are not the same across all replicas. -------------------------------------------------------------------------------- src/pmemd/src/master_setup.F90 | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git src/pmemd/src/master_setup.F90 src/pmemd/src/master_setup.F90 index 440ce62..5ecfe73 100644 --- src/pmemd/src/master_setup.F90 +++ src/pmemd/src/master_setup.F90 @@ -96,6 +96,12 @@ subroutine master_setup(num_ints, num_reals, new_stack_limit, terminal_flag) character(8) :: date character(10) :: time character(512) :: char_tmp_512 + +#ifdef MPI + double precision :: val + double precision, allocatable :: repvals(:) + integer :: alloc_failed +#endif inerr = 0 @@ -461,6 +467,44 @@ subroutine master_setup(num_ints, num_reals, new_stack_limit, terminal_flag) if (using_pme_potential) & call print_mdin_ewald_dat(box_alpha, box_beta, box_gamma, box, es_cutoff) + +#ifdef MPI + ! Prints an error if REMD is to be performed with different cell sizes across + ! the different replicas + if (remd_method .ne. 0 .and. ntp .eq. 0) then + allocate(repvals(numgroups), stat = alloc_failed) + if (alloc_failed .ne. 0) then + write(mdout, '(a,a)') error_hdr, 'Error in master_setup' + write(mdout, '(a,a)') extra_line_hdr, 'allocation error' + call mexit(6,1) + end if + do i = 1, 6 + repvals(:) = 0.d0 + if (i .lt. 4) then + val = box(i) + else if (i .eq. 4) then + val = box_alpha + else if (i .eq. 5) then + val = box_beta + else if (i .eq. 6) then + val = box_gamma + end if + call mpi_allgather(val, 1, mpi_double_precision, & + repvals, 1, mpi_double_precision, & + pmemd_master_comm, err_code_mpi) + do j = 2, numgroups + if (abs(repvals(j)-repvals(1)) .gt. 1.0d-5) then + write(mdout,'(a,a,a)') error_hdr, "The box sizes do not match for all REMD replicas." + write(mdout,'(11x,a)') "This can happen, for example, if you are using different input coordinate files" + write(mdout,'(11x,a)') "for the different replicas and these structures come from a NPT run." + write(mdout,'(11x,a)') "Make sure the box lengths and angles are the same for all replicas in all input" + write(mdout,'(11x,a)') "coordinate files." + call mexit(6,1) + end if + end do + end do + end if +#endif /* MPI */ ! Check if ifbox variable from prmtop file matches actual angles. This must ! occur immediately after print_mdin_ewald_dat for consistency with sander11