Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
53406ab
Update RMG example 1,3-hexadiene with multiplicity label
bbuesser Mar 14, 2014
8289805
Update RMG example c3h4 with multiplicity label
bbuesser Mar 14, 2014
5b6a2df
Update RMG example ch3no2 with multiplicity label
bbuesser Mar 14, 2014
b8149e4
Update RMG example diesel with multiplicity label
bbuesser Mar 14, 2014
709738a
Update RMG example e85 with multiplicity label
bbuesser Mar 14, 2014
e6cf8c2
Update RMG example liquid_phase with multiplicity label
bbuesser Mar 14, 2014
8c731b3
Update RMG example methylformate with multiplicity label
bbuesser Mar 14, 2014
0afcfbf
Update RMG example minimal with multiplicity label
bbuesser Mar 14, 2014
7a38633
Update RMG example minimal_sensitivity with multiplicity label
bbuesser Mar 14, 2014
fcf923d
Update RMG example TEOS with multiplicity label
bbuesser Mar 14, 2014
9c35037
Add multiplicity label to loadEntry for transport libraries
bbuesser Mar 14, 2014
c065bf1
Add multiplicity label to loadEntry for thermo libraries and groups
bbuesser Mar 14, 2014
28a6da5
Add multiplicity label to loadEntry for statmech depository
bbuesser Mar 14, 2014
8005b34
Add multiplicity label to class Entry and loadEntry for forbidden
bbuesser Mar 14, 2014
0f07e7f
Add multiplicity label to loadEntry for kinetics depository
bbuesser Mar 14, 2014
0df6ebb
Add multiplicity label to loadEntry for kinetic groups
bbuesser Mar 14, 2014
7887e4f
Add multiplicity label in loadEntry for kinetic libraries
bbuesser Mar 14, 2014
b499e18
Add multiplicity label to group.py
bbuesser Mar 14, 2014
684ad02
Add printMultiplicity=True to toAdjacencyList() in
bbuesser Mar 14, 2014
3287ea4
Add multiplicity label to molecule.py
bbuesser Mar 14, 2014
6bbea1c
Update to- and fromAdjacencyList() for multiplicity in Molecule instead
bbuesser Mar 14, 2014
ddc3984
Use new molecule.multiplicity attribute in qm.molecule
bbuesser Mar 14, 2014
dd1c69f
Add multiplicity to read input file
bbuesser Mar 14, 2014
50438a1
Add copy() to reaction.py to make deep copies of reaction objects
bbuesser Mar 14, 2014
4a90fdb
Add multiplicity attribute to Species.py
bbuesser Mar 14, 2014
d8423a2
Add species multiplicity model.py
bbuesser Mar 14, 2014
6328c8e
Update family.py for new species multiplicity and search for spin
bbuesser Mar 14, 2014
bb1557f
Change toAdjacencyList() to new adjacency list style
bbuesser Apr 25, 2014
7f40142
Add multiplicity label to saveEntry() for transport libraries.
bbuesser May 16, 2014
f0c6bec
Add multiplicity label to saveEntry() for thermo libraries.
bbuesser May 16, 2014
1da587d
Add multiplicity label to saveEntry() for forbiddenstructures.py
bbuesser May 16, 2014
d33a705
Replace strip() with split() to read adjacency lists in kinetics library
bbuesser May 16, 2014
b0d232d
Set printMultiplicity label in toAdjacencyList() explicitely to True
bbuesser May 16, 2014
8fa7f9b
Define type of maxMultiplicity in fromAdjacencyList()
bbuesser May 16, 2014
a33e38f
Prepare molecule.py for new adjacency list style
bbuesser May 16, 2014
7cae51e
Remove maxMultiplicity argument
bbuesser May 16, 2014
a92b48a
Modify adjlist.py to read and write the new-style adjacency list.
bbuesser May 16, 2014
e7853de
Updating examples with new adjacency list style
bbuesser May 16, 2014
cb0f65d
Updating existing unit tests for new adjacency list style
bbuesser May 19, 2014
f506f1d
Remove maxMultiplicity argument
bbuesser May 19, 2014
615eb1f
Updating existing unit test for new adjacency list style
bbuesser May 19, 2014
1a71723
Update fromRDKitMol() for the new adjacency list style
bbuesser May 19, 2014
2385182
Change treatment of missing lone pair card
bbuesser May 19, 2014
7283bba
Update existing unit test for new adjacency list style
bbuesser May 19, 2014
e8246b5
Prevent species generation from crashing if molecule is None and add
bbuesser May 19, 2014
38ace33
Update existing unit tests for the new adjacency list style
bbuesser May 19, 2014
d11eb3e
Add write multiplicity label to kinetics groups
bbuesser May 19, 2014
51aab8a
Add multiplicity and lone pairs to functions required for pickling
bbuesser May 20, 2014
69be300
Add additional unit test for handling the new adjacency list styles
bbuesser May 20, 2014
dd94ccd
Prevent species creation from crashing of molecule is an empty vector
bbuesser May 20, 2014
3fc6cd0
Add multiplicity to species unit test for pickling species
bbuesser May 20, 2014
bf1764a
Update the travis config file for unit tests on the new-style-adjacen…
rwest May 20, 2014
0818984
Update lone pairs and multiplicity for qm calculation before HBI
pierrelb May 27, 2014
80e3afe
Update lone pairs and multiplicity for solvation corrections
pierrelb May 27, 2014
00c6280
Only write multiplicity in adjacency lists, and store on Molecules.
rwest Jun 13, 2014
db6ea0f
Correct "special cases" for carbon monoxide SMILES strings.
rwest Jun 13, 2014
e3f08fe
Remove multiplicities from Species declarations in all examples files.
connie Jun 13, 2014
65e55e3
Don't bother printing default multiplicity values in toAdjacencyList
rwest Jun 13, 2014
960e188
fromAdjacencyList returns multiplicity even when reading groups.
rwest Jun 13, 2014
71ea9b8
Added fromOldAdjacencyList method.
rwest Jun 13, 2014
ea14c4f
Group.toAdjacencyList needs to pass multiplicity.
rwest Jun 13, 2014
7908b18
New adjlistTest.py to just test adjacency list functions.
rwest Jun 16, 2014
96a1f01
Splitting adjacency list tests into separate tests.
rwest Jun 16, 2014
fa8e2d4
Restore a test for reading old adjacency lists, with implicit H's
rwest Jun 16, 2014
d2eb873
Detect old style adjacency lists via regular expressions
rwest Jun 17, 2014
1abd314
Add unit tests for reading old style adjacency lists
rwest Jun 17, 2014
fe5b2e9
Migrate back to master RMG-database in travis build.
connie Jun 17, 2014
61a9ddb
Print multiplicity in adjacency lists of anything with a radical elec…
rwest Jun 17, 2014
156a317
fromOldAdjacencyList: reduce nesting of if statements
rwest Jun 18, 2014
cd2653c
fromOldAdjacencyList: reduce code duplication
rwest Jun 18, 2014
ecdce9d
Tweak some comments, docstrings, and debug logging.
rwest Jun 18, 2014
ff73c5a
fromAdjacencyList: make last-line sniffing safer
rwest Jun 18, 2014
647db07
fromOldAdjacencyList: stricter syntax checking of multiplicity line
rwest Jun 18, 2014
073e892
to/fromAdjacencyList: SYNTAX CHANGE: wildcard 'x' now includes 0.
rwest Jun 18, 2014
dda6f02
Tidy indentation in fromAdjacancyList
rwest Jun 18, 2014
261ef22
toAdjacencyList: rename internal variable to atomUnpairedElectrons
rwest Jun 18, 2014
8c2aa17
Molecule __init__ and __repr__ respect multiplicity.
rwest Jun 18, 2014
46234ab
fromOldAdjacencyList: condense radical list [2,2] into 2
rwest Jun 18, 2014
6b7c5c9
toAdjacencyList: multiplicity list printed without spaces.
rwest Jun 18, 2014
2080714
fromOldAdjacencyList: rename variable to lonePairsOfElectrons
rwest Jun 18, 2014
59171d2
fromOldAdjacencyList: blank lone pairs on group interpreted as undefi…
rwest Jun 18, 2014
11d0c76
Small tweak in Atom.isSpecificCaseOf; use list iterator instead of in…
rwest Jun 18, 2014
8905c83
TODO: lone pairs and charges are not compared when comparing Atoms or…
rwest Jun 18, 2014
82d3849
Adjacency list I/O for groups better for Lone Pairs
rwest Jun 18, 2014
4ad4eba
Changing the style of new adjacency list to use lowercase letters.
connie Jun 18, 2014
bdc9885
Change adjlists in example files to new lowercase style.
connie Jun 18, 2014
f8caed6
Update unit tests with lower case labels in adjacency lists
rwest Jun 19, 2014
c698a74
Switch from using {Cs,Cd} to [Cs,Cd] and u{0,1} to u[0,1] in Adjacenc…
rwest Jun 19, 2014
f791d3e
A first attempt to document the new adjacency list syntax.
rwest Jun 22, 2014
7ae437c
Add note about update to top of adjacency list documentation, and the…
rwest Jun 30, 2014
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ before_install:
# - sudo apt-get install python-rdkit librdkit-dev librdkit1 rdkit-data
- sudo apt-get install -qq python-numpy python-scipy python-matplotlib
- cd ..

- git clone https://github.com/GreenGroup/RMG-database.git
- git clone https://github.com/GreenGroup/PyDAS.git
- git clone https://github.com/GreenGroup/PyDQED.git
Expand Down
112 changes: 80 additions & 32 deletions documentation/source/reference/molecule/adjlist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Adjacency Lists

.. module:: rmgpy.molecule.adjlist


.. note::
The adjacency list syntax changed in July 2014.
The minimal requirement for most translations is to prefix the number
of unpaired electrons with the letter `u`.
The new syntax, however, allows much
greater flexibility, including definition of lone pairs, partial charges,
wildcards, and molecule multiplicities.

.. note::
To quickly visualize any adjacency list, or to generate an adjacency list from
other types of molecular representations such as SMILES, InChI, or even common
Expand All @@ -21,49 +30,100 @@ RMG -- but extended to allow for specification of extra semantic information.
The first line of most adjacency lists is a unique identifier for the molecule
or pattern the adjacency list represents. This is not strictly required, but
is recommended in most cases. Generally the identifier should only use
alphanumeric characters and the underscore, as if an identifer in many popular
alphanumeric characters and the underscore, as if an identifier in many popular
programming languages. However, strictly speaking any non-space ASCII character
is allowed.

After the identifier line, each subsequent line describes a single atom and its
The subsequent lines may contain keyword-value pairs. Currently there is only
one keyword, ``multiplicity``.

For species or molecule declarations, the value after ``multiplicity`` defines
the spin multiplicity of the molecule. E.g. ``multiplicity 1`` for most ground state
closed shell species, ``multiplicity 2`` for most radical species,
and ``multiplicity 3`` for a triplet biradical.
If the ``multiplicity`` line is not present then a value of
(1 + number of unpaired electrons) is assumed.
Thus, it can usually be omitted, but if present can be used to distinguish,
for example, singlet CH2 from triplet CH2.

If defining a Functional :class:`~rmgpy.molecule.Group`, then the value must be a list,
which defines the multiplicities that will be matched by the group, eg.
``multiplicity [1,2,3,4,5]`` or, for a single value, ``multiplicity [1]``.
If the multiplicity line is omitted, then ``multiplicity [1,2,3,4,5]`` is assumed.

After the identifier line and keyword-value lines,
each subsequent line describes a single atom and its
local bond structure. The format of these lines is a whitespace-delimited list
with tokens ::

<number> [<label>] <element> <radicals> <bondlist>
<number> [<label>] <element> u<unpaired> [p<pairs>] [c<charge>] <bondlist>

The first item is the number used to identify that atom. Any number may be used,
though it is recommended to number the atoms sequentially starting from one.
Next is an optional label used to tag that atom; this should be an
asterisk followed by a unique number for the label, e.g. ``*1``. After that is
the atom's element, indicated by its atomic symbol, followed by the number of
radical electrons on the atom. The last set of tokens is the list of bonds.
asterisk followed by a unique number for the label, e.g. ``*1``.
In some cases (e.g. thermodynamics groups) there is only one labeled atom, and the label
is just an asterisk with no number: ``*``.

After that is
the atom's element or atom type, indicated by its atomic symbol, followed by
a sequence of tokens describing the electronic state of the atom:

* ``u0`` number of **unpaired** electrons (eg. radicals)
* ``p0`` number of lone **pairs** of electrons, common on oxygen and nitrogen.
* ``c0`` formal **charge** on the atom, e.g. ``c-1`` (negatively charged),
``c0``, ``c+1`` (positively charged)

For :class:`~rmgpy.molecule.Molecule` definitions:
The value must be a single integer (and for charge must have a + or - sign if not equal to 0)
The number of unpaired electrons (i.e. radical electrons) is required, even if zero.
The number of lone pairs and the formal charge are assumed to be zero if omitted.

For :class:`~rmgpy.molecule.Group` definitions:
The value can be an integer or a list of integers (with signs, for charges),
eg. ``u[0,1,2]`` or ``c[0,+1,+2,+3,+4]``, or may be a wildcard ``x``
which matches any valid value,
eg. ``px`` is the same as ``p[0,1,2,3,4]`` and ``cx`` is the same as
``c[-4,-3,-2,-1,0,+1,+2,+3,+4]``. Lists must be enclosed is square brackets,
and separated by commas, without spaces.
If lone pairs or formal charges are omitted from a group definition,
the wildcard is assumed.


The last set of tokens is the list of bonds.
To indicate a bond, place the number of the atom at the other end of the bond
and the bond type within curly braces and separated by a comma, e.g. ``{2,S}``.
Multiple bonds to the same atom should be separated by whitespace.
Multiple bonds from the same atom should be separated by whitespace.

.. note::
You must take care to make sure each bond is listed on the lines of *both*
atoms in the bond, and that these entries have the same bond type. RMG will
raise an exception if it encounters such an invalid adjacency list.


When writing a molecular substructure pattern, you may specify multiple
elements, radical counts, and bond types as a comma-separated list inside curly
braces. For example, to specify any carbon or oxygen atom, use the syntax
``{C,O}``. Atom types may also be used as a shorthand. (Atom types can also be
elements, radical counts, and bond types as a comma-separated list inside square
brackets. For example, to specify any carbon or oxygen atom, use the syntax
``[C,O]``. For a single or double bond to atom 2, write ``{2,[S,D]}``.

Atom types such as ``R!H`` or ``Cdd`` may also be used as a shorthand. (Atom types
like ``Cdd`` can also be
used in full molecules, but this use is discouraged, as RMG can compute them
automatically for full molecules.)

Below is an example adjacency list, for 1,3-hexadiene, with the weakest bond in
the molecule labeled with ``*1`` and ``*2``. Note that hydrogen atoms
can be omitted if desired, as their presence is inferred::
can be omitted if desired, as their presence is inferred, provided that unpaired
electrons, lone pairs, and charges are all correctly defined::

HXD13
1 C 0 {2,D}
2 C 0 {1,D} {3,S}
3 C 0 {2,S} {4,D}
4 C 0 {3,D} {5,S}
5 *1 C 0 {4,S} {6,S}
6 *2 C 0 {5,S}
multiplicity 1
1 C u0 {2,D}
2 C u0 {1,D} {3,S}
3 C u0 {2,S} {4,D}
4 C u0 {3,D} {5,S}
5 *1 C u0 {4,S} {6,S}
6 *2 C u0 {5,S}

The allowed element types, radicals, and bonds are listed in the following table:

Expand All @@ -77,10 +137,10 @@ The allowed element types, radicals, and bonds are listed in the following table
| | H | Hydrogen atom |
| +----------+---------------------+
| | S | Sulfur atom |
+----------------------+----------+---------------------+
| Nonreactive Elements | N | Nitrogen atom |
| +----------+---------------------+
| | Si | Silicon atom |
| | N | Nitrogen atom |
+----------------------+----------+---------------------+
| Nonreactive Elements | Si | Silicon atom |
| +----------+---------------------+
| | Cl | Chlorine atom |
| +----------+---------------------+
Expand All @@ -89,18 +149,6 @@ The allowed element types, radicals, and bonds are listed in the following table
| | Ar | Argon atom |
| +----------+---------------------+
+----------------------+----------+---------------------+
| Free Electrons | 0 | Non-radical |
| +----------+---------------------+
| | 1 | Mono-radical |
| +----------+---------------------+
| | 2 | Bi-radical |
| +----------+---------------------+
| | 2T | Triplet |
| +----------+---------------------+
| | 2S | Singlet |
| +----------+---------------------+
| | 3 | Tri-radical |
+----------------------+----------+---------------------+
| Chemical Bond | S | Single Bond |
| +----------+---------------------+
| | D | Double Bond |
Expand Down
34 changes: 34 additions & 0 deletions documentation/source/users/rmg/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,37 @@
**************************
Frequently Asked Questions
**************************


Why can't my adjacency lists be read any more?
==============================================

The adjacency list syntax changed in July 2014.
The minimal requirement for most translations is to prefix the number
of unpaired electrons with the letter `u`.

Example old syntax::

HXD13
1 C 0 {2,D}
2 C 0 {1,D} {3,S}
3 C 0 {2,S} {4,D}
4 C 0 {3,D} {5,S}
5 *1 C 0 {4,S} {6,S}
6 *2 C 0 {5,S}

Example new syntax::

HXD13
1 C u0 {2,D}
2 C u0 {1,D} {3,S}
3 C u0 {2,S} {4,D}
4 C u0 {3,D} {5,S}
5 *1 C u0 {4,S} {6,S}
6 *2 C u0 {5,S}

The new syntax, however, allows much
greater flexibility, including definition of lone pairs, partial charges,
wildcards, and molecule multiplicities, and was necessary to allow us to
add Nitrogen chemistry.
See :ref:`rmgpy.molecule.adjlist` for details of the new syntax.
9 changes: 7 additions & 2 deletions examples/rmg/1,3-hexadiene/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
kineticsEstimator = 'rate rules',
)

# Constraints on generated species
generatedSpeciesConstraints(
maximumRadicalElectrons = 2,
)

# List of species
species(
label='HXD13',
Expand All @@ -24,8 +29,8 @@
reactive=True,
structure=adjacencyList(
"""
1 H 0 {2,S}
2 H 0 {1,S}
1 H u0 p0 {2,S}
2 H u0 p0 {1,S}
"""),
)
species(
Expand Down
4 changes: 4 additions & 0 deletions examples/rmg/c3h4/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
kineticsEstimator = 'rate rules',
)

generatedSpeciesConstraints(
maximumRadicalElectrons = 4,
)

# List of species
species(
label='CH2',
Expand Down
22 changes: 11 additions & 11 deletions examples/rmg/ch3no2/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
reactive=True,
structure=adjacencyList(
"""
1 C 0 0 {2,S} {3,S} {4,S} {5,S}
2 H 0 0 {1,S}
3 H 0 0 {1,S}
4 H 0 0 {1,S}
5 N 0 0 {1,S} {6,D} {7,S}
6 O 0 2 {5,D}
7 O 0 3 {5,S}
1 C u0 p0 {2,S} {3,S} {4,S} {5,S}
2 H u0 p0 {1,S}
3 H u0 p0 {1,S}
4 H u0 p0 {1,S}
5 N u0 p0 {1,S} {6,D} {7,S}
6 O u0 p2 {5,D}
7 O u0 p3 {5,S}
"""),
)

Expand All @@ -41,8 +41,8 @@
reactive=True,
structure=adjacencyList(
"""
1 O 1 2 {2,S}
2 O 1 2 {1,S}
1 O u1 p2 {2,S}
2 O u1 p2 {1,S}
"""),
)

Expand All @@ -51,8 +51,8 @@
reactive=True,
structure=adjacencyList(
"""
1 N 1 1 {2,T}
2 N 1 1 {1,T}
1 N u0 p1 {2,T}
2 N u0 p1 {1,T}
"""),
)

Expand Down
2 changes: 1 addition & 1 deletion examples/rmg/diesel/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
species(
label='O2',
reactive=True,
structure=SMILES("O=O"),
structure=SMILES("[O][O]"),
)

# Reaction systems
Expand Down
7 changes: 6 additions & 1 deletion examples/rmg/e85/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
kineticsEstimator = 'rate rules',
)

# Constraints on generated species
generatedSpeciesConstraints(
maximumRadicalElectrons = 2,
)

# List of species
species(
label='O2', # oxygen
reactive=True,
structure=SMILES("O=O"),
structure=SMILES("[O][O]"),
)
species(
label='C8H18i', # isooctane
Expand Down
5 changes: 5 additions & 0 deletions examples/rmg/liquid_phase/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
kineticsEstimator = 'rate rules',
)

# Constraints on generated species
generatedSpeciesConstraints(
maximumRadicalElectrons = 3,
)

# List of species
species(
label='octane',
Expand Down
7 changes: 4 additions & 3 deletions examples/rmg/methylformate/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
reactive=True,
structure=adjacencyList(
"""
1 C 3 {2,S}
2 H 0 {1,S}
1 C u3 p0 {2,S}
2 H u0 p0 {1,S}
"""),
)
species(
Expand All @@ -46,7 +46,7 @@
species(
label='CO',
reactive=True,
structure=SMILES("[C]=O"),
structure=SMILES("[C+]#[O-]"),
)
species(
label='CO2',
Expand Down Expand Up @@ -157,4 +157,5 @@
drawMolecules=False,
generatePlots=False,
saveConcentrationProfiles=False,
saveEdgeSpecies=True,
)
5 changes: 5 additions & 0 deletions examples/rmg/minimal_sensitivity/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
kineticsEstimator = 'rate rules',
)

# Constraints on generated species
generatedSpeciesConstraints(
maximumRadicalElectrons = 2,
)

# List of species
species(
label='ethane',
Expand Down
1 change: 0 additions & 1 deletion rmgpy/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,6 @@ def saveEntry(self, f, entry, name='entry'):

f.write('{0}(\n'.format(name))
f.write(' label = "{0}",\n'.format(entry.label))

if isinstance(entry.item, Molecule):
f.write(' molecule = \n')
f.write('"""\n')
Expand Down
Loading