– you have earned Featured Contributor Badge ![]()
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
This is very cool. Can you please expand on the example? What would one use these selected atoms - or molecule patterns - for?
What would one use these selected atoms - or molecule patterns - for?
Basically anytime you want to modify a molecule you have to refer to atoms by their atom index - their position in the atoms list. In this example from the MoleculeModify documentation the goal is to remove a hydroxyl group from a molecule, turning hexanol into hexane. To call the "DeleteAtom" function you need to know which atom to delete. You can find it programmatically with FindMoleculeSubstructure or interactively with AtomSelector.
There are also cases where there are multiple atoms that would match a pattern and you only want the position of one of them. Take the two nonequivalent chlorine atoms in 2,4-dichlorotoluene, and delete just one of them:
AtomSelector[Molecule["2,4-dichlorotoluene"], Dynamic[selection]]
In[30]:= MoleculeName[
MoleculeModify[
Molecule["2,4-dichlorotoluene"], {"DeleteAtom", selection}]]
Out[30]= "1-chloro-4-methylbenzene"
