1! 2! Copyright (C) 2019 Quantum ESPRESSO group 3! This file is distributed under the terms of the 4! GNU General Public License. See the file `License' 5! in the root directory of the present distribution, 6! or http://www.gnu.org/copyleft/gpl.txt . 7! 8!------------------------------------------------------------------------ 9SUBROUTINE set_spin_vars( lsda, noncolin, lspinorb, domag, & 10 npol, nspin, nspin_lsda, nspin_mag, nspin_gga, current_spin ) 11 !------------------------------------------------------------------------ 12 ! 13 ! Set various spin-related variables 14 ! 15 LOGICAL, INTENT(IN) :: lsda, noncolin, lspinorb, domag 16 INTEGER, INTENT(OUT) :: npol, nspin, nspin_lsda, nspin_mag, nspin_gga 17 INTEGER, INTENT(OUT) :: current_spin 18 ! 19 IF ( lsda ) THEN 20 ! 21 ! ... wavefunctions have up and down spin 22 ! 23 npol = 1 24 nspin = 2 25 nspin_mag = 2 26 nspin_lsda = 2 27 nspin_gga = 2 28 current_spin = -1 29 ELSE IF ( noncolin ) THEN 30 ! 31 ! ... wavefunctions are spinors with 2 components 32 ! 33 npol = 2 34 nspin = 4 35 nspin_lsda = 1 36 IF (domag) THEN 37 nspin_gga = 2 38 nspin_mag = 4 39 ELSE 40 nspin_gga = 1 41 nspin_mag = 1 42 ENDIF 43 current_spin = 1 44 ELSE 45 ! 46 ! ... wavefunctions are scalars 47 ! 48 npol = 1 49 nspin = 1 50 nspin_mag = 1 51 nspin_lsda = 1 52 nspin_gga = 1 53 current_spin = 1 54 END IF 55 ! 56END SUBROUTINE set_spin_vars 57