Perl script

Hi MS Users,

I am trying to write a self crosslinking script.The Yellow atom is the reaction atom with the name R1.I want to put these two atoms in two variables (or an array) respectively.How should I write them?

Thanks in advance.


#!perl

use strict;
use Getopt::Long;
use MaterialsScript qw(:all);

my \\\$doc = \\\$Documents{"1.xsd"};
my \\\$atoms = \\\$doc->DisplayRange->Atoms;
my \\\$atom1;my \\\$atom2;my \\\$atom3;my \\\$atom4;my @atom;

foreach my \\\$atom(@\\\$atoms){

if (\\\$atom->Name eq "R1")
{ \\\$atom1 =\\\$atom;
foreach my \\\$atom_1(@\\\$atom1){
???
 
}
}  
}

Answers 1
FH
FH 2022-06-10 Best Answer

Hi, 

Have you looked at the cross-linking protocols in the Materials Studio collection (see tutorials on Pipeline Pilot connector) and do they work for you?

For more general reactions, Materials Studio 2022 (and future releases) contain a functionality called "Reaction Finder" that should really remove all the heavy lifting for this task. Two tutorials and examples are also provided in the Scripting Tutorial section. 

If none of these are helpful for you, then I can recommend to look through the scripting help as you want to form and break bonds. This can be achieved by the CreateBond function (see doc for full details) or by the Bond->Delete function if you have identified a suitable bond. 

Felix