Re: How to vary some parameter automatically per run

From: Marco Mauri (marco.mauri@cern.ch)
Date: Mon Aug 20 2007 - 11:35:23 CEST

  • Next message: Rollet Sofia: "FLUKA and micro-PET? -2-"

    Hi!
    I think the best way to handle this is by a shell script that changes
    the value of the energy set in the input file and than starts the
    simulation.

    For instance (just to give you an idea):
    ---------------------------------------------------------------------------------------------------

    #!/bin/bash

    INPUTFILE="your_input_file.inp"
    ENERGIES_FILE="energies.list"

    # Reading energies from file
    # (assuming that each line in the file contains only the energy value)
    energies=(`cat $ENERGIES_FILE `)

    #Cycle through all energies:
    for element in ${energies[@]}
    do
    #Modifying the energy in the input file:
    awk '
    {
      if ($0~/^BEAM/)
        {
        #change BEAMcard definition to suit your needs (must contain the
    full BEAM card)
        BEAMcard=sprintf("BEAM
    %10s MUON+", e_string)
        print BEAMcard
        }
      else print $0
    }
    ' e_string=$element $INPUTFILE > $INPUTFILE.temp

    mv $INPUTFILE.temp $INPUTFILE

    #
    # to do: running fluka
    #

    done
    #End cycle
    ---------------------------------------------------------------------------------------------------

    Marco

    Yung-Shun Yeh wrote:

    > Dear FLUKA users,
    >
    > I don't know if this question is appropriate in this forum.
    >
    > I am doing a simulation about estimation of muon-induced neutrons. In
    > this simulation, I must vary the energy of primary muon and then do
    > the simulation again. Earlier I varied the energy by hand, but it is
    > not good method. Could anyone teach me any good way to deal with this
    > routine. Thank you very much.
    >
    > Best regards,
    > Yung-Shun


  • Next message: Rollet Sofia: "FLUKA and micro-PET? -2-"

    This archive was generated by hypermail 2.1.6 : Wed Aug 22 2007 - 23:49:11 CEST