Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Commit fa1204a

Browse files
authored
Merge pull request #50 from larsbratholm/qmldev
High level interface and neural network, thanks Lars and Silvia!
2 parents 2634aef + 17242b8 commit fa1204a

File tree

7,308 files changed

+9073
-447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,308 files changed

+9073
-447
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6+
# pytest
7+
.pytest_cache/
8+
69
# C extensions
710
*.so
811

@@ -61,6 +64,7 @@ instance/
6164
.scrapy
6265

6366
# Sphinx documentation
67+
docs/build/
6468
docs/_build/
6569

6670
# PyBuilder

.travis.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ install:
3232
if [ ${TRAVIS_PYTHON_VERSION:0:1} = 3 ]; then
3333
sudo apt-get install python3-numpy
3434
pip3 install scipy
35+
pip3 install ase
36+
pip3 install scikit-learn
37+
pip3 install tensorflow
3538
python3 setup.py build
3639
python3 setup.py install
3740
pip3 install sphinx
@@ -41,6 +44,9 @@ install:
4144
elif [ ${TRAVIS_PYTHON_VERSION} = "2.7" ]; then
4245
sudo apt-get install python-numpy
4346
pip2 install scipy
47+
pip2 install ase
48+
pip2 install scikit-learn
49+
pip2 install tensorflow
4450
python2 setup.py build
4551
python2 setup.py install
4652
pip2 install sphinx
@@ -53,10 +59,10 @@ install:
5359
5460
5561
before_script:
56-
- cd ${TRAVIS_BUILD_DIR}/tests/
62+
- cd ${TRAVIS_BUILD_DIR}/test/
5763

5864
script:
59-
- nosetests -v
65+
- pytest -v
6066

6167
notifications:
6268
email: false

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ QML is a Python2/3-compatible toolkit for representation learning of properties
55

66
#### Current list of contributors:
77
* Anders S. Christensen (University of Basel)
8+
* Lars A. Bratholm (University of Bristol)
9+
* Silvia Amabilino (University of Bristol)
810
* Felix A. Faber (University of Basel)
911
* Bing Huang (University of Basel)
10-
* Lars A. Bratholm (University of Copenhagen)
11-
* Alexandre Tkatchenko (University of Luxembourg)
12-
* Klaus-Robert Müller (Technische Universität Berlin/Korea University)
1312
* O. Anatole von Lilienfeld (University of Basel)
1413

1514
## 1) Citing QML:
1615

1716
Until the preprint is available from arXiv, please cite this GitHub repository as:
1817

19-
AS Christensen, LA Bratholm, FA Faber, B Huang, A Tkatchenko, KR Müller, OA von Lilienfeld (2017) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
18+
AS Christensen, LA Bratholm, S Amabilino, FA Faber, B Huang, GR Glowacki, OA von Lilienfeld (2018) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
2019

2120

2221
## 2) Get help:

README.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Current list of contributors:
1010
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1111

1212
- Anders S. Christensen (University of Basel)
13+
- Lars A. Bratholm (University of Bristol)
14+
- Silvia Amabilino (University of Bristol)
1315
- Felix A. Faber (University of Basel)
1416
- Bing Huang (University of Basel)
15-
- Lars A. Bratholm (University of Copenhagen)
16-
- Alexandre Tkatchenko (University of Luxembourg)
17-
- Klaus-Robert Müller (Technische Universität Berlin/Korea University)
17+
- David R. Glowacki (University of Bristol)
1818
- O. Anatole von Lilienfeld (University of Basel)
1919

2020
1) Citing QML:
@@ -25,7 +25,7 @@ repository as:
2525

2626
::
2727

28-
AS Christensen, LA Bratholm, FA Faber, B Huang, A Tkatchenko, KR Müller, OA von Lilienfeld (2017) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
28+
AS Christensen, LA Bratholm, S Amabilino, FA Faber, B Huang, GR Glowacki, OA von Lilienfeld (2018) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
2929

3030
2) Get help:
3131
------------

docs/source/citation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Until the preprint is available from arXiv, please cite use of QML as:
99

1010
::
1111

12-
AS Christensen, FA Faber, B Huang, LA Bratholm, A Tkatchenko, KR Müller, OA von Lilienfeld (2017) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
12+
AS Christensen, LA Bratholm, S Amabilino, FA Faber, B Huang, DR Glowacki, OA von Lilienfeld (2018) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
1313

1414

1515

docs/source/conf.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# add these directories to sys.path here. If the directory is relative to the
1717
# documentation root, use os.path.abspath to make it absolute, like shown here.
1818
#
19+
from __future__ import print_function
1920
import os
2021
import sys
21-
print os.getcwd()
22-
sys.path.insert(0, os.path.abspath('../../build/lib.linux-x86_64-2.7/'))
22+
print(os.getcwd())
23+
# sys.path.insert(0, os.path.abspath('../../build/lib.linux-x86_64-2.7/'))
2324
import sphinx_rtd_theme
2425

2526
# -- General configuration ------------------------------------------------
@@ -47,17 +48,17 @@
4748

4849
# General information about the project.
4950
project = u'QML'
50-
copyright = u'2017, Anders S. Christensen'
51+
copyright = u'2016-2018, Anders S. Christensen'
5152
author = u'Anders S. Christensen'
5253

5354
# The version info for the project you're documenting, acts as replacement for
5455
# |version| and |release|, also used in various other places throughout the
5556
# built documents.
5657
#
5758
# The short X.Y version.
58-
iversion = u'0.4.0'
59+
iversion = u'0.5.0.0'
5960
# The full version, including alpha/beta/rc tags.
60-
release = u'0.4.0'
61+
release = u'0.5.0.0'
6162

6263
# The language for content autogenerated by Sphinx. Refer to documentation
6364
# for a list of supported languages.

docs/source/examples.rst

+17-15
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ Generating representations using the ``Compound`` class
55
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66

77
The following example demonstrates how to generate a representation via
8-
the ``qml.Compound`` class.
8+
the ``qml.data.Compound`` class.
99

1010
.. code:: python
1111
12+
from qml.data import Compound
13+
1214
# Read in an xyz or cif file.
1315
water = Compound(xyz="water.xyz")
1416
@@ -31,7 +33,7 @@ Generating representations via the ``qml.representations`` module
3133
.. code:: python
3234
3335
import numpy as np
34-
from qml.representations import *
36+
from qml.ml.representations import *
3537
3638
# Dummy coordinates for a water molecule
3739
coordinates = np.array([[1.464, 0.707, 1.056],
@@ -86,7 +88,7 @@ The input for most of the kernels in QML is a numpy array, where the first dimen
8688
.. code:: python
8789
8890
import numpy as np
89-
from qml.kernels import gaussian_kernel
91+
from qml.ml.kernels import gaussian_kernel
9092
9193
# Generate a numpy-array of the representation
9294
X = np.array([c.representation for c in compounds])
@@ -106,7 +108,7 @@ The easiest way to calculate the kernel matrix using an explicit, local represen
106108
.. code:: python
107109
108110
import numpy as np
109-
from qml.kernels import get_local_kernels_gaussian
111+
from qml.ml.kernels import get_local_kernels_gaussian
110112
111113
# Assume the QM7 dataset is loaded into a list of Compound()
112114
for compound in qm7:
@@ -144,7 +146,7 @@ This input (the types of many-body terms) is generate via the ``get_slatm_mbtype
144146

145147
.. code:: python
146148
147-
from qml.representations import get_slatm_mbtypes
149+
from qml.ml.representations import get_slatm_mbtypes
148150
149151
# Assume 'qm7' is a list of Compound() objects.
150152
mbtypes = get_slatm_mbtypes([mol.nuclear_charges for compound in qm7])
@@ -155,11 +157,11 @@ This input (the types of many-body terms) is generate via the ``get_slatm_mbtype
155157
# Generate the desired representation for each compound
156158
compound.generate_slatm(mbtypes, local=True)
157159
158-
The ``local`` keyword in this example specifies that a local representation is produced. Alternatively the SLATM representation can be generate via the ``qml.representations`` module:
160+
The ``local`` keyword in this example specifies that a local representation is produced. Alternatively the SLATM representation can be generate via the ``qml.ml.representations`` module:
159161

160162
.. code:: python
161163
162-
from qml.representations import generate_slatm
164+
from qml.ml.representations import generate_slatm
163165
164166
# Dummy coordinates
165167
coordinates = ...
@@ -178,7 +180,7 @@ Here ``coordinates`` is an Nx3 numpy array, and ``nuclear_charges`` is simply a
178180
Generating the FCHL representation
179181
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180182
The FCHL representation does not have an explicit representation in the form of a vector, and the kernel elements must be calculated analytically in a separate kernel function.
181-
The syntax is analogous to the explicit representations (e.g. Coulomb matrix, BoB, SLATM, etc), but is handled by kernels from the separate ``qml.fchl`` module.
183+
The syntax is analogous to the explicit representations (e.g. Coulomb matrix, BoB, SLATM, etc), but is handled by kernels from the separate ``qml.ml.representations.fchl`` module.
182184

183185
The code below show three ways to create the input representations for the FHCL kernel functions.
184186

@@ -199,12 +201,12 @@ First using the ``Compound`` class:
199201
The dimensions of the array should be ``(number_molecules, size, 5, size)``, where ``size`` is the
200202
size keyword used when generating the representations.
201203

202-
In addition to using the ``Compound`` class to generate the representations, FCHL representations can also be generated via the ``qml.fchl.generate_fchl_representation()`` function, using similar notation to the functions in the ``qml.representations.*`` functions.
204+
In addition to using the ``Compound`` class to generate the representations, FCHL representations can also be generated via the ``qml.ml.representations.fchl.generate_fchl_representation()`` function, using similar notation to the functions in the ``qml.ml.representations.*`` functions.
203205

204206

205207
.. code:: python
206208
207-
from qml.fchl import generate_representation
209+
from qml.ml.representations.fchl import generate_representation
208210
209211
# Dummy coordinates for a water molecule
210212
coordinates = np.array([[1.464, 0.707, 1.056],
@@ -221,7 +223,7 @@ To create the representation for a crystal, the notation is as follows:
221223

222224
.. code:: python
223225
224-
from qml.fchl import generate_representation
226+
from qml.ml.representations.fchl import generate_representation
225227
226228
# Dummy fractional coordinates
227229
fractional_coordinates = np.array(
@@ -266,7 +268,7 @@ The following example demonstrates how to calculate the local FCHL kernel elemen
266268

267269
.. code:: python
268270
269-
from qml.fchl import get_local_kernels
271+
from qml.ml.representations.fchl import get_local_kernels
270272
271273
# You can get kernels for multiple kernel-widths
272274
sigmas = [2.5, 5.0, 10.0]
@@ -288,7 +290,7 @@ In case ``X1`` and ``X2`` are identical, K will be symmetrical. This is handled
288290

289291
.. code:: python
290292
291-
from qml.fchl import get_local_symmetric_kernels
293+
from qml.ml.representations.fchl import get_local_symmetric_kernels
292294
293295
# You can get kernels for multiple kernel-widths
294296
sigmas = [2.5, 5.0, 10.0]
@@ -307,8 +309,8 @@ In addition to the local kernel, the FCHL module also provides kernels for atomi
307309

308310
.. code:: python
309311
310-
from qml.fchl import get_atomic_kernels
311-
from qml.fchl import get_atomic_symmetric_kernels
312+
from qml.ml.representations.fchl import get_atomic_kernels
313+
from qml.ml.representations.fchl import get_atomic_symmetric_kernels
312314
313315
The only difference between the local and atomic kernels is the shape of the input.
314316
Since the atomic kernel outputs kernels with atomic resolution, the atomic input has the shape ``(number_atoms, 5, size)``.

docs/source/index.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ QML: A Python Toolkit for Quantum Machine Learning
99
==================================================
1010

1111
QML is a Python2/3-compatible toolkit for representation learning of
12-
properties of molecules and solids. QML is not a high-level framework
13-
where you can do ``model.train()``, but supplies the building blocks to
12+
properties of molecules and solids. QML supplies the the building blocks to
1413
carry out efficient and accurate machine learning on chemical compounds.
15-
As such, the goal is to provide usable and efficient implementations of
16-
concepts such as representations and kernels.
14+
The goal is to provide usable and efficient implementations of
15+
concepts such as representations and kernels as well as a high level interface
16+
to make it easy for computational chemists to use these for machine-learning tasks.
1717

1818

1919
Current list of contributors:
2020
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2121

2222
- Anders S. Christensen (University of Basel)
23+
- Lars A. Bratholm (University of Bristol)
24+
- Silvia Amabilino (University of Bristol)
2325
- Felix A. Faber (University of Basel)
2426
- Bing Huang (University of Basel)
25-
- Lars A. Bratholm (University of Copenhagen)
26-
- Alexandre Tkatchenko (University of Luxembourg)
27-
- Klaus-Robert Müller (Technische Universität Berlin/Korea University)
27+
- David R. Glowacki (University of Bristol)
2828
- O. Anatole von Lilienfeld (University of Basel)
2929

3030
Code development
@@ -48,7 +48,7 @@ Until the preprint is available from arXiv, please cite use of QML as:
4848

4949
::
5050

51-
AS Christensen, FA Faber, B Huang, LA Bratholm, A Tkatchenko, KR Müller, OA von Lilienfeld (2017) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
51+
AS Christensen, LA Bratholm, S Amabilino, FA Faber, B Huang, DR Glowacki, OA von Lilienfeld (2018) "QML: A Python Toolkit for Quantum Machine Learning" https://github.com/qmlcode/qml
5252

5353

5454
For citation of the individual procedures of QML, please see the "Citing use of QML" section.

docs/source/installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Installing prerequisite modules (for most Linux systems):
55

66
.. code:: bash
77
8-
sudo apt-get install python-pip gfortran libblas-dev liblapack-dev git
8+
sudo apt-get install python-pip gfortran libblas-dev liblapack-dev
99
1010
These should already be installed on most systems. The Intel compilers
1111
and MKL math-libraries are supported as well (see section 1.3).

docs/source/qml.rst

+15-7
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,39 @@ Python API documentation
88
qml\.representations module
99
---------------------------
1010

11-
.. automodule:: qml.representations
11+
.. automodule:: qml.ml.representations.representations
1212
:members:
1313
:undoc-members:
1414
:show-inheritance:
1515

1616
qml\.kernels module
1717
-------------------
1818

19-
.. automodule:: qml.kernels
19+
.. automodule:: qml.ml.kernels
2020
:members:
2121
:undoc-members:
2222
:show-inheritance:
2323

2424
qml\.distance module
2525
--------------------
2626

27-
.. automodule:: qml.distance
27+
.. automodule:: qml.ml.kernels.distance
2828
:members:
2929
:undoc-members:
3030
:show-inheritance:
3131

3232
qml\.math module
3333
----------------
3434

35-
.. automodule:: qml.math
35+
.. automodule:: qml.ml.math
3636
:members:
3737
:undoc-members:
3838
:show-inheritance:
3939

4040
qml\.Compound class
4141
--------------------
4242

43-
.. autoclass:: qml.Compound
43+
.. autoclass:: qml.data.compound.Compound
4444
:members:
4545
:undoc-members:
4646
:show-inheritance:
@@ -55,15 +55,15 @@ qml\.Compound class
5555
qml\.fchl module
5656
----------------
5757

58-
.. automodule:: qml.fchl
58+
.. automodule:: qml.ml.representations.fchl
5959
:members:
6060
:show-inheritance:
6161

6262

6363
qml\.wrappers module
6464
--------------------
6565

66-
.. automodule:: qml.wrappers
66+
.. automodule:: qml.ml.kernels.wrappers
6767
:members:
6868
:undoc-members:
6969
:show-inheritance:
@@ -85,3 +85,11 @@ qml\.wrappers module
8585
.. :undoc-members:
8686
.. :show-inheritance:
8787
88+
89+
qml\.aglaia module
90+
------------------
91+
92+
.. automodule:: qml.aglaia.aglaia
93+
:inherited-members:
94+
95+

0 commit comments

Comments
 (0)