Skip to content

Commit cf4b9bc

Browse files
authored
Directory structure (qmlcode#71)
* Reverts to old directory structure * Fix authors in several __init__ files that are updated
1 parent 6b777fe commit cf4b9bc

Some content is hidden

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

48 files changed

+146
-163
lines changed

docs/source/qml.rst

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

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

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

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

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

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

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

35-
.. automodule:: qml.ml.math
35+
.. automodule:: qml.math
3636
:members:
3737
:undoc-members:
3838
:show-inheritance:
@@ -55,15 +55,15 @@ qml\.Compound class
5555
qml\.fchl module
5656
----------------
5757

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

6262

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

66-
.. automodule:: qml.ml.kernels.wrappers
66+
.. automodule:: qml.kernels.wrappers
6767
:members:
6868
:undoc-members:
6969
:show-inheritance:

docs/source/qml_examples/examples.ipynb

+14-14
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"outputs": [],
7474
"source": [
7575
"import numpy as np\n",
76-
"from qml.ml.representations import *\n",
76+
"from qml.representations import *\n",
7777
"\n",
7878
"# Dummy coordinates for a water molecule\n",
7979
"coordinates = np.array([[1.464, 0.707, 1.056],\n",
@@ -121,7 +121,7 @@
121121
"outputs": [],
122122
"source": [
123123
"import numpy as np\n",
124-
"from qml.ml.kernels import gaussian_kernel\n",
124+
"from qml.kernels import gaussian_kernel\n",
125125
"\n",
126126
"# Generate a numpy-array of the representation\n",
127127
"X = np.array([c.representation for c in compounds])\n",
@@ -149,7 +149,7 @@
149149
"outputs": [],
150150
"source": [
151151
"import numpy as np\n",
152-
"from qml.ml.kernels import get_local_kernels_gaussian\n",
152+
"from qml.kernels import get_local_kernels_gaussian\n",
153153
"\n",
154154
"# Assume the QM7 dataset is loaded into a list of Compound()\n",
155155
"for compound in qm7:\n",
@@ -195,7 +195,7 @@
195195
"metadata": {},
196196
"outputs": [],
197197
"source": [
198-
"from qml.ml.representations import get_slatm_mbtypes\n",
198+
"from qml.representations import get_slatm_mbtypes\n",
199199
"\n",
200200
"# Assume 'qm7' is a list of Compound() objects.\n",
201201
"mbtypes = get_slatm_mbtypes([mol.nuclear_charges for compound in qm7])\n",
@@ -211,7 +211,7 @@
211211
"cell_type": "markdown",
212212
"metadata": {},
213213
"source": [
214-
"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:"
214+
"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:"
215215
]
216216
},
217217
{
@@ -220,7 +220,7 @@
220220
"metadata": {},
221221
"outputs": [],
222222
"source": [
223-
"from qml.ml.representations import generate_slatm\n",
223+
"from qml.representations import generate_slatm\n",
224224
"\n",
225225
"# Dummy coordinates\n",
226226
"coordinates = ... \n",
@@ -249,7 +249,7 @@
249249
"## Generating the FCHL representation\n",
250250
"\n",
251251
"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.\n",
252-
"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.\n",
252+
"The syntax is analogous to the explicit representations (e.g. Coulomb matrix, BoB, SLATM, etc), but is handled by kernels from the separate ``qml.representations.fchl`` module.\n",
253253
"\n",
254254
"The code below show three ways to create the input representations for the FHCL kernel functions.\n",
255255
"\n",
@@ -279,7 +279,7 @@
279279
"The dimensions of the array should be ``(number_molecules, size, 5, size)``, where ``size`` is the\n",
280280
"size keyword used when generating the representations. \n",
281281
"\n",
282-
"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."
282+
"In addition to using the ``Compound`` class to generate the representations, FCHL representations can also be generated via the ``qml.representations.fchl.generate_fchl_representation()`` function, using similar notation to the functions in the ``qml.representations.*`` functions."
283283
]
284284
},
285285
{
@@ -288,7 +288,7 @@
288288
"metadata": {},
289289
"outputs": [],
290290
"source": [
291-
"from qml.ml.representations.fchl import generate_representation \n",
291+
"from qml.representations.fchl import generate_representation \n",
292292
"\n",
293293
"# Dummy coordinates for a water molecule\n",
294294
"coordinates = np.array([[1.464, 0.707, 1.056],\n",
@@ -314,7 +314,7 @@
314314
"metadata": {},
315315
"outputs": [],
316316
"source": [
317-
"from qml.ml.representations.fchl import generate_representation \n",
317+
"from qml.representations.fchl import generate_representation \n",
318318
"\n",
319319
"# Dummy fractional coordinates\n",
320320
"fractional_coordinates = np.array(\n",
@@ -372,7 +372,7 @@
372372
"metadata": {},
373373
"outputs": [],
374374
"source": [
375-
"from qml.ml.representations.fchl import get_local_kernels\n",
375+
"from qml.representations.fchl import get_local_kernels\n",
376376
"\n",
377377
"# You can get kernels for multiple kernel-widths\n",
378378
"sigmas = [2.5, 5.0, 10.0]\n",
@@ -396,7 +396,7 @@
396396
"metadata": {},
397397
"outputs": [],
398398
"source": [
399-
"from qml.ml.representations.fchl import get_local_symmetric_kernels\n",
399+
"from qml.representations.fchl import get_local_symmetric_kernels\n",
400400
"\n",
401401
"# You can get kernels for multiple kernel-widths\n",
402402
"sigmas = [2.5, 5.0, 10.0]\n",
@@ -420,8 +420,8 @@
420420
"metadata": {},
421421
"outputs": [],
422422
"source": [
423-
"from qml.ml.representations.fchl import get_atomic_kernels\n",
424-
"from qml.ml.representations.fchl import get_atomic_symmetric_kernels"
423+
"from qml.representations.fchl import get_atomic_kernels\n",
424+
"from qml.representations.fchl import get_atomic_symmetric_kernels"
425425
]
426426
},
427427
{

docs/source/tutorial.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ If you run the code below, you will read in the file ``qm7/0001.xyz`` (a methane
3939
import qml
4040
4141
# Create the compound object mol from the file qm7/0001.xyz which happens to be methane
42-
mol = qml.ml.Compound(xyz="qm7/0001.xyz")
42+
mol = qml.Compound(xyz="qm7/0001.xyz")
4343
4444
# Generate and print a Coulomb matrix for compound with 5 atoms
4545
mol.generate_coulomb_matrix(size=5, sorting="row-norm")
@@ -80,7 +80,7 @@ In order to save time you can import the entire QM7 dataset as ``Compound`` obje
8080
# Import QM7, already parsed to QML
8181
from tutorial_data import compounds
8282
83-
from qml.ml.kernels import gaussian_kernel
83+
from qml.kernels import gaussian_kernel
8484
8585
# For every compound generate a Coulomb matrix or BoB
8686
for mol in compounds:
@@ -114,7 +114,7 @@ With the kernel matrix and representations sorted out in the previous two exerci
114114
:math:`\boldsymbol{\alpha} = (\mathbf{K} + \lambda \mathbf{I})^{-1} \mathbf{y}\label{eq:inv}`
115115

116116
One of the most efficient ways of solving this equation is using a Cholesky-decomposition.
117-
QML includes a function named ``cho_solve()`` to do this via the math module ``qml.ml.math``.
117+
QML includes a function named ``cho_solve()`` to do this via the math module ``qml.math``.
118118
In this step it is convenient to only use a subset of the full dataset as training data (see below).
119119
The following builds on the code from the previous step.
120120
To save time, you can import the PBE0/def2-TZVP atomization energies for the QM7 dataset from the file ``tutorial_data.py``.
@@ -123,7 +123,7 @@ Extend your code from the previous step with the code below:
123123

124124
.. code:: python
125125
126-
from qml.ml.math import cho_solve
126+
from qml.math import cho_solve
127127
from tutorial_data import energy_pbe0
128128
129129
# Assign first 1000 molecules to the training set

qml/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@
3333
from __future__ import absolute_import
3434

3535
from . import data
36-
from . import ml
3736
from . import models
3837
from . import aglaia
38+
from . import math
39+
from . import kernels
40+
from . import arad
41+
from . import fchl
42+
from . import representations
3943

4044
__author__ = "Anders S. Christensen"
4145
__copyright__ = "Copyright 2016"

qml/aglaia/aglaia.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040

4141
try:
4242
from qml.data import Compound
43-
from qml.ml import representations as qml_rep
44-
except ModuleNotFoundError:
45-
raise ModuleNotFoundError("The module qml is required")
43+
from qml import representations as qml_rep
44+
except ImportError:
45+
raise ImportError("The module qml is required")
4646

4747
try:
4848
import tensorflow
49-
except ModuleNotFoundError:
50-
raise ModuleNotFoundError("Tensorflow 1.8 is required to run neural networks.")
49+
except ImportError:
50+
raise ImportError("Tensorflow 1.8 is required to run neural networks.")
5151

5252
class _NN(BaseEstimator):
5353

qml/ml/arad/__init__.py qml/arad/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen and Felix A. Faber
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
File renamed without changes.
File renamed without changes.

qml/data/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

qml/data/compound.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
import numpy as np
2626
import collections
2727

28-
from ..ml.representations.alchemy import NUCLEAR_CHARGE
28+
from ..representations.alchemy import NUCLEAR_CHARGE
2929

30-
from ..ml.representations import generate_coulomb_matrix
31-
from ..ml.representations import generate_atomic_coulomb_matrix
32-
from ..ml.representations import generate_bob
33-
from ..ml.representations import generate_eigenvalue_coulomb_matrix
34-
from ..ml.representations import generate_slatm
30+
from ..representations import generate_coulomb_matrix
31+
from ..representations import generate_atomic_coulomb_matrix
32+
from ..representations import generate_bob
33+
from ..representations import generate_eigenvalue_coulomb_matrix
34+
from ..representations import generate_slatm
3535

36-
from ..ml.representations.fchl import generate_representation as generate_fchl_representation
36+
from ..fchl import generate_representation as generate_fchl_representation
3737

38-
from ..ml.representations.facsf import fgenerate_acsf, fgenerate_acsf_and_gradients
38+
from ..representations.facsf import fgenerate_acsf, fgenerate_acsf_and_gradients
3939

4040
class Compound(object):
4141
""" The ``Compound`` class is used to store data from

qml/data/dataprovider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

qml/data/xyzdataprovider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

qml/fchl/__init__.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2017 Anders S. Christensen and Felix A. Faber
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
from .fchl import *

qml/ml/representations/fchl.py qml/fchl/fchl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from .ffchl_module import fget_atomic_kernels_fchl
3131
from .ffchl_module import fget_atomic_symmetric_kernels_fchl
3232

33-
from .alchemy import get_alchemy
33+
from ..representations.alchemy import get_alchemy
3434

3535
def generate_representation(coordinates, nuclear_charges,
3636
max_size=23, neighbors=23, cut_distance = 5.0, cell=None):
File renamed without changes.

qml/ml/kernels/__init__.py qml/kernels/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

qml/ml/math/__init__.py qml/math/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
File renamed without changes.
File renamed without changes.

qml/ml/__init__.py

-26
This file was deleted.

qml/models/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela
3+
# Copyright (c) 2017 Anders S. Christensen
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal

qml/models/kernelridge.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
import ase
3030

31-
from ..ml.representations import generate_coulomb_matrix
32-
from ..ml.kernels import gaussian_kernel
33-
from ..ml.math import cho_solve
31+
from ..representations import generate_coulomb_matrix
32+
from ..kernels import gaussian_kernel
33+
from ..math import cho_solve
3434
from .mlmodel import MLModel
3535

3636
class GenericKRR(MLModel):

0 commit comments

Comments
 (0)