112    character(len=MAX_PATH_LEN) :: dir
 
  113    character(len=MAX_PATH_LEN) :: pwd
 
  115    type(namespace_t), 
pointer, 
public :: namespace
 
  116    type(mpi_grp_t)   :: mpi_grp
 
  117    type(multicomm_t), 
pointer :: mc
 
  119    integer(int64), 
allocatable :: map(:)
 
  125    character(len=20) :: tag
 
  126    character(len=MAX_PATH_LEN) :: basedir
 
  127    character(len=MAX_PATH_LEN) :: dir
 
  132  integer, 
parameter, 
public :: &
 
  133    RESTART_TYPE_DUMP = 1,      &
 
  136  integer, 
parameter, 
public :: &
 
  137    RESTART_UNDEFINED  = -1,    &
 
  152  integer, 
parameter :: RESTART_N_DATA_TYPES = 12
 
  154  integer, 
parameter, 
public :: &
 
  155    RESTART_FLAG_STATES = 1,    &
 
  161  type(restart_data_t) :: info(RESTART_N_DATA_TYPES)
 
  166    subroutine block_signals()
 
  168    end subroutine block_signals
 
  172    subroutine unblock_signals()
 
  174    end subroutine unblock_signals
 
  181    type(MPI_Comm), 
intent(in) :: comm
 
  183    logical :: clean_stop, file_exists
 
  190      inquire(file=
'stop', exist=file_exists)
 
  191      if (file_exists) 
then 
  199    call mpi_bcast(clean_stop, 1, mpi_logical, 0, comm, 
mpi_err)
 
  215    logical :: set(restart_n_data_types)
 
  216    integer :: iline, n_cols, data_type
 
  217    character(len=MAX_PATH_LEN) :: default_basedir
 
  237    info(:)%basedir = 
'restart' 
  386    if (
parse_block(namespace, 
'RestartOptions', blk) == 0) 
then 
  388      default_basedir = 
'restart' 
  394        if (data_type < 0 .or. data_type > restart_n_data_types) 
then 
  395          call messages_input_error(namespace, 
'RestartOptions', 
"Invalid data type", row=iline-1, column=0)
 
  397        if (data_type == 0) 
then 
  400          set(data_type) = .
true.
 
  410        info(:)%basedir = default_basedir
 
  420  subroutine restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
 
  423    integer,                     
intent(in)  :: data_type
 
  424    integer,                     
intent(in)  :: 
type 
  427    integer,                     
intent(out) :: ierr
 
  428    class(
mesh_t),     
optional, 
intent(in)  :: mesh
 
  430    character(len=*),  
optional, 
intent(in)  :: dir
 
  432    logical,           
optional, 
intent(in)  :: exact
 
  435    logical :: grid_changed, grid_reordered, 
restart_write, dir_exists
 
  436    character(len=20) :: tag
 
  437    character(len=MAX_PATH_LEN) :: basedir, dirname
 
  444    if (
present(exact) .and. .not. 
present(mesh)) 
then 
  445      message(1) = 
"Error in restart_init: the 'exact' optional argument requires a mesh." 
  449    restart%has_mesh = 
present(mesh)
 
  455    if (data_type < restart_undefined .and. data_type > restart_n_data_types) 
then 
  456      message(1) = 
"Illegal data_type in restart_init" 
  459    restart%data_type = data_type
 
  460    restart%namespace => namespace
 
  462    select case (restart%type)
 
  463    case (restart_type_dump)
 
  477      if (restart%skip) 
then 
  478        message(1) = 
'Restart information will not be written.' 
  484      restart%skip = .false.
 
  487      message(1) = 
"Unknown restart type in restart_init" 
  493    if (restart%data_type == restart_undefined) 
then 
  498      basedir = info(restart%data_type)%basedir
 
  499      if (index(basedir, 
'/', .
true.) /= len_trim(basedir)) 
then 
  500        basedir = trim(basedir)//
"/" 
  502      dirname = info(restart%data_type)%dir
 
  506    restart%dir = trim(basedir)//trim(dirname)
 
  508    if (index(restart%dir, 
'/', .
true.) == len_trim(restart%dir)) 
then 
  509      restart%dir = restart%dir(1:len_trim(restart%dir)-1)
 
  513    restart%pwd = restart%dir
 
  517      if (restart%type == restart_type_dump .and. .not. dir_exists) 
then 
  518        call io_mkdir(trim(restart%pwd), namespace, parents=.
true.)
 
  521    if (restart%mpi_grp%size > 1) 
then 
  522      call restart%mpi_grp%bcast(dir_exists, 1, mpi_logical, 0)
 
  525    if (restart%data_type == restart_undefined) 
then 
  528      tag = info(data_type)%tag
 
  531    select case (restart%type)
 
  532    case (restart_type_dump)
 
  533      if (.not. restart%skip) 
then 
  534        message(1) = 
"Info: "//trim(tag)//
" restart information will be written to '"//trim(restart%pwd)//
"'." 
  539        if (
present(mesh)) 
then 
  540          call index_dump(mesh%idx, mesh%np_part_global, restart%pwd, restart%mpi_grp, &
 
  541            restart%namespace, ierr)
 
  543            message(1) = 
"Unable to write index map to '"//trim(restart%pwd)//
"'." 
  549            message(1) = 
"Unable to write mesh fingerprint to '"//trim(restart%pwd)//
"/grid'." 
  557      if (.not. dir_exists) 
then 
  559        restart%skip = .
true.
 
  561        message(1) = 
"Info: Could not find '"//trim(restart%pwd)//
"' directory for restart." 
  562        message(2) = 
"Info: No restart information will be read." 
  566        message(1) = 
"Info: "//trim(tag)//
" restart information will be read from '"//trim(restart%pwd)//
"'." 
  569        if (
present(mesh)) 
then 
  571            restart%mpi_grp, grid_changed, grid_reordered, restart%map, ierr)
 
  576              message(1) = 
"Unable to check mesh compatibility: unable to read mesh fingerprint" 
  577              message(2) = 
"in '"//trim(restart%pwd)//
"'." 
  578            else if (ierr > 0) 
then 
  579              message(1) = 
"Mesh from current calculation is not compatible with mesh found in" 
  580              message(2) = 
"'"//trim(restart%pwd)//
"'." 
  582            message(3) = 
"No restart information will be read." 
  588          if (grid_changed) 
then 
  589            if (grid_reordered) 
then 
  590              message(1) = 
"Info: Octopus is attempting to restart from a mesh with a different order of points." 
  592              message(1) = 
"Info: Octopus is attempting to restart from a different mesh." 
  597          if (
present(exact)) 
then 
  598            restart%skip = grid_changed .and. .not. grid_reordered .and. exact
 
  599            if (restart%skip) 
then 
  600              message(1) = 
"This calculation requires the exact same mesh to restart." 
  601              message(2) = 
"No restart information will be read from '"//trim(restart%pwd)//
"'." 
  606            restart%skip = .false.
 
  617    if (restart%mpi_grp%size > 1) 
then 
  618      call restart%mpi_grp%barrier()
 
  627    type(
restart_t),  
intent(inout) :: restart
 
  632      select case (restart%type)
 
  634        message(1) = 
"Info: Finished reading information from '"//trim(restart%dir)//
"'." 
  635        call io_rm(trim(restart%pwd)//
"/loading", restart%namespace)
 
  636      case (restart_type_dump)
 
  637        call io_rm(trim(restart%pwd)//
"/dumping", restart%namespace)
 
  638        message(1) = 
"Info: Finished writing information to '"//trim(restart%dir)//
"'." 
  644    restart%data_type = 0
 
  645    restart%skip = .
true.
 
  646    safe_deallocate_a(restart%map)
 
  647    restart%has_mesh = .false.
 
  677    type(
restart_t),  
intent(inout) :: restart
 
  678    character(len=*), 
intent(in)    :: dirname
 
  679    integer,          
intent(out)   :: ierr
 
  683    assert(.not. restart%skip)
 
  687    select case (restart%type)
 
  688    case (restart_type_dump)
 
  697      if (index(dirname, 
'/', .
true.) == len_trim(dirname)) 
then 
  698        restart%pwd = trim(restart%dir)//
"/"//dirname(1:len_trim(dirname)-1)
 
  700        restart%pwd = trim(restart%dir)//
"/"//trim(dirname)
 
  711    type(
restart_t),  
intent(inout) :: restart
 
  715    assert(.not. restart%skip)
 
  717    restart%pwd = restart%dir
 
  727    character(len=*), 
intent(in) :: dirname
 
  731    assert(.not. restart%skip)
 
  733    assert(restart%type == restart_type_dump)
 
  735    call io_mkdir(trim(restart%pwd)//
"/"//trim(dirname), restart%namespace, parents=.
true.)
 
  745    character(len=*), 
intent(in) :: name
 
  747    assert(.not. restart%skip)
 
  748    assert(restart%type == restart_type_dump)
 
  752    call io_rm(trim(restart%pwd)//
"/"//trim(name), restart%namespace)
 
  765  function restart_open(restart, filename, status, position, silent)
 
  767    character(len=*),           
intent(in) :: filename
 
  768    character(len=*), 
optional, 
intent(in) :: status
 
  769    character(len=*), 
optional, 
intent(in) :: position
 
  770    logical,          
optional, 
intent(in) :: silent
 
  774    character(len=20) :: action, status_
 
  778    assert(.not. restart%skip)
 
  780    select case (restart%type)
 
  781    case (restart_type_dump)
 
  792      message(1) = 
"Error in restart_open: illegal restart type" 
  796    if (
present(status)) status_ = status
 
  799      action=trim(action), status=trim(status_), &
 
  800      die=die, position=position, form=
"formatted", grp=restart%mpi_grp)
 
  803      message(1) = 
"Unable to open file '"//trim(restart%pwd)//
"/"//trim(filename)//
"'." 
  812  subroutine restart_write(restart, iunit, lines, nlines, ierr)
 
  814    integer,          
intent(in)  :: iunit
 
  815    character(len=*), 
intent(in)  :: lines(:)
 
  816    integer,          
intent(in)  :: nlines
 
  817    integer,          
intent(out) :: ierr
 
  827          write(iunit,
"(a)") trim(lines(iline))
 
  839  subroutine restart_read(restart, iunit, lines, nlines, ierr)
 
  841    integer,          
intent(in)  :: iunit
 
  842    character(len=*), 
intent(out) :: lines(:)
 
  843    integer,          
intent(in)  :: nlines
 
  844    integer,          
intent(out) :: ierr
 
  848    call iopar_read(restart%mpi_grp, iunit, lines, nlines, ierr)
 
  858    integer,         
intent(inout) :: iunit
 
  862    if (iunit > 0) 
call io_close(iunit, restart%mpi_grp)
 
  885    integer,         
intent(in) :: flag
 
  905    integer, 
intent(in) :: type1
 
  906    integer, 
intent(in) :: type2
 
  915#include "restart_inc.F90" 
  918#include "complex.F90" 
  919#include "restart_inc.F90" 
This module implements batches of mesh functions.
 
This module handles the calculation mode.
 
character(len= *), parameter, public em_resp_fd_dir
 
character(len= *), parameter, public gs_dir
 
character(len= *), parameter, public casida_dir
 
character(len= *), parameter, public vib_modes_dir
 
character(len= *), parameter, public partition_dir
 
character(len= *), parameter, public kdotp_dir
 
character(len= *), parameter, public em_resp_dir
 
character(len= *), parameter, public td_dir
 
character(len= *), parameter, public vdw_dir
 
character(len= *), parameter, public oct_dir
 
This module implements the index, used for the mesh points.
 
subroutine, public index_dump(idx, np, dir, mpi_grp, namespace, ierr)
 
subroutine, public io_close(iunit, grp)
 
subroutine, public iopar_read(grp, iunit, lines, n_lines, ierr)
 
character(len=max_path_len) function, public io_workpath(path, namespace)
 
subroutine, public io_rm(fname, namespace)
 
subroutine, public io_mkdir(fname, namespace, parents)
 
logical function, public io_dir_exists(dir, namespace)
Returns true if a dir with name 'dir' exists.
 
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
 
logical function, public loct_dir_exists(dirname)
 
This module defines functions over batches of mesh functions.
 
This module defines the meshes, which are used in Octopus.
 
subroutine, public mesh_check_dump_compatibility(mesh, dir, filename, namespace, mpi_grp, grid_changed, grid_reordered, map, ierr)
 
subroutine, public mesh_write_fingerprint(mesh, dir, filename, mpi_grp, namespace, ierr)
 
subroutine, public messages_warning(no_lines, all_nodes, namespace)
 
subroutine, public messages_obsolete_variable(namespace, name, rep)
 
subroutine, public messages_info(no_lines, iunit, verbose_limit, stress, all_nodes, namespace)
 
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
 
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
 
subroutine, public messages_input_error(namespace, var, details, row, column)
 
logical function mpi_grp_is_root(grp)
 
type(mpi_grp_t), public mpi_world
 
subroutine mpi_grp_init(grp, comm)
Initialize MPI group instance.
 
integer, public mpi_err
used to store return values of mpi calls
 
This module handles the communicators for the various parallelization strategies.
 
Some general things and nomenclature:
 
integer function, public parse_block(namespace, name, blk, check_varinfo_)
 
subroutine zrestart_write_binary3_int32(restart, filename, np, ff, ierr, root)
 
subroutine drestart_write_binary1_int32(restart, filename, np, ff, ierr, root)
 
subroutine drestart_read_binary3(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_partition
 
subroutine, public restart_module_init(namespace)
 
subroutine drestart_write_binary5(restart, filename, np, ff, ierr, root)
 
subroutine, public restart_read(restart, iunit, lines, nlines, ierr)
 
character(len=max_path_len) function, public restart_dir(restart)
Returns the name of the directory containing the restart information. The use of this function should...
 
integer, parameter, public restart_all
 
subroutine drestart_read_binary1(restart, filename, np, ff, ierr)
 
subroutine zrestart_write_mesh_function(restart, space, filename, mesh, ff, ierr, root)
 
subroutine zrestart_write_binary1(restart, filename, np, ff, ierr, root)
 
integer, parameter, public restart_casida
 
subroutine zrestart_write_binary5_int32(restart, filename, np, ff, ierr, root)
 
subroutine, public restart_close(restart, iunit)
Close a file previously opened with restart_open.
 
logical function, public clean_stop(comm)
returns true if a file named stop exists
 
subroutine zrestart_read_binary5_int32(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_kdotp
 
subroutine zrestart_read_binary3(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_oct
 
subroutine drestart_read_binary3_int32(restart, filename, np, ff, ierr)
 
subroutine, public restart_rm(restart, name)
Remove directory or file "name" that is located inside the current restart directory.
 
subroutine, public restart_mkdir(restart, dirname)
Make directory "dirname" inside the current restart directory.
 
subroutine zrestart_read_binary3_int32(restart, filename, np, ff, ierr)
 
subroutine drestart_read_binary2(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_gs
 
subroutine zrestart_read_binary1_int32(restart, filename, np, ff, ierr)
 
type(restart_data_t), dimension(restart_n_data_types) info
 
subroutine drestart_write_binary3(restart, filename, np, ff, ierr, root)
 
subroutine drestart_read_mesh_function(restart, space, filename, mesh, ff, ierr)
In domain parallel case each process reads a part of the file. At the end all the processes have the ...
 
integer, parameter, public restart_flag_mix
 
subroutine drestart_write_binary3_int32(restart, filename, np, ff, ierr, root)
 
subroutine zrestart_write_binary1_int32(restart, filename, np, ff, ierr, root)
 
integer, parameter, public restart_flag_skip
 
integer, parameter, public restart_em_resp_fd
 
subroutine drestart_read_binary2_int32(restart, filename, np, ff, ierr)
 
subroutine drestart_write_binary5_int32(restart, filename, np, ff, ierr, root)
 
subroutine, public restart_init(restart, namespace, data_type, type, mc, ierr, mesh, dir, exact)
Initializes a restart object.
 
integer, parameter, public restart_proj
 
subroutine zrestart_read_mesh_function(restart, space, filename, mesh, ff, ierr)
In domain parallel case each process reads a part of the file. At the end all the processes have the ...
 
subroutine zrestart_read_binary1(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_flag_rho
 
integer, parameter, public restart_em_resp
 
subroutine, public restart_write(restart, iunit, lines, nlines, ierr)
 
integer, parameter, public restart_vib_modes
 
subroutine drestart_write_binary1(restart, filename, np, ff, ierr, root)
 
subroutine drestart_read_binary1_int32(restart, filename, np, ff, ierr)
 
subroutine zrestart_write_binary5(restart, filename, np, ff, ierr, root)
 
logical pure function, public restart_skip(restart)
Returns true if the restart information should neither be read nor written. This might happen because...
 
integer, parameter, public restart_flag_vhxc
 
logical pure function, public restart_has_map(restart)
Returns true if the restart was from a different order of mesh points.
 
subroutine drestart_read_binary5_int32(restart, filename, np, ff, ierr)
 
subroutine drestart_write_binary2(restart, filename, np, ff, ierr, root)
 
subroutine drestart_read_binary5(restart, filename, np, ff, ierr)
 
subroutine zrestart_write_binary2_int32(restart, filename, np, ff, ierr, root)
 
logical pure function, public restart_has_flag(restart, flag)
Returns true if...
 
integer function, public restart_open(restart, filename, status, position, silent)
Open file "filename" found inside the current restart directory. Depending on the type of restart,...
 
subroutine, public restart_open_dir(restart, dirname, ierr)
Change the restart directory to dirname, where "dirname" is a subdirectory of the base restart direct...
 
integer, parameter, public restart_td
 
integer, parameter, public restart_type_load
 
subroutine zrestart_read_binary2(restart, filename, np, ff, ierr)
 
integer, parameter, public restart_vdw
 
subroutine zrestart_read_binary5(restart, filename, np, ff, ierr)
 
subroutine zrestart_write_binary2(restart, filename, np, ff, ierr, root)
 
subroutine drestart_write_mesh_function(restart, space, filename, mesh, ff, ierr, root)
 
integer, parameter, public restart_unocc
 
subroutine zrestart_write_binary3(restart, filename, np, ff, ierr, root)
 
logical pure function, public restart_are_basedirs_equal(type1, type2)
Returns true if...
 
subroutine zrestart_read_binary2_int32(restart, filename, np, ff, ierr)
 
subroutine, public restart_end(restart)
 
subroutine, public restart_close_dir(restart)
Change back to the base directory. To be called after restart_open_dir.
 
subroutine drestart_write_binary2_int32(restart, filename, np, ff, ierr, root)
 
This module defines the unit system, used for input and output.
 
Describes mesh distribution to nodes.
 
Stores all communicators and groups.