FFV calculation

Dear all

The following is a script to calculate FFV in a amorphous cell in .xsd file. However, after molecular dynamics simulation (NVT or NPT) a .xtd file including many frames will be generated. I want calculate

FFV of all frames in the .xtd. But I am a newer to MS and I am poor at writing Perl script programs, so i don't konw how to modify this script. Could anyone give me a hand.

#!perl

use strict;

use MaterialsScript qw(:all);


my \$newStudyTable = Documents->New("KAUST-PI-1-M01_FFV.std");

my \$calcSheet = \$newStudyTable->ActiveSheet;

\$calcSheet->ColumnHeading(0) = "Occupied Volume";

\$calcSheet->ColumnHeading(1) = "Free Space";

\$calcSheet->ColumnHeading(2) = "vdw Volume";

\$calcSheet->ColumnHeading(3) = "Total Cell Volume";

\$calcSheet->ColumnHeading(4) = "FFV";

\$calcSheet->ColumnHeading(5) = "Density";


my \$Doc = \$Documents{"KAUST1-PI-1-M01_0000ps.xsd"} ;

my \$avField = \$Doc->CalculateSolventField (Settings(GridInterval => 0.15));

\$avField->VDWScaling = 1;

\$avField->IsVisible = "YES";

my \$ISO = \$avField->CreateIsosurface([IsoValue => 0, HasFlippedNormals => "NO"]);

my \$OccV = \$ISO->EnclosedVolume ;

\$calcSheet->Cell(0, 0) = \$OccV ;

\$calcSheet->Cell(0, 1) = \$Doc->Lattice3D->CellVolume - \$OccV ;

\$calcSheet->Cell(0, 2) = 1.3 * \$OccV ;

\$calcSheet->Cell(0, 3) = \$Doc->Lattice3D->CellVolume ;

\$calcSheet->Cell(0, 4) = ((\$Doc->Lattice3D->CellVolume)-(1.3 * \$OccV))/(\$Doc->Lattice3D->CellVolume) ;

\$calcSheet->Cell(0, 5) = \$Doc->SymmetrySystem->Density ;

\$avField->Delete;