TABLE OF CONTENTS


ABINIT/m_lattice_mover [ Modules ]

[ Top ] [ Modules ]

NAME

 m_lattice_mover

FUNCTION

 This module contains the lattice mover.


 Datatypes:

 * lattice_mover_t: defines the lattice movers

 Subroutines:
 TODO: add this when F2003 doc style is determined.

COPYRIGHT

 Copyright (C) 2001-2024 ABINIT group (hexu)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributorsi see ~abinit/doc/developers/contributors.txt .

SOURCE

28 #if defined HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31 
32 #include "abi_common.h"
33 
34 module m_lattice_mover
35   use defs_basis
36   use m_abicore
37   use m_errors
38   use m_xmpi
39   use m_multibinit_dataset, only: multibinit_dtset_type
40   use m_abstract_potential, only: abstract_potential_t
41   use m_abstract_mover, only: abstract_mover_t
42   use m_multibinit_cell, only: mbcell_t, mbsupercell_t
43   use m_random_xoroshiro128plus, only:  rng_t
44   use m_hashtable_strval, only: hash_table_t
45   use m_lattice_ncfile, only: lattice_ncfile_t
46   use m_mpi_scheduler, only: init_mpi_info

m_lwf_mover/run_varT [ Functions ]

[ Top ] [ Functions ]

NAME

 run_varT

FUNCTION

 run M vs Temperature

INPUTS

 pot: potential
 T_start, Tend, T_nstep

OUTPUT

SOURCE

469   subroutine  run_varT(self, pot, ncfile_prefix, displacement, strain, spin, lwf, energy_table)
470     class(lattice_mover_t), intent(inout) :: self
471     class(abstract_potential_t), intent(inout) :: pot
472     real(dp), optional, intent(inout) :: displacement(:,:), strain(:,:), lwf(:), spin(:,:)
473     character(fnlen), intent(inout) :: ncfile_prefix
474     type(hash_table_t), optional, intent(inout) :: energy_table
475     real(dp) :: T_start, T_end
476     integer :: T_nstep
477     !type(lwf_ncfile_t) :: lwf_ncfile
478     character(len=4) :: post_fname
479     real(dp) :: T, T_step
480     integer :: i
481     !integer :: Tfile, iostat
482     character(len=90) :: msg
483     !character(len=4200) :: Tmsg ! to write to var T file
484     !character(len=150) :: iomsg
485     !character(fnlen) :: Tfname ! file name for output various T calculation
486     !real(dp), allocatable :: Tlist(:), chi_list(:), Cv_list(:), binderU4_list(:)
487     !real(dp), allocatable :: Mst_sub_norm_list(:, :)
488     !real(dp), allocatable ::  Mst_norm_total_list(:)
489 
490     integer :: master, my_rank, comm, nproc, ierr
491     logical :: iam_master
492     call init_mpi_info(master, iam_master, my_rank, comm, nproc) 
493 
494     ABI_UNUSED_A(displacement)
495     ABI_UNUSED_A(strain)
496 
497     if (iam_master) then
498        T_start=self%params%latt_temperature_start
499        T_end=self%params%latt_temperature_end
500        T_nstep=self%params%latt_temperature_nstep
501        !Tfile=get_unit()
502        !Tfname = trim(ncfile_prefix)//'.varT'
503        !iostat=open_file(file=Tfname, unit=Tfile, iomsg=iomsg )
504        if (T_nstep<=1) then
505           T_step=0.0
506        else
507           T_step=(T_end-T_start)/(T_nstep-1)
508        endif
509        write(msg, "(A52, ES13.5, A11, ES13.5, A1)") & 
510             & "Starting temperature dependent calculations. T from ", &
511             & T_start*Ha_K, "K to ", T_end*Ha_K, " K."
512        call wrtout(std_out, msg, "COLL")
513        call wrtout(ab_out, msg, "COLL")
514     end if
515 
516     call xmpi_bcast(T_nstep, 0, comm, ierr)
517     do i=1, T_nstep
518        if(iam_master) then
519           T=T_start+(i-1)*T_step
520           msg=repeat("=", 79)
521           call wrtout(std_out, msg, "COLL")
522           call wrtout(ab_out, msg, "COLL")
523 
524           write(msg, "(A13, 5X, ES13.5, A3)") "Temperature: ", T*Ha_K, " K."
525           call wrtout(std_out, msg, "COLL")
526           call wrtout(ab_out,  msg, "COLL")
527 
528           ! set temperature
529           ! TODO make this into a subroutine set_params
530        endif
531        call self%set_temperature(temperature=T)
532        if(iam_master) then
533           if(i==1) then
534              call self%set_initial_state(mode=1)
535           endif
536 
537           write(post_fname, "(I4.4)") i
538           call self%prepare_ncfile( self%params, &
539                & trim(ncfile_prefix)//'_T'//post_fname//'_latthist.nc')
540           call self%ncfile%write_one_step(self%current_xcart, self%current_vcart, self%energy, self%Ek )
541        endif
542 
543        call self%run_time(pot, spin=spin, &
544             & lwf=lwf, energy_table=energy_table)
545 
546        if(iam_master) then
547           call self%ncfile%finalize()
548        endif
549     end do
550 
551   end subroutine run_varT