Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions doc/source/universe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,34 @@ For example, to construct a universe with 6 atoms in 2 residues:
`See this notebook tutorial for more information. <examples/constructing_universe.ipynb>`_


Constructing from SMILES
------------------------

Thanks to the interoperability with RDKit, a Universe can be constructed from a SMILES string with :meth:`Universe.from_smiles<MDAnalysis.core.universe.Universe.from_smiles>`. Since the SMILES string usually contains information about heavy atoms only, this method automatically adds the appropriate number of hydrogens on all atoms, by setting :code:`addHs=True`. It is also possible to generate coordinates with :code:`generate_coordinates=True`. This will allow RDKit to generate one or more conformers for the given molecule. For example, setting :code:`numConfs=10` will generate 10 conformers, and each conformer will be read as a frame by the Universe.

Here is a minimal example to create a Universe from one conformer of ethanol:

.. ipython:: python

u = mda.Universe.from_smiles("CCO")
u
u.trajectory

Internally, calling the :meth:`Universe.from_smiles<MDAnalysis.core.universe.Universe.from_smiles>` method does the following:

.. ipython:: python

from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.MolFromSmiles("CCO") # ethanol
mol = Chem.AddHs(mol)
confids = AllChem.EmbedMultipleConfs(mol, numConfs=1) # 1 conformer
u = mda.Universe(mol, format="RDKIT")
u
u.trajectory


Guessing topology attributes
----------------------------

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
- sphinxcontrib-bibtex<2.0.0
- sphinx_rtd_theme
- tabulate
- rdkit
- pip:
- msmb_theme==1.2.0
- sphinx-sitemap==1.0.2
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ sphinx-rtd-theme==0.4.3
sphinx-sitemap==1.0.2
tabulate==0.8.5
pybtex==0.22.2
plotly==4.5.1
plotly==4.5.1
rdkit==2020.03.3