Hi,
I use this script to perform NPT run in forcite module, but I want to perform sequential three NPT runs.
For example, first NPT run should be at 600 K, and later the script should give the last configuration of trajectory.
Secondly, by taking this last configuration, it should perform second NPT run at 575 K and
finaly again taking the last frame of the second run, it should perform final NPT run at 550K.
Besides this, the script should give the all output of three runs.
In my script , it just does the first part, but I could not proceed it as a continuous process.
I'm reaaly in trouble, I tried different things, but they did not work. I will be very pleased if anybody can help me.
Thanks a lot.
Sadiye

Dear sadiye,
Is the simulation crashing due to an energy deviation or something like that? It probably has something to do with your dynamics settings and/or your input structure. Try a Forcite run using the same exact settings you have in the script. Once you clear up that issue you can do sequential runs like this:
#!perl
use strict;
use Getopt::Long;
use MaterialsScript qw(:all);
# Create a really simple system - a couple of waters
my $doc = Documents->New("simple.xsd");
$doc->CreateAtom("O",Point());
$doc->CreateAtom("O",Point(X=>3.0));
$doc->AdjustHydrogen;
# Geometry optimize
my $Forcite = Modules->Forcite;
$Forcite->ChangeSettings([WriteLevel=>"Silent"]);
$Forcite->GeometryOptimization->Run($doc);
# Dynamics
my $Dynamics = $Forcite->Dynamics;
# Step 1
my $results = $Dynamics->Run($doc,[Temperature=>2000]);
$results->Trajectory->Delete;
printf "Kinetic Energy %f\n", $doc->KineticEnergy;
# Step 2
my $results = $Dynamics->Run($doc,[Temperature=>500]);
$results->Trajectory->Delete;
printf "Kinetic Energy %f\n", $doc->KineticEnergy;
# Step 3
my $results = $Dynamics->Run($doc,[Temperature=>100]);
$results->Trajectory->Delete;
printf "Kinetic Energy %f\n", $doc->KineticEnergy;
Best,
/Jason
Dear Jason,
The simulation is not crashing due to any reason, it is correct, it run correctly and give the results. I just want to improve it, but I could not. As your script (which you gave as an example), I want to add extra three steps with different temperature, but after your run at 2000 K, the run in 500 K should start with the final configuration (.xsd) of the trajecyory (.xtd) of 2000K run. And again after your run at 500 K, the run in 100 K should start with the final configuration of the trajecyory of 500K run. I do not know how I can write a script that will define a different name of the last frame (.xsd) of the trajectory (.xtd) of 2000K run and by begining this last frame it will perform NPT run again at 500K.Thank you very much for your help.
Sadiye
Dear Sadiye,
I don't see why you cannot use the method I illustrated above. Note each time Forcite is applied to $doc, the coordinates and velocities in $doc are updated. These are the same values as in the last frame of $results->Trajectory.
Best,
/Jason
As Jason wrote, the $doc has the final coordinates in it at the end of each MD. If you want to create a new document and not overwrite the old you can try something like this
my $results = $Dynamics->Run($doc,[Temperature=>2000]);
my $base_name = $doc->Name;
my $doc2 = Documents->New($base_name . "2.xsd");
$doc2->CopyFrom($doc)
my $results2 = $Dynamics->Run($doc2,[Temperature=>1000]);
my $doc3 = Documents->New($base_name . "3.xsd");
$doc3->CopyFrom($doc2)
my $results3 = $Dynamics->Run($doc3,[Temperature=>500]);
This will leave you with 3 different structure and trajectory documents.
Thanks a lot, Jason and george,
As George explained, I do not want the program to overwrite the old one. I want ot see all output of my each run.
Again thank you very much.