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

  • The following types of modification are supported:
  • "AddAtom"add a disconnected atom
    "AddBond"add a bond, possibly with a new atom
    "AddHydrogens"convert any implicit hydrogens to explicit
    "AssignStereochemistryFromCoordinates"assign stereochemistry from 3D coordinates
    "Canonicalize"convert to a canonical form
    "ComputeAtomCoordinates"compute atom coordinates and store them in the molecule expression
    "DeleteAtom"delete an atom or list of atoms
    "DeleteBond"delete a bond or list of bonds
    "EnergyMinimizeAtomCoordinates"change the atomic coordinates to minimize the energy according to the Merck molecular force field (MMFF)
    "GenerateConformers"generate a list of molecules, each with different coordinates
    "Kekulize"convert aromatic bonds to localized single and double bonds
    "RemoveHydrogens"convert explicit hydrogens to implicit
    "RemoveStereochemistry"remove any defined stereochemistry
    "RenumberAtoms"renumber atoms
    "ReplaceAtom"replace an atom
    "ReplaceSubstructure"replace all occurrences of a substructure
    "ReplaceSubstructureList"replace each occurrences of a substructure and return a list
    "SetAromaticity"convert localized single and double bonds to aromatic
    "SetAtomChirality"set the chiral value for an atom to "R" or "S"
    "SetBondAngle"set the angle between three consecutively bonded atoms
    "SetBondLength"set the distance between two bonded atoms
    "SetBondStereo"set the stereo value for a double bond to "E" or "Z"
    "SetFormalCharge"set the formal charge for an atom
    "SetMassNumber"set the mass number for an atom
    "SetMetaInformation"set the molecule's metainformation
    "SetTorsionAngle"set the signed torsion angle for a group of four consecutively bonded atoms
    "SetUnpairedElectronCount"set the number of radical electrons for an atom
    "TransformAtomCoordinates"apply a transformation function to the atom coordinates
  • MoleculeModify["mod",specs][mol] is equivalent to MoleculeModify[mol,"mod",specs].
  • MoleculeModify[mol,{"AddAtom", "sym"}] will add an atom with the given atomic symbol (e.g. "C", "Cl").
  • For "AddAtom", spec should be an atom or list of atoms in 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[elemspec,"prop""val",]atom with specified properties
  • "AddAtom" will add a disconnected atom, with no bonds to the rest of the molecule.
  • For "AddBond", spec should be a bond or list of bonds in one of the following forms:
  • {id1,id1}a list of two atom indices, interpreted as a single bond
    Bond[{id1,id2},type]a bond of a specific type between two atoms
    Bond[{id1,atom},type]a bond between an atom with index id1 and a new atom represented by atom
  • For "DeleteAtom", spec should be an atom index or a list of atom indices.
  • For "DeleteBond", spec should be a Bond, a list of two bonded atom indices or a list of bonds.
  • For "EnergyMinimizeAtomCoordinates", it is possible to add a set of geometric constraints corresponding to additional terms in the MMFF force field. The constraints can be of the following forms:
  • {id1,id2}dspecify a distance between two atoms
    {id1,id2,id3}aspecify an angle among three atoms
    {id1,id2,id3,id4}aspecify a torsion angle among four atoms
  • "RenumberAtoms" takes a permutation of the atom indices {1,2,,n}, where n is the number of atoms as returned by AtomCount.
  • In "ReplaceAtom", spec should be a rule id->atom from an atom index to a new atom or a list of such rules.

Examples

open all close all

Basic Examples  (4)

Add a carbon atom to propane:

In[1]:=
Click for copyable input
Out[1]=

Add a bond between to the new atom:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Add a bond to turn hexane into cyclohexane:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Delete a bond to convert cyclohexane to hexane:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Replace all nitro groups in TNT with methyl groups:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Use "ReplaceSubstructureList" to replace one nitro group at a time:

In[3]:=
Click for copyable input
Out[3]=

Scope  (32)

Neat Examples  (1)

Introduced in 2019
(12.0)