MOL2 (.mol2)


    MIME type: chemical/x-mol2Tripos MOL2 molecule model files.
    Used in cheminformatics applications and on the web for storing and exchanging 3D molecule models.
    Native format of the SYBYL cheminformatics application.
    Plain text tabular format.
    Represents a single chemical compound or multiple chemical compounds.
    Stores atomic coordinates, chemical bond information, and metadata.

Import and Export

  • Import["file.mol2"] imports a list of molecule models or structure diagrams from a MOL2 file.
  • Export["file.mol2",expr] exports elements of molecule models to a MOL2 file.
  • Import["file.mol2"] gives a list of Graphics3D objects when reading 3D molecule models, and vector graphics when importing a planar representation of molecules.
  • Import["file.mol2",elem] imports the specified element from a MOL2 file.
  • Import["file.mol2",{elem,suba,subb,}] imports a subelement.
  • Import["file.mol2",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","MOL2"] or Import["file",{"MOL2",elem,}].
  • Export["file.mol2",expr,elem] creates a MOL2 file by treating expr as specifying element elem.
  • Export["file.mol2",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.mol2",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.mol2",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the MOL2 format.


  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Graphics elements:
  • "Graphics3D"3D renderings of all molecule models stored in the file
    "Graphics3D", n3D renderings of the n^(th) molecule
    "StructureDiagram"2D structure formula of all molecule models
  • Import by default uses the "Graphics3D" element if the file represents a 3D model and "StructureDiagram" for planar compounds.
  • Data representation elements:
  • "EdgeRules"connectivity data, given as a list of lists of rules
    "EdgeTypes"bond types, given as a list of lists of strings
    "VertexCoordinates"atomic coordinates, typically given in picometers
    "VertexTypes"all atoms or groups constituting the molecule, typically given as a list of chemical element abbreviations
    "PartialCharges"electric charges of the atoms given as a list of reals
    "Residues"residue sequences, given as a list of lists of three-letter abbreviations
    "Sequence"residue sequences, given as a list of strings
    "ResidueAtoms"list of lists of residue atoms
    "ResidueCoordinates"3D coordinates of residue atoms
    "ResidueCharges"charges of the atoms given by "ResidueAtoms"
  • Export["file.mol2",{vert,coord},{{"ResidueAtoms","ResidueCoordinates"}}] creates a MOL2 file from a specification of atom types and their 2D or 3D coordinates.


  • General Import options:
  • ImageSizeAutomaticspecifies the overall size of the graphics to display
    BackgroundWhitespecifies what background color to use
    ViewPointAutomaticpoint in space from which the 3D model is to be viewed
  • With the default setting "ViewPoint"->Automatic, the Wolfram Language automatically calculates the optimal viewing angle for the imported molecule geometry.
  • Select a 3D rendering style:
  • "Rendering""BallAndStick"specifies the visualization method
  • Possible settings for "Rendering" are:
  • "BallAndStick"displays atoms and bonds as a ball-and-stick model
    "Spacefilling"atoms shown as overlapping spheres
    "Wireframe"bonds rendered as lines


Basic Examples  (2)

Import a MOL2 file as a three-dimensional ball-and-stick model:

Click for copyable input

Show the Import elements available in a MOL2 file:

Click for copyable input

This gives a list of atoms that constitute a molecule:

Click for copyable input
Click for copyable input

Import the molecule and render it as a structure diagram:

Click for copyable input

This gives the residue atom types and their 3D coordinates for all molecules in this file:

Click for copyable input

This creates a MOL2 file from the previous output (the default value for the residue name is "Unk"; the default atom charge is 0):

Click for copyable input

See Also

"FASTA"  "GenBank"  "MMCIF"  "MOL"  "PDB"  "SDF"  "SMILES"  "XYZ"

Introduced in 2008