Skip to content
Snippets Groups Projects
Commit bfe8b97c authored by Nicolas Essing's avatar Nicolas Essing
Browse files

Cleaned up input parameters for nonco bfields.

Remove some inputs that were moved to atom-wise switches in
nonco_angle.dat and some for functionality that was not implemented.

Changed the rest to form a more consistent interface.
Keeping a switch to turn everything off. If that switch is turned on,
this implies calculating the torque and constraint magnetism in general.
The fields are calculated for all atoms where that is specified in
the nonco_angle.dat.
It does not anymore imply external fields: There is a new switch for that.
If that is turned on, a file with external fields must be provided.
Introduced a verbosity parameter for bfields, select between no output,
summary and detailed information.

See comments and documentation for details.

Changed output depending on the new input parameter.
parent 23bab175
No related branches found
No related tags found
No related merge requests found
...@@ -295,6 +295,7 @@ module CalculationData_mod ...@@ -295,6 +295,7 @@ module CalculationData_mod
integer, intent(in) :: voronano integer, intent(in) :: voronano
integer :: atom_id, ila, irmd integer :: atom_id, ila, irmd
integer :: verbosity
call create(self%lattice_vectors, arrays%bravais) ! createLatticeVectors call create(self%lattice_vectors, arrays%bravais) ! createLatticeVectors
...@@ -385,8 +386,14 @@ module CalculationData_mod ...@@ -385,8 +386,14 @@ module CalculationData_mod
call setup_iguess(self, dims, arrays%nofks, kmesh) ! setup storage for iguess call setup_iguess(self, dims, arrays%nofks, kmesh) ! setup storage for iguess
if (params%noncobfield) then if (params%noncobfield) then
! Output only as master, in that case copy the input parameter
verbosity = -1
if (mp%isMasterRank) verbosity = params%bfield_verbosity
! Initialize the noncolinear magnetic field. If present, read from disk ! Initialize the noncolinear magnetic field. If present, read from disk
call load_bfields_from_disk(self%bfields, params%constr_field, dims%naez, self%atom_ids) call load_bfields_from_disk(self%bfields, params%external_bfield, &
verbosity, dims%naez, self%atom_ids, &
self%noco_data%angle_fix_mode)
! Initialize the fields ! Initialize the fields
do ila = 1, self%num_local_atoms do ila = 1, self%num_local_atoms
call init_bfield(self%bfields(ila), dims%lmaxd, & call init_bfield(self%bfields(ila), dims%lmaxd, &
......
...@@ -33,7 +33,7 @@ SUBROUTINE tmat_newsolver(ie,nspin,lmax,zat,socscale, & ...@@ -33,7 +33,7 @@ SUBROUTINE tmat_newsolver(ie,nspin,lmax,zat,socscale, &
! lly, & ! lly, &
lmpotd,irmd_new,TmatN,soc,enable_quad_prec, & lmpotd,irmd_new,TmatN,soc,enable_quad_prec, &
bfield, imt, iteration_number, itscf0, itscf1, & bfield, imt, iteration_number, itscf0, itscf1, &
lbfield, lbfield_constr, lbfield_trans, lbfield_mt) lbfield, lbfield_trans, lbfield_mt)
! Code converted using TO_F90 by Alan Miller ! Code converted using TO_F90 by Alan Miller
! Date: 2016-04-18 Time: 14:58:02 ! Date: 2016-04-18 Time: 14:58:02
...@@ -68,7 +68,7 @@ type(bfield_data), intent(in) :: bfield !! Information on the noncoll ...@@ -68,7 +68,7 @@ type(bfield_data), intent(in) :: bfield !! Information on the noncoll
integer, intent(in) :: imt !! MT radius (index in cheb mesh) integer, intent(in) :: imt !! MT radius (index in cheb mesh)
integer, intent(in) :: iteration_number !! Current iteration number integer, intent(in) :: iteration_number !! Current iteration number
integer, intent(in) :: itscf0, itscf1 !! Window of iterations when to apply fields integer, intent(in) :: itscf0, itscf1 !! Window of iterations when to apply fields
logical, intent(in) :: lbfield, lbfield_constr !! Wheter to apply the fields logical, intent(in) :: lbfield !! Wheter to apply nonco bfields
logical, intent(in) :: lbfield_trans ! Apply only transveral logical, intent(in) :: lbfield_trans ! Apply only transveral
logical, intent(in) :: lbfield_mt ! Apply only up do MT radius logical, intent(in) :: lbfield_mt ! Apply only up do MT radius
...@@ -167,8 +167,7 @@ allocate(ull(nsra*lmmaxso,lmmaxso,irmdnew)) ...@@ -167,8 +167,7 @@ allocate(ull(nsra*lmmaxso,lmmaxso,irmdnew))
! add bfield ! add bfield
if (lbfield) then if (lbfield) then
call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, & call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, &
itscf0, itscf1, lbfield_constr, lbfield_trans, & itscf0, itscf1, lbfield_trans, lbfield_mt, .false.)
lbfield_mt, .false.)
end if end if
!c extend matrix for the SRA treatment !c extend matrix for the SRA treatment
...@@ -339,7 +338,7 @@ SUBROUTINE rhovalnew(ldorhoef,ielast,nsra,nspin,lmax,ez,wez,zat, & ...@@ -339,7 +338,7 @@ SUBROUTINE rhovalnew(ldorhoef,ielast,nsra,nspin,lmax,ez,wez,zat, &
den_out,espv,rho2ns,r2nef,gmatn, muorb, & den_out,espv,rho2ns,r2nef,gmatn, muorb, &
lpotd,lmaxd,irmd,irmd_new,iemxd,soc,enable_quad_prec, & lpotd,lmaxd,irmd,irmd_new,iemxd,soc,enable_quad_prec, &
bfield, imt, iteration_number, itscf0, itscf1, & bfield, imt, iteration_number, itscf0, itscf1, &
lbfield, lbfield_constr, ltorque, lbfield_trans, lbfield_mt) lbfield, lbfield_trans, lbfield_mt)
! Code converted using TO_F90 by Alan Miller ! Code converted using TO_F90 by Alan Miller
! Date: 2016-04-21 Time: 11:39:57 ! Date: 2016-04-21 Time: 11:39:57
...@@ -395,8 +394,7 @@ type(bfield_data), intent(inout) :: bfield !! Information on the noncoll ...@@ -395,8 +394,7 @@ type(bfield_data), intent(inout) :: bfield !! Information on the noncoll
integer, intent(in) :: imt !! MT radius (index in cheb mesh) integer, intent(in) :: imt !! MT radius (index in cheb mesh)
integer, intent(in) :: iteration_number !! Current iteration number integer, intent(in) :: iteration_number !! Current iteration number
integer, intent(in) :: itscf0, itscf1 !! Window of iterations when to apply fields integer, intent(in) :: itscf0, itscf1 !! Window of iterations when to apply fields
logical, intent(in) :: lbfield, lbfield_constr !! Wheter to apply the fields logical, intent(in) :: lbfield !! Wheter to apply nonco bfields
logical, intent(in) :: ltorque !! Whether to calculate torques
logical, intent(in) :: lbfield_trans ! Apply only transveral logical, intent(in) :: lbfield_trans ! Apply only transveral
logical, intent(in) :: lbfield_mt ! Apply only up do MT radius logical, intent(in) :: lbfield_mt ! Apply only up do MT radius
...@@ -559,8 +557,7 @@ DO ie=1,ielast ...@@ -559,8 +557,7 @@ DO ie=1,ielast
! Add bfield ! Add bfield
if (lbfield) then if (lbfield) then
call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, & call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, &
itscf0, itscf1, lbfield_constr, lbfield_trans, & itscf0, itscf1, lbfield_trans, lbfield_mt, .false.)
lbfield_mt, .false.)
end if end if
!c extend matrix for the SRA treatment !c extend matrix for the SRA treatment
...@@ -625,8 +622,7 @@ DO ie=1,ielast ...@@ -625,8 +622,7 @@ DO ie=1,ielast
! Add bfield ! Add bfield
if (lbfield) then if (lbfield) then
call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, & call add_bfield(bfield, vnspll1, theta, phi, imt, iteration_number, &
itscf0, itscf1, lbfield_constr, lbfield_trans, & itscf0, itscf1, lbfield_trans, lbfield_mt, .true.)
lbfield_mt, .true.)
end if end if
!c extend matrix for the SRA treatment !c extend matrix for the SRA treatment
...@@ -823,10 +819,10 @@ END DO ...@@ -823,10 +819,10 @@ END DO
! Calculate torque ! Calculate torque
! Compare this position to KKhost: calling after the rho2nsc_loop, before cheb2oldgrid ! Compare this position to KKhost: calling after the rho2nsc_loop, before cheb2oldgrid
if (ltorque) then if (lbfield) then
call calc_torque(bfield, vins, rho2nsc, theta, phi, lmax, rpan_intervall, ipan_intervall, & call calc_torque(bfield, vins, rho2nsc, theta, phi, lmax, rpan_intervall, ipan_intervall, &
npan_tot, ncheb, imt1, iend, icleb, cleb, ifunm, thetasnew, & npan_tot, ncheb, imt1, iend, icleb, cleb, ifunm, thetasnew, &
lbfield_constr, lbfield_mt, itscf0, itscf1, iteration_number, angle_fix_mode) lbfield_mt, itscf0, itscf1, iteration_number, angle_fix_mode)
end if end if
allocate(rhotemp(irmdnew,lmpotd)) allocate(rhotemp(irmdnew,lmpotd))
......
...@@ -274,7 +274,7 @@ implicit none ...@@ -274,7 +274,7 @@ implicit none
kkr(ila)%TmatN(:,:,ispin),params%soc,params%enable_quad_prec, & kkr(ila)%TmatN(:,:,ispin),params%soc,params%enable_quad_prec, &
calc%bfields(ila), get_muffin_tin_index(atomdata%chebmesh_ptr), & calc%bfields(ila), get_muffin_tin_index(atomdata%chebmesh_ptr), &
iter, params%itbfield0, params%itbfield1, & iter, params%itbfield0, params%itbfield1, &
params%noncobfield, params%constr_field, params%trans_bfield, params%mt_bfield) params%noncobfield, params%trans_bfield, params%mt_bfield)
call rotatematrix(kkr(ila)%TmatN(:,:,ispin),noco%theta_noco(i1),noco%phi_noco(i1),lmmaxd,0) call rotatematrix(kkr(ila)%TmatN(:,:,ispin),noco%theta_noco(i1),noco%phi_noco(i1),lmmaxd,0)
else else
......
...@@ -38,16 +38,18 @@ module mod_bfield ...@@ -38,16 +38,18 @@ module mod_bfield
contains contains
!> Load the external noncollinear magnetic field (if a file is present) and !> Load the external noncollinear magnetic field (if used) and the initial
!> the initial guess for the constraining fields (if constraint magnetism is !> guess for the constraining fields from disk.
!> used and a file is present) from disk. !> This subroutine loads information for the locally treated atoms into a
!> This subroutine loads information for the locally treated atoms into an !> given array of structs of the right size.
!> array of structs. subroutine load_bfields_from_disk(bfields, external_bfield, verbosity, naez, &
subroutine load_bfields_from_disk(bfields, lbfield_constr, naez, atom_ids) atom_ids, fix_angle_modes)
type(bfield_data), intent(inout) :: bfields(:) !! Array for the read fields type(bfield_data), intent(inout) :: bfields(:) !! Array for the read fields
logical, intent(in) :: lbfield_constr !! Wheter constraint magnetism is used logical, intent(in) :: external_bfield !! Whether to apply external nonco fields
integer, intent(in) :: verbosity !! Output verbosity
integer, intent(in) :: naez !! Number of atoms in the unit cell integer, intent(in) :: naez !! Number of atoms in the unit cell
integer(kind=4), dimension(:), intent(in) :: atom_ids !! Locally treated atoms integer(kind=4), dimension(:), intent(in) :: atom_ids !! Locally treated atoms
integer(kind=1), dimension(:), intent(in) :: fix_angle_modes
integer :: num_local_atoms ! number of atoms treated in this MPI rank integer :: num_local_atoms ! number of atoms treated in this MPI rank
integer :: ila ! atom index integer :: ila ! atom index
...@@ -61,10 +63,8 @@ contains ...@@ -61,10 +63,8 @@ contains
allocate(all_bfields(naez)) allocate(all_bfields(naez))
! Read the files ! Read the files
call read_bfield(all_bfields) call read_external_bfield(all_bfields, external_bfield, verbosity)
if (lbfield_constr) then call read_constr_bfield_initial_guess(all_bfields, verbosity, fix_angle_modes)
call read_bconstr(all_bfields)
end if
! Copy the locally treated atoms to the output ! Copy the locally treated atoms to the output
do ila = 1, num_local_atoms do ila = 1, num_local_atoms
...@@ -105,18 +105,19 @@ contains ...@@ -105,18 +105,19 @@ contains
end subroutine init_bfield end subroutine init_bfield
!TODO save_bconst()
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
!> Summary: Reads the atom-wise constraining field from bconstr.dat !> Summary: Reads the atom-wise initial guess for the constraining magnetic
!> field from bconstr.dat
!> Author: MdSD, Nicolas Essing !> Author: MdSD, Nicolas Essing
!> !>
!> The file should contain three floating point values in each line and a line !> The file should contain three floating point values in each line and a line
!> for each atom. The first line is treated as a header and skipped. !> for each atom. The first line is treated as a header and skipped.
!> Intepreted as initial constraining bfield in cartesian coordinates, in Ry. !> Intepreted as initial constraining bfield in cartesian coordinates, in Ry.
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
subroutine read_bconstr(bfields) subroutine read_constr_bfield_initial_guess(bfields, verbosity, fix_angle_modes)
type(bfield_data), dimension(:), intent(inout) :: bfields type(bfield_data), dimension(:), intent(inout) :: bfields
integer, intent(in) :: verbosity
integer(kind=1), dimension(:), intent(in) :: fix_angle_modes
integer :: number_of_atoms integer :: number_of_atoms
integer :: iatom integer :: iatom
...@@ -136,6 +137,19 @@ contains ...@@ -136,6 +137,19 @@ contains
write(*,*) "Error reading bconstr_in.dat" write(*,*) "Error reading bconstr_in.dat"
stop stop
end if end if
! In case constraint magnetism is not used for this atom, set the initial
! guess to zero. Will not be updated in that case and can be added to the
! potential without further checking on input parameters.
! If an initial guess was provided that is not zero, give a warning.
if (.not. (fix_angle_modes(iatom) == 2 .or. fix_angle_modes(iatom) == 3)) then
if (any(bfields(iatom)%bfield_constr /= 0) .and. verbosity >= 0) then
write(*,'(2A,I3,2A)') 'Warning: Initial guess for constraint magnetic field ', &
'for atom ', iatom, ' was not zero, but no constraint magnetism is ', &
'used for this atom. Will be set to zero.'
end if
bfields(iatom)%bfield_constr(:) = 0
end if
end do end do
close(57493215) close(57493215)
else else
...@@ -145,43 +159,65 @@ contains ...@@ -145,43 +159,65 @@ contains
end do end do
end if end if
write(*,*) ' ############################################################' if (verbosity >= 3) then
write(*,*) ' input constraining fields' ! Write detailed information
write(*,*) ' ############################################################' write(*,'(79("#"))')
write(*,*) ' iatom Bx By Bz (in Ry)' write(*,'(2X,A)') 'Initial guess for constraining fields'
do iatom = 1, number_of_atoms write(*,'(79("#"))')
write(*,'(2X,I4,3(E16.8))') iatom, bfields(iatom)%bfield_constr(:) write(*,'(2X,A4,3(7X,A7,3X))') 'atom','Bx [Ry]','By [Ry]','Bz [Ry]'
end do do iatom = 1, number_of_atoms
end subroutine read_bconstr write(*,'(2X,I4,3(2X,E15.8))') iatom, bfields(iatom)%bfield_constr(:)
end do
write(*,'(79("#"))')
else if (verbosity >= 2) then
! Give an overview
if (file_exists) then
write(*,'(A)') 'Initial constraining magnetic fields read from file.'
else
write(*,'(A)') 'Initial constraining magnetic fields set to zero.'
end if
else
! No output
end if
end subroutine
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
!> Summary: Reads the atom-wise magnetic field from bfield.dat !> Summary: Reads the atom-wise external magnetic field from bfield.dat,
!> if it should be used according to the input parameters.
!> Author: Nicolas Essing !> Author: Nicolas Essing
!> !>
!> If external fields shall not be used, the external field is set to zero and
!> an eventually present file is ignored.
!> If external fields shall be used and no file is present, the program stops
!> with an error.
!> The file should contain three numbers per line and one line per atom. !> The file should contain three numbers per line and one line per atom.
!> Read as 'theta phi bfield_strength' with the angles in degrees and the !> Read as 'theta phi bfield_strength' with the angles in degrees and the
!> strength in Ry ( ! might get changed to Tesla ! ) !> strength in Ry.
!> Lines can be commented out with a # as first character. !> Lines can be commented out with a # as first character.
!>------------------------------------------------------------------------------ !>------------------------------------------------------------------------------
subroutine read_bfield(bfields) subroutine read_external_bfield(bfields, external_bfield, verbosity)
type(bfield_data), dimension(:), intent(inout) :: bfields type(bfield_data), dimension(:), intent(inout) :: bfields
logical, intent(in) :: external_bfield
integer, intent(in) :: verbosity
integer :: number_of_atoms integer :: number_of_atoms
integer :: iatom, iostat integer :: iatom, iostat
character(256) :: linebuffer character(256) :: linebuffer
logical :: file_exists
double precision, dimension(:), allocatable :: phi, theta, strength double precision, dimension(:), allocatable :: phi, theta, strength
number_of_atoms = size(bfields) number_of_atoms = size(bfields)
inquire(file='bfield.dat', exist=file_exists)
allocate(phi(number_of_atoms), theta(number_of_atoms), strength(number_of_atoms)) allocate(phi(number_of_atoms), theta(number_of_atoms), strength(number_of_atoms))
if (file_exists) then if (external_bfield) then
open(unit=57493215, file='bfield.dat', iostat=iostat) open(unit=57493215, file='bfield.dat', iostat=iostat)
if (iostat /= 0) then
write(*,*) "I/O Error opening bfield.dat"
write(*,*) "If you do not want external nonco bfields, turn it of in the input.conf"
stop
end if
! manual loop over iatom because comments are allowed ! manual loop over iatom because comments are allowed
iatom = 1 iatom = 1
do while (iatom <= number_of_atoms) do while (iatom <= number_of_atoms)
...@@ -214,14 +250,28 @@ contains ...@@ -214,14 +250,28 @@ contains
bfields(iatom)%bfield_ext(3) = strength(iatom) * cos(theta(iatom)) bfields(iatom)%bfield_ext(3) = strength(iatom) * cos(theta(iatom))
end do end do
write(*,*) ' ###############################################' if (verbosity >= 3) then
write(*,*) ' external non-collinear magnetic fields' ! Write detailed information
write(*,*) ' ###############################################' write(*,'(79("#"))')
write(*,*) ' iatom theta phi bfield (in Ry)' write(*,'(16X,A)') 'external non-collinear magnetic fields'
do iatom = 1, number_of_atoms write(*,'(79("#"))')
write(*,'(2X,I4,3(E16.8))') iatom, theta(iatom), phi(iatom), strength(iatom) write(*,'(2X,A4,3(5X,A11,1X))') 'atom', ' theta ', ' phi ', 'bfield [Ry]'
end do do iatom = 1, number_of_atoms
end subroutine read_bfield write(*,'(2X,I4,3(2X,E15.8))') iatom, theta(iatom), phi(iatom), strength(iatom)
end do
write(*,'(79("#"))')
else if (verbosity >= 2) then
! Give an overview
if (external_bfield) then
write(*,'(A)') 'External non-collinear magnetic fields loaded from file.'
write(*,'(2X,A,E16.8)') 'Mean magnitude [Ry]:', sum(abs(strength)) / number_of_atoms
else
write(*,'(A)') 'Not applying external non-collinear magnetic fields.'
end if
else
! No output
end if
end subroutine
!>------------------------------------------------------------------------------ !>------------------------------------------------------------------------------
...@@ -234,7 +284,7 @@ contains ...@@ -234,7 +284,7 @@ contains
!> pauli matrices and B the combined bfield. !> pauli matrices and B the combined bfield.
!>------------------------------------------------------------------------------ !>------------------------------------------------------------------------------
subroutine add_bfield(bfield, vnspll, theta, phi, imt, iteration_number, & subroutine add_bfield(bfield, vnspll, theta, phi, imt, iteration_number, &
itscf0, itscf1, lbfield_constr, lbfield_trans, & itscf0, itscf1, lbfield_trans, &
lbfield_mt, transpose_bfield) lbfield_mt, transpose_bfield)
type(bfield_data), intent(in) :: bfield type(bfield_data), intent(in) :: bfield
double complex, dimension(:,:,:), intent(inout) :: vnspll ! The potential to add to double complex, dimension(:,:,:), intent(inout) :: vnspll ! The potential to add to
...@@ -242,7 +292,6 @@ contains ...@@ -242,7 +292,6 @@ contains
integer, intent(in) :: imt ! MT radius (index in cheb mesh) integer, intent(in) :: imt ! MT radius (index in cheb mesh)
integer, intent(in) :: iteration_number !TODO this, or just a logical and do the check outside? integer, intent(in) :: iteration_number !TODO this, or just a logical and do the check outside?
integer, intent(in) :: itscf0, itscf1 !TODO ^ integer, intent(in) :: itscf0, itscf1 !TODO ^
logical, intent(in) :: lbfield_constr !! Wheter to use constraint fields
logical, intent(in) :: lbfield_trans ! Apply only transveral logical, intent(in) :: lbfield_trans ! Apply only transveral
logical, intent(in) :: lbfield_mt ! Apply only up do MT radius logical, intent(in) :: lbfield_mt ! Apply only up do MT radius
logical, intent(in) :: transpose_bfield ! Transpose the bfield (for left solutions) logical, intent(in) :: transpose_bfield ! Transpose the bfield (for left solutions)
...@@ -262,11 +311,10 @@ contains ...@@ -262,11 +311,10 @@ contains
lmmax = size(bfield%thetallmat, 1) ! size(vnspll, 1) is 2*lmmax lmmax = size(bfield%thetallmat, 1) ! size(vnspll, 1) is 2*lmmax
irmd = size(vnspll, 3) irmd = size(vnspll, 3)
combined_bfields(:) = bfield%bfield_ext(:) ! start with external, is zero if unused ! Add external and constraint field. If one of them is tured off by input
if (lbfield_constr) then ! parameters or mode, it is zero, so this distinction does not have to be
! Add constraint field ! done here.
combined_bfields(:) = combined_bfields(:) + bfield%bfield_constr(:) combined_bfields(:) = bfield%bfield_ext(:) + bfield%bfield_constr(:)
end if
if (lbfield_trans) then if (lbfield_trans) then
dir(1) = sin(theta) * cos(phi) dir(1) = sin(theta) * cos(phi)
...@@ -312,8 +360,6 @@ contains ...@@ -312,8 +360,6 @@ contains
!------------------------------------------------------------------------------------ !------------------------------------------------------------------------------------
!> Summary: Shape function LL' expansion !> Summary: Shape function LL' expansion
!> Author: Sascha Brinker !> Author: Sascha Brinker
!> Category: KKRhost, geometry, new-mesh, shapefun
!> Deprecated: False
!> Calculates the LL' expansion of the shape function similarly to vllmat_new.f90 !> Calculates the LL' expansion of the shape function similarly to vllmat_new.f90
!> @note The input shapefunction (single L) uses pointer arrays for the lm index. !> @note The input shapefunction (single L) uses pointer arrays for the lm index.
!> The output does not need pointers! !> The output does not need pointers!
......
...@@ -23,7 +23,7 @@ contains ...@@ -23,7 +23,7 @@ contains
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
subroutine calc_torque(bfield, vpot, rho2nsc, theta, phi, lmax, rpan_intervall, ipan_intervall, & subroutine calc_torque(bfield, vpot, rho2nsc, theta, phi, lmax, rpan_intervall, ipan_intervall, &
npan_tot, ncheb, imt, iend, icleb, cleb, ifunm, thetasnew, & npan_tot, ncheb, imt, iend, icleb, cleb, ifunm, thetasnew, &
lbfield_constr, lbfield_mt, itscf0, itscf1, iteration, constr_mode) lbfield_mt, itscf0, itscf1, iteration, constr_mode)
type(bfield_data), intent(inout) :: bfield !! Information on the magnetic field type(bfield_data), intent(inout) :: bfield !! Information on the magnetic field
double precision, dimension(:,:,:), intent(in) :: vpot !! The potential double precision, dimension(:,:,:), intent(in) :: vpot !! The potential
double complex, dimension(:,:,:), intent(in) :: rho2nsc !! complex density matrix double complex, dimension(:,:,:), intent(in) :: rho2nsc !! complex density matrix
...@@ -39,7 +39,6 @@ contains ...@@ -39,7 +39,6 @@ contains
double precision, dimension(:), intent(in) :: cleb !! Gaunt coefficients double precision, dimension(:), intent(in) :: cleb !! Gaunt coefficients
integer , dimension(:), intent(in) :: ifunm !! pointer array for shapefun integer , dimension(:), intent(in) :: ifunm !! pointer array for shapefun
double precision, dimension(:, :), intent(in) :: thetasnew !! shapefun on the Cheby mesh double precision, dimension(:, :), intent(in) :: thetasnew !! shapefun on the Cheby mesh
logical, intent(in) :: lbfield_constr !! Use constraint fields
logical, intent(in) :: lbfield_mt !! Use magnetic fields only inside the muffin tin logical, intent(in) :: lbfield_mt !! Use magnetic fields only inside the muffin tin
integer, intent(in) :: itscf0, itscf1 !! Apply magnetic fields between these iterations integer, intent(in) :: itscf0, itscf1 !! Apply magnetic fields between these iterations
integer, intent(in) :: iteration !! Current iteration integer, intent(in) :: iteration !! Current iteration
...@@ -159,7 +158,7 @@ contains ...@@ -159,7 +158,7 @@ contains
end if end if
! Scf-cycle for constraint fields, based either on torque or on fields alone ! Scf-cycle for constraint fields, based either on torque or on fields alone
if (lbfield_constr .and. itscf0 <= iteration .and. iteration <= itscf1) then if (itscf0 <= iteration .and. iteration <= itscf1) then
if (constr_mode == 3) then if (constr_mode == 3) then
bfield%bfield_constr(:) = bfield%bfield_constr(:) - bfield%mag_torque(:) / mag_mom_len bfield%bfield_constr(:) = bfield%bfield_constr(:) - bfield%mag_torque(:) / mag_mom_len
else if (constr_mode == 2) then else if (constr_mode == 2) then
......
...@@ -126,21 +126,15 @@ d a_log 0.025D0 ...@@ -126,21 +126,15 @@ d a_log 0.025D0
l enable_quad_prec .FALSE. l enable_quad_prec .FALSE.
### [bfields] turn on or off everything concerning non-collinear magnetic fields (called lbfield in KKRhost code) ### [bfields] turn on or off everything concerning non-collinear magnetic fields (called lbfield in KKRhost code)
l noncobfield .FALSE. l noncobfield .FALSE.
### [bfields] constraining fields, non-collinear magnetic field (called lbfield_constr in KKRhost code) ### [bfields] turn on or off external non-collinear magnetic fields
l constr_field .FALSE. l external_bfield .FALSE.
### [bfields] apply same field to all atoms (True) or individual fields to each atom (called lbfield_all in KKRhost code)
l same_bfield .FALSE.
### [bfields] apply only transversal bfield (called lbfield_trans in KKRhost code) ### [bfields] apply only transversal bfield (called lbfield_trans in KKRhost code)
l trans_bfield .FALSE. l trans_bfield .FALSE.
### [bfields] apply magnetic field only in the muffin-tin (called lbfield_mt in KKRhost code) ### [bfields] apply magnetic field only in the muffin-tin (called lbfield_mt in KKRhost code)
l mt_bfield .FALSE. l mt_bfield .FALSE.
### [bfields] calculate magnetic torque (called ltorque in KKRhost code) ### [bfields] start applying magnetic field at iteration (called ibfield_itscf0 in KKRhost code)
l torque .FALSE.
### [bfields] spin (0), orbital (1), spin+orbial (2) fields (called ibfield in KKRhost code)
i ibfield 0
### [bfields] type of contraint (0 = torque, 1 = magnetic moment) (called ibfield_constr in KKRhost code)
i iconstr 0
### [bfields] start magnetic field at iteration itscf0 (called ibfield_itscf0 in KKRhost code)
i itbfield0 0 i itbfield0 0
### [bfields] stop applying magnetic field after iteration itscf1 (called ibfield_itscf1 in KKRhost code) ### [bfields] stop applying magnetic field after iteration itscf1 (called ibfield_itscf1 in KKRhost code)
i itbfield1 10000 i itbfield1 10000
### [bfields] control verbosity concerning non-collinear magnetic fields
i bfield_verbosity 2
...@@ -79,15 +79,12 @@ module InputParams_mod ...@@ -79,15 +79,12 @@ module InputParams_mod
double precision :: a_log double precision :: a_log
logical :: enable_quad_prec logical :: enable_quad_prec
logical :: noncobfield logical :: noncobfield
logical :: constr_field logical :: external_bfield
logical :: same_bfield
logical :: trans_bfield logical :: trans_bfield
logical :: mt_bfield logical :: mt_bfield
logical :: torque
integer :: ibfield
integer :: iconstr
integer :: itbfield0 integer :: itbfield0
integer :: itbfield1 integer :: itbfield1
integer :: bfield_verbosity
endtype ! InputParams endtype ! InputParams
...@@ -657,21 +654,12 @@ integer function getValues(filename, self) result(ierror) ...@@ -657,21 +654,12 @@ integer function getValues(filename, self) result(ierror)
destroy_and_return destroy_and_return
endif endif
ierror = getValue(cr, "constr_field", self%constr_field , def=.FALSE.) ierror = getValue(cr, "external_bfield", self%external_bfield , def=.FALSE.)
if (ierror == use_default) then if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for constr_field. Set constr_field to .FALSE." write(*,*) "WARNING: Bad/no value given for external_bfield. Set external_bfield to .FALSE."
ierror = 0 ! ok, no error ierror = 0 ! ok, no error
elseif (ierror /= 0) then elseif (ierror /= 0) then
write(*,*) "Bad/no value given for constr_field." write(*,*) "Bad/no value given for external_bfield."
destroy_and_return
endif
ierror = getValue(cr, "same_bfield", self%same_bfield , def=.FALSE.)
if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for same_bfield. Set same_bfield to .FALSE."
ierror = 0 ! ok, no error
elseif (ierror /= 0) then
write(*,*) "Bad/no value given for same_bfield."
destroy_and_return destroy_and_return
endif endif
...@@ -693,33 +681,6 @@ integer function getValues(filename, self) result(ierror) ...@@ -693,33 +681,6 @@ integer function getValues(filename, self) result(ierror)
destroy_and_return destroy_and_return
endif endif
ierror = getValue(cr, "torque", self%torque , def=.FALSE.)
if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for torque. Set torque to .FALSE."
ierror = 0 ! ok, no error
elseif (ierror /= 0) then
write(*,*) "Bad/no value given for torque."
destroy_and_return
endif
ierror = getValue(cr, "ibfield", self%ibfield , def=0)
if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for ibfield. Set ibfield to 0"
ierror = 0 ! ok, no error
elseif (ierror /= 0) then
write(*,*) "Bad/no value given for ibfield."
destroy_and_return
endif
ierror = getValue(cr, "iconstr", self%iconstr , def=0)
if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for iconstr. Set iconstr to 0"
ierror = 0 ! ok, no error
elseif (ierror /= 0) then
write(*,*) "Bad/no value given for iconstr."
destroy_and_return
endif
ierror = getValue(cr, "itbfield0", self%itbfield0 , def=0) ierror = getValue(cr, "itbfield0", self%itbfield0 , def=0)
if (ierror == use_default) then if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for itbfield0. Set itbfield0 to 0" write(*,*) "WARNING: Bad/no value given for itbfield0. Set itbfield0 to 0"
...@@ -738,6 +699,15 @@ integer function getValues(filename, self) result(ierror) ...@@ -738,6 +699,15 @@ integer function getValues(filename, self) result(ierror)
destroy_and_return destroy_and_return
endif endif
ierror = getValue(cr, "bfield_verbosity", self%bfield_verbosity , def=2)
if (ierror == use_default) then
write(*,*) "WARNING: Bad/no value given for bfield_verbosity. Set bfield_verbosity to 2"
ierror = 0 ! ok, no error
elseif (ierror /= 0) then
write(*,*) "Bad/no value given for bfield_verbosity."
destroy_and_return
endif
write(*,*) "Finished reading information from input.conf" write(*,*) "Finished reading information from input.conf"
destroy_and_return destroy_and_return
#undef destroy_and_return #undef destroy_and_return
......
...@@ -99,7 +99,7 @@ module wrappers_mod ...@@ -99,7 +99,7 @@ module wrappers_mod
den,espv,rho2ns,r2nef, gmatn(:,:,:,1), muorb, & ! just one spin component of gmatn needed den,espv,rho2ns,r2nef, gmatn(:,:,:,1), muorb, & ! just one spin component of gmatn needed
atomdata%potential%lpot,lmaxd,mesh%irmd,chebmesh%irmd_new,iemxd, params%soc,params%enable_quad_prec, & atomdata%potential%lpot,lmaxd,mesh%irmd,chebmesh%irmd_new,iemxd, params%soc,params%enable_quad_prec, &
bfield, imt, iteration_number, params%itbfield0, params%itbfield1, & bfield, imt, iteration_number, params%itbfield0, params%itbfield1, &
params%noncobfield, params%constr_field, params%torque, params%trans_bfield, params%mt_bfield) params%noncobfield, params%trans_bfield, params%mt_bfield)
! calculate correct orbital moment ! calculate correct orbital moment
do ispin=1,nspind do ispin=1,nspind
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment