Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85234762
random.pl
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 27, 17:07
Size
769 B
Mime Type
text/x-perl
Expires
Sun, Sep 29, 17:07 (2 d)
Engine
blob
Format
Raw Data
Handle
21144562
Attached To
rLAMMPS lammps
random.pl
View Options
#!/usr/bin/perl
#
This
script
can
be
used
to
generate
random
lists
of
particles
in
the
unit
#
box
0
<
x
<
1
,
0
<
y
<
1
,
0
<
z
<
1
,
that
can
be
used
as
test
input
to
voro++.
The
-
r
#
switch
adds
extra
radial
information
for
use
with
the
Voronoi
radical
#
tessellation
.
use
Getopt
::
Std
;
getopts
(
"hr:"
);
if
(
$
opt_h
)
{
print
"Usage: random.pl [switches] <number of particles> <filename>\n"
;
print
"Switches:\n"
;
print
"-h Print this information\n"
;
print
"-r <max radius> Add extra radial column\n"
;
exit
0
;
};
@
ARGV
==
2
or
die
"Exactly two command line arguments required\n"
;
open
A
,
">@ARGV[1]"
or
die
"Can't open output file"
;
foreach
(
1
..
@
ARGV
[
0
])
{
printf
A
"$_ %f %f %f"
,
rand
(),
rand
(),
rand
();
printf
A
" %f"
,
$
opt_r
*
rand
()
if
$
opt_r
;
printf
A
"\n"
;
}
Event Timeline
Log In to Comment