--- prn_dipoles.f 2007-11-01 08:55:07.000000000 -0700 +++ prn_dipoles.f 2007-11-01 09:23:15.000000000 -0700 @@ -16,7 +16,8 @@ !the dipole moment is calculated with respect to the group centre !of mass. - use constants, only : INV_AMBER_ELECTROSTATIC + use constants, only : INV_AMBER_ELECTROSTATIC, AMBER_ELECTROSTATIC, zero + use qmmm_module, only : qmmm_nml, qm2_struct, qmmm_struct implicit none integer numgroups integer ipres(*) @@ -28,6 +29,7 @@ integer grpcount integer atomcount + integer qm_temp_count _REAL_ centmass(3) _REAL_ permdipx, permdipy, permdipz _REAL_ inddipx, inddipy, inddipz @@ -42,6 +44,14 @@ _REAL_ elecang_to_debye elecang_to_debye = 4.802889778d0 + !if QMMM is in use then use the mulliken charges to calculate dipoles. + if (qmmm_nml%ifqnt) then + do qm_temp_count = 1, qmmm_struct%nquant_nlink + q(qmmm_nml%iqmatoms(qm_temp_count)) = & + qm2_struct%scf_mchg(qm_temp_count)*AMBER_ELECTROSTATIC + end do + end if + ! Loop over groups 1 to numgroups - 1 ! minus 1 since the last group contains everything else ! so we don't want it @@ -115,6 +125,12 @@ !Move to next group end do ! grpcount = 1,(numgroups-1) + if (qmmm_nml%ifqnt) then + do qm_temp_count = 1, qmmm_struct%nquant_nlink + q(qmmm_nml%iqmatoms(qm_temp_count)) = zero + end do + end if + return end subroutine printdip --- qmmm_module.f 2007-11-01 10:02:52.000000000 -0700 +++ qmmm_module.f 2007-11-01 09:52:38.000000000 -0700 @@ -530,13 +530,8 @@ end if !scf_mchg has not been allocated yet on non-master threads so allocate it. - if ( qm2_struct%calc_mchg_scf .or. qmmm_nml%qm_ewald>0) then - !We need to allocate the memory for the mulliken charge array - !Even if calc_mchg_scf is off for QM ewald since we will fill this - !array with the muliken charges for the converged SCF. - allocate ( qm2_struct%scf_mchg(qmmm_struct%nquant_nlink), stat = ier ) - REQUIRE(ier == 0) !Deallocated in deallocate qmmm - end if + allocate ( qm2_struct%scf_mchg(qmmm_struct%nquant_nlink), stat = ier ) + REQUIRE(ier == 0) !Deallocated in deallocate qmmm !Now we can broadcast each of the arrays call mpi_bcast(qmmm_struct%qm_atom_type, qmmm_struct%nquant_nlink, MPI_INTEGER, 0, commsander, ier) @@ -1058,10 +1053,8 @@ end if !Deallocate the scf Mulliken charge array if it was used. !Was allocated on all cpus. - if ( qm2_struct%calc_mchg_scf ) then - deallocate ( qm2_struct%scf_mchg, stat = ier ) - REQUIRE(ier == 0) - end if + deallocate ( qm2_struct%scf_mchg, stat = ier ) + REQUIRE(ier == 0) !Deallocate QM-GB arrays - only used with qmgb=2. if ( qmmm_nml%qmgb == 2 ) then --- qm_mm.f 2007-11-01 09:19:13.000000000 -0700 +++ qm_mm.f 2007-11-01 09:19:22.000000000 -0700 @@ -411,7 +411,7 @@ !============================= ! Print Mulliken Charges !============================= - if (qmmm_nml%printcharges .and. qmmm_mpi%master) then + if (qmmm_mpi%master) then !Calculate and store the mulliken charges on every step if we are !printing them. We only actually print on every ntpr steps but this !is done at the end of runmd so it is difficult to get a message in here --- sander.f 2007-11-01 09:55:59.000000000 -0700 +++ sander.f 2007-11-01 09:53:06.000000000 -0700 @@ -453,14 +453,8 @@ qmmm_mpi%nquant_nlink_start = 1 qmmm_mpi%nquant_nlink_end = qmmm_struct%nquant_nlink / ncopy !Now we know how many link atoms we can allocated the scf_mchg array... - if ( qm2_struct%calc_mchg_scf .or. qmmm_nml%qm_ewald>0 .or. & - qmmm_nml%printcharges) then - !We need to allocate the memory for the mulliken charge array - !Even if calc_mchg_scf is off for QM ewald since we will fill this - !array with the muliken charges for the converged SCF. - allocate ( qm2_struct%scf_mchg(qmmm_struct%nquant_nlink), stat = ier ) - REQUIRE(ier == 0) !Deallocated in deallocate qmmm - end if + allocate ( qm2_struct%scf_mchg(qmmm_struct%nquant_nlink), stat = ier ) + REQUIRE(ier == 0) !Deallocated in deallocate qmmm !We can also allocate ewald_memory if (qmmm_nml%qm_ewald > 0 ) then call allocate_qmewald(natom)