MoleculeModify
MoleculeModify[mol,"mod"]
gives a molecule or list of molecules derived from the molecule mol by applying the modification "mod".
MoleculeModify[mol,{"mod",specs}]
gives a molecule or list of molecules derived from the molecule mol by applying the modification "mod" with additional specifications specs.
MoleculeModify["mod"]
represents an operator form of MoleculeModify that can be applied to a molecule.
Details and Options
- Operations that modify the molecule's atom list:
-
{"AddAtom",atom} add a disconnected atom {"AddAtom",{atom1,atom2,…}} add a list of atoms {"DeleteAtom",a} delete the atom with index a {"DeleteAtom",{a1,a2,…}} delete the indicated atoms {"ReplaceAtom",aatom} replace the atom with index a with atom {"ReplaceAtom",{a1atom1,…}} replace atoms ai with atomi - atom should have one of the following forms:
-
"sym" atom with atomic symbol "sym" (e.g. "C", "Cl") Entity["Element",element] atom of a given element Entity["Isotope",isotope] atom of the specified isotope Atom["sym","prop"val,…] atom with specified properties - "AddAtom" will add a disconnected atom, with no bonds to the rest of the molecule. To add a new atom and bond together use "AddBond".
- "DeleteAtom" will remove any bonds to the atom in question.
- When removing or replacing an atom, the number of explicit hydrogen atoms may be adjusted to maintain proper valence. Disconnected hydrogen atoms will be removed. To disable this behavior, use the option ValenceErrorHandlingFalse.
- Implicit hydrogen atoms are added to the added atoms as normal. To disable implicit hydrogens, use "HydrogenCount"None in the new atom specification.
- Operations that modify atom properties:
-
{"SetFormalCharge",aval} set the formal charge of the atom with index a to val {"SetMassNumber",aval} set the mass number of the atom with index a to val {"SetUnpairedElectronCount",aval} set the number of radical electrons for the given atom - To change a property for multiple atoms, use a list of rules {a1val1,a2val2,…}.
- Operations that modify the molecule's bond list:
-
{"AddBond",{a1,a2}} add a single bond between atoms with indices a1 and a2 {"AddBond",Bond[{a1,a2},"type"]} add a bond of the given type between the given atoms {"AddBond",Bond[{a1,atom},type]} a bond between an atom with index a1 and a new atom represented by atom {"DeleteBond",{a1,a2}} remove the bond between the atoms with the given indices {"SetBondType",{a1,a2}"type"} set the bond type for the bond between atoms with indices a1 and a2 -
"SetAromaticity" convert localized single and double bonds to aromatic "Kekulize" convert aromatic bonds to localized single and double bonds {"RenumberAtoms",{a1,a2,…}} reorder the atoms list so that the atom with index ai appears at position i in the atoms list {"SetMetaInformation",meta} set the molecule's MetaInformation to meta, which should be an association or key-value pair "MakeHydrogensExplicit" convert any implicit hydrogens to explicit "MakeHydrogensImplicit" remove explicit hydrogen atoms when their presence can be inferred by normal valence rules - Information about a molecule's 3D arrangement, independent of the 3D geometry, is stored in the StereochemistryElements option value. The following operations modify the stereo elements:
-
"AssignStereochemistryFromCoordinates" assign tetrahedral and double bond stereochemistry elements from 3D coordinates "RemoveStereochemistry" remove any defined stereochemistry - To change the defined stereochemistry for an atom or bond, use one of the following operations:
-
{"SetAtomChirality",aval} set the chiral value for an atom to "R" or "S" {"SetBondStereo",{a1,a2}val} set the bond stereo value to either "E" or "Z" - Changing the stereo for an atom or bond will affect the 3D coordinates that are generated on demand. If the molecule contains 3D coordinates already, these are discarded when changing the stereochemistry.
-
{"ReplaceSubstructure",pattrepl} replace all occurrences of patt with repl {"ReplaceSubstructure",pattrepl,attchmts} replace patt with repl, using the specified attachment points between pattern and replacement {"ReplaceSubstructureList",pattrepl} replace each occurrence of patt with repl and return a list - Here repl should be a Molecule object or SMILES string, and patt can have one of the following forms:
-
MoleculePattern[…] a valid molecule pattern object {a1,a2,…} a list of atom indices constituting a connected substructure {{a1,a2,…},{b1,b2,…},…} a list of lists of atom indices, each of which will be replaced with repl - attchmts should be a list of rules {p1r1,…} from pattern atom index to replacement atom index. If no attachment points are provided, the first and last atoms from the pattern and replacement are matched.
- When a molecule is plotted in 3D or 2D, coordinates are taken from the AtomCoordinates and AtomDiagramCoordinates option values, respectively. If no coordinates are present in the molecule expression, they are generated automatically.
- The following operations will precompute the automatic coordinates and return a Molecule object containing them:
-
"ComputeAtomCoordinates" compute automatic 3D coordinates for the molecule {"ComputeAtomCoordinates",opts} compute atom coordinates using the options opts {"GenerateConformers",n} compute 3D coordinates n times with a different seed value and return a list of molecules "ComputeAtomDiagramCoordinates" compute 2D coordinates - "ComputeAtomCoordinates" will make all implicit hydrogens explicit in order to embed the molecule.
- "ComputeAtomCoordinates" takes the following options:
-
"Canonicalize" True whether to canonicalize the coordinates "EnergyMinimize" True whether to run a force-field minimization on the coordinates RandomSeeding 1234 how to seed randomness - "GenerateConformers" will return unminimized conformers by default.
- "ComputeAtomDiagramCoordinates" will make implicit those hydrogens attached to carbon, and make explicit those attached to a heteroatom, to match the default output of MoleculePlot. Use {"ComputeAtomDiagramCoordinates",IncludeHydrogensTrue} to include all atoms.
- To change the coordinates for a single atom, use:
-
{"SetAtomPosition",a{x,y,z}} set the position of the specified atom - To canonicalize atom coordinates without changing internal geometry, use:
-
"CanonicalizeAtomCoordinates" translate the molecule's center of mass to the origin and align the principal axes with the Cartesian axes - For general geometry transformations use the following:
-
{"TransformAtomCoordinates",tfun} apply the transformation function tfun to the coordinates - Here tfun should be a TransformationFunction object, e.g. TranslationTransform, ReflectionTransform, etc., or any arbitrary function that operates on and returns a QuantityArray object.
- The following operations modify the internal coordinates:
-
{"SetBondLength", {a1,a2}val} set the bond length between the specified atoms {"SetBondAngle", {a1,a2,a3}val} set the angle between the specified atoms {"SetTorsionAngle",{a1,a2,a3,a4}val} set the torsion angle for a group of four consecutively bonded atoms - These operations also support a list of length or angle changes, e.g. {{a1,a2}val1,…}.
- Here val should be a Quantity object or numeric. If numeric, the units are taken to be "Angstroms" or "AngularDegrees".
- For "SetBondLength", atoms a1 and a2 must be bonded and the bond between them should not be in a ring. All atoms connected to atom a2 are moved.
- For "SetBondAngle", atoms {a1,a2} and {a2,a3} should be bonded and both bonds should not be in rings. All atoms connected to atom a3 are moved.
- For "SetTorsionAngle", atoms {a1,a2}, {a2,a3} and {a3,a4} should be bonded, and bond {a2,a3} should not be in a ring. All atoms connected to atom a4 are moved.
- To minimize the coordinates with respect to the MMFF force field, use the following:
-
"EnergyMinimizeAtomCoordinates" minimize the total force-field energy {"EnergyMinimizeAtomCoordinates",ff} minimize the energy using the force field ff, one of "UFF", "MMFF94" or "MMFF94s" {"EnergyMinimizeAtomCoordinates",constraints} minimize the energy with the given constraints added to the force field - constraints should be a list of bond, angle or torsion constraints of the following forms:
-
{a1,a2}d specify a distance between two atoms {a1,a2,a3}θ specify an angle among three atoms {a1,a2,a3,a4}θ specify a torsion angle among four atoms <… > an association with keys "Atoms", "Value" and "ForceConstant"
Atom Modifications
Bond Modifications
General Modifications
Stereochemistry Modifications
Substructure Replacement
Generating Coordinates
Geometry Modifications
Examples
open allclose allBasic Examples (4)
Scope (37)
"AssignStereochemistryFromCoordinates" (1)
"CanonicalizeAtomCoordinates" (1)
Import a structure from an "XYZ" file and canonicalize the 3D coordinates:
After importing, compute the molecule's center of mass and principal axes:
"CanonicalizeAtomCoordinates" will translate the molecule, move the center of mass to the origin and rotate to align the principal axes with the Cartesian axes:
"ComputeAtomCoordinates" (2)
When a molecule is created from an identifier like a SMILES string or name, coordinates are not computed immediately:
Use "ComputeAtomCoordinates" to compute the coordinates and store them in the molecule expression:
Generate different conformations using the RandomSeeding option:
The resulting molecules have different conformational energy:
"ComputeAtomDiagramCoordinates" (2)
When a molecule is visualized in 2D using MoleculePlot, hydrogen atoms attached to carbon atoms are hidden by default. Only the hydroxyl hydrogen is shown by default in octanol:
"ComputeAtomDiagramCoordinates" will remove those hydrogens that are not shown, and make explicit those that are shown:
The coordinates are now stored in the molecule expression:
As there is only one hydrogen shown by default, the returned molecule has one explicit hydrogen:
The coordinates match exactly those used in a molecule plot:
Compute the atom diagram coordinates showing the default hydrogens, all hydrogens or none:
"DeleteAtom" (2)
Convert hexanol to hexane using "DeleteAtom":
Find an Entity to match:
When an atom is deleted, any hydrogens attached to it are also removed, and unfilled valences on heavy atoms are filled by implicit hydrogens. Use ValenceErrorHandling->False to disable this behavior and leave unpaired electrons instead:
"EnergyMinimizeAtomCoordinates" (1)
Import a structure from an "XYZ" file and use the MMFF force field to minimize the energy:
"GenerateConformers" (1)
It is often desirable to have a set of conformations for a molecule, for example, to sample a larger portion of the energy landscape. Generate 100 conformers for cyclohexane:
The conformers will have a large energy spread:
After minimizing the conformations using a force field, they fall into two groups energetically:
These groupings correspond to the so-called "chair" and "twist-boat" conformations, which are global and local minima on the potential energy surface, respectively. Select one conformer from each group and plot in 3D:
"RemoveStereochemistry" (1)
"ReplaceAtom" (1)
"ReplaceSubstructure" (1)
"SetBondAngle" (3)
"SetBondType" (1)
"SetMassNumber" (1)
Label the C-2 of mevalonolactone with 13C by setting the mass number to 13:
Use AtomList to find the labeled carbon:
Label the 5-pro-S hydrogen of mevalonolactone with deuterium by setting the mass number to 2:
"SetMetaInformation" (1)
"SetTorsionAngle" (1)
"TransformAtomCoordinates" (2)
Create a copy of a molecule with the coordinates translated in space:
Create a molecule's enantiomer using ReflectionTransform:
Neat Examples (1)
Add distance constraints to the MMFF force field to find a conformation with a given distance between two atoms. First, create the base molecule:
Find the two atoms that are farthest away in the standard configuration:
The default conformation has these two atoms 32 ångströms apart:
Use "EnergyMinimizeAtomCoordinates" to find new conformations with specific separations for these atoms:
Verify that the returned geometries match the requirement and get the force field energies:
Text
Wolfram Research (2019), MoleculeModify, Wolfram Language function, https://reference.wolfram.com/language/ref/MoleculeModify.html (updated 2020).
CMS
Wolfram Language. 2019. "MoleculeModify." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/MoleculeModify.html.
APA
Wolfram Language. (2019). MoleculeModify. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MoleculeModify.html