diff --git a/docs/source/qml.rst b/docs/source/qml.rst index e25a0e2d5..a24f9ff36 100644 --- a/docs/source/qml.rst +++ b/docs/source/qml.rst @@ -8,7 +8,7 @@ Python API documentation qml\.representations module --------------------------- -.. automodule:: qml.ml.representations.representations +.. automodule:: qml.representations :members: :undoc-members: :show-inheritance: @@ -16,7 +16,7 @@ qml\.representations module qml\.kernels module ------------------- -.. automodule:: qml.ml.kernels +.. automodule:: qml.kernels :members: :undoc-members: :show-inheritance: @@ -24,7 +24,7 @@ qml\.kernels module qml\.distance module -------------------- -.. automodule:: qml.ml.kernels.distance +.. automodule:: qml.kernels.distance :members: :undoc-members: :show-inheritance: @@ -32,7 +32,7 @@ qml\.distance module qml\.math module ---------------- -.. automodule:: qml.ml.math +.. automodule:: qml.math :members: :undoc-members: :show-inheritance: @@ -55,7 +55,7 @@ qml\.Compound class qml\.fchl module ---------------- -.. automodule:: qml.ml.representations.fchl +.. automodule:: qml.representations.fchl :members: :show-inheritance: @@ -63,7 +63,7 @@ qml\.fchl module qml\.wrappers module -------------------- -.. automodule:: qml.ml.kernels.wrappers +.. automodule:: qml.kernels.wrappers :members: :undoc-members: :show-inheritance: diff --git a/docs/source/qml_examples/examples.ipynb b/docs/source/qml_examples/examples.ipynb index 66e728230..caad1725f 100644 --- a/docs/source/qml_examples/examples.ipynb +++ b/docs/source/qml_examples/examples.ipynb @@ -73,7 +73,7 @@ "outputs": [], "source": [ "import numpy as np\n", - "from qml.ml.representations import *\n", + "from qml.representations import *\n", "\n", "# Dummy coordinates for a water molecule\n", "coordinates = np.array([[1.464, 0.707, 1.056],\n", @@ -121,7 +121,7 @@ "outputs": [], "source": [ "import numpy as np\n", - "from qml.ml.kernels import gaussian_kernel\n", + "from qml.kernels import gaussian_kernel\n", "\n", "# Generate a numpy-array of the representation\n", "X = np.array([c.representation for c in compounds])\n", @@ -149,7 +149,7 @@ "outputs": [], "source": [ "import numpy as np\n", - "from qml.ml.kernels import get_local_kernels_gaussian\n", + "from qml.kernels import get_local_kernels_gaussian\n", "\n", "# Assume the QM7 dataset is loaded into a list of Compound()\n", "for compound in qm7:\n", @@ -195,7 +195,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations import get_slatm_mbtypes\n", + "from qml.representations import get_slatm_mbtypes\n", "\n", "# Assume 'qm7' is a list of Compound() objects.\n", "mbtypes = get_slatm_mbtypes([mol.nuclear_charges for compound in qm7])\n", @@ -211,7 +211,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "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:" + "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:" ] }, { @@ -220,7 +220,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations import generate_slatm\n", + "from qml.representations import generate_slatm\n", "\n", "# Dummy coordinates\n", "coordinates = ... \n", @@ -249,7 +249,7 @@ "## Generating the FCHL representation\n", "\n", "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", - "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", + "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", "\n", "The code below show three ways to create the input representations for the FHCL kernel functions.\n", "\n", @@ -279,7 +279,7 @@ "The dimensions of the array should be ``(number_molecules, size, 5, size)``, where ``size`` is the\n", "size keyword used when generating the representations. \n", "\n", - "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." + "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." ] }, { @@ -288,7 +288,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations.fchl import generate_representation \n", + "from qml.representations.fchl import generate_representation \n", "\n", "# Dummy coordinates for a water molecule\n", "coordinates = np.array([[1.464, 0.707, 1.056],\n", @@ -314,7 +314,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations.fchl import generate_representation \n", + "from qml.representations.fchl import generate_representation \n", "\n", "# Dummy fractional coordinates\n", "fractional_coordinates = np.array(\n", @@ -372,7 +372,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations.fchl import get_local_kernels\n", + "from qml.representations.fchl import get_local_kernels\n", "\n", "# You can get kernels for multiple kernel-widths\n", "sigmas = [2.5, 5.0, 10.0]\n", @@ -396,7 +396,7 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations.fchl import get_local_symmetric_kernels\n", + "from qml.representations.fchl import get_local_symmetric_kernels\n", "\n", "# You can get kernels for multiple kernel-widths\n", "sigmas = [2.5, 5.0, 10.0]\n", @@ -420,8 +420,8 @@ "metadata": {}, "outputs": [], "source": [ - "from qml.ml.representations.fchl import get_atomic_kernels\n", - "from qml.ml.representations.fchl import get_atomic_symmetric_kernels" + "from qml.representations.fchl import get_atomic_kernels\n", + "from qml.representations.fchl import get_atomic_symmetric_kernels" ] }, { diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index c1ab31cdb..30ac10bdf 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -39,7 +39,7 @@ If you run the code below, you will read in the file ``qm7/0001.xyz`` (a methane import qml # Create the compound object mol from the file qm7/0001.xyz which happens to be methane - mol = qml.ml.Compound(xyz="qm7/0001.xyz") + mol = qml.Compound(xyz="qm7/0001.xyz") # Generate and print a Coulomb matrix for compound with 5 atoms 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 # Import QM7, already parsed to QML from tutorial_data import compounds - from qml.ml.kernels import gaussian_kernel + from qml.kernels import gaussian_kernel # For every compound generate a Coulomb matrix or BoB for mol in compounds: @@ -114,7 +114,7 @@ With the kernel matrix and representations sorted out in the previous two exerci :math:`\boldsymbol{\alpha} = (\mathbf{K} + \lambda \mathbf{I})^{-1} \mathbf{y}\label{eq:inv}` One of the most efficient ways of solving this equation is using a Cholesky-decomposition. -QML includes a function named ``cho_solve()`` to do this via the math module ``qml.ml.math``. +QML includes a function named ``cho_solve()`` to do this via the math module ``qml.math``. In this step it is convenient to only use a subset of the full dataset as training data (see below). The following builds on the code from the previous step. 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: .. code:: python - from qml.ml.math import cho_solve + from qml.math import cho_solve from tutorial_data import energy_pbe0 # Assign first 1000 molecules to the training set diff --git a/qml/__init__.py b/qml/__init__.py index 6e902c35d..1d98cf687 100644 --- a/qml/__init__.py +++ b/qml/__init__.py @@ -33,9 +33,13 @@ from __future__ import absolute_import from . import data -from . import ml from . import models from . import aglaia +from . import math +from . import kernels +from . import arad +from . import fchl +from . import representations __author__ = "Anders S. Christensen" __copyright__ = "Copyright 2016" diff --git a/qml/aglaia/aglaia.py b/qml/aglaia/aglaia.py index e3b114ad7..c174ce286 100644 --- a/qml/aglaia/aglaia.py +++ b/qml/aglaia/aglaia.py @@ -40,14 +40,14 @@ try: from qml.data import Compound - from qml.ml import representations as qml_rep -except ModuleNotFoundError: - raise ModuleNotFoundError("The module qml is required") + from qml import representations as qml_rep +except ImportError: + raise ImportError("The module qml is required") try: import tensorflow -except ModuleNotFoundError: - raise ModuleNotFoundError("Tensorflow 1.8 is required to run neural networks.") +except ImportError: + raise ImportError("Tensorflow 1.8 is required to run neural networks.") class _NN(BaseEstimator): diff --git a/qml/ml/arad/__init__.py b/qml/arad/__init__.py similarity index 93% rename from qml/ml/arad/__init__.py rename to qml/arad/__init__.py index 6bfb1cbab..804256594 100644 --- a/qml/ml/arad/__init__.py +++ b/qml/arad/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen and Felix A. Faber # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/ml/arad/arad.py b/qml/arad/arad.py similarity index 100% rename from qml/ml/arad/arad.py rename to qml/arad/arad.py diff --git a/qml/ml/arad/farad_kernels.f90 b/qml/arad/farad_kernels.f90 similarity index 100% rename from qml/ml/arad/farad_kernels.f90 rename to qml/arad/farad_kernels.f90 diff --git a/qml/data/__init__.py b/qml/data/__init__.py index fb70a3ae2..c7a9bb4df 100644 --- a/qml/data/__init__.py +++ b/qml/data/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/data/compound.py b/qml/data/compound.py index fad0937b1..64c612c02 100644 --- a/qml/data/compound.py +++ b/qml/data/compound.py @@ -25,17 +25,17 @@ import numpy as np import collections -from ..ml.representations.alchemy import NUCLEAR_CHARGE +from ..representations.alchemy import NUCLEAR_CHARGE -from ..ml.representations import generate_coulomb_matrix -from ..ml.representations import generate_atomic_coulomb_matrix -from ..ml.representations import generate_bob -from ..ml.representations import generate_eigenvalue_coulomb_matrix -from ..ml.representations import generate_slatm +from ..representations import generate_coulomb_matrix +from ..representations import generate_atomic_coulomb_matrix +from ..representations import generate_bob +from ..representations import generate_eigenvalue_coulomb_matrix +from ..representations import generate_slatm -from ..ml.representations.fchl import generate_representation as generate_fchl_representation +from ..fchl import generate_representation as generate_fchl_representation -from ..ml.representations.facsf import fgenerate_acsf, fgenerate_acsf_and_gradients +from ..representations.facsf import fgenerate_acsf, fgenerate_acsf_and_gradients class Compound(object): """ The ``Compound`` class is used to store data from diff --git a/qml/data/dataprovider.py b/qml/data/dataprovider.py index 53fa92c8f..72b8e0345 100644 --- a/qml/data/dataprovider.py +++ b/qml/data/dataprovider.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/data/xyzdataprovider.py b/qml/data/xyzdataprovider.py index f0eca2a9f..2ee4adc2b 100644 --- a/qml/data/xyzdataprovider.py +++ b/qml/data/xyzdataprovider.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/fchl/__init__.py b/qml/fchl/__init__.py new file mode 100644 index 000000000..f8ed9ea85 --- /dev/null +++ b/qml/fchl/__init__.py @@ -0,0 +1,23 @@ +# MIT License +# +# Copyright (c) 2017 Anders S. Christensen and Felix A. Faber +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from .fchl import * diff --git a/qml/ml/representations/fchl.py b/qml/fchl/fchl.py similarity index 99% rename from qml/ml/representations/fchl.py rename to qml/fchl/fchl.py index 7c1c3f18c..d3e0aa587 100644 --- a/qml/ml/representations/fchl.py +++ b/qml/fchl/fchl.py @@ -30,7 +30,7 @@ from .ffchl_module import fget_atomic_kernels_fchl from .ffchl_module import fget_atomic_symmetric_kernels_fchl -from .alchemy import get_alchemy +from ..representations.alchemy import get_alchemy def generate_representation(coordinates, nuclear_charges, max_size=23, neighbors=23, cut_distance = 5.0, cell=None): diff --git a/qml/ml/representations/ffchl_module.f90 b/qml/fchl/ffchl_module.f90 similarity index 100% rename from qml/ml/representations/ffchl_module.f90 rename to qml/fchl/ffchl_module.f90 diff --git a/qml/ml/representations/ffchl_scalar_kernels.f90 b/qml/fchl/ffchl_scalar_kernels.f90 similarity index 100% rename from qml/ml/representations/ffchl_scalar_kernels.f90 rename to qml/fchl/ffchl_scalar_kernels.f90 diff --git a/qml/ml/kernels/__init__.py b/qml/kernels/__init__.py similarity index 93% rename from qml/ml/kernels/__init__.py rename to qml/kernels/__init__.py index 964e6e25c..d30a02794 100644 --- a/qml/ml/kernels/__init__.py +++ b/qml/kernels/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/ml/kernels/distance.py b/qml/kernels/distance.py similarity index 100% rename from qml/ml/kernels/distance.py rename to qml/kernels/distance.py diff --git a/qml/ml/kernels/fdistance.f90 b/qml/kernels/fdistance.f90 similarity index 100% rename from qml/ml/kernels/fdistance.f90 rename to qml/kernels/fdistance.f90 diff --git a/qml/ml/kernels/fkernels.f90 b/qml/kernels/fkernels.f90 similarity index 100% rename from qml/ml/kernels/fkernels.f90 rename to qml/kernels/fkernels.f90 diff --git a/qml/ml/kernels/kernels.py b/qml/kernels/kernels.py similarity index 100% rename from qml/ml/kernels/kernels.py rename to qml/kernels/kernels.py diff --git a/qml/ml/kernels/wrappers.py b/qml/kernels/wrappers.py similarity index 100% rename from qml/ml/kernels/wrappers.py rename to qml/kernels/wrappers.py diff --git a/qml/ml/math/__init__.py b/qml/math/__init__.py similarity index 93% rename from qml/ml/math/__init__.py rename to qml/math/__init__.py index 2e637b6ef..95d898280 100644 --- a/qml/ml/math/__init__.py +++ b/qml/math/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/ml/math/fsolvers.f90 b/qml/math/fsolvers.f90 similarity index 100% rename from qml/ml/math/fsolvers.f90 rename to qml/math/fsolvers.f90 diff --git a/qml/ml/math/math.py b/qml/math/math.py similarity index 100% rename from qml/ml/math/math.py rename to qml/math/math.py diff --git a/qml/ml/__init__.py b/qml/ml/__init__.py deleted file mode 100644 index 936088b10..000000000 --- a/qml/ml/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# MIT License -# -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from . import math -from . import kernels -from . import arad -from . import representations diff --git a/qml/models/__init__.py b/qml/models/__init__.py index e375525cb..c8aadcb2f 100644 --- a/qml/models/__init__.py +++ b/qml/models/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/models/kernelridge.py b/qml/models/kernelridge.py index 9097241dd..47fab8c79 100644 --- a/qml/models/kernelridge.py +++ b/qml/models/kernelridge.py @@ -28,9 +28,9 @@ import ase -from ..ml.representations import generate_coulomb_matrix -from ..ml.kernels import gaussian_kernel -from ..ml.math import cho_solve +from ..representations import generate_coulomb_matrix +from ..kernels import gaussian_kernel +from ..math import cho_solve from .mlmodel import MLModel class GenericKRR(MLModel): diff --git a/qml/models/mlmodel.py b/qml/models/mlmodel.py index 2241a7a43..cd63b96a2 100644 --- a/qml/models/mlmodel.py +++ b/qml/models/mlmodel.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/ml/representations/__init__.py b/qml/representations/__init__.py similarity index 93% rename from qml/ml/representations/__init__.py rename to qml/representations/__init__.py index 78c5e05e6..3f85ad95f 100644 --- a/qml/ml/representations/__init__.py +++ b/qml/representations/__init__.py @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017 Anders S. Christensen, Kristof T. Schutt, Stefan Chmiela +# Copyright (c) 2017 Anders S. Christensen # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/qml/ml/representations/alchemy.py b/qml/representations/alchemy.py similarity index 100% rename from qml/ml/representations/alchemy.py rename to qml/representations/alchemy.py diff --git a/qml/ml/representations/facsf.f90 b/qml/representations/facsf.f90 similarity index 100% rename from qml/ml/representations/facsf.f90 rename to qml/representations/facsf.f90 diff --git a/qml/ml/representations/frepresentations.f90 b/qml/representations/frepresentations.f90 similarity index 100% rename from qml/ml/representations/frepresentations.f90 rename to qml/representations/frepresentations.f90 diff --git a/qml/ml/representations/fslatm.f90 b/qml/representations/fslatm.f90 similarity index 100% rename from qml/ml/representations/fslatm.f90 rename to qml/representations/fslatm.f90 diff --git a/qml/ml/representations/representations.py b/qml/representations/representations.py similarity index 100% rename from qml/ml/representations/representations.py rename to qml/representations/representations.py diff --git a/qml/ml/representations/slatm.py b/qml/representations/slatm.py similarity index 100% rename from qml/ml/representations/slatm.py rename to qml/representations/slatm.py diff --git a/setup.py b/setup.py index 2ead66e22..dd525b605 100755 --- a/setup.py +++ b/setup.py @@ -24,9 +24,9 @@ MATH_LINKER_FLAGS = ["-lblas", "-llapack"] # UNCOMMENT TO FORCE LINKING TO MKL with GNU compilers: -# if mkl_exists(verbose=True): -# LINKER_FLAGS = ["-lgomp", " -lpthread", "-lm", "-ldl"] -# MATH_LINKER_FLAGS = ["-L${MKLROOT}/lib/intel64", "-lmkl_rt"] +if mkl_exists(verbose=True): + LINKER_FLAGS = ["-lgomp", " -lpthread", "-lm", "-ldl"] + MATH_LINKER_FLAGS = ["-L${MKLROOT}/lib/intel64", "-lmkl_rt"] # For clang without OpenMP: (i.e. most Apple/mac system) if sys.platform == "darwin" and all(["gnu" not in arg for arg in sys.argv]): @@ -44,8 +44,8 @@ -ext_fkernels = Extension(name = '.ml.kernels.fkernels', - sources = ['qml/ml/kernels/fkernels.f90'], +ext_fkernels = Extension(name = '.kernels.fkernels', + sources = ['qml/kernels/fkernels.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -53,10 +53,10 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_ffchl_module = Extension(name = '.ml.representations.ffchl_module', +ext_ffchl_module = Extension(name = '.fchl.ffchl_module', sources = [ - 'qml/ml/representations/ffchl_module.f90', - 'qml/ml/representations/ffchl_scalar_kernels.f90' + 'qml/fchl/ffchl_module.f90', + 'qml/fchl/ffchl_scalar_kernels.f90' ], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, @@ -65,26 +65,8 @@ language = FORTRAN, f2py_options=['--quiet']) -#ext_ffchl_scalar_kernels = Extension(name = 'ffchl_scalar_kernels', -# sources = ['qml/ml/representations/ffchl_scalar_kernels.f90'], -# extra_f90_compile_args = COMPILER_FLAGS, -# extra_f77_compile_args = COMPILER_FLAGS, -# extra_compile_args = COMPILER_FLAGS, -# extra_link_args = LINKER_FLAGS + MATH_LINKER_FLAGS, -# language = FORTRAN, -# f2py_options=['--quiet']) -# -#ext_ffchl_vector_kernels = Extension(name = 'ffchl_vector_kernels', -# sources = ['qml/ml/representations/ffchl_vector_kernels.f90'], -# extra_f90_compile_args = COMPILER_FLAGS, -# extra_f77_compile_args = COMPILER_FLAGS, -# extra_compile_args = COMPILER_FLAGS, -# extra_link_args = LINKER_FLAGS + MATH_LINKER_FLAGS, -# language = FORTRAN, -# f2py_options=['--quiet']) - -ext_farad_kernels = Extension(name = '.ml.arad.farad_kernels', - sources = ['qml/ml/arad/farad_kernels.f90'], +ext_farad_kernels = Extension(name = '.arad.farad_kernels', + sources = ['qml/arad/farad_kernels.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -92,8 +74,8 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_frepresentations = Extension(name = '.ml.representations.frepresentations', - sources = ['qml/ml/representations/frepresentations.f90'], +ext_frepresentations = Extension(name = '.representations.frepresentations', + sources = ['qml/representations/frepresentations.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -101,8 +83,8 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_fdistance = Extension(name = '.ml.kernels.fdistance', - sources = ['qml/ml/kernels/fdistance.f90'], +ext_fdistance = Extension(name = '.kernels.fdistance', + sources = ['qml/kernels/fdistance.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -110,8 +92,8 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_fslatm = Extension(name = '.ml.representations.fslatm', - sources = ['qml/ml/representations/fslatm.f90'], +ext_fslatm = Extension(name = '.representations.fslatm', + sources = ['qml/representations/fslatm.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -119,8 +101,8 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_fsolvers = Extension(name = '.ml.math.fsolvers', - sources = ['qml/ml/math/fsolvers.f90'], +ext_fsolvers = Extension(name = '.math.fsolvers', + sources = ['qml/math/fsolvers.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -128,8 +110,8 @@ language = FORTRAN, f2py_options=['--quiet']) -ext_facsf = Extension(name = '.ml.representations.facsf', - sources = ['qml/ml/representations/facsf.f90'], +ext_facsf = Extension(name = '.representations.facsf', + sources = ['qml/representations/facsf.f90'], extra_f90_compile_args = COMPILER_FLAGS, extra_f77_compile_args = COMPILER_FLAGS, extra_compile_args = COMPILER_FLAGS, @@ -156,11 +138,11 @@ def setup_qml(): 'qml', 'qml.data', 'qml.aglaia', - 'qml.ml', - 'qml.ml.arad', - 'qml.ml.kernels', - 'qml.ml.math', - 'qml.ml.representations', + 'qml.arad', + 'qml.fchl', + 'qml.kernels', + 'qml.math', + 'qml.representations', 'qml.models', ], diff --git a/test/test_arad.py b/test/test_arad.py index 638598d36..37801cca3 100644 --- a/test/test_arad.py +++ b/test/test_arad.py @@ -28,17 +28,17 @@ import numpy as np import qml -from qml.ml.math import cho_solve -from qml.ml.arad import generate_arad_representation +from qml.math import cho_solve +from qml.arad import generate_arad_representation -from qml.ml.arad import get_local_kernels_arad -from qml.ml.arad import get_local_symmetric_kernels_arad +from qml.arad import get_local_kernels_arad +from qml.arad import get_local_symmetric_kernels_arad -from qml.ml.arad import get_global_kernels_arad -from qml.ml.arad import get_global_symmetric_kernels_arad +from qml.arad import get_global_kernels_arad +from qml.arad import get_global_symmetric_kernels_arad -from qml.ml.arad import get_atomic_kernels_arad -from qml.ml.arad import get_atomic_symmetric_kernels_arad +from qml.arad import get_atomic_kernels_arad +from qml.arad import get_atomic_symmetric_kernels_arad def get_energies(filename): """ Returns a dictionary with heats of formation for each xyz-file. diff --git a/test/test_distance.py b/test/test_distance.py index d0bea8210..203253154 100644 --- a/test/test_distance.py +++ b/test/test_distance.py @@ -24,7 +24,7 @@ import numpy as np -from qml.ml.kernels.distance import * +from qml.kernels.distance import * def test_manhattan(): diff --git a/test/test_energy_krr_atomic_cmat.py b/test/test_energy_krr_atomic_cmat.py index 4b4a37869..b5940f50a 100644 --- a/test/test_energy_krr_atomic_cmat.py +++ b/test/test_energy_krr_atomic_cmat.py @@ -28,15 +28,15 @@ import qml import qml.data -from qml.ml.kernels import laplacian_kernel -from qml.ml.math import cho_solve +from qml.kernels import laplacian_kernel +from qml.math import cho_solve -from qml.ml.representations import get_slatm_mbtypes +from qml.representations import get_slatm_mbtypes -from qml.ml.kernels import get_local_kernels_gaussian -from qml.ml.kernels import get_local_kernels_laplacian +from qml.kernels import get_local_kernels_gaussian +from qml.kernels import get_local_kernels_laplacian -from qml.ml.kernels.wrappers import get_atomic_kernels_gaussian, get_atomic_kernels_laplacian +from qml.kernels.wrappers import get_atomic_kernels_gaussian, get_atomic_kernels_laplacian def get_energies(filename): """ Returns a dictionary with heats of formation for each xyz-file. diff --git a/test/test_energy_krr_bob.py b/test/test_energy_krr_bob.py index 2a580545b..8eb413a09 100644 --- a/test/test_energy_krr_bob.py +++ b/test/test_energy_krr_bob.py @@ -28,9 +28,9 @@ import qml import qml.data -from qml.ml.kernels import laplacian_kernel -from qml.ml.math import cho_solve -from qml.ml.representations import get_slatm_mbtypes +from qml.kernels import laplacian_kernel +from qml.math import cho_solve +from qml.representations import get_slatm_mbtypes def get_energies(filename): diff --git a/test/test_energy_krr_cmat.py b/test/test_energy_krr_cmat.py index ca0da2632..64595b2e6 100644 --- a/test/test_energy_krr_cmat.py +++ b/test/test_energy_krr_cmat.py @@ -28,9 +28,9 @@ import qml import qml.data -from qml.ml.kernels import laplacian_kernel -from qml.ml.math import cho_solve -from qml.ml.representations import get_slatm_mbtypes +from qml.kernels import laplacian_kernel +from qml.math import cho_solve +from qml.representations import get_slatm_mbtypes def get_energies(filename): diff --git a/test/test_fchl.py b/test/test_fchl.py index 962940009..c9a9cb9cf 100644 --- a/test/test_fchl.py +++ b/test/test_fchl.py @@ -28,15 +28,15 @@ from qml.data import Compound -from qml.ml.math import cho_solve - -from qml.ml.representations.fchl import generate_representation -from qml.ml.representations.fchl import get_local_symmetric_kernels -from qml.ml.representations.fchl import get_local_kernels -from qml.ml.representations.fchl import get_global_symmetric_kernels -from qml.ml.representations.fchl import get_global_kernels -from qml.ml.representations.fchl import get_atomic_kernels -from qml.ml.representations.fchl import get_atomic_symmetric_kernels +from qml.math import cho_solve + +from qml.fchl import generate_representation +from qml.fchl import get_local_symmetric_kernels +from qml.fchl import get_local_kernels +from qml.fchl import get_global_symmetric_kernels +from qml.fchl import get_global_kernels +from qml.fchl import get_atomic_kernels +from qml.fchl import get_atomic_symmetric_kernels def get_energies(filename): """ Returns a dictionary with heats of formation for each xyz-file. diff --git a/test/test_kernels.py b/test/test_kernels.py index 6e0bf0f57..6e21ec7f8 100644 --- a/test/test_kernels.py +++ b/test/test_kernels.py @@ -25,11 +25,11 @@ import sys import numpy as np import qml -from qml.ml.kernels import laplacian_kernel -from qml.ml.kernels import gaussian_kernel -from qml.ml.kernels import linear_kernel -from qml.ml.kernels import matern_kernel -from qml.ml.kernels import sargan_kernel +from qml.kernels import laplacian_kernel +from qml.kernels import gaussian_kernel +from qml.kernels import linear_kernel +from qml.kernels import matern_kernel +from qml.kernels import sargan_kernel def test_laplacian_kernel(): diff --git a/test/test_math.py b/test/test_math.py index fc396c847..5cb461ddc 100644 --- a/test/test_math.py +++ b/test/test_math.py @@ -27,7 +27,7 @@ from copy import deepcopy import qml -import qml.ml.math +import qml.math def test_cho_solve(): @@ -38,7 +38,7 @@ def test_cho_solve(): A = deepcopy(A_ref) y = deepcopy(y_ref) - x_qml = qml.ml.math.cho_solve(A,y) + x_qml = qml.math.cho_solve(A,y) # Check arrays are unchanged assert np.allclose(y, y_ref) @@ -58,7 +58,7 @@ def test_cho_invert(): A_ref = np.loadtxt(test_dir + "/data/K_local_gaussian.txt") A = deepcopy(A_ref) - Ai_qml = qml.ml.math.cho_invert(A) + Ai_qml = qml.math.cho_invert(A) # Check A is unchanged assert np.allclose(A, A_ref) @@ -77,7 +77,7 @@ def test_bkf_invert(): A_ref = np.loadtxt(test_dir + "/data/K_local_gaussian.txt") A = deepcopy(A_ref) - Ai_qml = qml.ml.math.bkf_invert(A) + Ai_qml = qml.math.bkf_invert(A) # Check A is unchanged assert np.allclose(A, A_ref) @@ -98,7 +98,7 @@ def test_bkf_solve(): A = deepcopy(A_ref) y = deepcopy(y_ref) - x_qml = qml.ml.math.bkf_solve(A,y) + x_qml = qml.math.bkf_solve(A,y) # Check arrays are unchanged assert np.allclose(y, y_ref) diff --git a/test/test_representations.py b/test/test_representations.py index 974a72c68..8cf9d0752 100644 --- a/test/test_representations.py +++ b/test/test_representations.py @@ -28,7 +28,7 @@ import qml -from qml.ml.representations import * +from qml.representations import * def get_asize(mols, pad): diff --git a/test/test_slatm.py b/test/test_slatm.py index f50de15ca..237cd8b25 100644 --- a/test/test_slatm.py +++ b/test/test_slatm.py @@ -25,7 +25,7 @@ import numpy as np import qml -from qml.ml.representations import get_slatm_mbtypes +from qml.representations import get_slatm_mbtypes def test_slatm_global_representation(): diff --git a/test/test_symm_funct.py b/test/test_symm_funct.py index 6735214a3..6fa92c7ce 100644 --- a/test/test_symm_funct.py +++ b/test/test_symm_funct.py @@ -29,7 +29,7 @@ import numpy as np import qml -from qml.ml.representations import generate_acsf +from qml.representations import generate_acsf from qml.aglaia import symm_funct import os