[Pw_forum] question pertaining to subroutine regterg

Stefano Baroni baroni at sissa.it
Thu Apr 3 16:46:16 CEST 2008


Hi Wei.

I know little of the routine regter, as it is now, but I know very  
well what it used to be, because I wrote a routine with this name  
long, long, ago. The routine name is a kind of awkward acronym, where  
the first "R" stands for real (as opposed to Cegter: guess why); TER  
stands for iTERative, and EG  for EiGen ... Admittedly, not a very  
informative name

1) a real matrix can be stored in a complex array: the computer will  
never know, because fortran arguments are passed to subprograms by  
reference (i.e. the compiler passes just the memory address of the  
first element of the array: it is the programmer's responsibility to  
make sure that what the subroutine receives is what the he/she  
intends). It is admittedly not good programming practice to pass a  
complex array instead of a real one (or vice versa), but I can assure  
that this was common practice when I was young (long, long ago).

2) the eigenvectors of a real symmetric matrix can ALWAYS be chosen to  
be real, as you can easily convince yourself by simply thinking of the  
definition of eiegenvectors.

Hope this helps the peace of your mind.

Cheers - Stefano Baroni

PS: I do appreciate that some people take the luxury of digging into  
the codes. This is the only way to learn the art of scientific  
computing. Bravo!

On Apr 2, 2008, at 10:43 PM, willy kohn wrote:

> Hi, there:
>
> I was stucked again in the subroutine regterg in the file  
> regterg.f90 when I read the pwscf code. There are two things  
> bothering me.
>
> One is in the subroutine, the variables psi and hpsi are declared as  
> complex(dp), however, they are used as parameters to call the   
> Lapack subroutine DGEMM, which requires real numbers. For example,  
> in the line 136,
>
>  CALL DGEMM( 'T', 'N', nbase, nbase, ndim2, 2.D0 , &
>                psi, ndmx2, hpsi, ndmx2, 0.D0, hr, nvecx )
>
> The other one is about the diagonalization of the reduced  
> hamiltonian hr, which is declared as a real symmetric matrix in the  
> subroutine. But in general, the wavefunction psi is complex, how can  
> we guarentee all the elements in the matrix is real? Can the matrix  
> hr be a Hermitian one?
>
>
> Best,
>
> Wei
> _______________________________________________
> Pw_forum mailing list
> Pw_forum at pwscf.org
> http://www.democritos.it/mailman/listinfo/pw_forum

---
Stefano Baroni - SISSA  &  DEMOCRITOS National Simulation Center -  
Trieste
[+39] 040 3787 406 (tel) -528 (fax) / stefanobaroni (skype)

Please, if possible, don't  send me MS Word or PowerPoint attachments
Why? See:  http://www.gnu.org/philosophy/no-word-attachments.html



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.democritos.it/pipermail/pw_forum/attachments/20080403/9d18ccd0/attachment.htm 


More information about the Pw_forum mailing list