LCOV - code coverage report
Current view: top level - src/45_geomoptim - m_predict_steepest.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 27 27
Test Date: 2026-11-06 14:42:53 Functions: 100.0 % 1 1
Branches: 59.1 % 110 65

             Branch data     Line data    Source code
       1                 :             : !!****m* ABINIT/m_predict_steepest
       2                 :             : !! NAME
       3                 :             : !!
       4                 :             : !! FUNCTION
       5                 :             : !!
       6                 :             : !! COPYRIGHT
       7                 :             : !!  Copyright (C) 2009-2026 ABINIT group (XG)
       8                 :             : !!  This file is distributed under the terms of the
       9                 :             : !!  GNU General Public License, see ~abinit/COPYING
      10                 :             : !!  or http://www.gnu.org/copyleft/gpl.txt .
      11                 :             : !!
      12                 :             : !! SOURCE
      13                 :             : 
      14                 :             : #if defined HAVE_CONFIG_H
      15                 :             : #include "config.h"
      16                 :             : #endif
      17                 :             : 
      18                 :             : #include "abi_common.h"
      19                 :             : 
      20                 :             : module m_predict_steepest
      21                 :             : 
      22                 :             :  use defs_basis
      23                 :             :  use m_abicore
      24                 :             :  use m_mep
      25                 :             : 
      26                 :             :  use m_results_img, only : results_img_type,get_geometry_img
      27                 :             : 
      28                 :             :  implicit none
      29                 :             : 
      30                 :             :  private
      31                 :             : !!***
      32                 :             : 
      33                 :             :  public :: predict_steepest
      34                 :             : !!***
      35                 :             : 
      36                 :             : contains
      37                 :             : !!***
      38                 :             : 
      39                 :             : !!****f* ABINIT/predict_steepest
      40                 :             : !! NAME
      41                 :             : !! predict_steepest
      42                 :             : !!
      43                 :             : !! FUNCTION
      44                 :             : !! Given the past history of images, predict the new set of images.
      45                 :             : !! Here, simple steepest descent algorithm, based on the value of the forces on the current timimage step.
      46                 :             : !! No change of acell, rprim and vel at present.
      47                 :             : !!
      48                 :             : !! INPUTS
      49                 :             : !! itimimage=time index for image propagation (itimimage+1 is to be predicted here)
      50                 :             : !! itimimage_eff=time index in the history
      51                 :             : !! list_dynimage(nimage)=list of dynamical images. The non-dynamical ones will not change.
      52                 :             : !!       Example : in the NEB of string method, one expect the two end images to be fixed.
      53                 :             : !! mep_param=several parameters for Minimal Energy Path (MEP) search
      54                 :             : !! natom=dimension of vel_timimage and xred_timimage
      55                 :             : !! ndynimage=number of dynamical images
      56                 :             : !! nimage=number of images
      57                 :             : !! ntimimage_stored=number of time steps stored in the history
      58                 :             : !!
      59                 :             : !! OUTPUT
      60                 :             : !!
      61                 :             : !! SIDE EFFECTS
      62                 :             : !! results_img(ntimimage_stored,nimage)=datastructure that holds the history of previous computations.
      63                 :             : !!   results_img(:,:)%acell(3)
      64                 :             : !!    at input, history of the values of acell for all images
      65                 :             : !!    at output, the predicted values of acell for all images
      66                 :             : !!   results_img(:,:)%results_gs
      67                 :             : !!    at input, history of the values of energies and forces for all images
      68                 :             : !!   results_img(:,:)%rprim(3,3)
      69                 :             : !!    at input, history of the values of rprim for all images
      70                 :             : !!    at output, the predicted values of rprim for all images
      71                 :             : !!   results_img(:,:)%vel(3,natom)
      72                 :             : !!    at input, history of the values of vel for all images
      73                 :             : !!    at output, the predicted values of vel for all images
      74                 :             : !!   results_img(:,:)%vel_cell(3,3)
      75                 :             : !!    at input, history of the values of vel_cell for all images
      76                 :             : !!    at output, the predicted values of vel_cell for all images
      77                 :             : !!   results_img(:,:)%xred(3,natom)
      78                 :             : !!    at input, history of the values of xred for all images
      79                 :             : !!    at output, the predicted values of xred for all images
      80                 :             : !!
      81                 :             : !! SOURCE
      82                 :             : 
      83                 :          10 : subroutine predict_steepest(itimimage,itimimage_eff,list_dynimage,mep_param,natom,&
      84                 :          10 : &                           ndynimage,nimage,ntimimage_stored,results_img)
      85                 :             : 
      86                 :             : !Arguments ------------------------------------
      87                 :             : !scalars
      88                 :             :  integer,intent(in) :: itimimage,itimimage_eff,natom,ndynimage
      89                 :             :  integer,intent(in) :: nimage,ntimimage_stored
      90                 :             :  type(mep_type),intent(inout) :: mep_param
      91                 :             : !arrays
      92                 :             :  integer,intent(in) :: list_dynimage(ndynimage)
      93                 :             :  type(results_img_type) :: results_img(nimage,ntimimage_stored)
      94                 :             : 
      95                 :             : !Local variables-------------------------------
      96                 :             : !scalars
      97                 :             :  integer :: iimage,next_itimimage
      98                 :             : !arrays
      99                 :          10 :  real(dp),allocatable :: etotal(:),fcart(:,:,:),rprimd(:,:,:),xcart(:,:,:),xred(:,:,:)
     100                 :          10 :  real(dp),allocatable :: strten(:,:)
     101                 :             : 
     102                 :             : ! *************************************************************************
     103                 :             : 
     104                 :             : !Retrieve positions and forces
     105   [ -  +  +  -  :          30 :  ABI_MALLOC(etotal,(nimage))
          +  -  +  -  -  
                +  -  + ]
     106   [ -  +  +  -  :          40 :  ABI_MALLOC(xred,(3,natom,nimage))
          -  +  +  -  +  
          -  +  -  -  +  
                   -  + ]
     107   [ -  +  +  -  :          30 :  ABI_MALLOC(xcart,(3,natom,nimage))
          -  +  +  -  -  
                +  -  + ]
     108   [ -  +  +  -  :          30 :  ABI_MALLOC(fcart,(3,natom,nimage))
          -  +  +  -  -  
                +  -  + ]
     109   [ -  +  +  -  :          30 :  ABI_MALLOC(rprimd,(3,3,nimage))
          +  -  +  -  -  
                +  -  + ]
     110   [ -  +  +  -  :          30 :  ABI_MALLOC(strten,(6,nimage))
          +  -  +  -  -  
                +  -  + ]
     111                 :             : 
     112                 :             :  call get_geometry_img(results_img(:,itimimage_eff),etotal,natom,nimage,&
     113                 :          10 : &                      fcart,rprimd,strten,xcart,xred)
     114                 :             : 
     115                 :             : !Compute new atomic positions in each cell
     116                 :          10 :  call mep_steepest(fcart,list_dynimage,mep_param,natom,natom,ndynimage,nimage,rprimd,xcart,xred)
     117                 :             : 
     118                 :             : !Store acell, rprim, xred and vel for the new iteration
     119                 :          10 :  next_itimimage=itimimage+1
     120         [ -  + ]:          10 :  if (next_itimimage>ntimimage_stored) next_itimimage=1
     121         [ +  + ]:          70 :  do iimage=1,nimage
     122   [ +  +  +  + ]:         540 :    results_img(iimage,next_itimimage)%xred(:,:)    =xred(:,:,iimage)
     123         [ +  + ]:         240 :    results_img(iimage,next_itimimage)%acell(:)     =results_img(iimage,itimimage_eff)%acell(:)
     124   [ +  +  +  + ]:         780 :    results_img(iimage,next_itimimage)%rprim(:,:)   =results_img(iimage,itimimage_eff)%rprim(:,:)
     125   [ +  +  +  + ]:         540 :    results_img(iimage,next_itimimage)%vel(:,:)     =results_img(iimage,itimimage_eff)%vel(:,:)
     126   [ +  +  +  + ]:         790 :    results_img(iimage,next_itimimage)%vel_cell(:,:)=results_img(iimage,itimimage_eff)%vel_cell(:,:)
     127                 :             :  end do
     128                 :             : 
     129         [ -  + ]:          10 :  ABI_FREE(etotal)
     130         [ -  + ]:          10 :  ABI_FREE(xred)
     131         [ -  + ]:          10 :  ABI_FREE(xcart)
     132         [ -  + ]:          10 :  ABI_FREE(fcart)
     133         [ -  + ]:          10 :  ABI_FREE(rprimd)
     134         [ -  + ]:          10 :  ABI_FREE(strten)
     135                 :             : 
     136                 :          10 : end subroutine predict_steepest
     137                 :             : !!***
     138                 :             : 
     139                 :             : end module m_predict_steepest
     140                 :             : !!***
        

Generated by: LCOV version 2.3-1