Ford-modules part 21

This commit is contained in:
fabrizio22 2021-03-12 17:51:01 +01:00
parent 7d4eaeaa9d
commit 46e469655e
4 changed files with 75 additions and 58 deletions

View File

@ -8,56 +8,70 @@
!----------------------------------------------------------------------------
!
MODULE noncollin_module
!
!! Variables related to the case of noncollinear magnetism.
!
USE kinds, ONLY : DP
USE parameters, ONLY : ntypx
!
SAVE
!
INTEGER :: &
npol, & ! number of coordinates of wfc
report, & ! print the local quantities (magnet. and rho)
! every #report iterations
nspin_lsda = 1, & ! =1 when nspin=1,4 =2 when nspin=2
nspin_mag = 1, & ! =1 when nspin=1,4 (domag=.false.), =2 when
! nspin=2, =4 nspin=4 (domag=.true.)
nspin_gga = 1, & ! =1 when nspin=1,4 (domag=.false.)
! =2 when nspin=2,4 (domag=.true.) (needed with gga)
i_cons = 0 ! indicator for constrained local quantities
INTEGER :: npol
!! number of coordinates of wfc
INTEGER :: report
!! print the local quantities (magnet. and rho) every #report iterations
INTEGER :: nspin_lsda = 1
!! equal to 1 when \(\text{nspin}=1,4\) and to 2 when \(\text{nspin}=2\)
INTEGER :: nspin_mag = 1
!! equal to 1 when \(\text{nspin}=1,4\) (\(\text{domag}=\text{FALSE}\)), to 2 when
!! \(\text{nspin}=2\) and to 4 when \(\text{nspin}=4\) (\(\text{domag}=\text{TRUE}\))
INTEGER :: nspin_gga = 1
!! equal to 1 when \(\text{nspin}=1,4\) (\(\text{domag}=\text{FALSE}\)), equal
!! to 2 when \(\text{nspin}=2,4\) (\(\text{domag}=\text{TRUE}\)) (needed with GGA)
INTEGER :: i_cons = 0
!! indicator for constrained local quantities
!
INTEGER, ALLOCATABLE :: &
! ! when spherical (non-overlapping) integration
pointlist(:) ! regions are defined around atoms this index
! says for each point in the fft grid to which
! atom it is assigned (0 if no atom is selected)
INTEGER, ALLOCATABLE :: pointlist(:)
!! when spherical (non-overlapping) integration regions are defined around
!! atoms this index says for each point in the fft grid to which atom
!! it is assigned (0 if no atom is selected).
!
LOGICAL :: &
noncolin, & ! true if noncollinear magnetism is allowed
lsign=.FALSE. ! if true use the sign feature to calculate
! rhoup and rhodw
LOGICAL :: noncolin
!! TRUE if noncollinear magnetism is allowed
LOGICAL :: lsign=.FALSE.
!! if TRUE use the sign feature to calculate rhoup and rhodw
!
REAL (DP) :: &
angle1(ntypx), &! Define the polar coordinates of the starting
angle2(ntypx), &! magnetization's direction for each atom
mcons(3,ntypx)=0.d0, &! constrained values for local variables
magtot_nc(3), &! total magnetization
bfield(3)=0.d0, &! magnetic field used in some cases
vtcon, &! contribution of the constraining fields to
! the total energy
r_m(ntypx) = 0.0d0, &! Radius for local integrations for each type
lambda ! prefactor in the penalty functional
! for constraints
REAL(DP) :: angle1(ntypx)
!! define the polar coordinates of the starting magnetization
!! direction for each atom - first angle
REAL(DP) :: angle2(ntypx)
!! starting mag. direction - second angle.
REAL(DP) :: mcons(3,ntypx)=0.d0
!! constrained values for local variables
REAL(DP) :: magtot_nc(3)
!! total magnetization
REAL(DP) :: bfield(3)=0.d0
!! magnetic field used in some cases
REAL(DP) :: vtcon
!! contribution of the constraining fields to the total energy
REAL(DP) :: r_m(ntypx)=0.0d0
!! radius for local integrations for each type
REAL(DP) :: lambda
!! prefactor in the penalty functional for constraints
!
REAL (DP), ALLOCATABLE :: &
factlist(:), &! weight factors for local integrations
m_loc(:,:) ! local integrated magnetization
REAL(DP) :: &
ux(3) ! versor for deciding signs in gga
REAL(DP), ALLOCATABLE :: factlist(:)
!! weight factors for local integrations
REAL(DP), ALLOCATABLE :: m_loc(:,:)
!! local integrated magnetization
REAL(DP) :: ux(3)
!! versor for deciding signs in GGA
!
CONTAINS
!
!------------------------------------------------------------------------
SUBROUTINE deallocate_noncol()
!------------------------------------------------------------------------
!! Deallocates arrays related to noncollinear magnetism.
!
IF ( ALLOCATED( pointlist) ) DEALLOCATE( pointlist )
IF ( ALLOCATED( factlist ) ) DEALLOCATE( factlist )

View File

@ -11,6 +11,8 @@
! Aug 2018 (PG): reading of old xml input file using iotk deleted
MODULE open_close_input_file
!
!! Input file management.
!
USE io_global, ONLY : stdin, stdout, qestdin
!
@ -59,29 +61,27 @@ CONTAINS
!----------------------------------------------------------------------------
FUNCTION open_input_file ( input_file_, is_xml) RESULT ( ierr )
!-----------------------------------------------------------------------------
!
! ... Open file for input read, connecting it to unit qestdin.
! ... If "input_file_" is not present, read it from command line
! ... If "input_file_" is empty, the standard input is dumped to
! ... temporary file "input_tmp.in" and this is opened for read
! ... If optional variable is_xml is present, test if the file is a
! ... valid xml file.
! ... In parallel execution, must be called by a single processor
! ... On exit:
! ... ierr = -1 if standard input is successfuly dumped to file
! ... ierr = 0 if input file is successfully opened
! ... ierr = 1 if there was an error opening file
! ... If optional variable is_xml is present:
! ... is_xml=.true. if the file has extension '.xml' or '.XML'
! ... or if either <xml...> or <?xml...> is found as first token
! ... Module varliable input_file is set to the file name actually read
! ... ---------------------------------------------------------------
!! Open file for input read, connecting it to unit \(\text{qestdin}\).
!! If optional variable \(\text{is_xml}\) is present, test if the file is a
!! valid xml file.
!! In parallel execution, must be called by a single processor.
!! Module varliable input_file is set to the file name actually read.
!---------------------------------------------------------------
!
IMPLICIT NONE
!
CHARACTER (len=*), intent(in), OPTIONAL :: input_file_
!! If \(\text{input_file_}\) is not present, read it from command line.
!! If \(\text{input_file_}\) is empty, the standard input is dumped to
!! temporary file "input_tmp.in" and this is opened for read
LOGICAL, intent(out), OPTIONAL :: is_xml
!! \(\text{is_xml}=\text{TRUE}\) if the file has extension '.xml' or '.XML'
!! or if either <xml...> or <?xml...> is found as first token.
INTEGER :: ierr
!! On exit:
!! \(\text{ierr} = -1\) if standard input is successfuly dumped to file;
!! \(\text{ierr} = 0\) if input file is successfully opened;
!! \(\text{ierr} = 1\) if there was an error opening file.
!
LOGICAL :: is_xml_, is_tmp
INTEGER :: length
@ -169,9 +169,9 @@ END FUNCTION open_input_file
FUNCTION close_input_file ( ) RESULT ( ierr )
!
! ... this subroutine closes the input file opened by open_input_file
! ... also removes temporary file if data was dumped from stdin
! ... returns -1 if unit is not opened, 0 if no problem, > 0 if problems
!! This subroutine closes the input file opened by \(\texttt{open_input_file}\),
!! also removes temporary file if data was dumped from \(\text{stdin}\) and
!! returns -1 if unit is not opened, 0 if no problem, > 0 if problems.
!
IMPLICIT NONE
!

View File

@ -7,7 +7,9 @@
!
!
MODULE parameters
!
!! Upper limits on k-points, atoms and supercell size.
!
IMPLICIT NONE
SAVE
@ -21,7 +23,7 @@ MODULE parameters
!! max number of atoms for DFT+U+V calculations
INTEGER, PARAMETER :: sc_size = 1
!! Defines the supercell in DFT+U+V as composed by the unit cells located
!! by (n1,n2,n3) in primitive vectors base with -sc_size <= ni <= sc_size,
!! \((2\text{sc_size}+1)^3\) is the number of cells.
!! by (n1,n2,n3) in primitive vectors base with \(-\text{sc_size} \leq ni
!! \leq \text{sc_size}\) and \((2\text{sc_size}+1)^3\) is the number of cells.
END MODULE parameters

View File

@ -9,6 +9,7 @@
!----------------------------------------------------------------------------
MODULE parser
!----------------------------------------------------------------------------
!! String parsing routines.
!
USE io_global, ONLY : stdout
USE kinds, ONLY : DP