Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77052015
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
Mon, Aug 12, 01:29
Size
769 B
Mime Type
text/x-perl
Expires
Wed, Aug 14, 01:29 (2 d)
Engine
blob
Format
Raw Data
Handle
19757227
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