vibra precision: double -> single complex -> double complex

Bug #1816719 reported by Nick Papior
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Siesta
Status tracked in Trunk
4.0
Fix Committed
Low
Nick Papior
4.1
Fix Committed
Low
Nick Papior
Trunk
Fix Released
Low
Nick Papior

Bug Description

In vibra the dc variable is build the dynamical matrix build with phases.

However, it is only a complex variable (not complex(dp)). Hence the dynamical matrix is build using single precision, then copied to a double precision array.
This is particularly important for the low energy eigenmodes.

This patch fixes this:

=== modified file 'Util/Vibra/Src/vibra.f'
--- Util/Vibra/Src/vibra.f 2016-01-25 16:00:16 +0000
+++ Util/Vibra/Src/vibra.f 2019-02-20 09:01:01 +0000
@@ -78,7 +78,7 @@
       real*8 zero(3,3,maxa), zeroo(3,3)

 c Work space for diagonalization.
- complex dc(maxd,maxd),phase,IRtrm,vecmw(3)
+ complex*16 dc(maxd,maxd),phase,IRtrm,vecmw(3)
       real*8 work(maxd),work2(2,maxd)
       real*8 dd(maxd,maxd),zr(maxd,maxd),zi(maxd,maxd),omega(maxd)

@@ -517,7 +517,7 @@
             enddo
 c qr = q(1)*r(1) + q(2)*r(2) + q(3)*r(3)
             do in = 1,neq
- phase = cos(qr(in))*(1.0,0.0) + sin(qr(in))*(0.0,1.0)
+ phase = cmplx(cos(qr(in)), sin(qr(in)), 8)
               do ii=1,3
               do ij=1,3
                 ix = (i-1)*3+ii
@@ -542,8 +542,8 @@

         do ix=1,3*natoms
           do jx=ix,3*natoms
- dd(ix,jx)=imag(dc(jx,ix))
- dd(jx,ix)=real(dc(jx,ix))
+ dd(ix,jx)=aimag(dc(jx,ix))
+ dd(jx,ix)=real(dc(jx,ix), 8)
           enddo
         enddo

@@ -571,7 +571,7 @@
 c Mass weight eigenvectors
               rmass = 1.0d0/sqrt(xmass(j))
               do ii = 1,3
- vecmw(ii) = cmplx(zr(ind+ii,i),zi(ind+ii,i))
+ vecmw(ii) = cmplx(zr(ind+ii,i),zi(ind+ii,i), 8)
                 vecmw(ii) = vecmw(ii)*rmass
               enddo

Revision history for this message
Nick Papior (nickpapior) wrote :

I'll fix this in 4.0 and push up through. Probably wait for next week ;)

Changed in siesta:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.