diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ca6147..367a610 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,27 +1,4 @@ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-toml - - id: check-yaml - - id: check-added-large-files - # Python-specific - - id: check-ast - - id: check-docstring-first - - id: debug-statements - - - repo: https://github.com/crate-ci/typos - rev: v1.16.23 - hooks: - - id: typos - args: [] - - - repo: https://github.com/psf/black - rev: 23.11.0 - hooks: - - id: black - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. @@ -33,7 +10,12 @@ repos: # Run the formatter. - id: ruff-format - - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.357 + - repo: https://github.com/psf/black + rev: 23.11.0 hooks: - - id: pyright + - id: black + + # - repo: https://github.com/RobertCraigie/pyright-python + # rev: v1.1.357 + # hooks: + # - id: pyright diff --git a/grid1q/_typings/scipy/speical.pyi b/grid1q/_typings/scipy/speical.pyi new file mode 100644 index 0000000..e69de29 diff --git a/grid1q/examples/operators/plane_waves.ipynb b/grid1q/examples/operators/plane_waves.ipynb new file mode 100644 index 0000000..2d66a4d --- /dev/null +++ b/grid1q/examples/operators/plane_waves.ipynb @@ -0,0 +1,546 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Plane Wave Operators" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 1D" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "k_min = -16\n", + "k_max = 15\n", + "k_point_grid = np.arange(k_min, k_max+1)\n", + "k_dim = len(k_point_grid)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "k_point_grid [-16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1\n", + " 2 3 4 5 6 7 8 9 10 11 12 13 14 15]\n" + ] + }, + { + "data": { + "text/plain": [ + "array([[32768. , 0. , 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 25312.5, 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 0. , 19208. , ..., 0. , 0. , 0. ],\n", + " ...,\n", + " [ 0. , 0. , 0. , ..., 14280.5, 0. , 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 19208. , 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 0. , 25312.5]])" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from grid1q.operators.plane_wave import kenetic, elec_nuc_potential, plane_wave_hamiltonian\n", + "print(\"k_point_grid\", k_point_grid)\n", + "k_point_grid_array = [np.array([k]) for k in k_point_grid]\n", + "\n", + "kenetic(k_point_grid_array)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j, ...,\n", + " -5.30334111e-03+1.39693671e-02j, -1.06072443e-02+9.07973112e-03j,\n", + " -1.27945982e-02+2.69984068e-03j],\n", + " [ 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j, ...,\n", + " 2.19169714e-03+1.58779836e-02j, -5.30334111e-03+1.39693671e-02j,\n", + " -1.06072443e-02+9.07973112e-03j],\n", + " [ 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j, ...,\n", + " 1.02551352e-02+1.38554911e-02j, 2.19169714e-03+1.58779836e-02j,\n", + " -5.30334111e-03+1.39693671e-02j],\n", + " ...,\n", + " [-5.30334111e-03-1.39693671e-02j, 2.19169714e-03-1.58779836e-02j,\n", + " 1.02551352e-02-1.38554911e-02j, ...,\n", + " 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j],\n", + " [-1.06072443e-02-9.07973112e-03j, -5.30334111e-03-1.39693671e-02j,\n", + " 2.19169714e-03-1.58779836e-02j, ...,\n", + " 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j],\n", + " [-1.27945982e-02-2.69984068e-03j, -1.06072443e-02-9.07973112e-03j,\n", + " -5.30334111e-03-1.39693671e-02j, ...,\n", + " 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j]])" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cell_area = 1.0\n", + "r_pos = [np.array([0.5])]\n", + "\n", + "elec_nuc_potential(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [], + "source": [ + "H = plane_wave_hamiltonian(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "EigResult(eigenvalues=array([ 3.27680221e+04+1.23821474e-19j, 2.53124988e+04+2.32376520e-13j,\n", + " 2.53125339e+04+3.01229805e-13j, 1.92079911e+04+2.55008295e-12j,\n", + " 1.92080233e+04+2.44252438e-12j, 1.42805278e+04-1.16809356e-13j,\n", + " 1.42804904e+04-8.20903748e-14j, 1.03680344e+04-8.66673123e-13j,\n", + " 1.03679905e+04-7.63644863e-13j, 7.32054378e+03+3.76395777e-13j,\n", + " 7.32049147e+03+3.73675432e-13j, 5.00005758e+03+3.86967443e-13j,\n", + " 4.99999407e+03+3.72729374e-13j, 3.28057887e+03-5.63579746e-14j,\n", + " 3.28050002e+03-2.32831416e-14j, 2.04811378e+03-8.18966836e-13j,\n", + " 2.04801297e+03-6.41683492e-13j, 1.20067577e+03-1.64604146e-13j,\n", + " 1.20054155e+03-1.76918298e-13j, 6.48298251e+02-1.13196318e-13j,\n", + " 6.48108058e+02-8.14439229e-14j, 3.13080431e+02-3.52855583e-13j,\n", + " 3.12778337e+02-9.41276609e-14j, 1.29420828e+02+6.04343696e-15j,\n", + " 1.28784694e+02+2.09377945e-13j, 4.63442489e+01-6.29517230e-14j,\n", + " 4.29600370e+01+4.26067398e-14j, 2.30386660e+01-3.19994487e-13j,\n", + " 1.02711525e+01-1.87200105e-13j, -5.09501563e-01-3.42874305e-14j,\n", + " -1.78044433e+01+1.05824004e-14j, -1.03928597e+01+1.00094188e-13j]), eigenvectors=array([[ 9.99998548e-01+0.00000000e+00j, -1.32436312e-03-7.23502872e-04j,\n", + " 7.36586283e-04-1.55430095e-04j, ...,\n", + " -9.58569564e-08-8.35343513e-08j, -2.33805316e-09+1.58980869e-08j,\n", + " 1.09543869e-08-1.45295080e-08j],\n", + " [ 1.47955617e-03-8.08285222e-04j, 8.95303914e-01+0.00000000e+00j,\n", + " -3.38401296e-01+2.89669276e-01j, ...,\n", + " -1.88352491e-07-4.14897595e-08j, 7.99835522e-09+2.16436601e-08j,\n", + " 4.23064246e-09-2.87671480e-08j],\n", + " [ 1.26065882e-04-1.96335978e-04j, 1.61627540e-03-8.82975275e-04j,\n", + " -3.26201720e-04+8.59237882e-04j, ...,\n", + " -2.90015533e-07+8.43963158e-08j, 2.54831390e-08+2.22072301e-08j,\n", + " -1.66696770e-08-4.51083771e-08j],\n", + " ...,\n", + " [-2.88165443e-07-7.59047698e-07j, -1.73170275e-05+1.25455052e-04j,\n", + " 1.39299897e-04+2.16946736e-04j, ...,\n", + " -1.70112041e-07+4.60325542e-07j, 4.93756375e-08-1.08763272e-08j,\n", + " 7.94526963e-08+2.31212265e-08j],\n", + " [-7.86186388e-07-6.72970360e-07j, 3.24780032e-04+8.55493056e-04j,\n", + " 1.61887144e-03+8.84393500e-04j, ...,\n", + " 4.39506985e-08+2.98852068e-07j, 2.54851047e-08-2.22089431e-08j,\n", + " 4.69669648e-08-1.03457515e-08j],\n", + " [-1.72257808e-06-3.63488273e-07j, 3.38401786e-01+2.89669696e-01j,\n", + " 8.95305179e-01+0.00000000e+00j, ...,\n", + " 1.16146777e-07+1.54052942e-07j, 8.00111510e-09-2.16511284e-08j,\n", + " 2.19277072e-08-1.91088562e-08j]]))" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from numpy.linalg import eig\n", + "eig(H)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 2D" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(-16, -16), (-16, -15), (-16, -14), (-16, -13), (-16, -12), (-16, -11), (-16, -10), (-16, -9), (-16, -8), (-16, -7), (-16, -6), (-16, -5), (-16, -4), (-16, -3), (-16, -2), (-16, -1), (-16, 0), (-16, 1), (-16, 2), (-16, 3), (-16, 4), (-16, 5), (-16, 6), (-16, 7), (-16, 8), (-16, 9), (-16, 10), (-16, 11), (-16, 12), (-16, 13), (-16, 14), (-16, 15), (-15, -16), (-15, -15), (-15, -14), (-15, -13), (-15, -12), (-15, -11), (-15, -10), (-15, -9), (-15, -8), (-15, -7), (-15, -6), (-15, -5), (-15, -4), (-15, -3), (-15, -2), (-15, -1), (-15, 0), (-15, 1), (-15, 2), (-15, 3), (-15, 4), (-15, 5), (-15, 6), (-15, 7), (-15, 8), (-15, 9), (-15, 10), (-15, 11), (-15, 12), (-15, 13), (-15, 14), (-15, 15), (-14, -16), (-14, -15), (-14, -14), (-14, -13), (-14, -12), (-14, -11), (-14, -10), (-14, -9), (-14, -8), (-14, -7), (-14, -6), (-14, -5), (-14, -4), (-14, -3), (-14, -2), (-14, -1), (-14, 0), (-14, 1), (-14, 2), (-14, 3), (-14, 4), (-14, 5), (-14, 6), (-14, 7), (-14, 8), (-14, 9), (-14, 10), (-14, 11), (-14, 12), (-14, 13), (-14, 14), (-14, 15), (-13, -16), (-13, -15), (-13, -14), (-13, -13), (-13, -12), (-13, -11), (-13, -10), (-13, -9), (-13, -8), (-13, -7), (-13, -6), (-13, -5), (-13, -4), (-13, -3), (-13, -2), (-13, -1), (-13, 0), (-13, 1), (-13, 2), (-13, 3), (-13, 4), (-13, 5), (-13, 6), (-13, 7), (-13, 8), (-13, 9), (-13, 10), (-13, 11), (-13, 12), (-13, 13), (-13, 14), (-13, 15), (-12, -16), (-12, -15), (-12, -14), (-12, -13), (-12, -12), (-12, -11), (-12, -10), (-12, -9), (-12, -8), (-12, -7), (-12, -6), (-12, -5), (-12, -4), (-12, -3), (-12, -2), (-12, -1), (-12, 0), (-12, 1), (-12, 2), (-12, 3), (-12, 4), (-12, 5), (-12, 6), (-12, 7), (-12, 8), (-12, 9), (-12, 10), (-12, 11), (-12, 12), (-12, 13), (-12, 14), (-12, 15), (-11, -16), (-11, -15), (-11, -14), (-11, -13), (-11, -12), (-11, -11), (-11, -10), (-11, -9), (-11, -8), (-11, -7), (-11, -6), (-11, -5), (-11, -4), (-11, -3), (-11, -2), (-11, -1), (-11, 0), (-11, 1), (-11, 2), (-11, 3), (-11, 4), (-11, 5), (-11, 6), (-11, 7), (-11, 8), (-11, 9), (-11, 10), (-11, 11), (-11, 12), (-11, 13), (-11, 14), (-11, 15), (-10, -16), (-10, -15), (-10, -14), (-10, -13), (-10, -12), (-10, -11), (-10, -10), (-10, -9), (-10, -8), (-10, -7), (-10, -6), (-10, -5), (-10, -4), (-10, -3), (-10, -2), (-10, -1), (-10, 0), (-10, 1), (-10, 2), (-10, 3), (-10, 4), (-10, 5), (-10, 6), (-10, 7), (-10, 8), (-10, 9), (-10, 10), (-10, 11), (-10, 12), (-10, 13), (-10, 14), (-10, 15), (-9, -16), (-9, -15), (-9, -14), (-9, -13), (-9, -12), (-9, -11), (-9, -10), (-9, -9), (-9, -8), (-9, -7), (-9, -6), (-9, -5), (-9, -4), (-9, -3), (-9, -2), (-9, -1), (-9, 0), (-9, 1), (-9, 2), (-9, 3), (-9, 4), (-9, 5), (-9, 6), (-9, 7), (-9, 8), (-9, 9), (-9, 10), (-9, 11), (-9, 12), (-9, 13), (-9, 14), (-9, 15), (-8, -16), (-8, -15), (-8, -14), (-8, -13), (-8, -12), (-8, -11), (-8, -10), (-8, -9), (-8, -8), (-8, -7), (-8, -6), (-8, -5), (-8, -4), (-8, -3), (-8, -2), (-8, -1), (-8, 0), (-8, 1), (-8, 2), (-8, 3), (-8, 4), (-8, 5), (-8, 6), (-8, 7), (-8, 8), (-8, 9), (-8, 10), (-8, 11), (-8, 12), (-8, 13), (-8, 14), (-8, 15), (-7, -16), (-7, -15), (-7, -14), (-7, -13), (-7, -12), (-7, -11), (-7, -10), (-7, -9), (-7, -8), (-7, -7), (-7, -6), (-7, -5), (-7, -4), (-7, -3), (-7, -2), (-7, -1), (-7, 0), (-7, 1), (-7, 2), (-7, 3), (-7, 4), (-7, 5), (-7, 6), (-7, 7), (-7, 8), (-7, 9), (-7, 10), (-7, 11), (-7, 12), (-7, 13), (-7, 14), (-7, 15), (-6, -16), (-6, -15), (-6, -14), (-6, -13), (-6, -12), (-6, -11), (-6, -10), (-6, -9), (-6, -8), (-6, -7), (-6, -6), (-6, -5), (-6, -4), (-6, -3), (-6, -2), (-6, -1), (-6, 0), (-6, 1), (-6, 2), (-6, 3), (-6, 4), (-6, 5), (-6, 6), (-6, 7), (-6, 8), (-6, 9), (-6, 10), (-6, 11), (-6, 12), (-6, 13), (-6, 14), (-6, 15), (-5, -16), (-5, -15), (-5, -14), (-5, -13), (-5, -12), (-5, -11), (-5, -10), (-5, -9), (-5, -8), (-5, -7), (-5, -6), (-5, -5), (-5, -4), (-5, -3), (-5, -2), (-5, -1), (-5, 0), (-5, 1), (-5, 2), (-5, 3), (-5, 4), (-5, 5), (-5, 6), (-5, 7), (-5, 8), (-5, 9), (-5, 10), (-5, 11), (-5, 12), (-5, 13), (-5, 14), (-5, 15), (-4, -16), (-4, -15), (-4, -14), (-4, -13), (-4, -12), (-4, -11), (-4, -10), (-4, -9), (-4, -8), (-4, -7), (-4, -6), (-4, -5), (-4, -4), (-4, -3), (-4, -2), (-4, -1), (-4, 0), (-4, 1), (-4, 2), (-4, 3), (-4, 4), (-4, 5), (-4, 6), (-4, 7), (-4, 8), (-4, 9), (-4, 10), (-4, 11), (-4, 12), (-4, 13), (-4, 14), (-4, 15), (-3, -16), (-3, -15), (-3, -14), (-3, -13), (-3, -12), (-3, -11), (-3, -10), (-3, -9), (-3, -8), (-3, -7), (-3, -6), (-3, -5), (-3, -4), (-3, -3), (-3, -2), (-3, -1), (-3, 0), (-3, 1), (-3, 2), (-3, 3), (-3, 4), (-3, 5), (-3, 6), (-3, 7), (-3, 8), (-3, 9), (-3, 10), (-3, 11), (-3, 12), (-3, 13), (-3, 14), (-3, 15), (-2, -16), (-2, -15), (-2, -14), (-2, -13), (-2, -12), (-2, -11), (-2, -10), (-2, -9), (-2, -8), (-2, -7), (-2, -6), (-2, -5), (-2, -4), (-2, -3), (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-2, 3), (-2, 4), (-2, 5), (-2, 6), (-2, 7), (-2, 8), (-2, 9), (-2, 10), (-2, 11), (-2, 12), (-2, 13), (-2, 14), (-2, 15), (-1, -16), (-1, -15), (-1, -14), (-1, -13), (-1, -12), (-1, -11), (-1, -10), (-1, -9), (-1, -8), (-1, -7), (-1, -6), (-1, -5), (-1, -4), (-1, -3), (-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2), (-1, 3), (-1, 4), (-1, 5), (-1, 6), (-1, 7), (-1, 8), (-1, 9), (-1, 10), (-1, 11), (-1, 12), (-1, 13), (-1, 14), (-1, 15), (0, -16), (0, -15), (0, -14), (0, -13), (0, -12), (0, -11), (0, -10), (0, -9), (0, -8), (0, -7), (0, -6), (0, -5), (0, -4), (0, -3), (0, -2), (0, -1), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), (0, 14), (0, 15), (1, -16), (1, -15), (1, -14), (1, -13), (1, -12), (1, -11), (1, -10), (1, -9), (1, -8), (1, -7), (1, -6), (1, -5), (1, -4), (1, -3), (1, -2), (1, -1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (1, 11), (1, 12), (1, 13), (1, 14), (1, 15), (2, -16), (2, -15), (2, -14), (2, -13), (2, -12), (2, -11), (2, -10), (2, -9), (2, -8), (2, -7), (2, -6), (2, -5), (2, -4), (2, -3), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (2, 10), (2, 11), (2, 12), (2, 13), (2, 14), (2, 15), (3, -16), (3, -15), (3, -14), (3, -13), (3, -12), (3, -11), (3, -10), (3, -9), (3, -8), (3, -7), (3, -6), (3, -5), (3, -4), (3, -3), (3, -2), (3, -1), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11), (3, 12), (3, 13), (3, 14), (3, 15), (4, -16), (4, -15), (4, -14), (4, -13), (4, -12), (4, -11), (4, -10), (4, -9), (4, -8), (4, -7), (4, -6), (4, -5), (4, -4), (4, -3), (4, -2), (4, -1), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (4, 9), (4, 10), (4, 11), (4, 12), (4, 13), (4, 14), (4, 15), (5, -16), (5, -15), (5, -14), (5, -13), (5, -12), (5, -11), (5, -10), (5, -9), (5, -8), (5, -7), (5, -6), (5, -5), (5, -4), (5, -3), (5, -2), (5, -1), (5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 7), (5, 8), (5, 9), (5, 10), (5, 11), (5, 12), (5, 13), (5, 14), (5, 15), (6, -16), (6, -15), (6, -14), (6, -13), (6, -12), (6, -11), (6, -10), (6, -9), (6, -8), (6, -7), (6, -6), (6, -5), (6, -4), (6, -3), (6, -2), (6, -1), (6, 0), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6), (6, 7), (6, 8), (6, 9), (6, 10), (6, 11), (6, 12), (6, 13), (6, 14), (6, 15), (7, -16), (7, -15), (7, -14), (7, -13), (7, -12), (7, -11), (7, -10), (7, -9), (7, -8), (7, -7), (7, -6), (7, -5), (7, -4), (7, -3), (7, -2), (7, -1), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4), (7, 5), (7, 6), (7, 7), (7, 8), (7, 9), (7, 10), (7, 11), (7, 12), (7, 13), (7, 14), (7, 15), (8, -16), (8, -15), (8, -14), (8, -13), (8, -12), (8, -11), (8, -10), (8, -9), (8, -8), (8, -7), (8, -6), (8, -5), (8, -4), (8, -3), (8, -2), (8, -1), (8, 0), (8, 1), (8, 2), (8, 3), (8, 4), (8, 5), (8, 6), (8, 7), (8, 8), (8, 9), (8, 10), (8, 11), (8, 12), (8, 13), (8, 14), (8, 15), (9, -16), (9, -15), (9, -14), (9, -13), (9, -12), (9, -11), (9, -10), (9, -9), (9, -8), (9, -7), (9, -6), (9, -5), (9, -4), (9, -3), (9, -2), (9, -1), (9, 0), (9, 1), (9, 2), (9, 3), (9, 4), (9, 5), (9, 6), (9, 7), (9, 8), (9, 9), (9, 10), (9, 11), (9, 12), (9, 13), (9, 14), (9, 15), (10, -16), (10, -15), (10, -14), (10, -13), (10, -12), (10, -11), (10, -10), (10, -9), (10, -8), (10, -7), (10, -6), (10, -5), (10, -4), (10, -3), (10, -2), (10, -1), (10, 0), (10, 1), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 7), (10, 8), (10, 9), (10, 10), (10, 11), (10, 12), (10, 13), (10, 14), (10, 15), (11, -16), (11, -15), (11, -14), (11, -13), (11, -12), (11, -11), (11, -10), (11, -9), (11, -8), (11, -7), (11, -6), (11, -5), (11, -4), (11, -3), (11, -2), (11, -1), (11, 0), (11, 1), (11, 2), (11, 3), (11, 4), (11, 5), (11, 6), (11, 7), (11, 8), (11, 9), (11, 10), (11, 11), (11, 12), (11, 13), (11, 14), (11, 15), (12, -16), (12, -15), (12, -14), (12, -13), (12, -12), (12, -11), (12, -10), (12, -9), (12, -8), (12, -7), (12, -6), (12, -5), (12, -4), (12, -3), (12, -2), (12, -1), (12, 0), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5), (12, 6), (12, 7), (12, 8), (12, 9), (12, 10), (12, 11), (12, 12), (12, 13), (12, 14), (12, 15), (13, -16), (13, -15), (13, -14), (13, -13), (13, -12), (13, -11), (13, -10), (13, -9), (13, -8), (13, -7), (13, -6), (13, -5), (13, -4), (13, -3), (13, -2), (13, -1), (13, 0), (13, 1), (13, 2), (13, 3), (13, 4), (13, 5), (13, 6), (13, 7), (13, 8), (13, 9), (13, 10), (13, 11), (13, 12), (13, 13), (13, 14), (13, 15), (14, -16), (14, -15), (14, -14), (14, -13), (14, -12), (14, -11), (14, -10), (14, -9), (14, -8), (14, -7), (14, -6), (14, -5), (14, -4), (14, -3), (14, -2), (14, -1), (14, 0), (14, 1), (14, 2), (14, 3), (14, 4), (14, 5), (14, 6), (14, 7), (14, 8), (14, 9), (14, 10), (14, 11), (14, 12), (14, 13), (14, 14), (14, 15), (15, -16), (15, -15), (15, -14), (15, -13), (15, -12), (15, -11), (15, -10), (15, -9), (15, -8), (15, -7), (15, -6), (15, -5), (15, -4), (15, -3), (15, -2), (15, -1), (15, 0), (15, 1), (15, 2), (15, 3), (15, 4), (15, 5), (15, 6), (15, 7), (15, 8), (15, 9), (15, 10), (15, 11), (15, 12), (15, 13), (15, 14), (15, 15)]\n" + ] + } + ], + "source": [ + "import itertools\n", + "import numpy as np\n", + "k_min = -16\n", + "k_max = 15\n", + "ks = np.arange(k_min, k_max+1)\n", + "k_dim = len(ks)\n", + "k_point_grid = list(itertools.product(ks, ks))\n", + "print(k_point_grid)\n", + "k_point_grid_array = [np.array(k) for k in k_point_grid]" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[131072. , 0. , 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 115680.5, 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 0. , 102152. , ..., 0. , 0. , 0. ],\n", + " ...,\n", + " [ 0. , 0. , 0. , ..., 77618. , 0. , 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 88620.5, 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 0. , 101250. ]])" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "kenetic(k_point_grid_array)" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j, ...,\n", + " 1.07568307e-03-6.89010631e-03j, 4.11264004e-03-5.35557810e-03j,\n", + " 5.98074479e-03-2.64166847e-03j],\n", + " [ 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j, ...,\n", + " -2.43635793e-03-6.77670455e-03j, 1.07568307e-03-6.89010631e-03j,\n", + " 4.11264004e-03-5.35557810e-03j],\n", + " [ 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j, ...,\n", + " -5.56234802e-03-4.93459724e-03j, -2.43635793e-03-6.77670455e-03j,\n", + " 1.07568307e-03-6.89010631e-03j],\n", + " ...,\n", + " [ 1.07568307e-03+6.89010631e-03j, -2.43635793e-03+6.77670455e-03j,\n", + " -5.56234802e-03+4.93459724e-03j, ...,\n", + " 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j],\n", + " [ 4.11264004e-03+5.35557810e-03j, 1.07568307e-03+6.89010631e-03j,\n", + " -2.43635793e-03+6.77670455e-03j, ...,\n", + " 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j],\n", + " [ 5.98074479e-03+2.64166847e-03j, 4.11264004e-03+5.35557810e-03j,\n", + " 1.07568307e-03+6.89010631e-03j, ...,\n", + " 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j]])" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cell_area = 1.0\n", + "r_pos = [np.array([0.5, 0.5])]\n", + "\n", + "elec_nuc_potential(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [], + "source": [ + "H = plane_wave_hamiltonian(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "EigResult(eigenvalues=array([131072.02321078+5.23959887e-17j, 115686.80698418+3.85737021e-11j,\n", + " 115680.5320558 +3.74401013e-11j, ...,\n", + " 304.10228353-4.18538792e-13j, 306.55513357+3.13999998e-12j,\n", + " 306.475703 -1.00847071e-13j]), eigenvectors=array([[ 9.99999291e-01+0.00000000e+00j, -1.01454921e-03-5.54250758e-04j,\n", + " -3.71840713e-06+7.84636353e-07j, ...,\n", + " 2.69933325e-19-1.24851429e-18j, -7.01669247e-19-5.99387348e-19j,\n", + " -5.79863769e-19+2.68965991e-19j],\n", + " [ 7.17099723e-04-3.91753364e-04j, 7.07098625e-01+0.00000000e+00j,\n", + " 2.32815378e-03-1.99288427e-03j, ...,\n", + " 8.37587180e-10+3.87820549e-10j, 9.77154536e-10+1.48126332e-10j,\n", + " -1.96682682e-10-2.98150158e-11j],\n", + " [ 5.89874892e-05-9.18675713e-05j, 6.92168559e-04-3.78133407e-04j,\n", + " 6.91787283e-07-1.82221553e-06j, ...,\n", + " 2.43474171e-09-1.61833009e-10j, 2.46554908e-09-8.98755077e-10j,\n", + " -5.23800804e-10+1.90938670e-10j],\n", + " ...,\n", + " [ 2.02299533e-08+1.29579551e-07j, -9.19093762e-08+2.55644985e-07j,\n", + " -1.85089351e-07-4.87538145e-07j, ...,\n", + " -3.18389626e-09+3.22645242e-09j, -2.34986993e-09+4.34702437e-09j,\n", + " 5.69570315e-10-1.05364811e-09j],\n", + " [ 9.73968839e-08+1.26832548e-07j, 5.70580667e-08+3.65475815e-07j,\n", + " -5.38709732e-07-4.61131976e-07j, ...,\n", + " -4.63323332e-10+1.61881266e-09j, 8.07494260e-12+1.82453660e-09j,\n", + " -1.84967120e-12-4.17932288e-10j],\n", + " [ 2.01529532e-07+8.90147011e-08j, 4.08436211e-07+5.31875389e-07j,\n", + " -1.25807062e-06-2.65470645e-07j, ...,\n", + " 2.02443626e-18+1.30365616e-17j, 9.73232682e-19-8.00194486e-18j,\n", + " -2.13290821e-18-6.15182845e-19j]]))" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "eig(H)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 3D" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "16 [-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]\n", + "4096\n" + ] + } + ], + "source": [ + "import itertools\n", + "import numpy as np\n", + "k_min = -8\n", + "k_max = 7\n", + "ks = np.arange(k_min, k_max+1)\n", + "k_dim = len(ks)\n", + "print(k_dim, ks)\n", + "k_point_grid = list(itertools.product(ks, ks, ks))\n", + "print(len(k_point_grid))" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "k_point_grid [(-8, -8, -8), (-8, -8, -7), (-8, -8, -6), (-8, -8, -5), (-8, -8, -4), (-8, -8, -3), (-8, -8, -2), (-8, -8, -1), (-8, -8, 0), (-8, -8, 1), (-8, -8, 2), (-8, -8, 3), (-8, -8, 4), (-8, -8, 5), (-8, -8, 6), (-8, -8, 7), (-8, -7, -8), (-8, -7, -7), (-8, -7, -6), (-8, -7, -5), (-8, -7, -4), (-8, -7, -3), (-8, -7, -2), (-8, -7, -1), (-8, -7, 0), (-8, -7, 1), (-8, -7, 2), (-8, -7, 3), (-8, -7, 4), (-8, -7, 5), (-8, -7, 6), (-8, -7, 7), (-8, -6, -8), (-8, -6, -7), (-8, -6, -6), (-8, -6, -5), (-8, -6, -4), (-8, -6, -3), (-8, -6, -2), (-8, -6, -1), (-8, -6, 0), (-8, -6, 1), (-8, -6, 2), (-8, -6, 3), (-8, -6, 4), (-8, -6, 5), (-8, -6, 6), (-8, -6, 7), (-8, -5, -8), (-8, -5, -7), (-8, -5, -6), (-8, -5, -5), (-8, -5, -4), (-8, -5, -3), (-8, -5, -2), (-8, -5, -1), (-8, -5, 0), (-8, -5, 1), (-8, -5, 2), (-8, -5, 3), (-8, -5, 4), (-8, -5, 5), (-8, -5, 6), (-8, -5, 7), (-8, -4, -8), (-8, -4, -7), (-8, -4, -6), (-8, -4, -5), (-8, -4, -4), (-8, -4, -3), (-8, -4, -2), (-8, -4, -1), (-8, -4, 0), (-8, -4, 1), (-8, -4, 2), (-8, -4, 3), (-8, -4, 4), (-8, -4, 5), (-8, -4, 6), (-8, -4, 7), (-8, -3, -8), (-8, -3, -7), (-8, -3, -6), (-8, -3, -5), (-8, -3, -4), (-8, -3, -3), (-8, -3, -2), (-8, -3, -1), (-8, -3, 0), (-8, -3, 1), (-8, -3, 2), (-8, -3, 3), (-8, -3, 4), (-8, -3, 5), (-8, -3, 6), (-8, -3, 7), (-8, -2, -8), (-8, -2, -7), (-8, -2, -6), (-8, -2, -5), (-8, -2, -4), (-8, -2, -3), (-8, -2, -2), (-8, -2, -1), (-8, -2, 0), (-8, -2, 1), (-8, -2, 2), (-8, -2, 3), (-8, -2, 4), (-8, -2, 5), (-8, -2, 6), (-8, -2, 7), (-8, -1, -8), (-8, -1, -7), (-8, -1, -6), (-8, -1, -5), (-8, -1, -4), (-8, -1, -3), (-8, -1, -2), (-8, -1, -1), (-8, -1, 0), (-8, -1, 1), (-8, -1, 2), (-8, -1, 3), (-8, -1, 4), (-8, -1, 5), (-8, -1, 6), (-8, -1, 7), (-8, 0, -8), (-8, 0, -7), (-8, 0, -6), (-8, 0, -5), (-8, 0, -4), (-8, 0, -3), (-8, 0, -2), (-8, 0, -1), (-8, 0, 0), (-8, 0, 1), (-8, 0, 2), (-8, 0, 3), (-8, 0, 4), (-8, 0, 5), (-8, 0, 6), (-8, 0, 7), (-8, 1, -8), (-8, 1, -7), (-8, 1, -6), (-8, 1, -5), (-8, 1, -4), (-8, 1, -3), (-8, 1, -2), (-8, 1, -1), (-8, 1, 0), (-8, 1, 1), (-8, 1, 2), (-8, 1, 3), (-8, 1, 4), (-8, 1, 5), (-8, 1, 6), (-8, 1, 7), (-8, 2, -8), (-8, 2, -7), (-8, 2, -6), (-8, 2, -5), (-8, 2, -4), (-8, 2, -3), (-8, 2, -2), (-8, 2, -1), (-8, 2, 0), (-8, 2, 1), (-8, 2, 2), (-8, 2, 3), (-8, 2, 4), (-8, 2, 5), (-8, 2, 6), (-8, 2, 7), (-8, 3, -8), (-8, 3, -7), (-8, 3, -6), (-8, 3, -5), (-8, 3, -4), (-8, 3, -3), (-8, 3, -2), (-8, 3, -1), (-8, 3, 0), (-8, 3, 1), (-8, 3, 2), (-8, 3, 3), (-8, 3, 4), (-8, 3, 5), (-8, 3, 6), (-8, 3, 7), (-8, 4, -8), (-8, 4, -7), (-8, 4, -6), (-8, 4, -5), (-8, 4, -4), (-8, 4, -3), (-8, 4, -2), (-8, 4, -1), (-8, 4, 0), (-8, 4, 1), (-8, 4, 2), (-8, 4, 3), (-8, 4, 4), (-8, 4, 5), (-8, 4, 6), (-8, 4, 7), (-8, 5, -8), (-8, 5, -7), (-8, 5, -6), (-8, 5, -5), (-8, 5, -4), (-8, 5, -3), (-8, 5, -2), (-8, 5, -1), (-8, 5, 0), (-8, 5, 1), (-8, 5, 2), (-8, 5, 3), (-8, 5, 4), (-8, 5, 5), (-8, 5, 6), (-8, 5, 7), (-8, 6, -8), (-8, 6, -7), (-8, 6, -6), (-8, 6, -5), (-8, 6, -4), (-8, 6, -3), (-8, 6, -2), (-8, 6, -1), (-8, 6, 0), (-8, 6, 1), (-8, 6, 2), (-8, 6, 3), (-8, 6, 4), (-8, 6, 5), (-8, 6, 6), (-8, 6, 7), (-8, 7, -8), (-8, 7, -7), (-8, 7, -6), (-8, 7, -5), (-8, 7, -4), (-8, 7, -3), (-8, 7, -2), (-8, 7, -1), (-8, 7, 0), (-8, 7, 1), (-8, 7, 2), (-8, 7, 3), (-8, 7, 4), (-8, 7, 5), (-8, 7, 6), (-8, 7, 7), (-7, -8, -8), (-7, -8, -7), (-7, -8, -6), (-7, -8, -5), (-7, -8, -4), (-7, -8, -3), (-7, -8, -2), (-7, -8, -1), (-7, -8, 0), (-7, -8, 1), (-7, -8, 2), (-7, -8, 3), (-7, -8, 4), (-7, -8, 5), (-7, -8, 6), (-7, -8, 7), (-7, -7, -8), (-7, -7, -7), (-7, -7, -6), (-7, -7, -5), (-7, -7, -4), (-7, -7, -3), (-7, -7, -2), (-7, -7, -1), (-7, -7, 0), (-7, -7, 1), (-7, -7, 2), (-7, -7, 3), (-7, -7, 4), (-7, -7, 5), (-7, -7, 6), (-7, -7, 7), (-7, -6, -8), (-7, -6, -7), (-7, -6, -6), (-7, -6, -5), (-7, -6, -4), (-7, -6, -3), (-7, -6, -2), (-7, -6, -1), (-7, -6, 0), (-7, -6, 1), (-7, -6, 2), (-7, -6, 3), (-7, -6, 4), (-7, -6, 5), (-7, -6, 6), (-7, -6, 7), (-7, -5, -8), (-7, -5, -7), (-7, -5, -6), (-7, -5, -5), (-7, -5, -4), (-7, -5, -3), (-7, -5, -2), (-7, -5, -1), (-7, -5, 0), (-7, -5, 1), (-7, -5, 2), (-7, -5, 3), (-7, -5, 4), (-7, -5, 5), (-7, -5, 6), (-7, -5, 7), (-7, -4, -8), (-7, -4, -7), (-7, -4, -6), (-7, -4, -5), (-7, -4, -4), (-7, -4, -3), (-7, -4, -2), (-7, -4, -1), (-7, -4, 0), (-7, -4, 1), (-7, -4, 2), (-7, -4, 3), (-7, -4, 4), (-7, -4, 5), (-7, -4, 6), (-7, -4, 7), (-7, -3, -8), (-7, -3, -7), (-7, -3, -6), (-7, -3, -5), (-7, -3, -4), (-7, -3, -3), (-7, -3, -2), (-7, -3, -1), (-7, -3, 0), (-7, -3, 1), (-7, -3, 2), (-7, -3, 3), (-7, -3, 4), (-7, -3, 5), (-7, -3, 6), (-7, -3, 7), (-7, -2, -8), (-7, -2, -7), (-7, -2, -6), (-7, -2, -5), (-7, -2, -4), (-7, -2, -3), (-7, -2, -2), (-7, -2, -1), (-7, -2, 0), (-7, -2, 1), (-7, -2, 2), (-7, -2, 3), (-7, -2, 4), (-7, -2, 5), (-7, -2, 6), (-7, -2, 7), (-7, -1, -8), (-7, -1, -7), (-7, -1, -6), (-7, -1, -5), (-7, -1, -4), (-7, -1, -3), (-7, -1, -2), (-7, -1, -1), (-7, -1, 0), (-7, -1, 1), (-7, -1, 2), (-7, -1, 3), (-7, -1, 4), (-7, -1, 5), (-7, -1, 6), (-7, -1, 7), (-7, 0, -8), (-7, 0, -7), (-7, 0, -6), (-7, 0, -5), (-7, 0, -4), (-7, 0, -3), (-7, 0, -2), (-7, 0, -1), (-7, 0, 0), (-7, 0, 1), (-7, 0, 2), (-7, 0, 3), (-7, 0, 4), (-7, 0, 5), (-7, 0, 6), (-7, 0, 7), (-7, 1, -8), (-7, 1, -7), (-7, 1, -6), (-7, 1, -5), (-7, 1, -4), (-7, 1, -3), (-7, 1, -2), (-7, 1, -1), (-7, 1, 0), (-7, 1, 1), (-7, 1, 2), (-7, 1, 3), (-7, 1, 4), (-7, 1, 5), (-7, 1, 6), (-7, 1, 7), (-7, 2, -8), (-7, 2, -7), (-7, 2, -6), (-7, 2, -5), (-7, 2, -4), (-7, 2, -3), (-7, 2, -2), (-7, 2, -1), (-7, 2, 0), (-7, 2, 1), (-7, 2, 2), (-7, 2, 3), (-7, 2, 4), (-7, 2, 5), (-7, 2, 6), (-7, 2, 7), (-7, 3, -8), (-7, 3, -7), (-7, 3, -6), (-7, 3, -5), (-7, 3, -4), (-7, 3, -3), (-7, 3, -2), (-7, 3, -1), (-7, 3, 0), (-7, 3, 1), (-7, 3, 2), (-7, 3, 3), (-7, 3, 4), (-7, 3, 5), (-7, 3, 6), (-7, 3, 7), (-7, 4, -8), (-7, 4, -7), (-7, 4, -6), (-7, 4, -5), (-7, 4, -4), (-7, 4, -3), (-7, 4, -2), (-7, 4, -1), (-7, 4, 0), (-7, 4, 1), (-7, 4, 2), (-7, 4, 3), (-7, 4, 4), (-7, 4, 5), (-7, 4, 6), (-7, 4, 7), (-7, 5, -8), (-7, 5, -7), (-7, 5, -6), (-7, 5, -5), (-7, 5, -4), (-7, 5, -3), (-7, 5, -2), (-7, 5, -1), (-7, 5, 0), (-7, 5, 1), (-7, 5, 2), (-7, 5, 3), (-7, 5, 4), (-7, 5, 5), (-7, 5, 6), (-7, 5, 7), (-7, 6, -8), (-7, 6, -7), (-7, 6, -6), (-7, 6, -5), (-7, 6, -4), (-7, 6, -3), (-7, 6, -2), (-7, 6, -1), (-7, 6, 0), (-7, 6, 1), (-7, 6, 2), (-7, 6, 3), (-7, 6, 4), (-7, 6, 5), (-7, 6, 6), (-7, 6, 7), (-7, 7, -8), (-7, 7, -7), (-7, 7, -6), (-7, 7, -5), (-7, 7, -4), (-7, 7, -3), (-7, 7, -2), (-7, 7, -1), (-7, 7, 0), (-7, 7, 1), (-7, 7, 2), (-7, 7, 3), (-7, 7, 4), (-7, 7, 5), (-7, 7, 6), (-7, 7, 7), (-6, -8, -8), (-6, -8, -7), (-6, -8, -6), (-6, -8, -5), (-6, -8, -4), (-6, -8, -3), (-6, -8, -2), (-6, -8, -1), (-6, -8, 0), (-6, -8, 1), (-6, -8, 2), (-6, -8, 3), (-6, -8, 4), (-6, -8, 5), (-6, -8, 6), (-6, -8, 7), (-6, -7, -8), (-6, -7, -7), (-6, -7, -6), (-6, -7, -5), (-6, -7, -4), (-6, -7, -3), (-6, -7, -2), (-6, -7, -1), (-6, -7, 0), (-6, -7, 1), (-6, -7, 2), (-6, -7, 3), (-6, -7, 4), (-6, -7, 5), (-6, -7, 6), (-6, -7, 7), (-6, -6, -8), (-6, -6, -7), (-6, -6, -6), (-6, -6, -5), (-6, -6, -4), (-6, -6, -3), (-6, -6, -2), (-6, -6, -1), (-6, -6, 0), (-6, -6, 1), (-6, -6, 2), (-6, -6, 3), (-6, -6, 4), (-6, -6, 5), (-6, -6, 6), (-6, -6, 7), (-6, -5, -8), (-6, -5, -7), (-6, -5, -6), (-6, -5, -5), (-6, -5, -4), (-6, -5, -3), (-6, -5, -2), (-6, -5, -1), (-6, -5, 0), (-6, -5, 1), (-6, -5, 2), (-6, -5, 3), (-6, -5, 4), (-6, -5, 5), (-6, -5, 6), (-6, -5, 7), (-6, -4, -8), (-6, -4, -7), (-6, -4, -6), (-6, -4, -5), (-6, -4, -4), (-6, -4, -3), (-6, -4, -2), (-6, -4, -1), (-6, -4, 0), (-6, -4, 1), (-6, -4, 2), (-6, -4, 3), (-6, -4, 4), (-6, -4, 5), (-6, -4, 6), (-6, -4, 7), (-6, -3, -8), (-6, -3, -7), (-6, -3, -6), (-6, -3, -5), (-6, -3, -4), (-6, -3, -3), (-6, -3, -2), (-6, -3, -1), (-6, -3, 0), (-6, -3, 1), (-6, -3, 2), (-6, -3, 3), (-6, -3, 4), (-6, -3, 5), (-6, -3, 6), (-6, -3, 7), (-6, -2, -8), (-6, -2, -7), (-6, -2, -6), (-6, -2, -5), (-6, -2, -4), (-6, -2, -3), (-6, -2, -2), (-6, -2, -1), (-6, -2, 0), (-6, -2, 1), (-6, -2, 2), (-6, -2, 3), (-6, -2, 4), (-6, -2, 5), (-6, -2, 6), (-6, -2, 7), (-6, -1, -8), (-6, -1, -7), (-6, -1, -6), (-6, -1, -5), (-6, -1, -4), (-6, -1, -3), (-6, -1, -2), (-6, -1, -1), (-6, -1, 0), (-6, -1, 1), (-6, -1, 2), (-6, -1, 3), (-6, -1, 4), (-6, -1, 5), (-6, -1, 6), (-6, -1, 7), (-6, 0, -8), (-6, 0, -7), (-6, 0, -6), (-6, 0, -5), (-6, 0, -4), (-6, 0, -3), (-6, 0, -2), (-6, 0, -1), (-6, 0, 0), (-6, 0, 1), (-6, 0, 2), (-6, 0, 3), (-6, 0, 4), (-6, 0, 5), (-6, 0, 6), (-6, 0, 7), (-6, 1, -8), (-6, 1, -7), (-6, 1, -6), (-6, 1, -5), (-6, 1, -4), (-6, 1, -3), (-6, 1, -2), (-6, 1, -1), (-6, 1, 0), (-6, 1, 1), (-6, 1, 2), (-6, 1, 3), (-6, 1, 4), (-6, 1, 5), (-6, 1, 6), (-6, 1, 7), (-6, 2, -8), (-6, 2, -7), (-6, 2, -6), (-6, 2, -5), (-6, 2, -4), (-6, 2, -3), (-6, 2, -2), (-6, 2, -1), (-6, 2, 0), (-6, 2, 1), (-6, 2, 2), (-6, 2, 3), (-6, 2, 4), (-6, 2, 5), (-6, 2, 6), (-6, 2, 7), (-6, 3, -8), (-6, 3, -7), (-6, 3, -6), (-6, 3, -5), (-6, 3, -4), (-6, 3, -3), (-6, 3, -2), (-6, 3, -1), (-6, 3, 0), (-6, 3, 1), (-6, 3, 2), (-6, 3, 3), (-6, 3, 4), (-6, 3, 5), (-6, 3, 6), (-6, 3, 7), (-6, 4, -8), (-6, 4, -7), (-6, 4, -6), (-6, 4, -5), (-6, 4, -4), (-6, 4, -3), (-6, 4, -2), (-6, 4, -1), (-6, 4, 0), (-6, 4, 1), (-6, 4, 2), (-6, 4, 3), (-6, 4, 4), (-6, 4, 5), (-6, 4, 6), (-6, 4, 7), (-6, 5, -8), (-6, 5, -7), (-6, 5, -6), (-6, 5, -5), (-6, 5, -4), (-6, 5, -3), (-6, 5, -2), (-6, 5, -1), (-6, 5, 0), (-6, 5, 1), (-6, 5, 2), (-6, 5, 3), (-6, 5, 4), (-6, 5, 5), (-6, 5, 6), (-6, 5, 7), (-6, 6, -8), (-6, 6, -7), (-6, 6, -6), (-6, 6, -5), (-6, 6, -4), (-6, 6, -3), (-6, 6, -2), (-6, 6, -1), (-6, 6, 0), (-6, 6, 1), (-6, 6, 2), (-6, 6, 3), (-6, 6, 4), (-6, 6, 5), (-6, 6, 6), (-6, 6, 7), (-6, 7, -8), (-6, 7, -7), (-6, 7, -6), (-6, 7, -5), (-6, 7, -4), (-6, 7, -3), (-6, 7, -2), (-6, 7, -1), (-6, 7, 0), (-6, 7, 1), (-6, 7, 2), (-6, 7, 3), (-6, 7, 4), (-6, 7, 5), (-6, 7, 6), (-6, 7, 7), (-5, -8, -8), (-5, -8, -7), (-5, -8, -6), (-5, -8, -5), (-5, -8, -4), (-5, -8, -3), (-5, -8, -2), (-5, -8, -1), (-5, -8, 0), (-5, -8, 1), (-5, -8, 2), (-5, -8, 3), (-5, -8, 4), (-5, -8, 5), (-5, -8, 6), (-5, -8, 7), (-5, -7, -8), (-5, -7, -7), (-5, -7, -6), (-5, -7, -5), (-5, -7, -4), (-5, -7, -3), (-5, -7, -2), (-5, -7, -1), (-5, -7, 0), (-5, -7, 1), (-5, -7, 2), (-5, -7, 3), (-5, -7, 4), (-5, -7, 5), (-5, -7, 6), (-5, -7, 7), (-5, -6, -8), (-5, -6, -7), (-5, -6, -6), (-5, -6, -5), (-5, -6, -4), (-5, -6, -3), (-5, -6, -2), (-5, -6, -1), (-5, -6, 0), (-5, -6, 1), (-5, -6, 2), (-5, -6, 3), (-5, -6, 4), (-5, -6, 5), (-5, -6, 6), (-5, -6, 7), (-5, -5, -8), (-5, -5, -7), (-5, -5, -6), (-5, -5, -5), (-5, -5, -4), (-5, -5, -3), (-5, -5, -2), (-5, -5, -1), (-5, -5, 0), (-5, -5, 1), (-5, -5, 2), (-5, -5, 3), (-5, -5, 4), (-5, -5, 5), (-5, -5, 6), (-5, -5, 7), (-5, -4, -8), (-5, -4, -7), (-5, -4, -6), (-5, -4, -5), (-5, -4, -4), (-5, -4, -3), (-5, -4, -2), (-5, -4, -1), (-5, -4, 0), (-5, -4, 1), (-5, -4, 2), (-5, -4, 3), (-5, -4, 4), (-5, -4, 5), (-5, -4, 6), (-5, -4, 7), (-5, -3, -8), (-5, -3, -7), (-5, -3, -6), (-5, -3, -5), (-5, -3, -4), (-5, -3, -3), (-5, -3, -2), (-5, -3, -1), (-5, -3, 0), (-5, -3, 1), (-5, -3, 2), (-5, -3, 3), (-5, -3, 4), (-5, -3, 5), (-5, -3, 6), (-5, -3, 7), (-5, -2, -8), (-5, -2, -7), (-5, -2, -6), (-5, -2, -5), (-5, -2, -4), (-5, -2, -3), (-5, -2, -2), (-5, -2, -1), (-5, -2, 0), (-5, -2, 1), (-5, -2, 2), (-5, -2, 3), (-5, -2, 4), (-5, -2, 5), (-5, -2, 6), (-5, -2, 7), (-5, -1, -8), (-5, -1, -7), (-5, -1, -6), (-5, -1, -5), (-5, -1, -4), (-5, -1, -3), (-5, -1, -2), (-5, -1, -1), (-5, -1, 0), (-5, -1, 1), (-5, -1, 2), (-5, -1, 3), (-5, -1, 4), (-5, -1, 5), (-5, -1, 6), (-5, -1, 7), (-5, 0, -8), (-5, 0, -7), (-5, 0, -6), (-5, 0, -5), (-5, 0, -4), (-5, 0, -3), (-5, 0, -2), (-5, 0, -1), (-5, 0, 0), (-5, 0, 1), (-5, 0, 2), (-5, 0, 3), (-5, 0, 4), (-5, 0, 5), (-5, 0, 6), (-5, 0, 7), (-5, 1, -8), (-5, 1, -7), (-5, 1, -6), (-5, 1, -5), (-5, 1, -4), (-5, 1, -3), (-5, 1, -2), (-5, 1, -1), (-5, 1, 0), (-5, 1, 1), (-5, 1, 2), (-5, 1, 3), (-5, 1, 4), (-5, 1, 5), (-5, 1, 6), (-5, 1, 7), (-5, 2, -8), (-5, 2, -7), (-5, 2, -6), (-5, 2, -5), (-5, 2, -4), (-5, 2, -3), (-5, 2, -2), (-5, 2, -1), (-5, 2, 0), (-5, 2, 1), (-5, 2, 2), (-5, 2, 3), (-5, 2, 4), (-5, 2, 5), (-5, 2, 6), (-5, 2, 7), (-5, 3, -8), (-5, 3, -7), (-5, 3, -6), (-5, 3, -5), (-5, 3, -4), (-5, 3, -3), (-5, 3, -2), (-5, 3, -1), (-5, 3, 0), (-5, 3, 1), (-5, 3, 2), (-5, 3, 3), (-5, 3, 4), (-5, 3, 5), (-5, 3, 6), (-5, 3, 7), (-5, 4, -8), (-5, 4, -7), (-5, 4, -6), (-5, 4, -5), (-5, 4, -4), (-5, 4, -3), (-5, 4, -2), (-5, 4, -1), (-5, 4, 0), (-5, 4, 1), (-5, 4, 2), (-5, 4, 3), (-5, 4, 4), (-5, 4, 5), (-5, 4, 6), (-5, 4, 7), (-5, 5, -8), (-5, 5, -7), (-5, 5, -6), (-5, 5, -5), (-5, 5, -4), (-5, 5, -3), (-5, 5, -2), (-5, 5, -1), (-5, 5, 0), (-5, 5, 1), (-5, 5, 2), (-5, 5, 3), (-5, 5, 4), (-5, 5, 5), (-5, 5, 6), (-5, 5, 7), (-5, 6, -8), (-5, 6, -7), (-5, 6, -6), (-5, 6, -5), (-5, 6, -4), (-5, 6, -3), (-5, 6, -2), (-5, 6, -1), (-5, 6, 0), (-5, 6, 1), (-5, 6, 2), (-5, 6, 3), (-5, 6, 4), (-5, 6, 5), (-5, 6, 6), (-5, 6, 7), (-5, 7, -8), (-5, 7, -7), (-5, 7, -6), (-5, 7, -5), (-5, 7, -4), (-5, 7, -3), (-5, 7, -2), (-5, 7, -1), (-5, 7, 0), (-5, 7, 1), (-5, 7, 2), (-5, 7, 3), (-5, 7, 4), (-5, 7, 5), (-5, 7, 6), (-5, 7, 7), (-4, -8, -8), (-4, -8, -7), (-4, -8, -6), (-4, -8, -5), (-4, -8, -4), (-4, -8, -3), (-4, -8, -2), (-4, -8, -1), (-4, -8, 0), (-4, -8, 1), (-4, -8, 2), (-4, -8, 3), (-4, -8, 4), (-4, -8, 5), (-4, -8, 6), (-4, -8, 7), (-4, -7, -8), (-4, -7, -7), (-4, -7, -6), (-4, -7, -5), (-4, -7, -4), (-4, -7, -3), (-4, -7, -2), (-4, -7, -1), (-4, -7, 0), (-4, -7, 1), (-4, -7, 2), (-4, -7, 3), (-4, -7, 4), (-4, -7, 5), (-4, -7, 6), (-4, -7, 7), (-4, -6, -8), (-4, -6, -7), (-4, -6, -6), (-4, -6, -5), (-4, -6, -4), (-4, -6, -3), (-4, -6, -2), (-4, -6, -1), (-4, -6, 0), (-4, -6, 1), (-4, -6, 2), (-4, -6, 3), (-4, -6, 4), (-4, -6, 5), (-4, -6, 6), (-4, -6, 7), (-4, -5, -8), (-4, -5, -7), (-4, -5, -6), (-4, -5, -5), (-4, -5, -4), (-4, -5, -3), (-4, -5, -2), (-4, -5, -1), (-4, -5, 0), (-4, -5, 1), (-4, -5, 2), (-4, -5, 3), (-4, -5, 4), (-4, -5, 5), (-4, -5, 6), (-4, -5, 7), (-4, -4, -8), (-4, -4, -7), (-4, -4, -6), (-4, -4, -5), (-4, -4, -4), (-4, -4, -3), (-4, -4, -2), (-4, -4, -1), (-4, -4, 0), (-4, -4, 1), (-4, -4, 2), (-4, -4, 3), (-4, -4, 4), (-4, -4, 5), (-4, -4, 6), (-4, -4, 7), (-4, -3, -8), (-4, -3, -7), (-4, -3, -6), (-4, -3, -5), (-4, -3, -4), (-4, -3, -3), (-4, -3, -2), (-4, -3, -1), (-4, -3, 0), (-4, -3, 1), (-4, -3, 2), (-4, -3, 3), (-4, -3, 4), (-4, -3, 5), (-4, -3, 6), (-4, -3, 7), (-4, -2, -8), (-4, -2, -7), (-4, -2, -6), (-4, -2, -5), (-4, -2, -4), (-4, -2, -3), (-4, -2, -2), (-4, -2, -1), (-4, -2, 0), (-4, -2, 1), (-4, -2, 2), (-4, -2, 3), (-4, -2, 4), (-4, -2, 5), (-4, -2, 6), (-4, -2, 7), (-4, -1, -8), (-4, -1, -7), (-4, -1, -6), (-4, -1, -5), (-4, -1, -4), (-4, -1, -3), (-4, -1, -2), (-4, -1, -1), (-4, -1, 0), (-4, -1, 1), (-4, -1, 2), (-4, -1, 3), (-4, -1, 4), (-4, -1, 5), (-4, -1, 6), (-4, -1, 7), (-4, 0, -8), (-4, 0, -7), (-4, 0, -6), (-4, 0, -5), (-4, 0, -4), (-4, 0, -3), (-4, 0, -2), (-4, 0, -1), (-4, 0, 0), (-4, 0, 1), (-4, 0, 2), (-4, 0, 3), (-4, 0, 4), (-4, 0, 5), (-4, 0, 6), (-4, 0, 7), (-4, 1, -8), (-4, 1, -7), (-4, 1, -6), (-4, 1, -5), (-4, 1, -4), (-4, 1, -3), (-4, 1, -2), (-4, 1, -1), (-4, 1, 0), (-4, 1, 1), (-4, 1, 2), (-4, 1, 3), (-4, 1, 4), (-4, 1, 5), (-4, 1, 6), (-4, 1, 7), (-4, 2, -8), (-4, 2, -7), (-4, 2, -6), (-4, 2, -5), (-4, 2, -4), (-4, 2, -3), (-4, 2, -2), (-4, 2, -1), (-4, 2, 0), (-4, 2, 1), (-4, 2, 2), (-4, 2, 3), (-4, 2, 4), (-4, 2, 5), (-4, 2, 6), (-4, 2, 7), (-4, 3, -8), (-4, 3, -7), (-4, 3, -6), (-4, 3, -5), (-4, 3, -4), (-4, 3, -3), (-4, 3, -2), (-4, 3, -1), (-4, 3, 0), (-4, 3, 1), (-4, 3, 2), (-4, 3, 3), (-4, 3, 4), (-4, 3, 5), (-4, 3, 6), (-4, 3, 7), (-4, 4, -8), (-4, 4, -7), (-4, 4, -6), (-4, 4, -5), (-4, 4, -4), (-4, 4, -3), (-4, 4, -2), (-4, 4, -1), (-4, 4, 0), (-4, 4, 1), (-4, 4, 2), (-4, 4, 3), (-4, 4, 4), (-4, 4, 5), (-4, 4, 6), (-4, 4, 7), (-4, 5, -8), (-4, 5, -7), (-4, 5, -6), (-4, 5, -5), (-4, 5, -4), (-4, 5, -3), (-4, 5, -2), (-4, 5, -1), (-4, 5, 0), (-4, 5, 1), (-4, 5, 2), (-4, 5, 3), (-4, 5, 4), (-4, 5, 5), (-4, 5, 6), (-4, 5, 7), (-4, 6, -8), (-4, 6, -7), (-4, 6, -6), (-4, 6, -5), (-4, 6, -4), (-4, 6, -3), (-4, 6, -2), (-4, 6, -1), (-4, 6, 0), (-4, 6, 1), (-4, 6, 2), (-4, 6, 3), (-4, 6, 4), (-4, 6, 5), (-4, 6, 6), (-4, 6, 7), (-4, 7, -8), (-4, 7, -7), (-4, 7, -6), (-4, 7, -5), (-4, 7, -4), (-4, 7, -3), (-4, 7, -2), (-4, 7, -1), (-4, 7, 0), (-4, 7, 1), (-4, 7, 2), (-4, 7, 3), (-4, 7, 4), (-4, 7, 5), (-4, 7, 6), (-4, 7, 7), (-3, -8, -8), (-3, -8, -7), (-3, -8, -6), (-3, -8, -5), (-3, -8, -4), (-3, -8, -3), (-3, -8, -2), (-3, -8, -1), (-3, -8, 0), (-3, -8, 1), (-3, -8, 2), (-3, -8, 3), (-3, -8, 4), (-3, -8, 5), (-3, -8, 6), (-3, -8, 7), (-3, -7, -8), (-3, -7, -7), (-3, -7, -6), (-3, -7, -5), (-3, -7, -4), (-3, -7, -3), (-3, -7, -2), (-3, -7, -1), (-3, -7, 0), (-3, -7, 1), (-3, -7, 2), (-3, -7, 3), (-3, -7, 4), (-3, -7, 5), (-3, -7, 6), (-3, -7, 7), (-3, -6, -8), (-3, -6, -7), (-3, -6, -6), (-3, -6, -5), (-3, -6, -4), (-3, -6, -3), (-3, -6, -2), (-3, -6, -1), (-3, -6, 0), (-3, -6, 1), (-3, -6, 2), (-3, -6, 3), (-3, -6, 4), (-3, -6, 5), (-3, -6, 6), (-3, -6, 7), (-3, -5, -8), (-3, -5, -7), (-3, -5, -6), (-3, -5, -5), (-3, -5, -4), (-3, -5, -3), (-3, -5, -2), (-3, -5, -1), (-3, -5, 0), (-3, -5, 1), (-3, -5, 2), (-3, -5, 3), (-3, -5, 4), (-3, -5, 5), (-3, -5, 6), (-3, -5, 7), (-3, -4, -8), (-3, -4, -7), (-3, -4, -6), (-3, -4, -5), (-3, -4, -4), (-3, -4, -3), (-3, -4, -2), (-3, -4, -1), (-3, -4, 0), (-3, -4, 1), (-3, -4, 2), (-3, -4, 3), (-3, -4, 4), (-3, -4, 5), (-3, -4, 6), (-3, -4, 7), (-3, -3, -8), (-3, -3, -7), (-3, -3, -6), (-3, -3, -5), (-3, -3, -4), (-3, -3, -3), (-3, -3, -2), (-3, -3, -1), (-3, -3, 0), (-3, -3, 1), (-3, -3, 2), (-3, -3, 3), (-3, -3, 4), (-3, -3, 5), (-3, -3, 6), (-3, -3, 7), (-3, -2, -8), (-3, -2, -7), (-3, -2, -6), (-3, -2, -5), (-3, -2, -4), (-3, -2, -3), (-3, -2, -2), (-3, -2, -1), (-3, -2, 0), (-3, -2, 1), (-3, -2, 2), (-3, -2, 3), (-3, -2, 4), (-3, -2, 5), (-3, -2, 6), (-3, -2, 7), (-3, -1, -8), (-3, -1, -7), (-3, -1, -6), (-3, -1, -5), (-3, -1, -4), (-3, -1, -3), (-3, -1, -2), (-3, -1, -1), (-3, -1, 0), (-3, -1, 1), (-3, -1, 2), (-3, -1, 3), (-3, -1, 4), (-3, -1, 5), (-3, -1, 6), (-3, -1, 7), (-3, 0, -8), (-3, 0, -7), (-3, 0, -6), (-3, 0, -5), (-3, 0, -4), (-3, 0, -3), (-3, 0, -2), (-3, 0, -1), (-3, 0, 0), (-3, 0, 1), (-3, 0, 2), (-3, 0, 3), (-3, 0, 4), (-3, 0, 5), (-3, 0, 6), (-3, 0, 7), (-3, 1, -8), (-3, 1, -7), (-3, 1, -6), (-3, 1, -5), (-3, 1, -4), (-3, 1, -3), (-3, 1, -2), (-3, 1, -1), (-3, 1, 0), (-3, 1, 1), (-3, 1, 2), (-3, 1, 3), (-3, 1, 4), (-3, 1, 5), (-3, 1, 6), (-3, 1, 7), (-3, 2, -8), (-3, 2, -7), (-3, 2, -6), (-3, 2, -5), (-3, 2, -4), (-3, 2, -3), (-3, 2, -2), (-3, 2, -1), (-3, 2, 0), (-3, 2, 1), (-3, 2, 2), (-3, 2, 3), (-3, 2, 4), (-3, 2, 5), (-3, 2, 6), (-3, 2, 7), (-3, 3, -8), (-3, 3, -7), (-3, 3, -6), (-3, 3, -5), (-3, 3, -4), (-3, 3, -3), (-3, 3, -2), (-3, 3, -1), (-3, 3, 0), (-3, 3, 1), (-3, 3, 2), (-3, 3, 3), (-3, 3, 4), (-3, 3, 5), (-3, 3, 6), (-3, 3, 7), (-3, 4, -8), (-3, 4, -7), (-3, 4, -6), (-3, 4, -5), (-3, 4, -4), (-3, 4, -3), (-3, 4, -2), (-3, 4, -1), (-3, 4, 0), (-3, 4, 1), (-3, 4, 2), (-3, 4, 3), (-3, 4, 4), (-3, 4, 5), (-3, 4, 6), (-3, 4, 7), (-3, 5, -8), (-3, 5, -7), (-3, 5, -6), (-3, 5, -5), (-3, 5, -4), (-3, 5, -3), (-3, 5, -2), (-3, 5, -1), (-3, 5, 0), (-3, 5, 1), (-3, 5, 2), (-3, 5, 3), (-3, 5, 4), (-3, 5, 5), (-3, 5, 6), (-3, 5, 7), (-3, 6, -8), (-3, 6, -7), (-3, 6, -6), (-3, 6, -5), (-3, 6, -4), (-3, 6, -3), (-3, 6, -2), (-3, 6, -1), (-3, 6, 0), (-3, 6, 1), (-3, 6, 2), (-3, 6, 3), (-3, 6, 4), (-3, 6, 5), (-3, 6, 6), (-3, 6, 7), (-3, 7, -8), (-3, 7, -7), (-3, 7, -6), (-3, 7, -5), (-3, 7, -4), (-3, 7, -3), (-3, 7, -2), (-3, 7, -1), (-3, 7, 0), (-3, 7, 1), (-3, 7, 2), (-3, 7, 3), (-3, 7, 4), (-3, 7, 5), (-3, 7, 6), (-3, 7, 7), (-2, -8, -8), (-2, -8, -7), (-2, -8, -6), (-2, -8, -5), (-2, -8, -4), (-2, -8, -3), (-2, -8, -2), (-2, -8, -1), (-2, -8, 0), (-2, -8, 1), (-2, -8, 2), (-2, -8, 3), (-2, -8, 4), (-2, -8, 5), (-2, -8, 6), (-2, -8, 7), (-2, -7, -8), (-2, -7, -7), (-2, -7, -6), (-2, -7, -5), (-2, -7, -4), (-2, -7, -3), (-2, -7, -2), (-2, -7, -1), (-2, -7, 0), (-2, -7, 1), (-2, -7, 2), (-2, -7, 3), (-2, -7, 4), (-2, -7, 5), (-2, -7, 6), (-2, -7, 7), (-2, -6, -8), (-2, -6, -7), (-2, -6, -6), (-2, -6, -5), (-2, -6, -4), (-2, -6, -3), (-2, -6, -2), (-2, -6, -1), (-2, -6, 0), (-2, -6, 1), (-2, -6, 2), (-2, -6, 3), (-2, -6, 4), (-2, -6, 5), (-2, -6, 6), (-2, -6, 7), (-2, -5, -8), (-2, -5, -7), (-2, -5, -6), (-2, -5, -5), (-2, -5, -4), (-2, -5, -3), (-2, -5, -2), (-2, -5, -1), (-2, -5, 0), (-2, -5, 1), (-2, -5, 2), (-2, -5, 3), (-2, -5, 4), (-2, -5, 5), (-2, -5, 6), (-2, -5, 7), (-2, -4, -8), (-2, -4, -7), (-2, -4, -6), (-2, -4, -5), (-2, -4, -4), (-2, -4, -3), (-2, -4, -2), (-2, -4, -1), (-2, -4, 0), (-2, -4, 1), (-2, -4, 2), (-2, -4, 3), (-2, -4, 4), (-2, -4, 5), (-2, -4, 6), (-2, -4, 7), (-2, -3, -8), (-2, -3, -7), (-2, -3, -6), (-2, -3, -5), (-2, -3, -4), (-2, -3, -3), (-2, -3, -2), (-2, -3, -1), (-2, -3, 0), (-2, -3, 1), (-2, -3, 2), (-2, -3, 3), (-2, -3, 4), (-2, -3, 5), (-2, -3, 6), (-2, -3, 7), (-2, -2, -8), (-2, -2, -7), (-2, -2, -6), (-2, -2, -5), (-2, -2, -4), (-2, -2, -3), (-2, -2, -2), (-2, -2, -1), (-2, -2, 0), (-2, -2, 1), (-2, -2, 2), (-2, -2, 3), (-2, -2, 4), (-2, -2, 5), (-2, -2, 6), (-2, -2, 7), (-2, -1, -8), (-2, -1, -7), (-2, -1, -6), (-2, -1, -5), (-2, -1, -4), (-2, -1, -3), (-2, -1, -2), (-2, -1, -1), (-2, -1, 0), (-2, -1, 1), (-2, -1, 2), (-2, -1, 3), (-2, -1, 4), (-2, -1, 5), (-2, -1, 6), (-2, -1, 7), (-2, 0, -8), (-2, 0, -7), (-2, 0, -6), (-2, 0, -5), (-2, 0, -4), (-2, 0, -3), (-2, 0, -2), (-2, 0, -1), (-2, 0, 0), (-2, 0, 1), (-2, 0, 2), (-2, 0, 3), (-2, 0, 4), (-2, 0, 5), (-2, 0, 6), (-2, 0, 7), (-2, 1, -8), (-2, 1, -7), (-2, 1, -6), (-2, 1, -5), (-2, 1, -4), (-2, 1, -3), (-2, 1, -2), (-2, 1, -1), (-2, 1, 0), (-2, 1, 1), (-2, 1, 2), (-2, 1, 3), (-2, 1, 4), (-2, 1, 5), (-2, 1, 6), (-2, 1, 7), (-2, 2, -8), (-2, 2, -7), (-2, 2, -6), (-2, 2, -5), (-2, 2, -4), (-2, 2, -3), (-2, 2, -2), (-2, 2, -1), (-2, 2, 0), (-2, 2, 1), (-2, 2, 2), (-2, 2, 3), (-2, 2, 4), (-2, 2, 5), (-2, 2, 6), (-2, 2, 7), (-2, 3, -8), (-2, 3, -7), (-2, 3, -6), (-2, 3, -5), (-2, 3, -4), (-2, 3, -3), (-2, 3, -2), (-2, 3, -1), (-2, 3, 0), (-2, 3, 1), (-2, 3, 2), (-2, 3, 3), (-2, 3, 4), (-2, 3, 5), (-2, 3, 6), (-2, 3, 7), (-2, 4, -8), (-2, 4, -7), (-2, 4, -6), (-2, 4, -5), (-2, 4, -4), (-2, 4, -3), (-2, 4, -2), (-2, 4, -1), (-2, 4, 0), (-2, 4, 1), (-2, 4, 2), (-2, 4, 3), (-2, 4, 4), (-2, 4, 5), (-2, 4, 6), (-2, 4, 7), (-2, 5, -8), (-2, 5, -7), (-2, 5, -6), (-2, 5, -5), (-2, 5, -4), (-2, 5, -3), (-2, 5, -2), (-2, 5, -1), (-2, 5, 0), (-2, 5, 1), (-2, 5, 2), (-2, 5, 3), (-2, 5, 4), (-2, 5, 5), (-2, 5, 6), (-2, 5, 7), (-2, 6, -8), (-2, 6, -7), (-2, 6, -6), (-2, 6, -5), (-2, 6, -4), (-2, 6, -3), (-2, 6, -2), (-2, 6, -1), (-2, 6, 0), (-2, 6, 1), (-2, 6, 2), (-2, 6, 3), (-2, 6, 4), (-2, 6, 5), (-2, 6, 6), (-2, 6, 7), (-2, 7, -8), (-2, 7, -7), (-2, 7, -6), (-2, 7, -5), (-2, 7, -4), (-2, 7, -3), (-2, 7, -2), (-2, 7, -1), (-2, 7, 0), (-2, 7, 1), (-2, 7, 2), (-2, 7, 3), (-2, 7, 4), (-2, 7, 5), (-2, 7, 6), (-2, 7, 7), (-1, -8, -8), (-1, -8, -7), (-1, -8, -6), (-1, -8, -5), (-1, -8, -4), (-1, -8, -3), (-1, -8, -2), (-1, -8, -1), (-1, -8, 0), (-1, -8, 1), (-1, -8, 2), (-1, -8, 3), (-1, -8, 4), (-1, -8, 5), (-1, -8, 6), (-1, -8, 7), (-1, -7, -8), (-1, -7, -7), (-1, -7, -6), (-1, -7, -5), (-1, -7, -4), (-1, -7, -3), (-1, -7, -2), (-1, -7, -1), (-1, -7, 0), (-1, -7, 1), (-1, -7, 2), (-1, -7, 3), (-1, -7, 4), (-1, -7, 5), (-1, -7, 6), (-1, -7, 7), (-1, -6, -8), (-1, -6, -7), (-1, -6, -6), (-1, -6, -5), (-1, -6, -4), (-1, -6, -3), (-1, -6, -2), (-1, -6, -1), (-1, -6, 0), (-1, -6, 1), (-1, -6, 2), (-1, -6, 3), (-1, -6, 4), (-1, -6, 5), (-1, -6, 6), (-1, -6, 7), (-1, -5, -8), (-1, -5, -7), (-1, -5, -6), (-1, -5, -5), (-1, -5, -4), (-1, -5, -3), (-1, -5, -2), (-1, -5, -1), (-1, -5, 0), (-1, -5, 1), (-1, -5, 2), (-1, -5, 3), (-1, -5, 4), (-1, -5, 5), (-1, -5, 6), (-1, -5, 7), (-1, -4, -8), (-1, -4, -7), (-1, -4, -6), (-1, -4, -5), (-1, -4, -4), (-1, -4, -3), (-1, -4, -2), (-1, -4, -1), (-1, -4, 0), (-1, -4, 1), (-1, -4, 2), (-1, -4, 3), (-1, -4, 4), (-1, -4, 5), (-1, -4, 6), (-1, -4, 7), (-1, -3, -8), (-1, -3, -7), (-1, -3, -6), (-1, -3, -5), (-1, -3, -4), (-1, -3, -3), (-1, -3, -2), (-1, -3, -1), (-1, -3, 0), (-1, -3, 1), (-1, -3, 2), (-1, -3, 3), (-1, -3, 4), (-1, -3, 5), (-1, -3, 6), (-1, -3, 7), (-1, -2, -8), (-1, -2, -7), (-1, -2, -6), (-1, -2, -5), (-1, -2, -4), (-1, -2, -3), (-1, -2, -2), (-1, -2, -1), (-1, -2, 0), (-1, -2, 1), (-1, -2, 2), (-1, -2, 3), (-1, -2, 4), (-1, -2, 5), (-1, -2, 6), (-1, -2, 7), (-1, -1, -8), (-1, -1, -7), (-1, -1, -6), (-1, -1, -5), (-1, -1, -4), (-1, -1, -3), (-1, -1, -2), (-1, -1, -1), (-1, -1, 0), (-1, -1, 1), (-1, -1, 2), (-1, -1, 3), (-1, -1, 4), (-1, -1, 5), (-1, -1, 6), (-1, -1, 7), (-1, 0, -8), (-1, 0, -7), (-1, 0, -6), (-1, 0, -5), (-1, 0, -4), (-1, 0, -3), (-1, 0, -2), (-1, 0, -1), (-1, 0, 0), (-1, 0, 1), (-1, 0, 2), (-1, 0, 3), (-1, 0, 4), (-1, 0, 5), (-1, 0, 6), (-1, 0, 7), (-1, 1, -8), (-1, 1, -7), (-1, 1, -6), (-1, 1, -5), (-1, 1, -4), (-1, 1, -3), (-1, 1, -2), (-1, 1, -1), (-1, 1, 0), (-1, 1, 1), (-1, 1, 2), (-1, 1, 3), (-1, 1, 4), (-1, 1, 5), (-1, 1, 6), (-1, 1, 7), (-1, 2, -8), (-1, 2, -7), (-1, 2, -6), (-1, 2, -5), (-1, 2, -4), (-1, 2, -3), (-1, 2, -2), (-1, 2, -1), (-1, 2, 0), (-1, 2, 1), (-1, 2, 2), (-1, 2, 3), (-1, 2, 4), (-1, 2, 5), (-1, 2, 6), (-1, 2, 7), (-1, 3, -8), (-1, 3, -7), (-1, 3, -6), (-1, 3, -5), (-1, 3, -4), (-1, 3, -3), (-1, 3, -2), (-1, 3, -1), (-1, 3, 0), (-1, 3, 1), (-1, 3, 2), (-1, 3, 3), (-1, 3, 4), (-1, 3, 5), (-1, 3, 6), (-1, 3, 7), (-1, 4, -8), (-1, 4, -7), (-1, 4, -6), (-1, 4, -5), (-1, 4, -4), (-1, 4, -3), (-1, 4, -2), (-1, 4, -1), (-1, 4, 0), (-1, 4, 1), (-1, 4, 2), (-1, 4, 3), (-1, 4, 4), (-1, 4, 5), (-1, 4, 6), (-1, 4, 7), (-1, 5, -8), (-1, 5, -7), (-1, 5, -6), (-1, 5, -5), (-1, 5, -4), (-1, 5, -3), (-1, 5, -2), (-1, 5, -1), (-1, 5, 0), (-1, 5, 1), (-1, 5, 2), (-1, 5, 3), (-1, 5, 4), (-1, 5, 5), (-1, 5, 6), (-1, 5, 7), (-1, 6, -8), (-1, 6, -7), (-1, 6, -6), (-1, 6, -5), (-1, 6, -4), (-1, 6, -3), (-1, 6, -2), (-1, 6, -1), (-1, 6, 0), (-1, 6, 1), (-1, 6, 2), (-1, 6, 3), (-1, 6, 4), (-1, 6, 5), (-1, 6, 6), (-1, 6, 7), (-1, 7, -8), (-1, 7, -7), (-1, 7, -6), (-1, 7, -5), (-1, 7, -4), (-1, 7, -3), (-1, 7, -2), (-1, 7, -1), (-1, 7, 0), (-1, 7, 1), (-1, 7, 2), (-1, 7, 3), (-1, 7, 4), (-1, 7, 5), (-1, 7, 6), (-1, 7, 7), (0, -8, -8), (0, -8, -7), (0, -8, -6), (0, -8, -5), (0, -8, -4), (0, -8, -3), (0, -8, -2), (0, -8, -1), (0, -8, 0), (0, -8, 1), (0, -8, 2), (0, -8, 3), (0, -8, 4), (0, -8, 5), (0, -8, 6), (0, -8, 7), (0, -7, -8), (0, -7, -7), (0, -7, -6), (0, -7, -5), (0, -7, -4), (0, -7, -3), (0, -7, -2), (0, -7, -1), (0, -7, 0), (0, -7, 1), (0, -7, 2), (0, -7, 3), (0, -7, 4), (0, -7, 5), (0, -7, 6), (0, -7, 7), (0, -6, -8), (0, -6, -7), (0, -6, -6), (0, -6, -5), (0, -6, -4), (0, -6, -3), (0, -6, -2), (0, -6, -1), (0, -6, 0), (0, -6, 1), (0, -6, 2), (0, -6, 3), (0, -6, 4), (0, -6, 5), (0, -6, 6), (0, -6, 7), (0, -5, -8), (0, -5, -7), (0, -5, -6), (0, -5, -5), (0, -5, -4), (0, -5, -3), (0, -5, -2), (0, -5, -1), (0, -5, 0), (0, -5, 1), (0, -5, 2), (0, -5, 3), (0, -5, 4), (0, -5, 5), (0, -5, 6), (0, -5, 7), (0, -4, -8), (0, -4, -7), (0, -4, -6), (0, -4, -5), (0, -4, -4), (0, -4, -3), (0, -4, -2), (0, -4, -1), (0, -4, 0), (0, -4, 1), (0, -4, 2), (0, -4, 3), (0, -4, 4), (0, -4, 5), (0, -4, 6), (0, -4, 7), (0, -3, -8), (0, -3, -7), (0, -3, -6), (0, -3, -5), (0, -3, -4), (0, -3, -3), (0, -3, -2), (0, -3, -1), (0, -3, 0), (0, -3, 1), (0, -3, 2), (0, -3, 3), (0, -3, 4), (0, -3, 5), (0, -3, 6), (0, -3, 7), (0, -2, -8), (0, -2, -7), (0, -2, -6), (0, -2, -5), (0, -2, -4), (0, -2, -3), (0, -2, -2), (0, -2, -1), (0, -2, 0), (0, -2, 1), (0, -2, 2), (0, -2, 3), (0, -2, 4), (0, -2, 5), (0, -2, 6), (0, -2, 7), (0, -1, -8), (0, -1, -7), (0, -1, -6), (0, -1, -5), (0, -1, -4), (0, -1, -3), (0, -1, -2), (0, -1, -1), (0, -1, 0), (0, -1, 1), (0, -1, 2), (0, -1, 3), (0, -1, 4), (0, -1, 5), (0, -1, 6), (0, -1, 7), (0, 0, -8), (0, 0, -7), (0, 0, -6), (0, 0, -5), (0, 0, -4), (0, 0, -3), (0, 0, -2), (0, 0, -1), (0, 0, 0), (0, 0, 1), (0, 0, 2), (0, 0, 3), (0, 0, 4), (0, 0, 5), (0, 0, 6), (0, 0, 7), (0, 1, -8), (0, 1, -7), (0, 1, -6), (0, 1, -5), (0, 1, -4), (0, 1, -3), (0, 1, -2), (0, 1, -1), (0, 1, 0), (0, 1, 1), (0, 1, 2), (0, 1, 3), (0, 1, 4), (0, 1, 5), (0, 1, 6), (0, 1, 7), (0, 2, -8), (0, 2, -7), (0, 2, -6), (0, 2, -5), (0, 2, -4), (0, 2, -3), (0, 2, -2), (0, 2, -1), (0, 2, 0), (0, 2, 1), (0, 2, 2), (0, 2, 3), (0, 2, 4), (0, 2, 5), (0, 2, 6), (0, 2, 7), (0, 3, -8), (0, 3, -7), (0, 3, -6), (0, 3, -5), (0, 3, -4), (0, 3, -3), (0, 3, -2), (0, 3, -1), (0, 3, 0), (0, 3, 1), (0, 3, 2), (0, 3, 3), (0, 3, 4), (0, 3, 5), (0, 3, 6), (0, 3, 7), (0, 4, -8), (0, 4, -7), (0, 4, -6), (0, 4, -5), (0, 4, -4), (0, 4, -3), (0, 4, -2), (0, 4, -1), (0, 4, 0), (0, 4, 1), (0, 4, 2), (0, 4, 3), (0, 4, 4), (0, 4, 5), (0, 4, 6), (0, 4, 7), (0, 5, -8), (0, 5, -7), (0, 5, -6), (0, 5, -5), (0, 5, -4), (0, 5, -3), (0, 5, -2), (0, 5, -1), (0, 5, 0), (0, 5, 1), (0, 5, 2), (0, 5, 3), (0, 5, 4), (0, 5, 5), (0, 5, 6), (0, 5, 7), (0, 6, -8), (0, 6, -7), (0, 6, -6), (0, 6, -5), (0, 6, -4), (0, 6, -3), (0, 6, -2), (0, 6, -1), (0, 6, 0), (0, 6, 1), (0, 6, 2), (0, 6, 3), (0, 6, 4), (0, 6, 5), (0, 6, 6), (0, 6, 7), (0, 7, -8), (0, 7, -7), (0, 7, -6), (0, 7, -5), (0, 7, -4), (0, 7, -3), (0, 7, -2), (0, 7, -1), (0, 7, 0), (0, 7, 1), (0, 7, 2), (0, 7, 3), (0, 7, 4), (0, 7, 5), (0, 7, 6), (0, 7, 7), (1, -8, -8), (1, -8, -7), (1, -8, -6), (1, -8, -5), (1, -8, -4), (1, -8, -3), (1, -8, -2), (1, -8, -1), (1, -8, 0), (1, -8, 1), (1, -8, 2), (1, -8, 3), (1, -8, 4), (1, -8, 5), (1, -8, 6), (1, -8, 7), (1, -7, -8), (1, -7, -7), (1, -7, -6), (1, -7, -5), (1, -7, -4), (1, -7, -3), (1, -7, -2), (1, -7, -1), (1, -7, 0), (1, -7, 1), (1, -7, 2), (1, -7, 3), (1, -7, 4), (1, -7, 5), (1, -7, 6), (1, -7, 7), (1, -6, -8), (1, -6, -7), (1, -6, -6), (1, -6, -5), (1, -6, -4), (1, -6, -3), (1, -6, -2), (1, -6, -1), (1, -6, 0), (1, -6, 1), (1, -6, 2), (1, -6, 3), (1, -6, 4), (1, -6, 5), (1, -6, 6), (1, -6, 7), (1, -5, -8), (1, -5, -7), (1, -5, -6), (1, -5, -5), (1, -5, -4), (1, -5, -3), (1, -5, -2), (1, -5, -1), (1, -5, 0), (1, -5, 1), (1, -5, 2), (1, -5, 3), (1, -5, 4), (1, -5, 5), (1, -5, 6), (1, -5, 7), (1, -4, -8), (1, -4, -7), (1, -4, -6), (1, -4, -5), (1, -4, -4), (1, -4, -3), (1, -4, -2), (1, -4, -1), (1, -4, 0), (1, -4, 1), (1, -4, 2), (1, -4, 3), (1, -4, 4), (1, -4, 5), (1, -4, 6), (1, -4, 7), (1, -3, -8), (1, -3, -7), (1, -3, -6), (1, -3, -5), (1, -3, -4), (1, -3, -3), (1, -3, -2), (1, -3, -1), (1, -3, 0), (1, -3, 1), (1, -3, 2), (1, -3, 3), (1, -3, 4), (1, -3, 5), (1, -3, 6), (1, -3, 7), (1, -2, -8), (1, -2, -7), (1, -2, -6), (1, -2, -5), (1, -2, -4), (1, -2, -3), (1, -2, -2), (1, -2, -1), (1, -2, 0), (1, -2, 1), (1, -2, 2), (1, -2, 3), (1, -2, 4), (1, -2, 5), (1, -2, 6), (1, -2, 7), (1, -1, -8), (1, -1, -7), (1, -1, -6), (1, -1, -5), (1, -1, -4), (1, -1, -3), (1, -1, -2), (1, -1, -1), (1, -1, 0), (1, -1, 1), (1, -1, 2), (1, -1, 3), (1, -1, 4), (1, -1, 5), (1, -1, 6), (1, -1, 7), (1, 0, -8), (1, 0, -7), (1, 0, -6), (1, 0, -5), (1, 0, -4), (1, 0, -3), (1, 0, -2), (1, 0, -1), (1, 0, 0), (1, 0, 1), (1, 0, 2), (1, 0, 3), (1, 0, 4), (1, 0, 5), (1, 0, 6), (1, 0, 7), (1, 1, -8), (1, 1, -7), (1, 1, -6), (1, 1, -5), (1, 1, -4), (1, 1, -3), (1, 1, -2), (1, 1, -1), (1, 1, 0), (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 1, 4), (1, 1, 5), (1, 1, 6), (1, 1, 7), (1, 2, -8), (1, 2, -7), (1, 2, -6), (1, 2, -5), (1, 2, -4), (1, 2, -3), (1, 2, -2), (1, 2, -1), (1, 2, 0), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 2, 6), (1, 2, 7), (1, 3, -8), (1, 3, -7), (1, 3, -6), (1, 3, -5), (1, 3, -4), (1, 3, -3), (1, 3, -2), (1, 3, -1), (1, 3, 0), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 3, 4), (1, 3, 5), (1, 3, 6), (1, 3, 7), (1, 4, -8), (1, 4, -7), (1, 4, -6), (1, 4, -5), (1, 4, -4), (1, 4, -3), (1, 4, -2), (1, 4, -1), (1, 4, 0), (1, 4, 1), (1, 4, 2), (1, 4, 3), (1, 4, 4), (1, 4, 5), (1, 4, 6), (1, 4, 7), (1, 5, -8), (1, 5, -7), (1, 5, -6), (1, 5, -5), (1, 5, -4), (1, 5, -3), (1, 5, -2), (1, 5, -1), (1, 5, 0), (1, 5, 1), (1, 5, 2), (1, 5, 3), (1, 5, 4), (1, 5, 5), (1, 5, 6), (1, 5, 7), (1, 6, -8), (1, 6, -7), (1, 6, -6), (1, 6, -5), (1, 6, -4), (1, 6, -3), (1, 6, -2), (1, 6, -1), (1, 6, 0), (1, 6, 1), (1, 6, 2), (1, 6, 3), (1, 6, 4), (1, 6, 5), (1, 6, 6), (1, 6, 7), (1, 7, -8), (1, 7, -7), (1, 7, -6), (1, 7, -5), (1, 7, -4), (1, 7, -3), (1, 7, -2), (1, 7, -1), (1, 7, 0), (1, 7, 1), (1, 7, 2), (1, 7, 3), (1, 7, 4), (1, 7, 5), (1, 7, 6), (1, 7, 7), (2, -8, -8), (2, -8, -7), (2, -8, -6), (2, -8, -5), (2, -8, -4), (2, -8, -3), (2, -8, -2), (2, -8, -1), (2, -8, 0), (2, -8, 1), (2, -8, 2), (2, -8, 3), (2, -8, 4), (2, -8, 5), (2, -8, 6), (2, -8, 7), (2, -7, -8), (2, -7, -7), (2, -7, -6), (2, -7, -5), (2, -7, -4), (2, -7, -3), (2, -7, -2), (2, -7, -1), (2, -7, 0), (2, -7, 1), (2, -7, 2), (2, -7, 3), (2, -7, 4), (2, -7, 5), (2, -7, 6), (2, -7, 7), (2, -6, -8), (2, -6, -7), (2, -6, -6), (2, -6, -5), (2, -6, -4), (2, -6, -3), (2, -6, -2), (2, -6, -1), (2, -6, 0), (2, -6, 1), (2, -6, 2), (2, -6, 3), (2, -6, 4), (2, -6, 5), (2, -6, 6), (2, -6, 7), (2, -5, -8), (2, -5, -7), (2, -5, -6), (2, -5, -5), (2, -5, -4), (2, -5, -3), (2, -5, -2), (2, -5, -1), (2, -5, 0), (2, -5, 1), (2, -5, 2), (2, -5, 3), (2, -5, 4), (2, -5, 5), (2, -5, 6), (2, -5, 7), (2, -4, -8), (2, -4, -7), (2, -4, -6), (2, -4, -5), (2, -4, -4), (2, -4, -3), (2, -4, -2), (2, -4, -1), (2, -4, 0), (2, -4, 1), (2, -4, 2), (2, -4, 3), (2, -4, 4), (2, -4, 5), (2, -4, 6), (2, -4, 7), (2, -3, -8), (2, -3, -7), (2, -3, -6), (2, -3, -5), (2, -3, -4), (2, -3, -3), (2, -3, -2), (2, -3, -1), (2, -3, 0), (2, -3, 1), (2, -3, 2), (2, -3, 3), (2, -3, 4), (2, -3, 5), (2, -3, 6), (2, -3, 7), (2, -2, -8), (2, -2, -7), (2, -2, -6), (2, -2, -5), (2, -2, -4), (2, -2, -3), (2, -2, -2), (2, -2, -1), (2, -2, 0), (2, -2, 1), (2, -2, 2), (2, -2, 3), (2, -2, 4), (2, -2, 5), (2, -2, 6), (2, -2, 7), (2, -1, -8), (2, -1, -7), (2, -1, -6), (2, -1, -5), (2, -1, -4), (2, -1, -3), (2, -1, -2), (2, -1, -1), (2, -1, 0), (2, -1, 1), (2, -1, 2), (2, -1, 3), (2, -1, 4), (2, -1, 5), (2, -1, 6), (2, -1, 7), (2, 0, -8), (2, 0, -7), (2, 0, -6), (2, 0, -5), (2, 0, -4), (2, 0, -3), (2, 0, -2), (2, 0, -1), (2, 0, 0), (2, 0, 1), (2, 0, 2), (2, 0, 3), (2, 0, 4), (2, 0, 5), (2, 0, 6), (2, 0, 7), (2, 1, -8), (2, 1, -7), (2, 1, -6), (2, 1, -5), (2, 1, -4), (2, 1, -3), (2, 1, -2), (2, 1, -1), (2, 1, 0), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 1, 4), (2, 1, 5), (2, 1, 6), (2, 1, 7), (2, 2, -8), (2, 2, -7), (2, 2, -6), (2, 2, -5), (2, 2, -4), (2, 2, -3), (2, 2, -2), (2, 2, -1), (2, 2, 0), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 2, 4), (2, 2, 5), (2, 2, 6), (2, 2, 7), (2, 3, -8), (2, 3, -7), (2, 3, -6), (2, 3, -5), (2, 3, -4), (2, 3, -3), (2, 3, -2), (2, 3, -1), (2, 3, 0), (2, 3, 1), (2, 3, 2), (2, 3, 3), (2, 3, 4), (2, 3, 5), (2, 3, 6), (2, 3, 7), (2, 4, -8), (2, 4, -7), (2, 4, -6), (2, 4, -5), (2, 4, -4), (2, 4, -3), (2, 4, -2), (2, 4, -1), (2, 4, 0), (2, 4, 1), (2, 4, 2), (2, 4, 3), (2, 4, 4), (2, 4, 5), (2, 4, 6), (2, 4, 7), (2, 5, -8), (2, 5, -7), (2, 5, -6), (2, 5, -5), (2, 5, -4), (2, 5, -3), (2, 5, -2), (2, 5, -1), (2, 5, 0), (2, 5, 1), (2, 5, 2), (2, 5, 3), (2, 5, 4), (2, 5, 5), (2, 5, 6), (2, 5, 7), (2, 6, -8), (2, 6, -7), (2, 6, -6), (2, 6, -5), (2, 6, -4), (2, 6, -3), (2, 6, -2), (2, 6, -1), (2, 6, 0), (2, 6, 1), (2, 6, 2), (2, 6, 3), (2, 6, 4), (2, 6, 5), (2, 6, 6), (2, 6, 7), (2, 7, -8), (2, 7, -7), (2, 7, -6), (2, 7, -5), (2, 7, -4), (2, 7, -3), (2, 7, -2), (2, 7, -1), (2, 7, 0), (2, 7, 1), (2, 7, 2), (2, 7, 3), (2, 7, 4), (2, 7, 5), (2, 7, 6), (2, 7, 7), (3, -8, -8), (3, -8, -7), (3, -8, -6), (3, -8, -5), (3, -8, -4), (3, -8, -3), (3, -8, -2), (3, -8, -1), (3, -8, 0), (3, -8, 1), (3, -8, 2), (3, -8, 3), (3, -8, 4), (3, -8, 5), (3, -8, 6), (3, -8, 7), (3, -7, -8), (3, -7, -7), (3, -7, -6), (3, -7, -5), (3, -7, -4), (3, -7, -3), (3, -7, -2), (3, -7, -1), (3, -7, 0), (3, -7, 1), (3, -7, 2), (3, -7, 3), (3, -7, 4), (3, -7, 5), (3, -7, 6), (3, -7, 7), (3, -6, -8), (3, -6, -7), (3, -6, -6), (3, -6, -5), (3, -6, -4), (3, -6, -3), (3, -6, -2), (3, -6, -1), (3, -6, 0), (3, -6, 1), (3, -6, 2), (3, -6, 3), (3, -6, 4), (3, -6, 5), (3, -6, 6), (3, -6, 7), (3, -5, -8), (3, -5, -7), (3, -5, -6), (3, -5, -5), (3, -5, -4), (3, -5, -3), (3, -5, -2), (3, -5, -1), (3, -5, 0), (3, -5, 1), (3, -5, 2), (3, -5, 3), (3, -5, 4), (3, -5, 5), (3, -5, 6), (3, -5, 7), (3, -4, -8), (3, -4, -7), (3, -4, -6), (3, -4, -5), (3, -4, -4), (3, -4, -3), (3, -4, -2), (3, -4, -1), (3, -4, 0), (3, -4, 1), (3, -4, 2), (3, -4, 3), (3, -4, 4), (3, -4, 5), (3, -4, 6), (3, -4, 7), (3, -3, -8), (3, -3, -7), (3, -3, -6), (3, -3, -5), (3, -3, -4), (3, -3, -3), (3, -3, -2), (3, -3, -1), (3, -3, 0), (3, -3, 1), (3, -3, 2), (3, -3, 3), (3, -3, 4), (3, -3, 5), (3, -3, 6), (3, -3, 7), (3, -2, -8), (3, -2, -7), (3, -2, -6), (3, -2, -5), (3, -2, -4), (3, -2, -3), (3, -2, -2), (3, -2, -1), (3, -2, 0), (3, -2, 1), (3, -2, 2), (3, -2, 3), (3, -2, 4), (3, -2, 5), (3, -2, 6), (3, -2, 7), (3, -1, -8), (3, -1, -7), (3, -1, -6), (3, -1, -5), (3, -1, -4), (3, -1, -3), (3, -1, -2), (3, -1, -1), (3, -1, 0), (3, -1, 1), (3, -1, 2), (3, -1, 3), (3, -1, 4), (3, -1, 5), (3, -1, 6), (3, -1, 7), (3, 0, -8), (3, 0, -7), (3, 0, -6), (3, 0, -5), (3, 0, -4), (3, 0, -3), (3, 0, -2), (3, 0, -1), (3, 0, 0), (3, 0, 1), (3, 0, 2), (3, 0, 3), (3, 0, 4), (3, 0, 5), (3, 0, 6), (3, 0, 7), (3, 1, -8), (3, 1, -7), (3, 1, -6), (3, 1, -5), (3, 1, -4), (3, 1, -3), (3, 1, -2), (3, 1, -1), (3, 1, 0), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 1, 4), (3, 1, 5), (3, 1, 6), (3, 1, 7), (3, 2, -8), (3, 2, -7), (3, 2, -6), (3, 2, -5), (3, 2, -4), (3, 2, -3), (3, 2, -2), (3, 2, -1), (3, 2, 0), (3, 2, 1), (3, 2, 2), (3, 2, 3), (3, 2, 4), (3, 2, 5), (3, 2, 6), (3, 2, 7), (3, 3, -8), (3, 3, -7), (3, 3, -6), (3, 3, -5), (3, 3, -4), (3, 3, -3), (3, 3, -2), (3, 3, -1), (3, 3, 0), (3, 3, 1), (3, 3, 2), (3, 3, 3), (3, 3, 4), (3, 3, 5), (3, 3, 6), (3, 3, 7), (3, 4, -8), (3, 4, -7), (3, 4, -6), (3, 4, -5), (3, 4, -4), (3, 4, -3), (3, 4, -2), (3, 4, -1), (3, 4, 0), (3, 4, 1), (3, 4, 2), (3, 4, 3), (3, 4, 4), (3, 4, 5), (3, 4, 6), (3, 4, 7), (3, 5, -8), (3, 5, -7), (3, 5, -6), (3, 5, -5), (3, 5, -4), (3, 5, -3), (3, 5, -2), (3, 5, -1), (3, 5, 0), (3, 5, 1), (3, 5, 2), (3, 5, 3), (3, 5, 4), (3, 5, 5), (3, 5, 6), (3, 5, 7), (3, 6, -8), (3, 6, -7), (3, 6, -6), (3, 6, -5), (3, 6, -4), (3, 6, -3), (3, 6, -2), (3, 6, -1), (3, 6, 0), (3, 6, 1), (3, 6, 2), (3, 6, 3), (3, 6, 4), (3, 6, 5), (3, 6, 6), (3, 6, 7), (3, 7, -8), (3, 7, -7), (3, 7, -6), (3, 7, -5), (3, 7, -4), (3, 7, -3), (3, 7, -2), (3, 7, -1), (3, 7, 0), (3, 7, 1), (3, 7, 2), (3, 7, 3), (3, 7, 4), (3, 7, 5), (3, 7, 6), (3, 7, 7), (4, -8, -8), (4, -8, -7), (4, -8, -6), (4, -8, -5), (4, -8, -4), (4, -8, -3), (4, -8, -2), (4, -8, -1), (4, -8, 0), (4, -8, 1), (4, -8, 2), (4, -8, 3), (4, -8, 4), (4, -8, 5), (4, -8, 6), (4, -8, 7), (4, -7, -8), (4, -7, -7), (4, -7, -6), (4, -7, -5), (4, -7, -4), (4, -7, -3), (4, -7, -2), (4, -7, -1), (4, -7, 0), (4, -7, 1), (4, -7, 2), (4, -7, 3), (4, -7, 4), (4, -7, 5), (4, -7, 6), (4, -7, 7), (4, -6, -8), (4, -6, -7), (4, -6, -6), (4, -6, -5), (4, -6, -4), (4, -6, -3), (4, -6, -2), (4, -6, -1), (4, -6, 0), (4, -6, 1), (4, -6, 2), (4, -6, 3), (4, -6, 4), (4, -6, 5), (4, -6, 6), (4, -6, 7), (4, -5, -8), (4, -5, -7), (4, -5, -6), (4, -5, -5), (4, -5, -4), (4, -5, -3), (4, -5, -2), (4, -5, -1), (4, -5, 0), (4, -5, 1), (4, -5, 2), (4, -5, 3), (4, -5, 4), (4, -5, 5), (4, -5, 6), (4, -5, 7), (4, -4, -8), (4, -4, -7), (4, -4, -6), (4, -4, -5), (4, -4, -4), (4, -4, -3), (4, -4, -2), (4, -4, -1), (4, -4, 0), (4, -4, 1), (4, -4, 2), (4, -4, 3), (4, -4, 4), (4, -4, 5), (4, -4, 6), (4, -4, 7), (4, -3, -8), (4, -3, -7), (4, -3, -6), (4, -3, -5), (4, -3, -4), (4, -3, -3), (4, -3, -2), (4, -3, -1), (4, -3, 0), (4, -3, 1), (4, -3, 2), (4, -3, 3), (4, -3, 4), (4, -3, 5), (4, -3, 6), (4, -3, 7), (4, -2, -8), (4, -2, -7), (4, -2, -6), (4, -2, -5), (4, -2, -4), (4, -2, -3), (4, -2, -2), (4, -2, -1), (4, -2, 0), (4, -2, 1), (4, -2, 2), (4, -2, 3), (4, -2, 4), (4, -2, 5), (4, -2, 6), (4, -2, 7), (4, -1, -8), (4, -1, -7), (4, -1, -6), (4, -1, -5), (4, -1, -4), (4, -1, -3), (4, -1, -2), (4, -1, -1), (4, -1, 0), (4, -1, 1), (4, -1, 2), (4, -1, 3), (4, -1, 4), (4, -1, 5), (4, -1, 6), (4, -1, 7), (4, 0, -8), (4, 0, -7), (4, 0, -6), (4, 0, -5), (4, 0, -4), (4, 0, -3), (4, 0, -2), (4, 0, -1), (4, 0, 0), (4, 0, 1), (4, 0, 2), (4, 0, 3), (4, 0, 4), (4, 0, 5), (4, 0, 6), (4, 0, 7), (4, 1, -8), (4, 1, -7), (4, 1, -6), (4, 1, -5), (4, 1, -4), (4, 1, -3), (4, 1, -2), (4, 1, -1), (4, 1, 0), (4, 1, 1), (4, 1, 2), (4, 1, 3), (4, 1, 4), (4, 1, 5), (4, 1, 6), (4, 1, 7), (4, 2, -8), (4, 2, -7), (4, 2, -6), (4, 2, -5), (4, 2, -4), (4, 2, -3), (4, 2, -2), (4, 2, -1), (4, 2, 0), (4, 2, 1), (4, 2, 2), (4, 2, 3), (4, 2, 4), (4, 2, 5), (4, 2, 6), (4, 2, 7), (4, 3, -8), (4, 3, -7), (4, 3, -6), (4, 3, -5), (4, 3, -4), (4, 3, -3), (4, 3, -2), (4, 3, -1), (4, 3, 0), (4, 3, 1), (4, 3, 2), (4, 3, 3), (4, 3, 4), (4, 3, 5), (4, 3, 6), (4, 3, 7), (4, 4, -8), (4, 4, -7), (4, 4, -6), (4, 4, -5), (4, 4, -4), (4, 4, -3), (4, 4, -2), (4, 4, -1), (4, 4, 0), (4, 4, 1), (4, 4, 2), (4, 4, 3), (4, 4, 4), (4, 4, 5), (4, 4, 6), (4, 4, 7), (4, 5, -8), (4, 5, -7), (4, 5, -6), (4, 5, -5), (4, 5, -4), (4, 5, -3), (4, 5, -2), (4, 5, -1), (4, 5, 0), (4, 5, 1), (4, 5, 2), (4, 5, 3), (4, 5, 4), (4, 5, 5), (4, 5, 6), (4, 5, 7), (4, 6, -8), (4, 6, -7), (4, 6, -6), (4, 6, -5), (4, 6, -4), (4, 6, -3), (4, 6, -2), (4, 6, -1), (4, 6, 0), (4, 6, 1), (4, 6, 2), (4, 6, 3), (4, 6, 4), (4, 6, 5), (4, 6, 6), (4, 6, 7), (4, 7, -8), (4, 7, -7), (4, 7, -6), (4, 7, -5), (4, 7, -4), (4, 7, -3), (4, 7, -2), (4, 7, -1), (4, 7, 0), (4, 7, 1), (4, 7, 2), (4, 7, 3), (4, 7, 4), (4, 7, 5), (4, 7, 6), (4, 7, 7), (5, -8, -8), (5, -8, -7), (5, -8, -6), (5, -8, -5), (5, -8, -4), (5, -8, -3), (5, -8, -2), (5, -8, -1), (5, -8, 0), (5, -8, 1), (5, -8, 2), (5, -8, 3), (5, -8, 4), (5, -8, 5), (5, -8, 6), (5, -8, 7), (5, -7, -8), (5, -7, -7), (5, -7, -6), (5, -7, -5), (5, -7, -4), (5, -7, -3), (5, -7, -2), (5, -7, -1), (5, -7, 0), (5, -7, 1), (5, -7, 2), (5, -7, 3), (5, -7, 4), (5, -7, 5), (5, -7, 6), (5, -7, 7), (5, -6, -8), (5, -6, -7), (5, -6, -6), (5, -6, -5), (5, -6, -4), (5, -6, -3), (5, -6, -2), (5, -6, -1), (5, -6, 0), (5, -6, 1), (5, -6, 2), (5, -6, 3), (5, -6, 4), (5, -6, 5), (5, -6, 6), (5, -6, 7), (5, -5, -8), (5, -5, -7), (5, -5, -6), (5, -5, -5), (5, -5, -4), (5, -5, -3), (5, -5, -2), (5, -5, -1), (5, -5, 0), (5, -5, 1), (5, -5, 2), (5, -5, 3), (5, -5, 4), (5, -5, 5), (5, -5, 6), (5, -5, 7), (5, -4, -8), (5, -4, -7), (5, -4, -6), (5, -4, -5), (5, -4, -4), (5, -4, -3), (5, -4, -2), (5, -4, -1), (5, -4, 0), (5, -4, 1), (5, -4, 2), (5, -4, 3), (5, -4, 4), (5, -4, 5), (5, -4, 6), (5, -4, 7), (5, -3, -8), (5, -3, -7), (5, -3, -6), (5, -3, -5), (5, -3, -4), (5, -3, -3), (5, -3, -2), (5, -3, -1), (5, -3, 0), (5, -3, 1), (5, -3, 2), (5, -3, 3), (5, -3, 4), (5, -3, 5), (5, -3, 6), (5, -3, 7), (5, -2, -8), (5, -2, -7), (5, -2, -6), (5, -2, -5), (5, -2, -4), (5, -2, -3), (5, -2, -2), (5, -2, -1), (5, -2, 0), (5, -2, 1), (5, -2, 2), (5, -2, 3), (5, -2, 4), (5, -2, 5), (5, -2, 6), (5, -2, 7), (5, -1, -8), (5, -1, -7), (5, -1, -6), (5, -1, -5), (5, -1, -4), (5, -1, -3), (5, -1, -2), (5, -1, -1), (5, -1, 0), (5, -1, 1), (5, -1, 2), (5, -1, 3), (5, -1, 4), (5, -1, 5), (5, -1, 6), (5, -1, 7), (5, 0, -8), (5, 0, -7), (5, 0, -6), (5, 0, -5), (5, 0, -4), (5, 0, -3), (5, 0, -2), (5, 0, -1), (5, 0, 0), (5, 0, 1), (5, 0, 2), (5, 0, 3), (5, 0, 4), (5, 0, 5), (5, 0, 6), (5, 0, 7), (5, 1, -8), (5, 1, -7), (5, 1, -6), (5, 1, -5), (5, 1, -4), (5, 1, -3), (5, 1, -2), (5, 1, -1), (5, 1, 0), (5, 1, 1), (5, 1, 2), (5, 1, 3), (5, 1, 4), (5, 1, 5), (5, 1, 6), (5, 1, 7), (5, 2, -8), (5, 2, -7), (5, 2, -6), (5, 2, -5), (5, 2, -4), (5, 2, -3), (5, 2, -2), (5, 2, -1), (5, 2, 0), (5, 2, 1), (5, 2, 2), (5, 2, 3), (5, 2, 4), (5, 2, 5), (5, 2, 6), (5, 2, 7), (5, 3, -8), (5, 3, -7), (5, 3, -6), (5, 3, -5), (5, 3, -4), (5, 3, -3), (5, 3, -2), (5, 3, -1), (5, 3, 0), (5, 3, 1), (5, 3, 2), (5, 3, 3), (5, 3, 4), (5, 3, 5), (5, 3, 6), (5, 3, 7), (5, 4, -8), (5, 4, -7), (5, 4, -6), (5, 4, -5), (5, 4, -4), (5, 4, -3), (5, 4, -2), (5, 4, -1), (5, 4, 0), (5, 4, 1), (5, 4, 2), (5, 4, 3), (5, 4, 4), (5, 4, 5), (5, 4, 6), (5, 4, 7), (5, 5, -8), (5, 5, -7), (5, 5, -6), (5, 5, -5), (5, 5, -4), (5, 5, -3), (5, 5, -2), (5, 5, -1), (5, 5, 0), (5, 5, 1), (5, 5, 2), (5, 5, 3), (5, 5, 4), (5, 5, 5), (5, 5, 6), (5, 5, 7), (5, 6, -8), (5, 6, -7), (5, 6, -6), (5, 6, -5), (5, 6, -4), (5, 6, -3), (5, 6, -2), (5, 6, -1), (5, 6, 0), (5, 6, 1), (5, 6, 2), (5, 6, 3), (5, 6, 4), (5, 6, 5), (5, 6, 6), (5, 6, 7), (5, 7, -8), (5, 7, -7), (5, 7, -6), (5, 7, -5), (5, 7, -4), (5, 7, -3), (5, 7, -2), (5, 7, -1), (5, 7, 0), (5, 7, 1), (5, 7, 2), (5, 7, 3), (5, 7, 4), (5, 7, 5), (5, 7, 6), (5, 7, 7), (6, -8, -8), (6, -8, -7), (6, -8, -6), (6, -8, -5), (6, -8, -4), (6, -8, -3), (6, -8, -2), (6, -8, -1), (6, -8, 0), (6, -8, 1), (6, -8, 2), (6, -8, 3), (6, -8, 4), (6, -8, 5), (6, -8, 6), (6, -8, 7), (6, -7, -8), (6, -7, -7), (6, -7, -6), (6, -7, -5), (6, -7, -4), (6, -7, -3), (6, -7, -2), (6, -7, -1), (6, -7, 0), (6, -7, 1), (6, -7, 2), (6, -7, 3), (6, -7, 4), (6, -7, 5), (6, -7, 6), (6, -7, 7), (6, -6, -8), (6, -6, -7), (6, -6, -6), (6, -6, -5), (6, -6, -4), (6, -6, -3), (6, -6, -2), (6, -6, -1), (6, -6, 0), (6, -6, 1), (6, -6, 2), (6, -6, 3), (6, -6, 4), (6, -6, 5), (6, -6, 6), (6, -6, 7), (6, -5, -8), (6, -5, -7), (6, -5, -6), (6, -5, -5), (6, -5, -4), (6, -5, -3), (6, -5, -2), (6, -5, -1), (6, -5, 0), (6, -5, 1), (6, -5, 2), (6, -5, 3), (6, -5, 4), (6, -5, 5), (6, -5, 6), (6, -5, 7), (6, -4, -8), (6, -4, -7), (6, -4, -6), (6, -4, -5), (6, -4, -4), (6, -4, -3), (6, -4, -2), (6, -4, -1), (6, -4, 0), (6, -4, 1), (6, -4, 2), (6, -4, 3), (6, -4, 4), (6, -4, 5), (6, -4, 6), (6, -4, 7), (6, -3, -8), (6, -3, -7), (6, -3, -6), (6, -3, -5), (6, -3, -4), (6, -3, -3), (6, -3, -2), (6, -3, -1), (6, -3, 0), (6, -3, 1), (6, -3, 2), (6, -3, 3), (6, -3, 4), (6, -3, 5), (6, -3, 6), (6, -3, 7), (6, -2, -8), (6, -2, -7), (6, -2, -6), (6, -2, -5), (6, -2, -4), (6, -2, -3), (6, -2, -2), (6, -2, -1), (6, -2, 0), (6, -2, 1), (6, -2, 2), (6, -2, 3), (6, -2, 4), (6, -2, 5), (6, -2, 6), (6, -2, 7), (6, -1, -8), (6, -1, -7), (6, -1, -6), (6, -1, -5), (6, -1, -4), (6, -1, -3), (6, -1, -2), (6, -1, -1), (6, -1, 0), (6, -1, 1), (6, -1, 2), (6, -1, 3), (6, -1, 4), (6, -1, 5), (6, -1, 6), (6, -1, 7), (6, 0, -8), (6, 0, -7), (6, 0, -6), (6, 0, -5), (6, 0, -4), (6, 0, -3), (6, 0, -2), (6, 0, -1), (6, 0, 0), (6, 0, 1), (6, 0, 2), (6, 0, 3), (6, 0, 4), (6, 0, 5), (6, 0, 6), (6, 0, 7), (6, 1, -8), (6, 1, -7), (6, 1, -6), (6, 1, -5), (6, 1, -4), (6, 1, -3), (6, 1, -2), (6, 1, -1), (6, 1, 0), (6, 1, 1), (6, 1, 2), (6, 1, 3), (6, 1, 4), (6, 1, 5), (6, 1, 6), (6, 1, 7), (6, 2, -8), (6, 2, -7), (6, 2, -6), (6, 2, -5), (6, 2, -4), (6, 2, -3), (6, 2, -2), (6, 2, -1), (6, 2, 0), (6, 2, 1), (6, 2, 2), (6, 2, 3), (6, 2, 4), (6, 2, 5), (6, 2, 6), (6, 2, 7), (6, 3, -8), (6, 3, -7), (6, 3, -6), (6, 3, -5), (6, 3, -4), (6, 3, -3), (6, 3, -2), (6, 3, -1), (6, 3, 0), (6, 3, 1), (6, 3, 2), (6, 3, 3), (6, 3, 4), (6, 3, 5), (6, 3, 6), (6, 3, 7), (6, 4, -8), (6, 4, -7), (6, 4, -6), (6, 4, -5), (6, 4, -4), (6, 4, -3), (6, 4, -2), (6, 4, -1), (6, 4, 0), (6, 4, 1), (6, 4, 2), (6, 4, 3), (6, 4, 4), (6, 4, 5), (6, 4, 6), (6, 4, 7), (6, 5, -8), (6, 5, -7), (6, 5, -6), (6, 5, -5), (6, 5, -4), (6, 5, -3), (6, 5, -2), (6, 5, -1), (6, 5, 0), (6, 5, 1), (6, 5, 2), (6, 5, 3), (6, 5, 4), (6, 5, 5), (6, 5, 6), (6, 5, 7), (6, 6, -8), (6, 6, -7), (6, 6, -6), (6, 6, -5), (6, 6, -4), (6, 6, -3), (6, 6, -2), (6, 6, -1), (6, 6, 0), (6, 6, 1), (6, 6, 2), (6, 6, 3), (6, 6, 4), (6, 6, 5), (6, 6, 6), (6, 6, 7), (6, 7, -8), (6, 7, -7), (6, 7, -6), (6, 7, -5), (6, 7, -4), (6, 7, -3), (6, 7, -2), (6, 7, -1), (6, 7, 0), (6, 7, 1), (6, 7, 2), (6, 7, 3), (6, 7, 4), (6, 7, 5), (6, 7, 6), (6, 7, 7), (7, -8, -8), (7, -8, -7), (7, -8, -6), (7, -8, -5), (7, -8, -4), (7, -8, -3), (7, -8, -2), (7, -8, -1), (7, -8, 0), (7, -8, 1), (7, -8, 2), (7, -8, 3), (7, -8, 4), (7, -8, 5), (7, -8, 6), (7, -8, 7), (7, -7, -8), (7, -7, -7), (7, -7, -6), (7, -7, -5), (7, -7, -4), (7, -7, -3), (7, -7, -2), (7, -7, -1), (7, -7, 0), (7, -7, 1), (7, -7, 2), (7, -7, 3), (7, -7, 4), (7, -7, 5), (7, -7, 6), (7, -7, 7), (7, -6, -8), (7, -6, -7), (7, -6, -6), (7, -6, -5), (7, -6, -4), (7, -6, -3), (7, -6, -2), (7, -6, -1), (7, -6, 0), (7, -6, 1), (7, -6, 2), (7, -6, 3), (7, -6, 4), (7, -6, 5), (7, -6, 6), (7, -6, 7), (7, -5, -8), (7, -5, -7), (7, -5, -6), (7, -5, -5), (7, -5, -4), (7, -5, -3), (7, -5, -2), (7, -5, -1), (7, -5, 0), (7, -5, 1), (7, -5, 2), (7, -5, 3), (7, -5, 4), (7, -5, 5), (7, -5, 6), (7, -5, 7), (7, -4, -8), (7, -4, -7), (7, -4, -6), (7, -4, -5), (7, -4, -4), (7, -4, -3), (7, -4, -2), (7, -4, -1), (7, -4, 0), (7, -4, 1), (7, -4, 2), (7, -4, 3), (7, -4, 4), (7, -4, 5), (7, -4, 6), (7, -4, 7), (7, -3, -8), (7, -3, -7), (7, -3, -6), (7, -3, -5), (7, -3, -4), (7, -3, -3), (7, -3, -2), (7, -3, -1), (7, -3, 0), (7, -3, 1), (7, -3, 2), (7, -3, 3), (7, -3, 4), (7, -3, 5), (7, -3, 6), (7, -3, 7), (7, -2, -8), (7, -2, -7), (7, -2, -6), (7, -2, -5), (7, -2, -4), (7, -2, -3), (7, -2, -2), (7, -2, -1), (7, -2, 0), (7, -2, 1), (7, -2, 2), (7, -2, 3), (7, -2, 4), (7, -2, 5), (7, -2, 6), (7, -2, 7), (7, -1, -8), (7, -1, -7), (7, -1, -6), (7, -1, -5), (7, -1, -4), (7, -1, -3), (7, -1, -2), (7, -1, -1), (7, -1, 0), (7, -1, 1), (7, -1, 2), (7, -1, 3), (7, -1, 4), (7, -1, 5), (7, -1, 6), (7, -1, 7), (7, 0, -8), (7, 0, -7), (7, 0, -6), (7, 0, -5), (7, 0, -4), (7, 0, -3), (7, 0, -2), (7, 0, -1), (7, 0, 0), (7, 0, 1), (7, 0, 2), (7, 0, 3), (7, 0, 4), (7, 0, 5), (7, 0, 6), (7, 0, 7), (7, 1, -8), (7, 1, -7), (7, 1, -6), (7, 1, -5), (7, 1, -4), (7, 1, -3), (7, 1, -2), (7, 1, -1), (7, 1, 0), (7, 1, 1), (7, 1, 2), (7, 1, 3), (7, 1, 4), (7, 1, 5), (7, 1, 6), (7, 1, 7), (7, 2, -8), (7, 2, -7), (7, 2, -6), (7, 2, -5), (7, 2, -4), (7, 2, -3), (7, 2, -2), (7, 2, -1), (7, 2, 0), (7, 2, 1), (7, 2, 2), (7, 2, 3), (7, 2, 4), (7, 2, 5), (7, 2, 6), (7, 2, 7), (7, 3, -8), (7, 3, -7), (7, 3, -6), (7, 3, -5), (7, 3, -4), (7, 3, -3), (7, 3, -2), (7, 3, -1), (7, 3, 0), (7, 3, 1), (7, 3, 2), (7, 3, 3), (7, 3, 4), (7, 3, 5), (7, 3, 6), (7, 3, 7), (7, 4, -8), (7, 4, -7), (7, 4, -6), (7, 4, -5), (7, 4, -4), (7, 4, -3), (7, 4, -2), (7, 4, -1), (7, 4, 0), (7, 4, 1), (7, 4, 2), (7, 4, 3), (7, 4, 4), (7, 4, 5), (7, 4, 6), (7, 4, 7), (7, 5, -8), (7, 5, -7), (7, 5, -6), (7, 5, -5), (7, 5, -4), (7, 5, -3), (7, 5, -2), (7, 5, -1), (7, 5, 0), (7, 5, 1), (7, 5, 2), (7, 5, 3), (7, 5, 4), (7, 5, 5), (7, 5, 6), (7, 5, 7), (7, 6, -8), (7, 6, -7), (7, 6, -6), (7, 6, -5), (7, 6, -4), (7, 6, -3), (7, 6, -2), (7, 6, -1), (7, 6, 0), (7, 6, 1), (7, 6, 2), (7, 6, 3), (7, 6, 4), (7, 6, 5), (7, 6, 6), (7, 6, 7), (7, 7, -8), (7, 7, -7), (7, 7, -6), (7, 7, -5), (7, 7, -4), (7, 7, -3), (7, 7, -2), (7, 7, -1), (7, 7, 0), (7, 7, 1), (7, 7, 2), (7, 7, 3), (7, 7, 4), (7, 7, 5), (7, 7, 6), (7, 7, 7)]\n" + ] + }, + { + "data": { + "text/plain": [ + "array([[18432. , 0. , 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 15664.5, 0. , ..., 0. , 0. , 0. ],\n", + " [ 0. , 0. , 13448. , ..., 0. , 0. , 0. ],\n", + " ...,\n", + " [ 0. , 0. , 0. , ..., 7564.5, 0. , 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 8978. , 0. ],\n", + " [ 0. , 0. , 0. , ..., 0. , 0. , 10804.5]])" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "print(\"k_point_grid\", k_point_grid)\n", + "k_point_grid_array = [np.array(k) for k in k_point_grid]\n", + "\n", + "kenetic(k_point_grid_array)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j, ...,\n", + " -1.79013274e-02+9.57478273e-03j, -1.94518241e-02-1.72180856e-04j,\n", + " -1.62581774e-02-9.06965256e-03j],\n", + " [ 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j, ...,\n", + " -1.15874897e-02+1.76998735e-02j, -1.79013274e-02+9.57478273e-03j,\n", + " -1.94518241e-02-1.72180856e-04j],\n", + " [ 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j, ...,\n", + " -1.75100748e-03+2.19378855e-02j, -1.15874897e-02+1.76998735e-02j,\n", + " -1.79013274e-02+9.57478273e-03j],\n", + " ...,\n", + " [-1.79013274e-02-9.57478273e-03j, -1.15874897e-02-1.76998735e-02j,\n", + " -1.75100748e-03-2.19378855e-02j, ...,\n", + " 0.00000000e+00+0.00000000e+00j, 1.10280277e+01+6.02463900e+00j,\n", + " 1.69740975e+00+2.64355906e+00j],\n", + " [-1.94518241e-02+1.72180856e-04j, -1.79013274e-02-9.57478273e-03j,\n", + " -1.15874897e-02-1.76998735e-02j, ...,\n", + " 1.10280277e+01-6.02463900e+00j, 0.00000000e+00+0.00000000e+00j,\n", + " 1.10280277e+01+6.02463900e+00j],\n", + " [-1.62581774e-02+9.06965256e-03j, -1.94518241e-02+1.72180856e-04j,\n", + " -1.79013274e-02-9.57478273e-03j, ...,\n", + " 1.69740975e+00-2.64355906e+00j, 1.10280277e+01-6.02463900e+00j,\n", + " 0.00000000e+00+0.00000000e+00j]])" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cell_area = 1.0\n", + "r_pos = [np.array([0.5, 0.5, 0.5])]\n", + "elec_nuc_potential(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [], + "source": [ + "H = plane_wave_hamiltonian(k_point_grid_array, cell_area, r_pos)" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "EigResult(eigenvalues=array([18432.22138309+4.18385584e-15j, 15677.54328129+5.17909258e-11j,\n", + " 15664.81454373+2.69496088e-12j, ...,\n", + " 1243.40770297-2.12774243e-13j, 834.19237979-4.71956263e-13j,\n", + " 1243.43708311+4.24947778e-13j]), eigenvectors=array([[ 9.99964420e-01+0.00000000e+00j, -7.00916462e-03-3.82912408e-03j,\n", + " 2.92523721e-05+7.91573244e-05j, ...,\n", + " -6.74179451e-19+3.10452846e-18j, -5.31928882e-19-2.05009148e-19j,\n", + " -4.50864009e-18-9.48092593e-19j],\n", + " [ 4.02606712e-03-2.19945049e-03j, 5.77195558e-01+0.00000000e+00j,\n", + " -6.75036419e-03-5.88259126e-03j, ...,\n", + " 1.41684468e-08+1.91225791e-08j, 9.94196445e-08-4.49690621e-08j,\n", + " -1.60964667e-08+1.60065446e-08j],\n", + " [ 3.55145099e-04-5.53105720e-04j, 4.08080205e-03-2.22935232e-03j,\n", + " -1.81512837e-05-3.99831398e-06j, ...,\n", + " 9.76982364e-09+4.51767428e-09j, 2.03353095e-07-2.69720291e-07j,\n", + " 4.05554375e-09-1.36802398e-08j],\n", + " ...,\n", + " [-1.84968628e-06-9.89331340e-07j, -2.93578135e-06-4.48440169e-06j,\n", + " 9.97805939e-07-7.22871150e-06j, ...,\n", + " 2.75759453e-07-7.47363732e-07j, 1.83306135e-06+1.16557026e-06j,\n", + " -8.26555074e-07-1.74922656e-07j],\n", + " [-2.30630510e-06+2.04146194e-08j, -5.47081270e-06-2.92614295e-06j,\n", + " -2.99943850e-06-7.90072838e-06j, ...,\n", + " -1.37122095e-09-9.29146989e-09j, 6.48372370e-07+4.30961714e-08j,\n", + " -5.01139552e-08+1.50337361e-08j],\n", + " [-2.37725124e-06+1.32615374e-06j, -8.10373916e-06+7.17315117e-08j,\n", + " -8.39918115e-06-7.18964364e-06j, ...,\n", + " -1.37539921e-17-2.38921649e-17j, 8.01210968e-18+2.33220615e-18j,\n", + " -1.96116344e-17+4.37542221e-19j]]))" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "eig(H)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/grid1q/examples/wavefunctions/plane_waves.ipynb b/grid1q/examples/wavefunctions/plane_waves.ipynb new file mode 100644 index 0000000..4c36899 --- /dev/null +++ b/grid1q/examples/wavefunctions/plane_waves.ipynb @@ -0,0 +1,387 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Plane Waves" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 1D" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "k_min = -16\n", + "k_max = 15\n", + "k_point_grid = np.arange(k_min, k_max+1)\n", + "k_dim = len(k_point_grid)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "coeff_dict = {(k,): coeff for k, coeff in zip(k_point_grid, np.random.rand(k_dim**1))}" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "n_space_qubits = 6\n", + "space_dim = 2**n_space_qubits\n", + "num_points = space_dim\n", + "L=1\n", + "R = np.array([np.linspace(0,L, num_points)]).T" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(64, 1)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "R.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [], + "source": [ + "from grid1q.wavefunctions.plane_wave import plane_wave, plane_wave_renorm\n", + "\n", + "pw = plane_wave(coeff_dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "pw_r = pw(R)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([ 0.5554723 +0.00000000e+00j, 0.50008993+2.62912424e-02j,\n", + " 0.35401515+3.90895037e-02j, 0.16887746+3.06244110e-02j,\n", + " 0.00606469+2.10375076e-03j, -0.08830976-3.68831903e-02j,\n", + " -0.10046658-7.25108007e-02j, -0.0509024 -9.25564279e-02j,\n", + " 0.01866005-9.13567910e-02j, 0.0662959 -7.17370493e-02j,\n", + " 0.06863356-4.31643610e-02j, 0.02891365-1.71027476e-02j,\n", + " -0.02836891-1.80251788e-03j, -0.07235056+1.04419743e-03j,\n", + " -0.08208314-3.69497637e-03j, -0.05612582-7.76290230e-03j,\n", + " -0.01135353-4.14788588e-03j, 0.02741293+9.18938794e-03j,\n", + " 0.04090854+2.83360362e-02j, 0.02494424+4.55793582e-02j,\n", + " -0.00857918+5.34571047e-02j, -0.039022 +4.85313706e-02j,\n", + " -0.04834208+3.29394460e-02j, -0.03033445+1.30337470e-02j,\n", + " 0.00680652-3.98339966e-03j, 0.0454731 -1.34774131e-02j,\n", + " 0.06816532-1.49773960e-02j, 0.06644419-1.12245307e-02j,\n", + " 0.04483152-5.49434999e-03j, 0.01798393+9.52614087e-04j,\n", + " 0.00291263+9.54699282e-03j, 0.0103452 +2.26845157e-02j,\n", + " 0.03948177+4.06824888e-02j, 0.07848587+5.95276064e-02j,\n", + " 0.11016644+7.12696566e-02j, 0.11991147+6.74292466e-02j,\n", + " 0.10210959+4.38740284e-02j, 0.06227633+4.41426519e-03j,\n", + " 0.01425431-3.93107800e-02j, -0.02591677-7.22601971e-02j,\n", + " -0.04656604-8.29240039e-02j, -0.04459141-6.92960486e-02j,\n", + " -0.02576919-4.05523830e-02j, -0.00142371-1.31109918e-02j,\n", + " 0.01682201-2.67424618e-03j, 0.02188833-1.61418508e-02j,\n", + " 0.01374185-4.76238807e-02j, -0.00125621-8.08692460e-02j,\n", + " -0.01364481-9.71660306e-02j, -0.01527835-8.48589923e-02j,\n", + " -0.00299155-4.56434746e-02j, 0.01996134+5.67205355e-03j,\n", + " 0.0452197 +4.79373755e-02j, 0.06278406+6.36093763e-02j,\n", + " 0.06517252+4.68880702e-02j, 0.05052764+6.01652108e-03j,\n", + " 0.02337418-4.12237926e-02j, -0.00728687-7.62816875e-02j,\n", + " -0.031729 -8.82366925e-02j, -0.04347539-7.76148572e-02j,\n", + " -0.04177262-5.40469719e-02j, -0.03149253-2.95779924e-02j,\n", + " -0.02053832-1.16885856e-02j, -0.01595557-1.79032932e-17j])" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pw_renorm = plane_wave_renorm(pw_r)\n", + "pw_renorm\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 2D" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(-16, -16), (-16, -15), (-16, -14), (-16, -13), (-16, -12), (-16, -11), (-16, -10), (-16, -9), (-16, -8), (-16, -7), (-16, -6), (-16, -5), (-16, -4), (-16, -3), (-16, -2), (-16, -1), (-16, 0), (-16, 1), (-16, 2), (-16, 3), (-16, 4), (-16, 5), (-16, 6), (-16, 7), (-16, 8), (-16, 9), (-16, 10), (-16, 11), (-16, 12), (-16, 13), (-16, 14), (-16, 15), (-15, -16), (-15, -15), (-15, -14), (-15, -13), (-15, -12), (-15, -11), (-15, -10), (-15, -9), (-15, -8), (-15, -7), (-15, -6), (-15, -5), (-15, -4), (-15, -3), (-15, -2), (-15, -1), (-15, 0), (-15, 1), (-15, 2), (-15, 3), (-15, 4), (-15, 5), (-15, 6), (-15, 7), (-15, 8), (-15, 9), (-15, 10), (-15, 11), (-15, 12), (-15, 13), (-15, 14), (-15, 15), (-14, -16), (-14, -15), (-14, -14), (-14, -13), (-14, -12), (-14, -11), (-14, -10), (-14, -9), (-14, -8), (-14, -7), (-14, -6), (-14, -5), (-14, -4), (-14, -3), (-14, -2), (-14, -1), (-14, 0), (-14, 1), (-14, 2), (-14, 3), (-14, 4), (-14, 5), (-14, 6), (-14, 7), (-14, 8), (-14, 9), (-14, 10), (-14, 11), (-14, 12), (-14, 13), (-14, 14), (-14, 15), (-13, -16), (-13, -15), (-13, -14), (-13, -13), (-13, -12), (-13, -11), (-13, -10), (-13, -9), (-13, -8), (-13, -7), (-13, -6), (-13, -5), (-13, -4), (-13, -3), (-13, -2), (-13, -1), (-13, 0), (-13, 1), (-13, 2), (-13, 3), (-13, 4), (-13, 5), (-13, 6), (-13, 7), (-13, 8), (-13, 9), (-13, 10), (-13, 11), (-13, 12), (-13, 13), (-13, 14), (-13, 15), (-12, -16), (-12, -15), (-12, -14), (-12, -13), (-12, -12), (-12, -11), (-12, -10), (-12, -9), (-12, -8), (-12, -7), (-12, -6), (-12, -5), (-12, -4), (-12, -3), (-12, -2), (-12, -1), (-12, 0), (-12, 1), (-12, 2), (-12, 3), (-12, 4), (-12, 5), (-12, 6), (-12, 7), (-12, 8), (-12, 9), (-12, 10), (-12, 11), (-12, 12), (-12, 13), (-12, 14), (-12, 15), (-11, -16), (-11, -15), (-11, -14), (-11, -13), (-11, -12), (-11, -11), (-11, -10), (-11, -9), (-11, -8), (-11, -7), (-11, -6), (-11, -5), (-11, -4), (-11, -3), (-11, -2), (-11, -1), (-11, 0), (-11, 1), (-11, 2), (-11, 3), (-11, 4), (-11, 5), (-11, 6), (-11, 7), (-11, 8), (-11, 9), (-11, 10), (-11, 11), (-11, 12), (-11, 13), (-11, 14), (-11, 15), (-10, -16), (-10, -15), (-10, -14), (-10, -13), (-10, -12), (-10, -11), (-10, -10), (-10, -9), (-10, -8), (-10, -7), (-10, -6), (-10, -5), (-10, -4), (-10, -3), (-10, -2), (-10, -1), (-10, 0), (-10, 1), (-10, 2), (-10, 3), (-10, 4), (-10, 5), (-10, 6), (-10, 7), (-10, 8), (-10, 9), (-10, 10), (-10, 11), (-10, 12), (-10, 13), (-10, 14), (-10, 15), (-9, -16), (-9, -15), (-9, -14), (-9, -13), (-9, -12), (-9, -11), (-9, -10), (-9, -9), (-9, -8), (-9, -7), (-9, -6), (-9, -5), (-9, -4), (-9, -3), (-9, -2), (-9, -1), (-9, 0), (-9, 1), (-9, 2), (-9, 3), (-9, 4), (-9, 5), (-9, 6), (-9, 7), (-9, 8), (-9, 9), (-9, 10), (-9, 11), (-9, 12), (-9, 13), (-9, 14), (-9, 15), (-8, -16), (-8, -15), (-8, -14), (-8, -13), (-8, -12), (-8, -11), (-8, -10), (-8, -9), (-8, -8), (-8, -7), (-8, -6), (-8, -5), (-8, -4), (-8, -3), (-8, -2), (-8, -1), (-8, 0), (-8, 1), (-8, 2), (-8, 3), (-8, 4), (-8, 5), (-8, 6), (-8, 7), (-8, 8), (-8, 9), (-8, 10), (-8, 11), (-8, 12), (-8, 13), (-8, 14), (-8, 15), (-7, -16), (-7, -15), (-7, -14), (-7, -13), (-7, -12), (-7, -11), (-7, -10), (-7, -9), (-7, -8), (-7, -7), (-7, -6), (-7, -5), (-7, -4), (-7, -3), (-7, -2), (-7, -1), (-7, 0), (-7, 1), (-7, 2), (-7, 3), (-7, 4), (-7, 5), (-7, 6), (-7, 7), (-7, 8), (-7, 9), (-7, 10), (-7, 11), (-7, 12), (-7, 13), (-7, 14), (-7, 15), (-6, -16), (-6, -15), (-6, -14), (-6, -13), (-6, -12), (-6, -11), (-6, -10), (-6, -9), (-6, -8), (-6, -7), (-6, -6), (-6, -5), (-6, -4), (-6, -3), (-6, -2), (-6, -1), (-6, 0), (-6, 1), (-6, 2), (-6, 3), (-6, 4), (-6, 5), (-6, 6), (-6, 7), (-6, 8), (-6, 9), (-6, 10), (-6, 11), (-6, 12), (-6, 13), (-6, 14), (-6, 15), (-5, -16), (-5, -15), (-5, -14), (-5, -13), (-5, -12), (-5, -11), (-5, -10), (-5, -9), (-5, -8), (-5, -7), (-5, -6), (-5, -5), (-5, -4), (-5, -3), (-5, -2), (-5, -1), (-5, 0), (-5, 1), (-5, 2), (-5, 3), (-5, 4), (-5, 5), (-5, 6), (-5, 7), (-5, 8), (-5, 9), (-5, 10), (-5, 11), (-5, 12), (-5, 13), (-5, 14), (-5, 15), (-4, -16), (-4, -15), (-4, -14), (-4, -13), (-4, -12), (-4, -11), (-4, -10), (-4, -9), (-4, -8), (-4, -7), (-4, -6), (-4, -5), (-4, -4), (-4, -3), (-4, -2), (-4, -1), (-4, 0), (-4, 1), (-4, 2), (-4, 3), (-4, 4), (-4, 5), (-4, 6), (-4, 7), (-4, 8), (-4, 9), (-4, 10), (-4, 11), (-4, 12), (-4, 13), (-4, 14), (-4, 15), (-3, -16), (-3, -15), (-3, -14), (-3, -13), (-3, -12), (-3, -11), (-3, -10), (-3, -9), (-3, -8), (-3, -7), (-3, -6), (-3, -5), (-3, -4), (-3, -3), (-3, -2), (-3, -1), (-3, 0), (-3, 1), (-3, 2), (-3, 3), (-3, 4), (-3, 5), (-3, 6), (-3, 7), (-3, 8), (-3, 9), (-3, 10), (-3, 11), (-3, 12), (-3, 13), (-3, 14), (-3, 15), (-2, -16), (-2, -15), (-2, -14), (-2, -13), (-2, -12), (-2, -11), (-2, -10), (-2, -9), (-2, -8), (-2, -7), (-2, -6), (-2, -5), (-2, -4), (-2, -3), (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), (-2, 3), (-2, 4), (-2, 5), (-2, 6), (-2, 7), (-2, 8), (-2, 9), (-2, 10), (-2, 11), (-2, 12), (-2, 13), (-2, 14), (-2, 15), (-1, -16), (-1, -15), (-1, -14), (-1, -13), (-1, -12), (-1, -11), (-1, -10), (-1, -9), (-1, -8), (-1, -7), (-1, -6), (-1, -5), (-1, -4), (-1, -3), (-1, -2), (-1, -1), (-1, 0), (-1, 1), (-1, 2), (-1, 3), (-1, 4), (-1, 5), (-1, 6), (-1, 7), (-1, 8), (-1, 9), (-1, 10), (-1, 11), (-1, 12), (-1, 13), (-1, 14), (-1, 15), (0, -16), (0, -15), (0, -14), (0, -13), (0, -12), (0, -11), (0, -10), (0, -9), (0, -8), (0, -7), (0, -6), (0, -5), (0, -4), (0, -3), (0, -2), (0, -1), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9), (0, 10), (0, 11), (0, 12), (0, 13), (0, 14), (0, 15), (1, -16), (1, -15), (1, -14), (1, -13), (1, -12), (1, -11), (1, -10), (1, -9), (1, -8), (1, -7), (1, -6), (1, -5), (1, -4), (1, -3), (1, -2), (1, -1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (1, 11), (1, 12), (1, 13), (1, 14), (1, 15), (2, -16), (2, -15), (2, -14), (2, -13), (2, -12), (2, -11), (2, -10), (2, -9), (2, -8), (2, -7), (2, -6), (2, -5), (2, -4), (2, -3), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (2, 10), (2, 11), (2, 12), (2, 13), (2, 14), (2, 15), (3, -16), (3, -15), (3, -14), (3, -13), (3, -12), (3, -11), (3, -10), (3, -9), (3, -8), (3, -7), (3, -6), (3, -5), (3, -4), (3, -3), (3, -2), (3, -1), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11), (3, 12), (3, 13), (3, 14), (3, 15), (4, -16), (4, -15), (4, -14), (4, -13), (4, -12), (4, -11), (4, -10), (4, -9), (4, -8), (4, -7), (4, -6), (4, -5), (4, -4), (4, -3), (4, -2), (4, -1), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (4, 7), (4, 8), (4, 9), (4, 10), (4, 11), (4, 12), (4, 13), (4, 14), (4, 15), (5, -16), (5, -15), (5, -14), (5, -13), (5, -12), (5, -11), (5, -10), (5, -9), (5, -8), (5, -7), (5, -6), (5, -5), (5, -4), (5, -3), (5, -2), (5, -1), (5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 7), (5, 8), (5, 9), (5, 10), (5, 11), (5, 12), (5, 13), (5, 14), (5, 15), (6, -16), (6, -15), (6, -14), (6, -13), (6, -12), (6, -11), (6, -10), (6, -9), (6, -8), (6, -7), (6, -6), (6, -5), (6, -4), (6, -3), (6, -2), (6, -1), (6, 0), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6), (6, 7), (6, 8), (6, 9), (6, 10), (6, 11), (6, 12), (6, 13), (6, 14), (6, 15), (7, -16), (7, -15), (7, -14), (7, -13), (7, -12), (7, -11), (7, -10), (7, -9), (7, -8), (7, -7), (7, -6), (7, -5), (7, -4), (7, -3), (7, -2), (7, -1), (7, 0), (7, 1), (7, 2), (7, 3), (7, 4), (7, 5), (7, 6), (7, 7), (7, 8), (7, 9), (7, 10), (7, 11), (7, 12), (7, 13), (7, 14), (7, 15), (8, -16), (8, -15), (8, -14), (8, -13), (8, -12), (8, -11), (8, -10), (8, -9), (8, -8), (8, -7), (8, -6), (8, -5), (8, -4), (8, -3), (8, -2), (8, -1), (8, 0), (8, 1), (8, 2), (8, 3), (8, 4), (8, 5), (8, 6), (8, 7), (8, 8), (8, 9), (8, 10), (8, 11), (8, 12), (8, 13), (8, 14), (8, 15), (9, -16), (9, -15), (9, -14), (9, -13), (9, -12), (9, -11), (9, -10), (9, -9), (9, -8), (9, -7), (9, -6), (9, -5), (9, -4), (9, -3), (9, -2), (9, -1), (9, 0), (9, 1), (9, 2), (9, 3), (9, 4), (9, 5), (9, 6), (9, 7), (9, 8), (9, 9), (9, 10), (9, 11), (9, 12), (9, 13), (9, 14), (9, 15), (10, -16), (10, -15), (10, -14), (10, -13), (10, -12), (10, -11), (10, -10), (10, -9), (10, -8), (10, -7), (10, -6), (10, -5), (10, -4), (10, -3), (10, -2), (10, -1), (10, 0), (10, 1), (10, 2), (10, 3), (10, 4), (10, 5), (10, 6), (10, 7), (10, 8), (10, 9), (10, 10), (10, 11), (10, 12), (10, 13), (10, 14), (10, 15), (11, -16), (11, -15), (11, -14), (11, -13), (11, -12), (11, -11), (11, -10), (11, -9), (11, -8), (11, -7), (11, -6), (11, -5), (11, -4), (11, -3), (11, -2), (11, -1), (11, 0), (11, 1), (11, 2), (11, 3), (11, 4), (11, 5), (11, 6), (11, 7), (11, 8), (11, 9), (11, 10), (11, 11), (11, 12), (11, 13), (11, 14), (11, 15), (12, -16), (12, -15), (12, -14), (12, -13), (12, -12), (12, -11), (12, -10), (12, -9), (12, -8), (12, -7), (12, -6), (12, -5), (12, -4), (12, -3), (12, -2), (12, -1), (12, 0), (12, 1), (12, 2), (12, 3), (12, 4), (12, 5), (12, 6), (12, 7), (12, 8), (12, 9), (12, 10), (12, 11), (12, 12), (12, 13), (12, 14), (12, 15), (13, -16), (13, -15), (13, -14), (13, -13), (13, -12), (13, -11), (13, -10), (13, -9), (13, -8), (13, -7), (13, -6), (13, -5), (13, -4), (13, -3), (13, -2), (13, -1), (13, 0), (13, 1), (13, 2), (13, 3), (13, 4), (13, 5), (13, 6), (13, 7), (13, 8), (13, 9), (13, 10), (13, 11), (13, 12), (13, 13), (13, 14), (13, 15), (14, -16), (14, -15), (14, -14), (14, -13), (14, -12), (14, -11), (14, -10), (14, -9), (14, -8), (14, -7), (14, -6), (14, -5), (14, -4), (14, -3), (14, -2), (14, -1), (14, 0), (14, 1), (14, 2), (14, 3), (14, 4), (14, 5), (14, 6), (14, 7), (14, 8), (14, 9), (14, 10), (14, 11), (14, 12), (14, 13), (14, 14), (14, 15), (15, -16), (15, -15), (15, -14), (15, -13), (15, -12), (15, -11), (15, -10), (15, -9), (15, -8), (15, -7), (15, -6), (15, -5), (15, -4), (15, -3), (15, -2), (15, -1), (15, 0), (15, 1), (15, 2), (15, 3), (15, 4), (15, 5), (15, 6), (15, 7), (15, 8), (15, 9), (15, 10), (15, 11), (15, 12), (15, 13), (15, 14), (15, 15)]\n" + ] + } + ], + "source": [ + "import itertools\n", + "import numpy as np\n", + "k_min = -16\n", + "k_max = 15\n", + "ks = np.arange(k_min, k_max+1)\n", + "k_dim = len(ks)\n", + "k_point_grid = list(itertools.product(ks, ks))\n", + "print(k_point_grid)" + ] + }, + { + "cell_type": "code", + "execution_count": 97, + "metadata": {}, + "outputs": [], + "source": [ + "coeff_dict = {k: coeff for k, coeff in zip(k_point_grid, np.random.rand(k_dim**2))}" + ] + }, + { + "cell_type": "code", + "execution_count": 98, + "metadata": {}, + "outputs": [], + "source": [ + "n_space_qubits = 6\n", + "space_dim = 2**n_space_qubits\n", + "num_points = space_dim\n", + "L=1\n", + "xs = np.linspace(0,L, num_points)\n", + "ys = np.linspace(0,L, num_points)\n", + "X, Y = np.meshgrid(xs, ys)\n", + "R = np.stack((X, Y), axis = -1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 99, + "metadata": {}, + "outputs": [], + "source": [ + "from grid1q.wavefunctions.plane_wave import plane_wave" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [], + "source": [ + "pw = plane_wave(coeff_dict)" + ] + }, + { + "cell_type": "code", + "execution_count": 101, + "metadata": {}, + "outputs": [], + "source": [ + "pw_r = pw(R)" + ] + }, + { + "cell_type": "code", + "execution_count": 102, + "metadata": {}, + "outputs": [], + "source": [ + "pw_renorm = plane_wave_renorm(pw_r)" + ] + }, + { + "cell_type": "code", + "execution_count": 103, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array([[ 3.67912279e-01+0.00000000e+00j, 3.30462958e-01-1.07007673e-02j,\n", + " 2.31994040e-01-1.62896487e-02j, ...,\n", + " -2.66045494e-03+7.06402815e-03j, 1.23478670e-03+5.31226216e-03j,\n", + " 2.83905126e-03-2.62101398e-18j],\n", + " [ 3.29073965e-01-1.02270730e-02j, 2.96267543e-01-1.87786818e-02j,\n", + " 2.08678116e-01-2.13778041e-02j, ...,\n", + " -4.73383841e-03+7.32396856e-03j, -3.40102923e-04+6.69860223e-03j,\n", + " 2.47873195e-03+2.37116335e-03j],\n", + " [ 2.26908471e-01-1.52376518e-02j, 2.05135092e-01-2.00271123e-02j,\n", + " 1.45425081e-01-1.98443671e-02j, ...,\n", + " -5.32425619e-03+5.40910887e-03j, -1.47666097e-03+6.04919516e-03j,\n", + " 1.59271255e-03+3.64460723e-03j],\n", + " ...,\n", + " [ 3.64071448e-03+1.36576555e-02j, 7.64836944e-03+1.07470509e-02j,\n", + " 9.33943402e-03+6.40290801e-03j, ...,\n", + " -2.25826191e-03+2.66453624e-03j, -2.94896401e-03+8.83812711e-04j,\n", + " -3.68940643e-03-1.56086982e-03j],\n", + " [ 4.75946469e-03+9.46480137e-03j, 6.92546241e-03+5.71445240e-03j,\n", + " 7.44860236e-03+1.19948932e-03j, ...,\n", + " -2.50844117e-03+5.46593540e-03j, -2.42911659e-03+2.69126284e-03j,\n", + " -2.61711327e-03-9.20299641e-04j],\n", + " [ 5.26284600e-03+1.81958178e-17j, 4.73976916e-03-3.34755941e-03j,\n", + " 3.41137663e-03-6.07238723e-03j, ...,\n", + " -2.38680668e-03+7.29476215e-03j, -2.21824114e-03+4.06493827e-03j,\n", + " -2.16020127e-03+2.56825648e-19j]])" + ] + }, + "execution_count": 103, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pw_renorm" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 3D" + ] + }, + { + "cell_type": "code", + "execution_count": 104, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "16 [-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]\n", + "4096\n" + ] + } + ], + "source": [ + "import itertools\n", + "import numpy as np\n", + "k_min = -8\n", + "k_max = 7\n", + "ks = np.arange(k_min, k_max+1)\n", + "k_dim = len(ks)\n", + "print(k_dim, ks)\n", + "k_point_grid = list(itertools.product(ks, ks, ks))\n", + "print(len(k_point_grid))" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(64, 64, 64, 3)" + ] + }, + "execution_count": 105, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "xs = np.linspace(0,L, num_points)\n", + "ys = np.linspace(0,L, num_points)\n", + "zs = np.linspace(0,L, num_points)\n", + "X, Y, Z = np.meshgrid(xs, ys, zs)\n", + "R = np.stack((X, Y, Z), axis = -1)\n", + "R.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 106, + "metadata": {}, + "outputs": [], + "source": [ + "coeff_dict = {k: coeff for k, coeff in zip(k_point_grid, np.random.rand(k_dim**3))}" + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": {}, + "outputs": [], + "source": [ + "pw_3d = plane_wave(coeff_dict) " + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": {}, + "outputs": [], + "source": [ + "pw_3d_r = pw_3d(R)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/grid1q/main.py b/grid1q/main.py deleted file mode 100644 index bce7840..0000000 --- a/grid1q/main.py +++ /dev/null @@ -1,9 +0,0 @@ -"""This is the main module of the grid1q package.""" - - -def hello_world() -> str: - """Print 'Hello, world!' to the console.""" - return "Hello, World!" - - -print(hello_world()) diff --git a/grid1q/operators/__init__.py b/grid1q/operators/__init__.py new file mode 100644 index 0000000..6796a78 --- /dev/null +++ b/grid1q/operators/__init__.py @@ -0,0 +1 @@ +"""Init file for the operators module.""" diff --git a/grid1q/operators/plane_wave.py b/grid1q/operators/plane_wave.py new file mode 100644 index 0000000..3e5b1b3 --- /dev/null +++ b/grid1q/operators/plane_wave.py @@ -0,0 +1,130 @@ +"""Plane wave Hamiltonian for a ND system.""" + +import multiprocessing + +import numpy as np +from numpy.typing import NDArray + + +def kenetic( + k_points: NDArray[np.int32], + hbar: float = 1.0, + m: float = 1.0, +) -> NDArray[np.complex128]: + """Return the diagonal kinetic energy matrix for a ND plane wave system. + + Args: + k_points: The k points of the system. + hbar: The reduced Planck constant. + m: The mass of the particle. + + Returns: + The digonal kinetic energy matrix. + """ + return np.diag([(hbar**2 * np.dot(k, k) ** 2) / (2 * m) for k in k_points]) + + +def elec_nuc_potential_element( + args: tuple[ + int, + int, + NDArray[np.int32], + NDArray[np.int32], + NDArray[np.float64], + float, + ], +) -> tuple[int, int, complex]: + """Return the matrix element of the electron-nucleus potential. + + This functions is parallelized and should be used with the multiprocessing + module. Where the each matrix element will be calculated in parallel. + + Args: + args: A tuple containing the following elements: + i: The row index of the matrix element. + j: The column index of the matrix element. + k_bra: The bra k point. + k_ket: The ket k point. + r_pos: The position of the nucleus. + cell_area: The area of the cell. + + Returns: + The matrix element of the electron-nucleus potential. + """ + i, j, k_bra, k_ket, r_pos, cell_area = args + mat_element = 0 + for r in r_pos: + if np.array_equal(k_bra, k_ket): + mat_element = 0 + else: + mat_element += ( + (4 * np.pi) / (cell_area * np.linalg.norm(k_bra - k_ket) ** 2) + ) * np.exp(-1j * np.dot(k_bra - k_ket, r)) + return i, j, mat_element + + +def elec_nuc_potential( + k_points: NDArray[np.int32], + cell_area: float, + r_pos: NDArray[np.float64], +) -> NDArray[np.complex128]: + """Return the electron-nucleus potential matrix for a ND plane wave system. + + This function is parallelized and should be used with the multiprocessing. + + Args: + k_points: The k points of the system. + cell_area: The area of the cell. + r_pos: The position of the nucleus. + + Returns: + The electron-nucleus potential matrix. + """ + mat = np.zeros((len(k_points), len(k_points)), dtype=complex) + args_list: list[ + tuple[ + tuple[ + int, + int, + NDArray[np.int32], + NDArray[np.int32], + NDArray[np.float64], + float, + ] + ] + ] = [] + for i, k_bra in enumerate(k_points): + for j, k_ket in enumerate(k_points): + args_list.append((i, j, k_bra, k_ket, r_pos, cell_area)) + + with multiprocessing.Pool() as pool: + results = pool.map(elec_nuc_potential_element, args_list) + + for i, j, mat_element in results: + mat[i, j] = mat_element + + return mat + + +def plane_wave_hamiltonian( + k_points: NDArray[np.int32], + cell_area: float, + r_pos: NDArray[np.float64], + hbar: float = 1.0, + m: float = 1.0, +) -> NDArray[np.complex128]: + """Return the Hamiltonian matrix for a ND plane wave system. + + This function is parallelized and should be used with the multiprocessing. + + Args: + k_points: The k points of the system. + cell_area: The area of the cell. + r_pos: The position of the nucleus. + hbar: The reduced Planck constant. + m: The mass of the particle. + + Returns: + The Hamiltonian matrix. + """ + return kenetic(k_points, hbar, m) + elec_nuc_potential(k_points, cell_area, r_pos) diff --git a/grid1q/utils.py b/grid1q/utils.py deleted file mode 100644 index 97f01f7..0000000 --- a/grid1q/utils.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Utility functions for the grid1q package.""" - - -def add_numbers(a: int, b: int) -> int: - """Add two numbers and returns the result.""" - return a + b diff --git a/grid1q/utils/fourier_methods/__init__.py b/grid1q/utils/fourier_methods/__init__.py new file mode 100644 index 0000000..2819dcc --- /dev/null +++ b/grid1q/utils/fourier_methods/__init__.py @@ -0,0 +1,3 @@ +"""init file for fourier_methods module.""" + +from .fourier import dft, dft2, idft, idft2 diff --git a/grid1q/utils/fourier_methods/fourier.py b/grid1q/utils/fourier_methods/fourier.py new file mode 100644 index 0000000..ae8a879 --- /dev/null +++ b/grid1q/utils/fourier_methods/fourier.py @@ -0,0 +1,121 @@ +"""Fourier methods for 1D and 2D signals.""" + +import numpy as np +from numpy.typing import NDArray + + +def dft( + signal: NDArray[np.complex128], + k_min: int, + k_max: int, +) -> NDArray[np.complex128]: + """Compute the Discrete Fourier Transform of a signal. + + Args: + signal: The input signal. + k_min: The minimum index of the DFT. + k_max: The maximum index of the DFT. + + Returns: + The DFT of the signal. + """ + truncated_dft_result = np.zeros(k_max - k_min, dtype=complex) + + for k in range(k_min, k_max): + sum_result = 0 + for n in range(len(signal)): + sum_result += signal[n] * np.exp(-1j * 2 * np.pi * k * n / len(signal)) + truncated_dft_result[k - k_min] = sum_result / len(signal) + + return truncated_dft_result + + +def idft( + truncated_dft_result: NDArray[np.complex128], + sig_len: int, + k_min: int, + k_max: int, +) -> NDArray[np.complex128]: + """Compute the Inverse Discrete Fourier Transform of a signal. + + Args: + truncated_dft_result: The truncated DFT of the signal. + sig_len: The length of the original signal. + k_min: The minimum index of the DFT. + k_max: The maximum index of the DFT. + + Returns: + The IDFT of the signal. + """ + reconstructed_signal = np.zeros(sig_len, dtype=complex) + + for n in range(sig_len): + sum_result = 0 + for k in range(k_min, k_max): + sum_result += truncated_dft_result[k - k_min] * np.exp( + 1j * 2 * np.pi * k * n / sig_len, + ) + reconstructed_signal[n] = sum_result + + return reconstructed_signal + + +def dft2( + signal_2d: NDArray[np.complex128], + k_min: int, + k_max: int, +) -> NDArray[np.complex128]: + """Compute the 2D Discrete Fourier Transform of a signal. + + Args: + signal_2d: The input 2D signal. + k_min: The minimum index of the DFT. + k_max: The maximum index of the DFT. + + Returns: + The 2D DFT of the signal. + """ + # Apply DFT to each row + dft_rows = np.array([dft(row, k_min, k_max) for row in signal_2d]) + + # Apply DFT to each column of the result + dft_columns = np.array( + [dft(dft_rows[:, col], k_min, k_max) for col in range(dft_rows.shape[1])], + ) + + # Transpose the result back to the original orientation + return dft_columns.T + + +def idft2( + truncated_dft_2d: NDArray[np.complex128], + original_shape: tuple[int, int], + k_min: int, + k_max: int, +) -> NDArray[np.complex128]: + """Compute the 2D Inverse Discrete Fourier Transform of a signal. + + Args: + truncated_dft_2d: The truncated 2D DFT of the signal. + original_shape: The shape of the original signal. + k_min: The minimum index of the DFT. + k_max: The maximum index of the DFT. + + Returns: + The 2D IDFT of the signal. + """ + # Apply IDFT to each column + idft_cols = np.array( + [ + idft(truncated_dft_2d[:, col], original_shape[0], k_min, k_max) + for col in range(truncated_dft_2d.shape[1]) + ], + ).T + + # Apply IDFT to each row of the result + return np.array( + [ + idft(idft_cols[row], original_shape[1], k_min, k_max) + for row in range(idft_cols.shape[0]) + ], + ) diff --git a/grid1q/wavefunctions/__init__.py b/grid1q/wavefunctions/__init__.py new file mode 100644 index 0000000..ed1b395 --- /dev/null +++ b/grid1q/wavefunctions/__init__.py @@ -0,0 +1 @@ +"""Wavefunctions package.""" diff --git a/grid1q/wavefunctions/plane_wave.py b/grid1q/wavefunctions/plane_wave.py new file mode 100644 index 0000000..4b2f7cf --- /dev/null +++ b/grid1q/wavefunctions/plane_wave.py @@ -0,0 +1,70 @@ +"""This module provides functions to represent plane waves in ND space.""" + +from collections.abc import Callable + +import numpy as np +from numpy.typing import NDArray + + +def plane_wave( + coeffs_dict: dict[tuple[int, ...], np.complex128], +) -> Callable[[NDArray[np.float64]], NDArray[np.complex128]]: + """Return a function that represents a plane wave in ND space. + + The plane wave is represented as a linear combination of complex exponentials. + The tuple keys are used to determine the dimension of the k space. + + Args: + coeffs_dict: A dictionary where the keys are tuples of integers representing the + wave vector and the values are the coefficients of the complex exponentials. + + Returns: + A function that takes a vector r in ND space and returns the value of the plane + wave at r. Where the x,y ... are stacked in a vector r = [x,y,...] + + + Example: + plane_wave({(1,0): + 0.4343, (0,1): 0.343434}) returns a function that represents a plane wave in 2D + space with wave vector (1,0) and (0,1), with expansion coefficients 0.4343 + and 0.343434 respectively. + """ + dim = len(next(iter(coeffs_dict.keys()))) + + def space_function( + r: NDArray[np.float64], + ) -> NDArray[np.complex128]: # Vectorised function + """Return the value of the plane wave at r. + + It is not normalised and you must use plane_wave_renorm to normalise it. + Where the x,y ... are stacked in a vector r = [x,y,...]. + + Args: + r: A vector in ND space. + + Returns: + The value of the plane wave at r. + """ + return sum( + [ + coeffs_dict[k] + * np.exp(np.pi * 1j * np.tensordot(r, k, axes=([dim], [0]))) + for k in coeffs_dict + ], + ) # type: ignore # noqa: PGH003 + + return space_function + + +def plane_wave_renorm(plane_wave_r: NDArray[np.complex128]) -> NDArray[np.complex128]: + """Return the normalised plane wave. + + Args: + plane_wave_r: The plane wave to normalise. + + Returns: + The normalised plane wave. + """ + pw_flat = plane_wave_r.flatten() + pw_flat_norm = pw_flat / np.linalg.norm(pw_flat) + return pw_flat_norm.reshape(plane_wave_r.shape) diff --git a/pyproject.toml b/pyproject.toml index 65cc22c..5bdbc47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,8 @@ Repository = "https://github.com/CQCL/pytemplate.git" # See https://microsoft.github.io/pyright/#/getting-started [tool.pyright] +venvPath = "." +venv = ".venv" include = ["grid1q","tests"] ignore = ["**/*.ipynb"] pythonVersion = "3.11" diff --git a/requirements.txt b/requirements.txt index 5bbc5d8..2cc159c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,7 @@ pyright==1.1.338 pytest==7.4.3 sphinx==7.2.6 wheel==0.42.0 +numpy +matplotlib +pandas +scipy diff --git a/ruff.toml b/ruff.toml index 14c2c7b..431d475 100644 --- a/ruff.toml +++ b/ruff.toml @@ -3,7 +3,7 @@ target-version = "py311" line-length = 88 -select = [ +lint.select = [ "E", # pycodestyle Errors "W", # pycodestyle Warnings @@ -59,7 +59,9 @@ select = [ "YTT", # flake8-2020 ] -[per-file-ignores] +exclude = ["**/*.ipynb"] + +[lint.per-file-ignores] "__init__.py" = ["F401"] # module imported but unused "docs/*" = [ "D100", # Missing docstring in public module @@ -72,5 +74,5 @@ select = [ "PLR2004", # Magic value used in comparison, consider replacing * with a constant variable ] -[pydocstyle] +[lint.pydocstyle] convention = "google"