See here for more details about the following code snippet used in vasp source code:
! Define Pauli-matrices
sig(1,2,1)=cmplx( 1.0_q, 0.0_q,kind=q)
sig(2,1,1)=cmplx( 1.0_q, 0.0_q,kind=q)
sig(2,1,2)=cmplx( 0.0_q, 1.0_q,kind=q)
sig(1,1,3)=cmplx( 1.0_q, 0.0_q,kind=q)
I’ve searched in the Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference, but still can’t figure out the meaning of _q and kind=q used in the above data type definition:
Any more hints will be highly appreciated.
q must be a named integer constant defined somewhere in the code that is given a value of a valid real kind. I.e. look for a statement like
integer, parameter :: q = selected_real_kind(15,300).
I found the following results, which is not exactly the same as your guess:
werner@X10DAi-00:~/Public/hpc/vasp/release/vasp.6.3.0$ rg -IN ':: q =' | awk '!a[$0]++'
INTEGER, PARAMETER :: q =SELECTED_REAL_KIND(10)
decimal precision of at least P digits
exponent range of at least R
Thank you for providing documentation. The GNU Fortran Compiler and Intel Fortran Compiler follow similar convention rules:
- GNU Fortran Compiler:
Before Fortran 2008, at least one of the arguments R or P shall be present; since Fortran 2008, they are assumed to be zero if absent.
- Intel Fortran Compiler
If p or r is absent, the result is as if the argument was present with the value zero. If
radix is absent, there is no requirement on the radix of the selected kind.