Skip to content

Commit d25da49

Browse files
authored
(#312) Quick fix: QM/MM dipole printing.
* Small fix for QM/MM in dipole center calculation. * Added dipole to QM/MM phosphate test.
1 parent acbe71b commit d25da49

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

lioamber/dip.f90

+10-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ subroutine dip(uDip, P_density)
1717

1818
use garcha_mod , only: NCO, Nunp, Iz, r, pc, d, natom, nsol
1919
use basis_data , only: a, c, Nuc, ncont, M, nshell, norm
20-
use constants_mod, only: pi32, pi5
20+
use constants_mod, only: pi32
2121

2222
implicit none
2323
double precision, intent(in) :: P_density(M*(M+1)/2)
@@ -27,7 +27,7 @@ subroutine dip(uDip, P_density)
2727
aux6(3), srs(3), Q(3), uDipAt(3)
2828
double precision :: sq3, alf, alf2, cc, cCoef, dd, dp, dijs, f1, f2, &
2929
factor, z2, zij, Qc, ps, pis, pjs, ss, t0, t1
30-
integer :: M2, ns, np, nd, i, j, k, ii, jj, l1, l2, l3, l4, l12, l34, n, &
30+
integer :: M2, ns, np, nd, i, j, k, ii, jj, l1, l2, l3, l4, l12, l34, &
3131
ni, nj, iCrd, nElec
3232

3333
! Constants
@@ -50,8 +50,7 @@ subroutine dip(uDip, P_density)
5050
alf = a(i,ni) * a(j,nj) / zij
5151
ss = pi32 * exp(-alf*dd) / (zij*sqrt(zij))
5252
k = i + ((M2-j) * (j-1)) /2
53-
cCoef = c(i,ni) * c(j,nj)
54-
cc = cCoef * P_density(k)
53+
cc = c(i,ni) * c(j,nj) * P_density(k)
5554
do iCrd = 1, 3
5655
Q(iCrd) = (a(i,ni) * r(Nuc(i),iCrd) &
5756
+ a(j,nj) * r(Nuc(j),iCrd)) /zij
@@ -165,12 +164,9 @@ subroutine dip(uDip, P_density)
165164
cCoef=c(i,ni)*c(j,nj)
166165

167166
do l1 = 1, 3
168-
t1=Q(l1)-r(Nuc(i),l1)
169-
ps=ss*t1
170-
aux(1)=t1*srs(1)
171-
aux(2)=t1*srs(2)
172-
aux(3)=t1*srs(3)
173-
aux(l1)=aux(l1)+ss/z2
167+
ps = ss * t1
168+
aux = (Q(l1) - r(Nuc(i),l1)) * srs
169+
aux(l1) = aux(l1) + ss / z2
174170

175171
do l2 = 1, l1
176172
t1 = Q(l2) - r(Nuc(i),l2)
@@ -404,9 +400,9 @@ subroutine dip(uDip, P_density)
404400
uDipAt(3) = uDipAt(3) + Iz(i)*r(i,3)
405401
enddo
406402

407-
Qc=Qc-nElec
403+
Qc = Qc - nElec
408404
if (Nsol > 0) then
409-
do k=1,Nsol
405+
do k = natom+1, natom + Nsol
410406
Qc = Qc + pc(k)
411407
enddo
412408
endif
@@ -416,8 +412,8 @@ subroutine dip(uDip, P_density)
416412
! center of charge (important in Reaction Field calculations). For neutral !
417413
! systems this is not necessary. !
418414

419-
factor = (Qc + nElec)/nElec
420-
uDip = (uDipAt - uDip*factor) * 2.54D0
415+
factor = (Qc + nElec) / nElec
416+
uDip = (uDipAt - uDip * factor) * 2.54D0
421417

422418
return
423419
end subroutine dip

test/LIO_test/03_fosfatoQMMM/check_test.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import energy
66
import forces
77
import mulliken
8+
import dipole
89

910
energy.Check()
1011
forces.Check()
1112
mulliken.Check()
12-
13+
dipole.Check()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
#DIPOLE MOMENT, X Y Z COMPONENTS AND NORM (DEBYES)
3+
4+
-15.327737914 15.718748223 29.199280029 36.532404102

test/LIO_test/03_fosfatoQMMM/fos.in

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
charge = -1
55
writeforces = t
66
mulliken = t
7+
dipole = t
78
nmax = 100
89

910
little_cube_size = 8

0 commit comments

Comments
 (0)