File: sum.pl

package info (click to toggle)
voro%2B%2B 0.4.6%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,372 kB
  • sloc: cpp: 6,384; perl: 232; makefile: 164
file content (14 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
# This script will take a .vol file created by voro++, and it will sum up the
# volumes of all the Voronoi cells. In many cases, this will equal the volume
# of the container, and it can be a useful check.
#
# It assumes that the volume is stored in the final column, so it works with
# both regular and polydisperse calculations.

open A,"@ARGV[0]" or die "Can't open input file";
while(<A>) {
	@A=split;
	$c+=pop @A;
}
print "$c\n";