********>Bugfix 31: Prepared by: Bob Duke Date: 2/6/2010 Programs: pmemd Description: Some systems, such as from the extra points versions of GLYCAM, have more "extra points" than was allowed for in the original code. Usage: Apply the following patch in $AMBERHOME/src/pmemd/src/ ---------------------------------------------------------------------------- --- extra_pnts_nb14.fpp 2010-03-08 09:45:53.000000000 -0500 +++ extra_pnts_nb14.fpp 2010-03-08 09:50:56.000000000 -0500 @@ -125,6 +125,9 @@ integer, allocatable, save :: cit_nb14(:,:) + ! Nonbonded 1-4 interactions possibly increase by: + integer, parameter :: nb14_mult_fac = 9 + ! Extra Points Frame datatype: type ep_frame_rec @@ -505,7 +508,7 @@ gbl_nb14_cnt = 0 gbl_frame_cnt = 0 - call alloc_extra_pnts_nb14_mem(numextra, 3 * (nphih + nphia), & + call alloc_extra_pnts_nb14_mem(numextra, nb14_mult_fac * (nphih + nphia), & num_ints, num_reals) numextra_test = 0 @@ -523,7 +526,7 @@ max11 = natom + numextra max12 = 3 * (nbonh + nbona) max13 = 3 * (ntheth + ntheta) - max14 = 3 * (nphih + nphia) + max14 = nb14_mult_fac * (nphih + nphia) maxa = max(max11, max12, max13, max14) allocate(epbtyp(5, natom), & @@ -537,7 +540,7 @@ i11(2, (natom + numextra)), & i12(2, 3 * (nbonh + nbona)), & i13(2, 3 * (ntheth + ntheta)), & - i14(2, 3 * (nphih + nphia)), & + i14(2, nb14_mult_fac * (nphih + nphia)), & nb_14_list(3,nphih + nphia), & s3(maxa), & stat = alloc_failed) --- nb_exclusions.fpp 2008-04-09 16:40:54.000000000 -0400 +++ nb_exclusions.fpp 2010-02-05 16:50:33.000000000 -0500 @@ -31,6 +31,7 @@ subroutine alloc_nb_exclusions_mem(atm_cnt, ext_cnt, num_ints, num_reals) use pmemd_lib_mod + use prmtop_dat_mod implicit none @@ -47,9 +48,9 @@ integer :: alloc_failed - allocate(gbl_nb_adjust_pairlst(atm_cnt + ext_cnt + ext_cnt), & + allocate(gbl_nb_adjust_pairlst(atm_cnt + ext_cnt * next_mult_fac), & atm_nb_maskdata(atm_cnt), & - atm_nb_mask(ext_cnt + ext_cnt), & + atm_nb_mask(ext_cnt * next_mult_fac), & stat = alloc_failed) if (alloc_failed .ne. 0) call setup_alloc_error @@ -128,22 +129,24 @@ ! !******************************************************************************* -subroutine make_atm_excl_mask_list(atm_cnt, numex, next, natex) +subroutine make_atm_excl_mask_list(atm_cnt, numex, natex) use gbl_constants_mod use file_io_dat_mod, only : mdout use constraints_mod, only : atm_igroup use mdin_ctrl_dat_mod, only : ibelly use pmemd_lib_mod + use prmtop_dat_mod implicit none ! Formal arguments: integer :: atm_cnt - integer :: numex(atm_cnt) ! Excluded atom count for each atom. - integer :: next ! natex() size, from prmtop. - integer :: natex(next) ! Excluded atom concatenated list. + ! Excluded atom count for each atom. + integer :: numex(atm_cnt) + ! Excluded atom concatenated list: + integer :: natex(next * next_mult_fac) ! Local variables: @@ -179,7 +182,7 @@ total_excl = total_excl + atm_nb_maskdata(atm_i)%cnt end do - if (total_excl .gt. 2 * next) then + if (total_excl .gt. next * next_mult_fac) then write(mdout, '(a,a)') error_hdr, & 'Variable next has inconsistent value in prmtop!' call mexit(6, 1) --- pme_alltasks_setup.fpp 2008-02-27 15:41:37.000000000 -0500 +++ pme_alltasks_setup.fpp 2010-02-03 18:07:03.000000000 -0500 @@ -98,7 +98,7 @@ ! to keep nonbonded calcs from being done on excluded atoms. The lists are ! static (atom-based). - call make_atm_excl_mask_list(natom, atm_numex, next, gbl_natex) + call make_atm_excl_mask_list(natom, atm_numex, gbl_natex) if (ntb .ne. 0) then call bcast_pbc @@ -184,7 +184,7 @@ ! to keep nonbonded calcs from being done on excluded atoms. The lists are ! static (atom-based). - call make_atm_excl_mask_list(natom, atm_numex, next, gbl_natex) + call make_atm_excl_mask_list(natom, atm_numex, gbl_natex) ! Need new molecule list structures to support no_intermolecular_bonds option. --- prmtop_dat.fpp 2010-03-08 09:45:53.000000000 -0500 +++ prmtop_dat.fpp 2010-03-08 10:00:42.000000000 -0500 @@ -26,14 +26,14 @@ ! Starting with nttyp, the integer values are derived rather than read. ! nttyp is the number of 6-12 vdw parameters. - integer, parameter :: prmtop_int_cnt = 35 + integer, parameter :: prmtop_int_cnt = 36 integer natom, ntypes, nbonh, ntheth, nphih, next, nres, & !7 nbona, ntheta, nphia, numbnd, numang, nptra, nphb, & !14 ifbox, ifcap, nspm, numextra, ncopy, nttyp, & !20 bonda_idx, anglea_idx, diheda_idx, & !23 gbl_bond_allocsize, gbl_angle_allocsize, & !25 - gbl_dihed_allocsize, & !26 + gbl_dihed_allocsize, next_mult_fac, & !26 nub, nubtypes, & !28 nimphi, nimprtyp, & !30 gbl_angle_ub_allocsize, gbl_dihed_imp_allocsize,& !32 @@ -54,6 +54,12 @@ save :: / prmtop_int / +! next_mult_fac is a multiplier that is set to handle differences in gbl_natex, +! etc. storage requirements due to extra points nb14 redefinition. It is set +! to 2 for non-ep code (handles list doubling), but bumped up to 9 for ep +! code; so far only glycam-associated ep really seem to need this... This +! is a hack... + ! Cap data not currently supported... ! integer, parameter :: prmtop_dbl_cnt = 4 @@ -62,6 +68,7 @@ ! common / prmtop_dbl / cutcap, xcap, ycap, zcap + ! atm_qterm = the atom partial charge array for amber pme. ! atm_mass = the atom mass array. ! atm_iac = TBS @@ -310,6 +317,17 @@ 'You must use no_intermolecular_bonds = 1 (the default) for this prmtop.' end if + ! BUGBUG: + ! This is a heuristic for possible nb exclusions list growth, a total + ! hack that may fail in some circumstances. Need to reengineer a bunch + ! of code to avoid this in the future... + + if (numextra .eq. 0) then + next_mult_fac = 2 + else + next_mult_fac = 8 + end if + nttyp = ntypes * (ntypes + 1) / 2 ! --- Read the force field information from the prmtop if available @@ -1384,7 +1402,7 @@ call mpi_bcast(atm_numex, natom, mpi_integer, 0, & mpi_comm_world, err_code_mpi) - call mpi_bcast(gbl_natex, next, mpi_integer, 0, & + call mpi_bcast(gbl_natex, next * next_mult_fac, mpi_integer, 0, & mpi_comm_world, err_code_mpi) call mpi_bcast(atm_nsp, nspm, mpi_integer, 0, & @@ -1576,13 +1594,15 @@ ! elements are read and subsequently broadcast. allocate(atm_numex(natom), & - gbl_natex(next * 2), & + gbl_natex(next * next_mult_fac), & stat = alloc_failed) if (alloc_failed .ne. 0) call setup_alloc_error num_ints = num_ints + size(atm_numex) + size(gbl_natex) + gbl_natex(:) = 0 + ! Allocation of stuff that will later be deallocated that is only used in ! the master: --- f90depends 2008-04-16 12:19:26.000000000 -0400 +++ f90depends 2010-02-05 16:51:14.000000000 -0500 @@ -207,6 +207,7 @@ mol_list.o: copyright.i nb_exclusions.o: gbl_datatypes.o nb_exclusions.o: pmemd_lib.o +nb_exclusions.o: prmtop_dat.o nb_exclusions.o: parallel_dat.o nb_exclusions.o: gbl_constants.o nb_exclusions.o: file_io_dat.o ---------------------------------------------------------------------------- Workaround: none