Skip to Content.
Sympa Menu

opal - Re: [Opal] Error in option seed

opal AT lists.psi.ch

Subject: The OPAL Discussion Forum

List archive

Re: [Opal] Error in option seed


Chronological Thread 
  • From: Christof Metzger-Kraus <christof.j.kraus AT gmail.com>
  • To: "Kuske, Bettina" <bettina.kuske AT helmholtz-berlin.de>
  • Cc: "opal AT lists.psi.ch" <opal AT lists.psi.ch>
  • Subject: Re: [Opal] Error in option seed
  • Date: Wed, 25 Mar 2020 22:15:18 +0100
  • Authentication-results: localhost; iprev=pass (mail-io1-f42.google.com) smtp.remote-ip=209.85.166.42; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com

Hi Bettina,

the lack of support of SEED=-1 doesn't mean that you have to do this manually. Add
SYSTEM, "python gen_seed.py";
to the end and
CALL, "gen_seed.opal";
somewhere at the begin of your input file and add the two files in the attachment to the directory where you run this input file.

Hope, that this helps. It worked for me, but I only tested it with a simple (BerlinPro) input file.

christof

On Wed, Mar 25, 2020 at 11:03 AM Frey Matthias (PSI) <matthias.frey AT psi.ch> wrote:

Dear Bettina,


The SEED in the Sampler is different to the SEED used for the particle distribution, which the manual refers to (I think).

So, if you use SEED=-1 for the particle distribution, OPAL takes the time. If you use the SEED=-1 for the sampler,

it doesn't take the time to generate the samples.


Best,

Matthias


Von: opal-request AT lists.psi.ch <opal-request AT lists.psi.ch> im Auftrag von Kuske, Bettina <bettina.kuske AT helmholtz-berlin.de>
Gesendet: Mittwoch, 25. März 2020 10:16:17
An: opal AT lists.psi.ch
Betreff: [Opal] Error in option seed
 
Dear developers,

I am using the seed option.
Refering to the manual, SEED=-1 uses the time as seed,
so to my understanding, each run of the same sampler file should
have a different seed and thus different samples.

This doesn't seem to work.
I ran a sampler file twice with SEED=-1 with only one variable.
Each time I start the run, I get identical solenoid settings.

// Sampling methods
SM1: SAMPLING, VARIABLE="sol",  TYPE="UNIFORM",  SEED=-1, RANDOM=TRUE, N=2;

I can work around by setting theseed manually, but that should be fixed, or the manual adapted.
Thank you!

Bettina



Helmholtz-Zentrum Berlin für Materialien und Energie GmbH

Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.

Aufsichtsrat: Vorsitzender Dr. Volkmar Dietz, stv. Vorsitzende Dr. Jutta Koch-Unterseher
Geschäftsführung: Prof. Dr. Bernd Rech (Sprecher), Prof. Dr. Jan Lüning, Thomas Frederking

Sitz Berlin, AG Charlottenburg, 89 HRB 5583

Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
#!/bin/env python

import datetime
import sys
import math
import struct

def main(argv):
    fh = open('gen_seed.opal', 'w')
    now = datetime.datetime.now()

    timestamp = datetime.datetime.now().timestamp() * math.pow(10, 9)
    itimestamp = struct.unpack('!Q', struct.pack('!d', timestamp))[0]
    timestamp = datetime.datetime(now.year, now.month, now.day).timestamp() * math.pow(10, 9)
    itimestamp = itimestamp - struct.unpack('!Q', struct.pack('!d', timestamp))[0]
    sitimestamp = (itimestamp >> 25) << 25
    itimestamp = itimestamp - sitimestamp

    fh.write('REAL genseed = %d;\n' % itimestamp)

    fh.close()

if __name__ == "__main__":
    main(sys.argv[1:])

Attachment: gen_seed.opal
Description: Binary data




Archive powered by MHonArc 2.6.19.

Top of Page