If by embedding code you mean scripting, BIOVA/Materials Studio uses perl as its scripting language. For complex simulations and analysis, scripting is much more productive in Materials Studio than the GUI interface. There are few repositories on Github, heres a nice example https://github.com/stevemonaco/MatStudio-Workflows, that provide examples on how to script with Perl in the Materials Studio environment. Hope this helps.
Behrouz Bayati In the "New" drop-down list in the left of toolbar you can choose "Perl Scrip Document". Here you can write your own code and find link it to your simulation project. Here is an example of our recent article (Article Loading-Dependent Diffusion of SO2 in 13X and 5A Using Molec...
):
We performed an MD simulation and we wanted to know the xyz of diffusing molecule (so2) at each time step.
Perl Script for extracting trajectories from .xtd files:
#!perl
use strict;
use MaterialsScript qw(:all);
#xyz of trajectory
my $doc=$Documents{"5A32SO2.xtd"};
my $atoms=$doc->UnitCell->Sets("S")->Atoms;
my $forcite=Modules->Forcite;
my $numFrames=$doc->Trajectory->NumFrames;
my $atomnumber=1;
print "Number of frames $numFrames\n";
printf "Atom t x y z\n";
foreach my $atom(@$atoms)
{
for (my $counter=1;$counterTrajectory->CurrentFrame=$counter;