gibuu is hosted by Hepforge, IPPP Durham
GiBUU

Changes between Version 1 and Version 2 of HowToFortranNMLtools


Ignore:
Timestamp:
Jul 6, 2023, 7:06:35 PM (10 months ago)
Author:
gallmei
Comment:

extend the comment about f90nml

Legend:

Unmodified
Added
Removed
Modified
  • HowToFortranNMLtools

    v1 v2  
    33== sed ==
    44
    5 If you want to change GiBUU input jobcards via a (bash) script, one way is to store the skeleton as a template, where the variables you want to change are given by placeholders like XXX. YYY etc.
     5If you want to change GiBUU input jobcards via a (bash) script, one way is to store the skeleton as a template, where the variables you want to change are given by placeholders like XXX, YYY etc.
    66Then you may use `sed` to replace the placeholder by the actual value, e.g. "sed s/XXX/myValue/"
    77
     
    99
    1010Recently (april 2022) I became aware of two projects at !GitHub, which are capable of reading in, changing, fine printing, comparing etc. of Fortran jobcards/namelists, written in Python:
    11  * f90nml [https://github.com/marshallward/f90nml]
    12  * nmltab [https://github.com/aekiss/nmltab]
     11 * 'f90nml' [https://github.com/marshallward/f90nml]
     12 * 'nmltab' [https://github.com/aekiss/nmltab] (uses 'f90nml')
     13
     14'f90nml' may be used to change entries in the jobcard. You may use the program within own python scripts, or use its cli at the prompt.
     15
     16In the later case,
     17with the option "--patch" it keeps the formatting and the comments of the original input unchanged!
     18
     19With the option '-g XXX' you have to specify the namelist in the jobcard you want to change, then you can specify new values for input variables by '-v "variable=VAL"'.
     20If in the original namelist 'variable' is already defined, its value is replaced, otherwise a line with the new assignment is added.
     21
     22'''Attention:'''
     23 * Not setting the right namelist with the option '-g ...' adds the variable to a wrong namelist and leads to a crash of GiBUU.x
     24 * One can give multiple '-v ...' arguments, but all changes are done in the namelist you specified with '-g ...' (no multiple '-g ...' are possible!).
     25
     26So, if one wants to change multiple variables in different namelists, one has to call the program again and again for every namelist (or use a short python program, where one can define the patch including differences in multiple namelists.)
     27
     28
     29''Examples:''
     30
     31 * `f90nml -g "input" -v "numTimeSteps=42" --patch in.job out.job` [[BR]]will (correctly) change the number of timesteps to the value '42' and produce the output jobcard 'out.job', which is unchanged otherwise.
     32
     33 * `f90nml -g "input" -v "numTimeSteps=42" -g "baryonPotential" -v "EQS_Type=42" --patch in.job out.job` [[BR]] will (correctly) change the value of 'EQS_Type' in the namelist 'baryonPotential', but will also (incorrectly) add the line "numTimeSteps=42" in the same namelist.