Hi All,
I have a simulation and I want to find the relative shift of an atom (in comparison to the starting position) as the simulation progresses. I was wondering if there is a method to either generate a plot or directly visualize (probably an arrow that shows the displacement with respect to starting position, & also showing the amount of displacement) in the Material Studio.
Thanks.
cheers,
Nitin

Hi Nitin,
Although it is not really meant for it, you can use the mean squre displacement analysis in Forcite. Follow these steps:
Alternatively you could use a PositionAnchor and Distance Monitor like so:
my $doc = $Documents{"Argon.xtd"};
my $atom = $doc->AsymmetricUnit->Sets(0)->Atoms(0);
my $anchor = $doc->CreatePositionAnchor($atom->XYZ);
my $distance = $doc->CreateDistance([$atom, $anchor]);
$doc->Trajectory->CurrentFrame = 1;
for (my $i=1; $i<=$doc->Trajectory->NumFrames; $i++)
{
$doc->Trajectory->CurrentFrame = $i;
my $d = $distance->Distance;
printf "Frame= %d, Distance= %f\n", $i, $d;
}
Best,
/Jason
Thanks for you reply Jason.
I tried running the perl script, but i get the following error:
The index value 1 is out of range (function/property "Sets") at -e line 7.
The line 7 refers to line 2 in your reply above. I also wanted to know what does 0 mean in this line? Also, what does "AsymmetricUnit" refer to?
These questions could be lame, but I am new to scripting in MS.
Thanks.
best,
nitin
Nitin,
You have to create a Set for the atom you want to track. Then run the script. AsymmetricUnit is explained in the Help and is necessary if you have a periodic system. It filters out periodic images.
/Jason
There is already a script on the Community to look at diffusive pathways for atoms and molecules. This might be of use to you.
Cheers
Stephen
Hi Nitin,
Building on from Jason and Stephen, you could visualize the pathway by a chain of distance monitors connected by anchors, like so (click to animate)
I attach the script that I used with the example trajectory of a molecule in a zeolite.
Reinier
The script in attachment was very usefull for me.
But I tried to modify it for my project.
I want to track displacements of a set which is assigned to an atom.
#!perl
use strict;
use MaterialsScript qw(:all);
my $xtd = $Documents{"Project.xtd"};
my $trj = $xtd->Trajectory;
my $xsd = Documents->New($xtd->Name.".xsd");
my $atoms = $xtd->UnitCell->Sets ("atom-1");
foreach my $atom (@$atoms)
{
print $atom->Name ."\n";
my $color = RGB(int(rand()*256), int(rand()*256), int(rand()*256));
my $anchor1;
for (my $i=0; $i<$trj->NumFrames; $i++)
{
$trj->CurrentFrame = $i+1; # Note +1 as frames indexed from 1
my $anchor2 = $xsd->CreatePositionAnchor($atom->Center);
$anchor2->Style = "Dot";
$anchor2->Color = $color;
if($anchor1)
{
my $distance = $xsd->CreateDistance([$anchor1,$anchor2]);
$distance->IsLabeledMeasurement = "No";
$distance->Color = $color;
}
$anchor1 = $anchor2;
}
}
But the script are not successfully completed and it has an error:
There is no function or property named "Center" on type "Object" at -e line 19.
I know it is for centroid of molecule. But I have no idea to fix this problem. Can you help me?
Thanks in advance
Behnam
To get the position of an atom, use XYZ rather than Center, i.e.
my $anchor2 = $xsd->CreatePositionAnchor($atom->XYZ);
Another problem might be that
my $atoms = $xtd->UnitCell->Sets ("atom-1");
foreach my $atom (@$atoms)
has the effect of looping over the set content, which might include objects that aren’t atoms (e.g. bonds). It would be better to filter for atoms first,
my $atoms = $xtd->UnitCell->Sets ("atom-1")->Atoms;
If the atom has a unique name you could also directly filter UnitCell without using a set.
Regards,
Reinier
Thanks a lot. I applied your suggested corrections. It is workig very well.
Best
Behnam