LCOV - code coverage report
Current view: top level - src/78_effpot - m_primitive_potential.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 34.8 % 23 8
Test Date: 2026-09-19 17:42:43 Functions: 20.0 % 5 1

            Line data    Source code
       1              : !!****m* ABINIT/m_primitive_potential
       2              : !! NAME
       3              : !! m_primitive_potential
       4              : !!
       5              : !! FUNCTION
       6              : !! This module define the primitive potential type, which is a direct map to the xml file (or other format).
       7              : !!
       8              : !! Datatypes:
       9              : !!  primitive_potential_t
      10              : !!
      11              : !! Subroutines:
      12              : !!
      13              : !!  * fill_supercell: use translation symmetry to fill the supercell.
      14              : !!  * load_from_file: load potential from file.
      15              : !!  * save_to_file: save to file.
      16              : !!
      17              : !! COPYRIGHT
      18              : !! Copyright (C) 2001-2026 ABINIT group (hexu)
      19              : !! This file is distributed under the terms of the
      20              : !! GNU General Public License, see ~abinit/COPYING
      21              : !! or http://www.gnu.org/copyleft/gpl.txt .
      22              : !! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
      23              : !!
      24              : !! SOURCE
      25              : 
      26              : 
      27              : #if defined HAVE_CONFIG_H
      28              : #include "config.h"
      29              : #endif
      30              : #include "abi_common.h"
      31              : 
      32              : module m_primitive_potential
      33              :   use defs_basis
      34              :   use m_abicore
      35              :   use m_errors
      36              :   use m_supercell
      37              :   use m_multibinit_dataset , only: multibinit_dtset_type
      38              :   use m_multibinit_cell, only: mbcell_t, mbsupercell_t
      39              :   use m_supercell_maker, only: supercell_maker_t
      40              :   use m_abstract_potential, only: abstract_potential_t
      41              :   use m_potential_list, only: potential_list_t
      42              :   use m_mpi_scheduler, only: init_mpi_info
      43              :   implicit none
      44              :   private
      45              : !!***
      46              : 
      47              : 
      48              :   !----------------------------------------------------------------------
      49              :   !> @brief Abstract primitve potential type
      50              :   !> It maps to a file which defines the potential
      51              :   !> therefore IO can be defined in this class
      52              :   !> And by using translation symmetry the supercell potential can be built
      53              :   !> using the fill_supercell method.
      54              :   !----------------------------------------------------------------------
      55              :   type ,public :: primitive_potential_t
      56              :      ! This is the abstract class of primitive potential
      57              :      ! It do the following things:
      58              :      type(mbcell_t), pointer :: primcell=>null()
      59              :      character(len=200) :: label="Abstract primitive potential"
      60              :      logical::has_displacement=.False.
      61              :      logical::has_strain=.False.
      62              :      logical::has_spin=.False.
      63              :      logical::has_lwf=.False.
      64              :    contains
      65              :      !procedure:: initialize       ! perhaps each effpot type should have own
      66              :      procedure :: finalize
      67              :      procedure :: fill_supercell   ! build potential for a supercell
      68              :      procedure :: load_from_files  ! load potential from the file list defined in files file.
      69              :   end type primitive_potential_t
      70              : 
      71              : contains
      72              : 
      73              :   !----------------------------------------------------------------------
      74              :   !> @brief finalize
      75              :   !----------------------------------------------------------------------
      76           10 : subroutine finalize(self)
      77              :   class(primitive_potential_t), intent(inout) :: self
      78           10 :   nullify(self%primcell)
      79           10 :   self%label="Destroyed primitive potential"
      80           10 :   self%has_displacement=.False.
      81           10 :   self%has_strain=.False.
      82           10 :   self%has_spin=.False.
      83           10 :   self%has_lwf=.False.
      84           10 : end subroutine finalize
      85              : 
      86              : 
      87              : !----------------------------------------------------------------------
      88              : !> @brief build potential for a supercell
      89              : !> @param[in]  input
      90              : !> @param[out] output
      91              : !----------------------------------------------------------------------
      92            0 : subroutine fill_supercell(self, scmaker, params, scpot, supercell)
      93              :     class(primitive_potential_t), intent(inout) :: self
      94              :     type(supercell_maker_t),      intent(inout) :: scmaker
      95              :     type(multibinit_dtset_type),  intent(inout) :: params
      96              :     class(abstract_potential_t), pointer, intent(inout) :: scpot
      97              :     type(mbsupercell_t), target :: supercell
      98              : 
      99              :     ! Note that sc_pot is a pointer
     100              :     ! use a pointer to the specific potential which will be filled
     101              :     ! e.g. type(spin_potential_t), pointer :: tmp
     102              :     ! call tmp%initialize(....)
     103              :     ! set tmp
     104            0 :     ABI_UNUSED_A(self)
     105            0 :     ABI_UNUSED_A(scmaker)
     106            0 :     ABI_UNUSED_A(params)
     107            0 :     ABI_UNUSED_A(scpot)
     108            0 :     ABI_UNUSED_A(params)
     109            0 :     ABI_UNUSED_A(supercell)
     110            0 :   end subroutine fill_supercell
     111              : 
     112              :   !----------------------------------------------------------------------
     113              :   !> @brief load potential from files
     114              :   !>
     115              :   !> @param[in]  params: parameter from input file
     116              :   !> @param[in] fnames: the list of files from files file
     117              :   !----------------------------------------------------------------------
     118            0 :   subroutine load_from_files(self, params,  fnames)
     119              :     class(primitive_potential_t), intent(inout) :: self
     120              :     type(multibinit_dtset_type), intent(in) :: params
     121              :     character(len=fnlen), intent(in) :: fnames(:)
     122            0 :     ABI_UNUSED_A(self)
     123            0 :     ABI_UNUSED_A(params)
     124            0 :     ABI_UNUSED_A(fnames)
     125            0 :     ABI_ERROR("load_from_files for abstract primitive potential is not implemented.")
     126            0 :   end subroutine load_from_files
     127              : 
     128              : 
     129              : !----------------------------------------------------------------------
     130              :   !> @brief save the potential to a file
     131              :   !> @param[in]   fname: name of file to save the potential
     132              :   !----------------------------------------------------------------------
     133              :   subroutine save_to_file(self, fname)
     134              :     class(primitive_potential_t), intent(inout) :: self
     135              :     character(len=fnlen), intent(in) :: fname
     136              :     ABI_UNUSED_A(self)
     137              :     ABI_UNUSED_A(fname)
     138              :   end subroutine save_to_file
     139              : 
     140            0 : end module m_primitive_potential
        

Generated by: LCOV version 2.3-1