variable with random integer or input from a file

Hi ,

I am wondering is there a way to assign a random integer value to a
variable repetitively on the fly.

variable command doesnt allow me to read from a file or to generate
some random integers.

what i am trying to do is something like this even-though group and
set commands doesnt accept variables ;
{
variable variable equal (an integer)
group group id v_variable
set atom v_variable type N
}

then put this into a loop, while checking no same integer is generated.

Best Regards
Murat

Hi ,

I am wondering is there a way to assign a random integer value to a
variable repetitively on the fly.

there are the random() and round() functions for equal style variables.

variable command doesnt allow me to read from a file or to generate
some random integers.

what i am trying to do is something like this even-though group and
set commands doesnt accept variables ;

they do accept variables. but differently.

{
variable variable equal (an integer)
group group id v_variable
set atom v_variable type N
}

then put this into a loop, while checking no same integer is generated.

sorry, but this looks very strange and like you are trying
to do something that has more problems than just computing
some random integer number.

as a general guideline. if you want to get help, your chances
will improve _massively_ if you don't just quote some random
lines from your input scripts, some speculations, some out-of-context
statements that are difficult to interpret and particularly only
explain one piece of the "mechanics" of what you are doing
rather than what your "goal" is and how you are trying to
achieve it.

if you provide a fully working input or an easy way to generate
eone (it can be one of a toy system or a modification of the
example inputs shipped with lammps), then it will be easier
to reproduce it and suggest modifications.

similarly, there are always multiple approaches to complex
problems. some are simple, some are convoluted, some
cannot work. but if you don't explain what your goal is, it
will be impossible to suggest an alternative.

cheers,
     axel.

To add to Axel's comment, you could use the round()
function in a variable around the random() function and
get a random integer, each time the variable is evaluated.

Steve

Hi
I have tried this
variable t1 equal round(random(x,y,z))

but it didnt worked , so i used something like this instead

variable v1 equal random(x,y,z)
variable v2 equal round(v_v1)
which seems working

but i didnt get how to use variables in set and group commands

best regards
Murat

Hi,

Going back to Doc file for variable command i realize that both set
and group commands actually accept variables.

set atom ${abc} type N
works perfect

Thnx
Murat