Requesting comments on a script for Forcite dynamics run

Hi all,

I want to write a script to do the followings.

  1. unfix any fixed atoms
  2. translate atoms in a defined set
  3. fix atoms in a defined set
  4. run forcite dynamics and get the .xsd file as output
  5. write the forces of .xsd file to a study table
  6. repeat 1-5 on the final .xsd obtain from step 4

The following is the script i wrote to achieve the above objective. Can anyone please tell me whether this script serves my purpose? My doubt is whether the calculations is repeated on the correct .xsd file.

my \$xsdDoc = "SWNT";
my \$doc = \$Documents{"\$xsdDoc.xsd"};


# Create a study table to store the velocity components
my \$studyTable1 = Documents -> New("\$xsdDoc"."_ForceSet1.std");
my \$studyTable2 = Documents -> New("\$xsdDoc"."_ForceSet2.std");

# repetitive dynamics

my \$initialstep = 1;
my \$totalsteps = 50;

for (my \$stepcounter = \$initialstep; \$stepcounter<=\$totalsteps; ++\$stepcounter) {

# (1) defining sets in initial file
my \$sets1 = \$doc->UnitCell->Sets("set1");
my \$sets2 = \$doc->UnitCell->Sets("set2");
my \$atoms1 = \$sets1->Atoms;
my \$atoms2 = \$sets2->Atoms;

# (2) Unfixing atoms

unfixatoms(\$doc, "unfixedatoms");

# Inserted the subroutine "unfixatoms" written by Cartsen here

# (3) Move the molecule along the Z axis

\$atoms1->Translate(Point(X=>0, Y=>0, Z=>-0.025));
\$atoms2->Translate(Point(X=>0, Y=>0, Z=>0.025));
my @set;
push (@set, \$sets1);
push (@set, \$sets2);

# (4) Fixing atoms
  my \$doc = fixatoms(\$doc,"Output");

# Inserted the subroutine "fixatoms" written by Cartsen here

# (5) forcite change settings and dynamics run
my \$forcite = Modules->Forcite;
\$forcite->ChangeSettings(Settings(CurrentForcefield=>"COMPASS",Ensemble3D=>"NVT",Temperature=>1,Thermostat=>"Berendsen",
   TimeStep=>1,NumberOfSteps=>20000));
 

\$forcite->Dynamics->Run(\$doc,Settings(WriteForces => "Yes"));

#defining sets in current file
my \$sets1 = \$doc->UnitCell->Sets("set1");
my \$sets2 = \$doc->UnitCell->Sets("set2");
my \$atoms1 = \$sets1->Atoms;
my \$atoms2 = \$sets2->Atoms;


# (6) writing atom name and force to study table

my \$columnCounter = 0;
my \$atomCounter = 1;

foreach my \$atom (@\$atoms1) {
my \$label = \$atom -> ElementSymbol."\$atomCounter";

\$atom -> Name = "\$label"; 

\$studyTable1 -> ColumnHeading(\$columnCounter) = "\$label"."_FZ";

        ++ \$columnCounter;


++\$atomCounter;

my \$atomName = \$atom -> Name;
my \$column = "\$atomName"."_FZ";
\$studyTable1 -> Cell(\$stepcounter,"\$column") = \$atom -> Force -> Z;

}
}