espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo] [t_random]


From: Tristan Bereau
Subject: Re: [ESPResSo] [t_random]
Date: Thu, 15 Jul 2010 03:23:54 -0400
User-agent: SquirrelMail/1.5.2 [SVN]

Hi Mike,

Yes, it affects all rountines of the code that require random numbers. If
you use the same random number seed for two simulations with identical
initial conditions, the integration will be exactly the same at each step:
the langevin thermostat will call the same sequence of random numbers in
the same order, and so the entire trajectory will be the same. As Axel
pointed out, this is extremely useful when you're debugging.

Best,
Tristan

On Wed, July 14, 2010 3:00 pm, Mikheil Azatov wrote:
> Hi, will it ( t_random seed [pid] ) also affect the random force in
> Langevin
> thermostat?
>
> I noticed that when I had the same initial positions in the beginning,
> the final position of all the particles after simulating for a long time
> in langevin thermostat was the same.
>
> Mike
>
>
> On Wed, Jul 14, 2010 at 5:08 AM, Axel Arnold
> <address@hidden>wrote:
>
>
>> On Tuesday 13 July 2010 21:22:50 Owen Hickey wrote:
>>
>>> You need to sed the random number generator as while the numbers
>>> appear
>> to
>>> be random they are in fact deterministic so for one processor:
>>> t_random seed [expr abs([clock clicks]%100000)]
>>
>> Another good choice is
>>
>>
>> t_random seed [pid]
>>
>> which has the advantage, that if you for example batch-submit your jobs
>> and 4
>> start at the same time, with modern systems the chance are actually
>> quite good that several start in the same second, which means you  get
>> again the same seed. The process id pid however is always different.
>>
>> Finally, the tcl built-in RNG is always initialized from some "true"
>> random source, so that also works:
>>
>> t_random seed [expr int(rand(()*32768)]
>>
>>>
>>> or for 128 processors: set Seeds [list {}] set _ran [pid] for {set i 0}
>>> {$i<128} {incr i} {
>>> lappend Seeds {0} }
>>> for {set i 0} {$i<128} {incr i} { set _ran [expr ($_ran * 9301 + 49297)
>>> % 233280]
>>> set seed [expr int(1000000000 * ($_ran / double(233280)))] lset Seeds
>>> $i $seed
>>> }
>>>
>>>
>>> puts $Seeds
>>
>>> t_random seed [lindex $Seeds 0] [lindex $Seeds 1] [lindex $Seeds 2]
>> [lindex
>> ....
>>
>>> [lindex $Seeds 125] [lindex $Seeds 126] [lindex $Seeds 127]
>>>
>>
>> That can be done much easier:
>>
>>
>> set seed [pid] for {set i 0} {$i< [setmd n_nodes]} {incr i} { lappend
>> Seeds [expr $seed + $i]
>> }
>> eval t_random seed $Seeds
>>
>> This has the advantage that it works for any number of CPUs, and using
>> a simple linear sequence for the seeds works as good as using a
>> pseudo-random series.
>>
>> Finally, you should always save the seed somewhere. In case something
>> really unusual happens in your simulation that you want to investigate
>> further, you need exactly the same seed again to reproduce the
>> simulation.
>>
>> Cheers,
>> Axel
>> --
>> JP Dr. Axel Arnold Tel: +49 711 685 67609
>> ICP, Universität Stuttgart      Email: address@hidden
>> Pfaffenwaldring 27
>> 70569 Stuttgart, Germany
>>
>>
>>
>> _______________________________________________
>> ESPResSo mailing list
>> address@hidden
>> https://fias.uni-frankfurt.de/mailman/listinfo/espresso
>>
>>
> _______________________________________________
> ESPResSo mailing list
> address@hidden
> https://fias.uni-frankfurt.de/mailman/listinfo/espresso
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]