MOL2 (.mol2)

Background & Context

    • 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 & Export

  • Import["file.mol2"] imports a list of molecules from a MOL2 file.
  • Export["file.mol2",expr] exports a molecule or list of molecules to a MOL2 file.
  • 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",mol] creates a MOL2 file by treating mol as a Molecule.
  • 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.

Import Elements

  • 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
  • Data elements:
  • "Molecule"a symbolic representation of the molecule model
    "Molecule", nsymbolic representation of the n^(th) molecule
  • 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
  • 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 angstroms
    "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 molecule:

Show the Import elements available in a MOL2 file:

This gives a list of atoms that constitute a molecule:

Import the molecule and render it as a structure diagram:

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

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

Introduced in 2008
Updated in 2019