TABLE OF CONTENTS


ABINIT/m_ab7_invars_f90 [ Modules ]

[ Top ] [ Modules ]

NAME

 m_ab7_invars_f90

FUNCTION

 driver for the parser

COPYRIGHT

 Copyright (C) 1999-2018 ABINIT group (XG)
 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 contributors, see ~abinit/doc/developers/contributors.txt.

PARENTS

      abinit

CHILDREN

SOURCE

 23 #if defined HAVE_CONFIG_H
 24 #include "config.h"
 25 #endif
 26 
 27 #include "abi_common.h"
 28 
 29 module m_ab7_invars
 30 
 31   use defs_basis
 32   use defs_datatypes
 33   use defs_abitypes
 34   use m_errors
 35   use m_abicore
 36   use m_xmpi
 37 
 38   use m_time,     only : timab
 39   use m_fstrings, only : inupper
 40   use m_parser,   only : intagm, importxyz, parsefile
 41   use m_dtset,    only : dtset_free, macroin, macroin2
 42   use m_dtfil,    only : status
 43   use m_pspheads, only : inpspheads, pspheads_comm
 44   use m_invars1,  only : invars1m, invars0, indefo
 45   use m_invars2,  only : invars2, invars2m
 46 
 47   implicit none
 48 
 49   private
 50 
 51   ! We store here a list of dtset arrays to be able to
 52   ! parse several ABINIT files without freeing it.
 53   ! The simplest portable way to do it, is to create
 54   ! a list of dtsets arrays and to use the list index
 55   ! as an identifier that can be given to the other languages.
 56   type, private :: dtsets_list
 57      integer                     :: id
 58      type(dtsets_list),  pointer :: next => null()
 59      type(dtsets_list),  pointer :: prev => null()
 60      type(dataset_type), pointer :: dtsets(:)
 61      type(pspheader_type), pointer :: pspheads(:)=>null()   !vz_z
 62      integer :: mxga_n_rules, mxgw_nqlwl, mxlpawu, &
 63          & mxmband, mxmband_upper, &
 64          & mxnatom, mxnatpawu, mxnatsph, mxnatsph_extra, mxnatvshift, &
 65          & mxnbandhf, mxnconeq, mxnfreqsp, &
 66          & mxnimage, mxnimfrqs, mxnkpt, mxnkptgw, mxnkpthf, &
 67          & mxnnos, mxnqptdm, mxnspinor, mxnsppol, mxnsym, &
 68          & mxntypat, mxnzchempot, &
 69          & mxn_efmas_dirs, mxn_projection_frequencies
 70      integer :: istatr, istatshft, dmatpuflag, papiopt, timopt
 71   end type dtsets_list
 72 
 73   type(dtsets_list), save, pointer :: my_dtsets => null()
 74   integer, save :: nb_dtsets = 0
 75 
 76   ! These flags should be .true. inside ABINIT.
 77   ! Use ab7_invars_set_flags() to change them.
 78   logical, save,private :: call_status = .false.
 79   character(len = fnlen), save,private :: opt_status_file
 80   logical, save, private :: call_timab = .false.
 81   real(dp), save, pointer, private :: opt_timab_tsec(:)
 82 
 83   ! These pointers are used only inside ABINIT and refers to their
 84   ! equivalent. The C binding don't support them.
 85   ! Use ab7_invars_get_abinit_vars() to get them.
 86 
 87   logical, private, parameter :: AB_DBG = .false.
 88 
 89 #include "ab7_invars_f90.inc"
 90 
 91   ! The following group is used for Fortran bindings only,
 92   ! and specifically its usage inside ABINIT. They have no C or Python equivalent.
 93   public :: ab7_invars_set_flags
 94 !  public :: ab7_invars_set_mpi
 95   public :: ab7_invars_get_abinit_vars
 96   public :: ab7_invars_load
 97 
 98   ! The following routines are the main creation routines, having also an equivalent in C or Python.
 99   public :: ab7_invars_new_from_file
100   public :: ab7_invars_new_from_string
101   public :: ab7_invars_free
102 
103   ! The following routines are the main getter functions, also available in C or Python.
104   public :: ab7_invars_get_ndtset
105   public :: ab7_invars_get_integer
106   public :: ab7_invars_get_real
107   public :: ab7_invars_get_shape
108   public :: ab7_invars_get_integer_array
109   public :: ab7_invars_get_real_array
110 
111 contains

m_ab7_invars/ab7_invars_free [ Functions ]

[ Top ] [ Functions ]

NAME

  ab7_invars_free

FUNCTION

  Free the memory allocated for a dataset.

INPUTS

   dtsetsId=Dataset identifier

PARENTS

      abinit

CHILDREN

SOURCE

841   subroutine ab7_invars_free(dtsetsId)
842 
843 
844 !This section has been created automatically by the script Abilint (TD).
845 !Do not modify the following lines by hand.
846 #undef ABI_FUNC
847 #define ABI_FUNC 'ab7_invars_free'
848 !End of the abilint section
849 
850  integer, intent(in) :: dtsetsId
851 
852  type(dtsets_list), pointer :: token
853 
854  nullify(token)
855  call get_token(token, dtsetsId)
856  call free_token(token)
857 
858 end subroutine ab7_invars_free

m_ab7_invars/ab7_invars_get_abinit_vars [ Functions ]

[ Top ] [ Functions ]

NAME

   ab7_invars_get_abinit_vars

FUNCTION

INPUTS

OUTPUT

PARENTS

      abinit

CHILDREN

SOURCE

181 !This section has been created automatically by the script Abilint (TD).
182 !Do not modify the following lines by hand.
183 #undef ABI_FUNC
184 #define ABI_FUNC 'ab7_invars_get_abinit_vars'
185 !End of the abilint section
186 
187  subroutine ab7_invars_get_abinit_vars(dtsetsId, dtsets, pspheads, mxvals, papiopt, timopt, dmatpuflag)
188 
189 
190 !This section has been created automatically by the script Abilint (TD).
191 !Do not modify the following lines by hand.
192 #undef ABI_FUNC
193 #define ABI_FUNC 'ab7_invars_get_abinit_vars'
194 !End of the abilint section
195 
196  integer, intent(in) :: dtsetsId
197  type(dataset_type), pointer :: dtsets(:)
198  type(pspheader_type), pointer :: pspheads(:)
199  type(ab_dimensions), intent(out) :: mxvals
200 
201  integer, intent(out) :: papiopt, timopt, dmatpuflag
202 
203  type(dtsets_list), pointer :: token
204 
205  call get_token(token, dtsetsId)
206 
207  if (associated(token)) then
208     dtsets        => token%dtsets
209     pspheads      => token%pspheads
210 
211     mxvals%ga_n_rules  = token%mxga_n_rules
212     mxvals%gw_nqlwl    = token%mxgw_nqlwl
213     mxvals%lpawu       = token%mxlpawu
214     mxvals%mband       = token%mxmband
215     mxvals%mband_upper = token%mxmband_upper
216     mxvals%natom       = token%mxnatom
217     mxvals%natpawu     = token%mxnatpawu
218     mxvals%natsph      = token%mxnatsph
219     mxvals%natsph_extra= token%mxnatsph_extra
220     mxvals%natvshift   = token%mxnatvshift
221     mxvals%nbandhf     = token%mxnbandhf
222     mxvals%nconeq      = token%mxnconeq
223     mxvals%n_efmas_dirs= token%mxn_efmas_dirs
224     mxvals%nimage      = token%mxnimage
225     mxvals%nimfrqs     = token%mxnimfrqs
226     mxvals%nfreqsp     = token%mxnfreqsp
227     mxvals%n_projection_frequencies = token%mxn_projection_frequencies
228     mxvals%nkpt        = token%mxnkpt
229     mxvals%nkpthf      = token%mxnkpthf
230     mxvals%nkptgw      = token%mxnkptgw
231     mxvals%nnos        = token%mxnnos
232     mxvals%nqptdm      = token%mxnqptdm
233     mxvals%nspinor     = token%mxnspinor
234     mxvals%nsppol      = token%mxnsppol
235     mxvals%nsym        = token%mxnsym
236     mxvals%ntypat      = token%mxntypat
237     mxvals%nzchempot   = token%mxnzchempot
238 
239     mxvals%nberry      = 20   ! This is presently a fixed value. Should be changed.
240 
241     papiopt       = token%papiopt
242     timopt        = token%timopt
243     dmatpuflag    = token%dmatpuflag
244  else
245     nullify(dtsets)
246     nullify(pspheads)
247  end if
248 
249 end subroutine ab7_invars_get_abinit_vars

m_ab7_invars/ab7_invars_get_ndtset [ Functions ]

[ Top ] [ Functions ]

NAME

  ab7_invars_get_ndtset

FUNCTION

   Returns the number of datasets.

INPUTS

   dtsetsId=Dataset identifier

OUTPUT

  value=Number of datasets
  errno=Error code

PARENTS

CHILDREN

SOURCE

883 subroutine ab7_invars_get_ndtset(dtsetsId, value, errno)
884 
885 
886 !This section has been created automatically by the script Abilint (TD).
887 !Do not modify the following lines by hand.
888 #undef ABI_FUNC
889 #define ABI_FUNC 'ab7_invars_get_ndtset'
890 !End of the abilint section
891 
892  integer, intent(in) :: dtsetsId
893  integer, intent(out) :: value
894  integer, intent(out) :: errno
895 
896  type(dtsets_list), pointer :: token
897 
898  call get_token(token, dtsetsId)
899  if (associated(token)) then
900     value = size(token%dtsets) - 1
901     errno = AB7_NO_ERROR
902  else
903     errno = AB7_ERROR_OBJ
904  end if
905 
906 end subroutine ab7_invars_get_ndtset

m_ab7_invars/ab7_invars_load [ Functions ]

[ Top ] [ Functions ]

NAME

  ab7_invars_load

FUNCTION

   Parse the input string and create a datasets object

INPUTS

   string=String with the input.
   lenstr=Length of string.
   ndtset=Number of datasets.
   with_psp=True if pseudos must be read.
   with_mem
   [pspfilnam]=List of pseudopotential files

OUTPUT

   dtsetsId=Datasets identifier

PARENTS

      abinit,m_ab7_invars_f90

CHILDREN

SOURCE

586  subroutine ab7_invars_load(dtsetsId, string, lenstr, ndtset, with_psp, with_mem, pspfilnam)
587 
588 
589 !This section has been created automatically by the script Abilint (TD).
590 !Do not modify the following lines by hand.
591 #undef ABI_FUNC
592 #define ABI_FUNC 'ab7_invars_load'
593 !End of the abilint section
594 
595  integer, intent(out) :: dtsetsId
596  character(len = strlen), intent(inout) :: string
597  integer, intent(in) :: lenstr, ndtset
598  logical, intent(in) :: with_psp, with_mem
599  character(len = fnlen), intent(in), optional :: pspfilnam(:)
600 
601  type(dtsets_list), pointer :: token
602  integer, parameter :: level=3
603  integer :: jdtset,nprocs,ipsp
604  integer :: me,ndtset_alloc
605  integer :: npsp, ii, idtset, msym, usepaw
606  integer,allocatable :: mband_upper_(:)
607  real(dp),allocatable :: zionpsp(:)
608  real(dp) :: ecut_tmp(3,2,10)
609  character(len = fnlen), allocatable :: pspfilnam_(:)
610  !character(len=500) :: message
611 
612  ! We allocate a new list token and prepend it.
613  if (AB_DBG) write(std_err,*) "AB module: allocate a new object."
614  call new_token(token)
615  dtsetsId = token%id
616 
617  ndtset_alloc=ndtset ; if(ndtset==0)ndtset_alloc=1
618  ABI_DATATYPE_ALLOCATE(token%dtsets,(0:ndtset_alloc))
619  if (AB_DBG) write(std_err,*) "AB module: allocation OK at ", dtsetsId
620 
621  if (AB_DBG) write(std_err,*) "AB module: call invars0()."
622  token%timopt = 1
623  if(xmpi_paral==1) token%timopt = 0
624 
625  !7) Continue to analyze the input string, get upper dimensions,
626  !and allocate the remaining arrays.
627  call invars0(token%dtsets,token%istatr,token%istatshft,lenstr,&
628       & msym,token%mxnatom,token%mxnimage,token%mxntypat,ndtset,ndtset_alloc,npsp,&
629       & token%papiopt, token%timopt, string)
630  token%dtsets(:)%timopt=token%timopt
631  token%dtsets(0)%timopt = 1
632  if(xmpi_paral==1) token%dtsets(0)%timopt = 0
633 
634  !Be careful : at these fourth and fifth calls of status, istatr and istatshft taken
635  !from the input variables will be saved definitively.
636  if (call_status) then
637    call status(0,opt_status_file,token%istatr,level,'init istatr   ')
638    call status(0,opt_status_file,token%istatshft,level,'init istatshft')
639  else
640 !  Fake call to disable status file
641    call status(0,' ',0,3,' ')
642  end if
643 
644  if (call_timab) then
645    call timab(41,2,opt_timab_tsec)
646    call timab(token%timopt,5,opt_timab_tsec)
647  end if
648 
649  !8) Finish to read the "file" file completely, as npsp is known,
650  !and also initialize pspheads, that contains the important information
651  !from the pseudopotential headers, as well as the psp filename
652 
653  if (call_timab) then
654    call timab(42,1,opt_timab_tsec)
655  end if
656 
657  if (call_status) then
658    call status(0,opt_status_file,99,level,'call iofn2    ')
659  end if
660  usepaw=0
661  ABI_DATATYPE_ALLOCATE(token%pspheads,(npsp))
662  if (npsp>10) then
663     MSG_BUG('ecut_tmp is not well defined.')
664  end if
665  ecut_tmp=-one
666 
667  token%pspheads(:)%usewvl=token%dtsets(1)%usewvl
668  if (with_psp) then
669     if (AB_DBG) write(std_err,*) "AB module: call iofn2()."
670     me=xmpi_comm_rank(xmpi_world)
671     if (me == 0) then
672        if (.not. present(pspfilnam)) then
673           ABI_ALLOCATE(pspfilnam_,(npsp))
674           call iofn2(npsp, pspfilnam_)
675           call inpspheads(pspfilnam_,npsp,token%pspheads,ecut_tmp)
676 !      write(std_out,*)' ab7_invars_f90 : token%pspheads(1)%nproj(0:3)=',token%pspheads(1)%nproj(0:3)
677           ABI_DEALLOCATE(pspfilnam_)
678        else
679           call inpspheads(pspfilnam,npsp,token%pspheads,ecut_tmp)
680        end if
681        if(minval(abs(token%pspheads(1:npsp)%pspcod-7))==0) usepaw=1
682        if(minval(abs(token%pspheads(1:npsp)%pspcod-17))==0) usepaw=1
683     end if
684     !Communicate pspheads to all processors
685     call pspheads_comm(npsp,token%pspheads,usepaw)
686  else
687     ! No psp files are given, we put default values into pspheads.
688     token%pspheads(:)%zionpsp = 1
689     token%pspheads(:)%pspxc   = token%dtsets(1)%ixc
690     token%pspheads(:)%pspso   = 0
691     token%pspheads(:)%xccc    = 0
692  end if
693 
694  !If (all) pspcod are 7 then this is a PAW calculation. Initialize (default) the value of ratsph
695  do idtset=0,ndtset_alloc
696     token%dtsets(idtset)%usepaw=usepaw
697     if(usepaw==0)then
698       token%dtsets(idtset)%ratsph(:)=two
699     else
700 !     Note that the following coding assumes that npsp=ntypati for PAW, which is true as of now (XG20101024).
701       !token%dtsets(idtset)%ratsph(1:npsp)=token%pspheads(1:npsp)%pawheader%rpaw
702       do ipsp=1,npsp
703         token%dtsets(idtset)%ratsph(ipsp)=token%pspheads(ipsp)%pawheader%rpaw
704       end do
705     endif
706  end do
707 
708  !Take care of other dimensions, and part of the content of dtsets
709  !that is or might be needed early.
710  !zion_max=maxval(pspheads(1:npsp)%zionpsp) ! This might not work properly with HP compiler
711 
712 ! zion_max=token%pspheads(1)%zionpsp
713 ! do ii=1,npsp
714 !    zion_max=max(token%pspheads(ii)%zionpsp,zion_max)
715 ! end do
716  ABI_ALLOCATE(zionpsp,(npsp))
717  do ii=1,npsp
718   zionpsp(ii)=token%pspheads(ii)%zionpsp
719  end do
720 
721  if (AB_DBG) write(std_err,*) "AB module: OK."
722 
723  ABI_ALLOCATE(mband_upper_ ,(  0:ndtset_alloc))
724 
725  if (AB_DBG) write(std_err,*) "AB module: call invars1m()."
726 
727 ! write(std_out,*)' ab7_invars_f90 , before invars1m : token%pspheads(1)%nproj(0:3)=',token%pspheads(1)%nproj(0:3)
728 
729  call invars1m(token%dmatpuflag,token%dtsets,ab_out,lenstr,mband_upper_,&
730    & msym,token%mxga_n_rules,token%mxgw_nqlwl,token%mxlpawu,&
731    & token%mxmband_upper,&
732    & token%mxnatom,token%mxnatpawu,token%mxnatsph,token%mxnatsph_extra,&
733    & token%mxnatvshift,&
734    & token%mxnconeq,token%mxnimage,token%mxn_efmas_dirs,token%mxnkpt,token%mxnkptgw,token%mxnkpthf,token%mxnnos,&
735    & token%mxnqptdm,&
736    & token%mxnspinor,token%mxnsppol,token%mxnsym,token%mxntypat,token%mxnimfrqs,&
737    & token%mxnfreqsp,token%mxnzchempot,token%mxn_projection_frequencies,ndtset,&
738    & ndtset_alloc,string,npsp,zionpsp)
739 
740  ABI_DEALLOCATE(zionpsp)
741  if (call_timab) then
742    call timab(42,2,opt_timab_tsec)
743  end if
744 
745  if (call_timab) then
746    call timab(43,3,opt_timab_tsec)
747  end if
748 
749  if (AB_DBG) write(std_err,*) "AB module: OK."
750 
751  !9) Provide defaults for the variables that have not yet been initialized.
752  if (AB_DBG) write(std_err,*) "AB module: call indefo()."
753  if (call_status) then
754    call status(0,opt_status_file,99,level,'call indefo   ')
755  end if
756 
757  nprocs = xmpi_comm_size(xmpi_world)
758  call indefo(token%dtsets,ndtset_alloc,nprocs)
759  if (AB_DBG) write(std_err,*) "AB module: OK."
760 
761  if (call_status) then
762    call status(0,opt_status_file,99,level,'call macroin  ')
763  end if
764 
765  call macroin(token%dtsets,ecut_tmp,lenstr,ndtset_alloc,string)
766 
767  !10) Perform some global initialization, depending on the value of
768  ! pseudopotentials, parallelism variables, or macro input variables
769 
770  !If all the pseudopotentials have the same pspxc, override the default
771  !value for dtsets 1 to ndtset
772  if(with_psp .and. minval(abs((token%pspheads(1:npsp)%pspxc-token%pspheads(1)%pspxc)))==0)then
773     token%dtsets(1:ndtset_alloc)%ixc=token%pspheads(1)%pspxc
774  end if
775 
776  !11) Call the main input routine.
777  if (AB_DBG) write(std_err,*) "AB module: call invars2()."
778 
779  if (call_status) then
780    call status(0,opt_status_file,99,level,'call invars2m ')
781  end if
782 
783  if (with_mem) then
784    !write(std_out,*)' ab7_invars_f90 : token%pspheads(1)%nproj(0:3)=',token%pspheads(1)%nproj(0:3)
785    call invars2m(token%dtsets,ab_out,lenstr,mband_upper_,msym,ndtset,ndtset_alloc,npsp,token%pspheads,string)
786  else
787    do idtset = 1, ndtset_alloc, 1
788       jdtset=token%dtsets(idtset)%jdtset ; if(ndtset==0)jdtset=0
789       call invars2(token%dtsets(idtset)%bravais,token%dtsets(idtset),ab_out,jdtset,lenstr,&
790          & mband_upper_(idtset),msym,npsp,string,usepaw,&
791          & token%pspheads(1:npsp)%zionpsp)
792    end do
793  end if
794 
795  if (AB_DBG) write(std_err,*) "AB module: OK."
796 
797  if (call_status) then
798    call status(0,opt_status_file,99,level,'call macroin2  ')
799  end if
800 
801  call macroin2(token%dtsets,ndtset_alloc)
802 
803  !mxmband=maxval(dtsets(1:ndtset_alloc)%mband) ! This might not work with the HP compiler
804  token%mxmband=token%dtsets(1)%mband
805  do ii=1,ndtset_alloc
806     token%mxmband=max(token%dtsets(ii)%mband,token%mxmband)
807  end do
808 
809  if (call_timab) then
810    call timab(43,2,opt_timab_tsec)
811  end if
812 
813  ABI_DEALLOCATE(mband_upper_)
814 
815  if (call_status) then
816    call status(0,opt_status_file,99,level,'exit')
817  end if
818 
819 end subroutine ab7_invars_load

m_ab7_invars/ab7_invars_new_from_file [ Functions ]

[ Top ] [ Functions ]

NAME

  ab7_invars_new_from_file

FUNCTION

   Create a datasets object from a file with the Abinit input.

INPUTS

  filename=String with the path to the file.
  n=len of filename.
  pspfiles=List of pseudopotential filenames.
  nsps=Number of pseudos
  comm=MPI communicator

OUTPUT

   dtsetsId=Datasets identifier

PARENTS

CHILDREN

SOURCE

524 subroutine ab7_invars_new_from_file(dtsetsId, filename, n, pspfiles, npsp, comm)
525 
526 
527 !This section has been created automatically by the script Abilint (TD).
528 !Do not modify the following lines by hand.
529 #undef ABI_FUNC
530 #define ABI_FUNC 'ab7_invars_new_from_file'
531 !End of the abilint section
532 
533  integer, intent(out) :: dtsetsId
534  integer, intent(in) :: n, npsp
535  integer,optional,intent(in) :: comm
536  character(len=n), intent(in) :: filename
537  character(len=fnlen), intent(in) :: pspfiles(npsp)
538 
539  character(len = strlen) :: string
540  integer :: lenstr, ndtset,my_comm
541 
542  my_comm = xmpi_world; if (present(comm)) my_comm = comm
543 
544  dtsetsId = 0
545 
546  if (AB_DBG) write(std_err,*) "AB module: read '", trim(filename), "' to string."
547  call parsefile(filename, lenstr, ndtset, string, my_comm)
548  if (AB_DBG) write(std_err,*) "AB module: read OK, string length ", lenstr
549 
550  if (npsp == 0) then
551     call ab7_invars_load(dtsetsId, string, lenstr, ndtset, .false., .false.)
552  else
553     call ab7_invars_load(dtsetsId, string, lenstr, ndtset, .true., .false., pspfiles)
554  end if
555 
556 end subroutine ab7_invars_new_from_file

m_ab7_invars/ab7_invars_new_from_string [ Functions ]

[ Top ] [ Functions ]

NAME

FUNCTION

   Create a datasets object from a string containing the Abinit input.

INPUTS

  instr=Input string
  len=len of the string

OUTPUT

   dtsetsId=Datasets identifier

PARENTS

CHILDREN

SOURCE

441   subroutine ab7_invars_new_from_string(dtsetsId, instr, len)
442 
443 
444 !This section has been created automatically by the script Abilint (TD).
445 !Do not modify the following lines by hand.
446 #undef ABI_FUNC
447 #define ABI_FUNC 'ab7_invars_new_from_string'
448 !End of the abilint section
449 
450  integer, intent(out) :: dtsetsId
451  integer, intent(in) :: len
452  character(len = len), intent(in) :: instr
453 
454  character(len = strlen) :: string
455  integer :: lenstr, ndtset
456  integer :: marr, tread
457  character(len = 30) :: token
458  integer :: intarr(1)
459  real(dp) :: dprarr(1)
460  character(len=500) :: message
461 
462  dtsetsId = 0
463 
464  if (len > strlen) then
465     return
466  end if
467 
468  write(string,*) instr
469 
470  !To make case-insensitive, map characters of string to upper case:
471  call inupper(string(1:len))
472 
473  !Might import data from xyz file(s) into string
474  !Need string_raw to deal properly with xyz filenames
475  lenstr = len
476  call importxyz(lenstr, instr, string, len)
477 
478  !6) Take ndtset from the input string, then allocate
479  !the arrays whose dimensions depends only on ndtset and msym.
480 
481  ndtset=0 ; marr=1
482  token = 'ndtset'
483  call intagm(dprarr,intarr,0,marr,1,string(1:lenstr),token,tread,'INT')
484  if(tread==1) ndtset=intarr(1)
485  !Check that ndtset is not negative
486  if (ndtset<0 .or. ndtset>99) then
487     write(message, '(a,i12,a,a,a,a)' )&
488 &     'Input ndtset must be non-negative and < 100, but was ',ndtset,ch10,&
489 &     'This is not allowed.  ',ch10,&
490 &     'Action : modify ndtset in the input file.'
491     MSG_ERROR(message)
492  end if
493 
494  call ab7_invars_load(dtsetsId, string, lenstr, ndtset, .false., .false.)
495 
496 end subroutine ab7_invars_new_from_string

m_ab7_invars/ab7_invars_set_flags [ Functions ]

[ Top ] [ Functions ]

NAME

   ab7_invars_set_flags

FUNCTION

INPUTS

OUTPUT

PARENTS

      abinit,multibinit

CHILDREN

SOURCE

133 subroutine ab7_invars_set_flags(status, timab, status_file, timab_tsec)
134 
135 
136 !This section has been created automatically by the script Abilint (TD).
137 !Do not modify the following lines by hand.
138 #undef ABI_FUNC
139 #define ABI_FUNC 'ab7_invars_set_flags'
140 !End of the abilint section
141 
142  logical, intent(in) :: status, timab
143  character(len = fnlen), intent(in), optional :: status_file
144  real(dp), intent(in), target, optional :: timab_tsec(:)
145 
146  call_status = status
147  if (present(status_file)) then
148     write(opt_status_file, "(A)") status_file
149  else
150     write(opt_status_file, "(A)") "status"
151  end if
152  call_timab  = timab
153  if (present(timab_tsec)) then
154     opt_timab_tsec => timab_tsec
155  else
156     ABI_ALLOCATE(opt_timab_tsec,(2))
157  end if
158 
159 end subroutine ab7_invars_set_flags

m_ab7_invars/free_token [ Functions ]

[ Top ] [ Functions ]

NAME

   free_token

FUNCTION

INPUTS

OUTPUT

PARENTS

      m_ab7_invars_f90

CHILDREN

SOURCE

318   subroutine free_token(token)
319 
320 
321 !This section has been created automatically by the script Abilint (TD).
322 !Do not modify the following lines by hand.
323 #undef ABI_FUNC
324 #define ABI_FUNC 'free_token'
325 !End of the abilint section
326 
327 type(dtsets_list), pointer :: token
328 
329 integer :: idtset
330 
331  if (.not. associated(token)) then
332     write (std_out,*) 'in m_ab7_invars:free_token : token not associated. Nothing doing.'
333     return
334  end if
335 
336  ! We free a token list.
337  if (AB_DBG) write(std_err,*) "AB module: free request on dataset array ", token%id
338  if (associated(token%dtsets)) then
339     if (AB_DBG) write(std_err,*) " | ", size(token%dtsets), "dtsets found."
340     do idtset = 0, size(token%dtsets) - 1, 1
341        if (AB_DBG) write(std_err,*) " | free dtset ", idtset
342        call dtset_free(token%dtsets(idtset))
343        if (AB_DBG) write(std_err,*) " | free OK"
344     end do
345     ABI_DATATYPE_DEALLOCATE(token%dtsets)
346     nullify(token%dtsets)
347     ABI_DATATYPE_DEALLOCATE(token%pspheads)
348     nullify(token%pspheads)
349     if (AB_DBG) write(std_err,*) " | general free OK"
350 
351     ! We remove token from the list.
352     if (associated(token%prev)) then
353        token%prev%next => token%next
354     else
355        my_dtsets => token%next
356     end if
357     if (associated(token%next)) then
358        token%next%prev => token%prev
359     end if
360     ABI_DATATYPE_DEALLOCATE(token)
361     if (AB_DBG) write(std_err,*) " | token free OK"
362 
363  end if
364  if (AB_DBG) write(std_err,*) "AB module: free done"
365 
366 end subroutine free_token

m_ab7_invars/get_token [ Functions ]

[ Top ] [ Functions ]

NAME

  get_token

FUNCTION

INPUTS

OUTPUT

PARENTS

      m_ab7_invars_f90

CHILDREN

SOURCE

388  subroutine get_token(token, id)
389 
390 
391 !This section has been created automatically by the script Abilint (TD).
392 !Do not modify the following lines by hand.
393 #undef ABI_FUNC
394 #define ABI_FUNC 'get_token'
395 !End of the abilint section
396 
397  type(dtsets_list), pointer :: token
398  integer, intent(in) :: id
399 
400  type(dtsets_list), pointer :: tmpLst
401 
402  if (AB_DBG) write(std_err,*) "AB module: request list element ", id
403  nullify(token)
404  ! List element are prepended so element id is at (nb - id) position.
405  tmpLst => my_dtsets
406  do
407     if (.not. associated(tmpLst)) then
408        exit
409     end if
410     if (tmpLst%id == id .and. associated(tmpLst%dtsets)) then
411        token => tmpLst
412        return
413     end if
414     tmpLst => tmpLst%next
415  end do
416 
417 end subroutine get_token

m_ab7_invars/iofn2 [ Functions ]

[ Top ] [ Functions ]

NAME

 iofn2

FUNCTION

 First, read and echo pseudopotential filenames from standard input unit
 Store them in an array.

INPUTS

  npsp=number of pseudopotentials

OUTPUT

  pspheads(npsp)=<type pspheader_type>=all the important information from the
   pseudopotential file headers, as well as the psp file names

PARENTS

      m_ab7_invars_f90

CHILDREN

SOURCE

931 subroutine iofn2(npsp,filnam)
932 
933  use defs_basis
934 
935 !This section has been created automatically by the script Abilint (TD).
936 !Do not modify the following lines by hand.
937 #undef ABI_FUNC
938 #define ABI_FUNC 'iofn2'
939 !End of the abilint section
940 
941  implicit none
942 
943 !Arguments ------------------------------------
944 !scalars
945  integer,intent(in) :: npsp
946 !arrays
947  character(len=fnlen), intent(out) :: filnam(npsp)
948 
949 !Local variables-------------------------------
950 !scalars
951  integer :: ios,ipsp
952  character(len=500) :: message
953  character(len=fnlen) :: filpsp
954 
955 !*************************************************************************
956 
957  do ipsp=1,npsp
958    ! Read the name of the psp file
959    write(std_out,'(/,a)' )' Please give name of formatted atomic psp file'
960    read (std_in, '(a)' , iostat=ios ) filpsp
961    filnam(ipsp)=trim(filpsp)
962 
963    !  It might be that a file name is missing
964    if (ios/=0) then
965      write(message, '(a,a,a,a,a,a,a)' )&
966 &     'There are not enough names of pseudopotentials',ch10,&
967 &     'provided in the files file.',ch10,&
968 &     'Action: check first the variable ntypat (and/or npsp) in the input file;',ch10,&
969 &     'if they are correct, complete your files file.'
970      MSG_ERROR(message)
971    end if
972 
973    write(std_out,'(a,i0,2a)' )' iofn2 : for atom type ',ipsp,', psp file is ',trim(filpsp)
974  end do ! ipsp=1,npsp
975 
976 end subroutine iofn2

m_ab7_invars/new_token [ Functions ]

[ Top ] [ Functions ]

NAME

   new_token

FUNCTION

INPUTS

OUTPUT

PARENTS

      m_ab7_invars_f90

CHILDREN

SOURCE

271   subroutine new_token(token)
272 
273 
274 !This section has been created automatically by the script Abilint (TD).
275 !Do not modify the following lines by hand.
276 #undef ABI_FUNC
277 #define ABI_FUNC 'new_token'
278 !End of the abilint section
279 
280 type(dtsets_list), pointer :: token
281 
282  ! We allocate a new list token and prepend it.
283  if (AB_DBG) write(std_err,*) "AB module: create a new token."
284  nb_dtsets = nb_dtsets + 1
285 
286  ABI_DATATYPE_ALLOCATE(token,)
287  token%id = nb_dtsets
288  nullify(token%dtsets)
289  nullify(token%pspheads)
290  token%next => my_dtsets
291  nullify(token%prev)
292 
293  my_dtsets => token
294  if (AB_DBG) write(std_err,*) "AB module: creation OK with id ", token%id
295 
296 end subroutine new_token