~nickpapior/siesta/4.1-fdf-blocks

Viewing all changes in revision 983.

  • Committer: Nick Papior
  • Date: 2018-09-08 04:18:59 UTC
  • Revision ID: nickpapior@gmail.com-20180908041859-r45v0tvpxzkrtmss
fdf-updates, allow fixing block-log output, added block-line-count and is-block

The fdf-infrastructure is default to create log-output files. However, these
log-files are not directly usable as input for subsequent siesta runs.
The reason was that blocks *only* wrote out %endblock to the log if
fdf_bline was called until it failed, i.e. to the end of the block.
And currently many places in siesta was reading based on another integer
input. Secondly, the fdf_defined opened a block which isn't necessary.

The solution is divided into a few things, parenthesis is the interface:

fdf_isblock: (label)
Added this routine to check whether a label is defined as a block.
Currently there may be inconsistencies if the label is used both as
block and label, however one can then programatically decide.
This routine is now used in fdf_defined because it removes the call
to fdf_block (which opens the block).

Writes

  #:block? <label> T/F

to log.

fdf_bclose: (block_fdf)
Added routine to loop the remaining lines in the block. This is never necessary
unless one wants the log-file to be complete in terms of re-use.
I.e. if one reads all lines in the block via:
   do while ( fdf_bline(bfdf, pline) )
     ...
   end do
there is no need for fdf_bclose. However, with

   n = fdf_get('LabelSize', 0)
   if ( n > 0 .and. fdf_block('Label', bfdf) ) then
     do i = 1, n
        if ( fdf_bline(bfdf, pline) ) then
          ...
        end if
     end do
   end if
   call fdf_bclose(bfdf)

it is required to use fdf_bclose to close the block in the log.

fdf_block_linecount: (label, morph?)
Added routine to count the number of lines in a block.
If morph is not specified, any line counts as a valid line.
If morph is present a match will be done for each line, and if
accepted it counts as a line.
For instance in AtomicCoordinatesAndAtomicSpecies one would do:

  na = fdf_block_linecount('AtomicCoordinatesAndAtomicSpecies', 'vvvi')

Note that this routine will suppress writing to the log file. The only thing
that is written to the log-file is:

  #:block-line-count? <label> (morph?) N


Secondly, all log-output that does not result in a valid input line is
prefixed with '#:'
This was the case for fdf_bbackspace which simply wrote out "(Backspace to..."
Now it writes: "#:(Backspace to..."
Also fixed in fdf_defined.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: