├── .gitignore ├── LICENSE ├── README.md ├── analysis ├── def2-universal-jfit-decontract.gbs ├── hellmann-feynman-forces.ipynb ├── plot_density.ipynb ├── plot_esp.ipynb └── pretrained_model.pt ├── data ├── ccsd_h_s_only_def2-universal-jfit-decontract_density.out ├── ccsd_o_s_only_def2-universal-jfit-decontract_density.out ├── h_s_only_def2-universal-jfit-decontract_density.out ├── o_s_only_def2-universal-jfit-decontract_density.out ├── water_density_dataset.pkl └── water_density_testset.pkl ├── generate_density_datasets ├── create_dataset.py └── densityfit_q.py ├── ml-dna ├── data │ ├── c_s_only_augccpvdz_density.out │ ├── def2-universal-jfit-dna.gbs │ ├── h_s_only_augccpvdz_density.out │ ├── n_s_only_augccpvdz_density.out │ ├── o_s_only_augccpvdz_density.out │ └── p_s_only_augccpvdz_density.out ├── plot_density_dna.ipynb ├── plot_potential_dna.ipynb ├── test-models │ └── saux │ │ ├── def2-universal-jfit-dna.gbs │ │ ├── dzhf-dna.gbs │ │ ├── h_s_only_dzhf_def2_density.out │ │ ├── o_s_only_dzhf_def2_density.out │ │ ├── train_saux.py │ │ ├── w3_dzhf_def2_test_energyforce.pkl │ │ └── w3_dzhf_def2_train_energyforce.pkl ├── train_dna.py └── utils.py ├── tests └── test_data_generation │ ├── def2-universal-jfit-decontract.gbs │ ├── output_w4_00.dat │ ├── output_w4_01.dat │ ├── output_w4_02.dat │ ├── output_w4_03.dat │ ├── output_w4_04.dat │ ├── output_w4_05.dat │ ├── output_w4_06.dat │ ├── output_w4_07.dat │ ├── output_w4_08.dat │ ├── output_w4_09.dat │ ├── output_w4_testdata.pkl.dat │ ├── testdata_w4.pkl │ ├── w4_00 │ ├── w4_00_def2-universal-jfit-decontract_density.out │ ├── w4_01 │ ├── w4_01_def2-universal-jfit-decontract_density.out │ ├── w4_02 │ ├── w4_02_def2-universal-jfit-decontract_density.out │ ├── w4_03 │ ├── w4_03_def2-universal-jfit-decontract_density.out │ ├── w4_04 │ ├── w4_04_def2-universal-jfit-decontract_density.out │ ├── w4_05 │ ├── w4_05_def2-universal-jfit-decontract_density.out │ ├── w4_06 │ ├── w4_06_def2-universal-jfit-decontract_density.out │ ├── w4_07 │ ├── w4_07_def2-universal-jfit-decontract_density.out │ ├── w4_08 │ ├── w4_08_def2-universal-jfit-decontract_density.out │ ├── w4_09 │ └── w4_09_def2-universal-jfit-decontract_density.out ├── training ├── train_density.py └── train_energy_force.py └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # wandb 132 | **/wandb 133 | 134 | # psi4 135 | *timer.dat 136 | 137 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). 2 | Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software. 3 | 4 | 5 | MIT License 6 | 7 | Copyright (c) 2021 Joshua A. Rackers 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # equivariant_electron_density 2 | Generate and predict molecular electron densities with Euclidean Neural Networks 3 | 4 | Below is a workflow for how to use the scripts in this repository. 5 | ## Step 1: Generate molecular electron densities from a set of input coordinates. 6 | The only neccesary inputs are a atomic coordinates file and an auxiliary basis set file. You can find examples of both in `tests/test_data_generation`. Atomic coordinates must be supplied in [XYZ file format](https://en.wikipedia.org/wiki/XYZ_file_format). 7 | 8 | > Command: `python densityfit_q.py xyz_filename orbital_basis density_fit_basis` 9 | > 10 | > Example: `python densityfit_q.py water.xyz aug-cc-pvtz def2-universal-jfit-decontract` 11 | 12 | This command uses the `densityfit_q.py` script to run a quantum chemistry calculation with the `psi4` quantum chemistry program. Then it projects the electron density onto the density fitting basis. This will produce a psi4 output file (from which one can extract energy and forces) and density output file with the coefficients of the density fitting basis set. 13 | 14 | 15 | ## Step 2: Create the dataset 16 | We must now parse the output files to create a dataset for training. This is done with the `create_dataset.py` script. 17 | 18 | > Command: `python create_dataset.py path/to/data/folder dataset_name` 19 | > 20 | > Example: `python create_dataset.py ../tests/test_data_generation water_density_dataset.pkl` 21 | 22 | The dataset will now be the input we use to train our `e3nn` network. 23 | 24 | ## Step 3: Train the model 25 | Now it's time to train an `e3nn` model on our dataset. We will use the `train_density.py` script in `training` to do this. There are a number of keyword arguments to `train_density.py`. 26 | 27 | - "dataset": path to training dataset 28 | - "testset": path to test dataset 29 | - "split": number of samples from the dataset to use for training 30 | - "epochs": number of epochs for training 31 | 32 | > Command: `python train_density.py --dataset path/to/dataset --testset path/to/testset --split n_samples --epochs n_epochs` 33 | > 34 | > Example: `python train_density.py --dataset ../tests/water_density_dataset.pkl --testset ../tests/water_density_testset.pkl --split 100 --epochs 500` 35 | 36 | The script is set up to track training and test metrics in `wandb`, so you'll need an account to see how training is going. 37 | 38 | 39 | For additional resources, see the [e3nn tutorial](https://e3nn.org/e3nn-tutorial-mrs-fall-2021/). Check out the tutorial on electron densities [here](https://colab.research.google.com/drive/1ryOQ6hXxCidM_mGN0Yrf4BbjUtpyCxgy#scrollTo=PTTwyYkhioyc) 40 | -------------------------------------------------------------------------------- /analysis/def2-universal-jfit-decontract.gbs: -------------------------------------------------------------------------------- 1 | **** 2 | H 0 3 | S 1 1.00 4 | 15.6752927 0.0186886 5 | S 1 1.00 6 | 3.6063578 0.0631670 7 | S 1 1.00 8 | 1.2080016 0.1204609 9 | S 1 1.00 10 | 0.4726794 0.0592485 11 | S 1 1.00 12 | 0.2018100 0.0051272 13 | P 1 1.00 14 | 2.0281365 1.0 15 | P 1 1.00 16 | 0.5358730 1.0 17 | D 1 1.00 18 | 2.2165124 0.0033116 19 | **** 20 | O 0 21 | S 1 1.00 22 | 2876.8216605 0.1443558 23 | S 1 1.00 24 | 1004.7443032 0.2920041 25 | S 1 1.00 26 | 369.7579954 1.0258517 27 | S 1 1.00 28 | 142.9442404 2.2875516 29 | S 1 1.00 30 | 57.8366425 3.6080237 31 | S 1 1.00 32 | 24.3864983 2.3737865 33 | S 1 1.00 34 | 10.6622662 0.0489414 35 | S 1 1.00 36 | 4.8070437 -0.1295186 37 | S 1 1.00 38 | 2.2210770 0.7747158 39 | S 1 1.00 40 | 1.0447795 0.7647816 41 | S 1 1.00 42 | 0.4968425 0.2369803 43 | S 1 1.00 44 | 0.2371384 0.0208099 45 | P 1 1.00 46 | 64.2613382 -0.0126659 47 | P 1 1.00 48 | 16.3006076 -0.0378744 49 | P 1 1.00 50 | 4.3550542 0.0638078 51 | P 1 1.00 52 | 1.2019554 0.0169516 53 | P 1 1.00 54 | 0.3354196 0.0065743 55 | D 1 1.00 56 | 9.2146611 -0.0597914 57 | D 1 1.00 58 | 2.8435251 -0.0846724 59 | D 1 1.00 60 | 0.9955759 -0.0466066 61 | D 1 1.00 62 | 0.3649441 -0.0096978 63 | F 1 1.00 64 | 2.6420115 1.0 65 | F 1 1.00 66 | 0.7345613 1.0 67 | G 1 1.00 68 | 1.3931000 -0.0016533 69 | **** 70 | -------------------------------------------------------------------------------- /analysis/hellmann-feynman-forces.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "0af871e5-b535-41aa-b947-453e60c45267", 6 | "metadata": {}, 7 | "source": [ 8 | "# Calculating Hellmann-Feynman Forces\n", 9 | "\n", 10 | "This code shows how to calculate Hellmann-Feynman forces from an ML electron density. This requires a custom-built version of psi4 available at https://github.com/JoshRackers/psi4. It will also show how to compute long-range versions of the Hellmann-Feynman force." 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "id": "0d0f9c17-c329-45ba-a1f4-a4a52ea292dd", 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "import sys\n", 21 | "if \"/home/jracker/codes/psi4/build/stage/lib\" not in sys.path:\n", 22 | " sys.path.append(\"/home/jracker/codes/psi4/build/stage/lib\")\n", 23 | " #print(sys.path)\n", 24 | "import psi4" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "id": "signed-spring", 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "%load_ext autoreload\n", 35 | "%autoreload 2\n", 36 | "\n", 37 | "import sys\n", 38 | "import os\n", 39 | "import math\n", 40 | "import numpy as np\n", 41 | "\n", 42 | "import torch\n", 43 | "import torch_geometric\n", 44 | "\n", 45 | "sys.path.append(os.path.dirname(os.path.abspath('')))\n", 46 | "from utils import get_iso_permuted_dataset\n", 47 | "from utils import flatten_list\n", 48 | "from utils import compute_potential_field\n", 49 | "\n", 50 | "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", 51 | "#device = torch.device(\"cpu\")\n", 52 | "print (device)\n", 53 | "\n", 54 | "# conversion from Hartrees to kcal/mol\n", 55 | "ha2kcalmol = 627.5094740631" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "id": "028e350d-4b7a-40e7-a5f1-796ab6e4610d", 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [ 65 | "# first, get dataset\n", 66 | "hhh = \"../data/h_s_only_def2-universal-jfit-decontract_density.out\"\n", 67 | "ooo = \"../data/o_s_only_def2-universal-jfit-decontract_density.out\"\n", 68 | "\n", 69 | "fours = \"../tests/test_data_generation/testdata_w4.pkl\"\n", 70 | "w04_dataset = get_iso_permuted_dataset(fours,o_iso=ooo,h_iso=hhh)\n", 71 | "\n", 72 | "data_loader = torch_geometric.data.DataLoader(w04_dataset[:], batch_size=1, shuffle=False)" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": null, 78 | "id": "2a56702a-a0ae-4757-ac3d-02d9992b77b5", 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "# now get model\n", 83 | "from e3nn.nn.models.gate_points_2101 import Network\n", 84 | "from e3nn import o3\n", 85 | "\n", 86 | "model_kwargs = {\n", 87 | " \"irreps_in\": \"2x 0e\", #irreps_in \n", 88 | " \"irreps_hidden\": [(mul, (l, p)) for l, mul in enumerate([125,40,25,15]) for p in [-1, 1]], #irreps_hidden\n", 89 | " #\"irreps_hidden\": \"100x0e + 100x0o\",\n", 90 | " \"irreps_out\": \"12x0e + 5x1o + 4x2e + 2x3o + 1x4e\", #irreps_out\n", 91 | " \"irreps_node_attr\": None, #irreps_node_attr\n", 92 | " \"irreps_edge_attr\": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr\n", 93 | " \"layers\": 3,\n", 94 | " \"max_radius\": 3.5,\n", 95 | " \"number_of_basis\": 10,\n", 96 | " \"radial_layers\": 1,\n", 97 | " \"radial_neurons\": 128,\n", 98 | " \"num_neighbors\": 12.2298,\n", 99 | " \"num_nodes\": 24,\n", 100 | " \"reduce_output\": False,\n", 101 | " }\n", 102 | "\n", 103 | "model = Network(**model_kwargs)\n", 104 | "model.to(device)\n", 105 | "\n", 106 | "model.load_state_dict(torch.load('pretrained_model.pt'))" 107 | ] 108 | }, 109 | { 110 | "cell_type": "code", 111 | "execution_count": null, 112 | "id": "4592fa97-3eb9-47e0-8e87-1b6c29610e73", 113 | "metadata": {}, 114 | "outputs": [], 115 | "source": [ 116 | "# now compute hellmann-feynman forces\n", 117 | "\n", 118 | "# get first structure\n", 119 | "data = data_loader.dataset[0]\n", 120 | "\n", 121 | "# inference on model\n", 122 | "mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach()\n", 123 | "y_ml = model(data.to(device))*mask.to(device)\n", 124 | "\n", 125 | "# get atomic positions\n", 126 | "x_atoms = data.pos_orig[:,0].cpu().detach().flatten()\n", 127 | "y_atoms = data.pos_orig[:,1].cpu().detach().flatten()\n", 128 | "z_atoms = data.pos_orig[:,2].cpu().detach().flatten()\n", 129 | "Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)]\n", 130 | "\n", 131 | "# evaluate full electrostatic field at atomic positions\n", 132 | "t_pot, t_field, m_pot, m_field = compute_potential_field(x_atoms,y_atoms,z_atoms,data,y_ml.detach(),Rs,intermolecular=False)\n", 133 | "\n", 134 | "# now compute forces\n", 135 | "charges = data.z.cpu().detach().numpy()\n", 136 | "target_forces = t_field*charges\n", 137 | "ml_forces = m_field*charges\n", 138 | "\n", 139 | "print(\"Force error (Ha/bohr)\")\n", 140 | "print(ml_forces-target_forces)" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": null, 146 | "id": "a5836d15-19bf-462f-b0c5-f44e057bfd3c", 147 | "metadata": {}, 148 | "outputs": [], 149 | "source": [ 150 | "# evaluate long-range electrostatic field at atomic positions\n", 151 | "# exclude contributions from <7 Å interactions\n", 152 | "# NOTE: for small clusters like this, this excludes all interactions\n", 153 | "# but for larger clusters, this is significant\n", 154 | "lr_t_pot, lr_t_field, lr_m_pot, lr_m_field = compute_potential_field(x_atoms,y_atoms,z_atoms,data,y_ml.detach(),Rs,intermolecular=True,rad=13.2281)\n", 155 | "\n", 156 | "# now compute forces\n", 157 | "lr_target_forces = lr_t_field*charges\n", 158 | "lr_ml_forces = lr_m_field*charges\n", 159 | "\n", 160 | "print(\"Force error (Ha/bohr)\")\n", 161 | "print(lr_ml_forces-lr_target_forces)" 162 | ] 163 | }, 164 | { 165 | "cell_type": "code", 166 | "execution_count": null, 167 | "id": "80b18b73-8657-46c6-9851-93dc1ecb89a5", 168 | "metadata": {}, 169 | "outputs": [], 170 | "source": [] 171 | }, 172 | { 173 | "cell_type": "code", 174 | "execution_count": null, 175 | "id": "f13bc32e-81cc-4f37-a97a-39493271637b", 176 | "metadata": {}, 177 | "outputs": [], 178 | "source": [] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": null, 183 | "id": "eb43bc10-abdb-404d-b7a6-44b48a178920", 184 | "metadata": {}, 185 | "outputs": [], 186 | "source": [] 187 | } 188 | ], 189 | "metadata": { 190 | "kernelspec": { 191 | "display_name": "e3nn_psi4_sept", 192 | "language": "python", 193 | "name": "e3nn_psi4_sept" 194 | }, 195 | "language_info": { 196 | "codemirror_mode": { 197 | "name": "ipython", 198 | "version": 3 199 | }, 200 | "file_extension": ".py", 201 | "mimetype": "text/x-python", 202 | "name": "python", 203 | "nbconvert_exporter": "python", 204 | "pygments_lexer": "ipython3", 205 | "version": "3.7.9" 206 | } 207 | }, 208 | "nbformat": 4, 209 | "nbformat_minor": 5 210 | } 211 | -------------------------------------------------------------------------------- /analysis/plot_density.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "tags": [] 7 | }, 8 | "source": [ 9 | "# Plotting Electron Densities\n", 10 | "\n", 11 | "This notebook is meant to show how you can plot machine learned densities. It uses an example structure and pretrained model. You should use this as a template with your own structure(s) and model(s)" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": null, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "%load_ext autoreload\n", 21 | "%autoreload 2\n", 22 | "\n", 23 | "import sys\n", 24 | "import os\n", 25 | "import math\n", 26 | "import numpy as np\n", 27 | "\n", 28 | "import torch\n", 29 | "import torch_geometric\n", 30 | "\n", 31 | "from torch_cluster import radius_graph\n", 32 | "from torch_scatter import scatter\n", 33 | "\n", 34 | "#sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n", 35 | "sys.path.append(os.path.dirname(os.path.abspath('')))\n", 36 | "from utils import get_iso_permuted_dataset, get_iso_dataset\n", 37 | "\n", 38 | "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", 39 | "\n", 40 | "torch.set_default_dtype(torch.float32)" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": null, 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "# first, get dataset\n", 50 | "hhh = \"../data/h_s_only_def2-universal-jfit-decontract_density.out\"\n", 51 | "ooo = \"../data/o_s_only_def2-universal-jfit-decontract_density.out\"\n", 52 | "\n", 53 | "fours = \"../tests/test_data_generation/testdata_w4.pkl\"\n", 54 | "w04_dataset = get_iso_permuted_dataset(fours,o_iso=ooo,h_iso=hhh)\n", 55 | "\n", 56 | "data_loader = torch_geometric.data.DataLoader(w04_dataset[:], batch_size=1, shuffle=False)\n" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [ 65 | "# now get model\n", 66 | "from e3nn.nn.models.gate_points_2101 import Network\n", 67 | "from e3nn import o3\n", 68 | "\n", 69 | "model_kwargs = {\n", 70 | " \"irreps_in\": \"2x 0e\", #irreps_in \n", 71 | " \"irreps_hidden\": [(mul, (l, p)) for l, mul in enumerate([125,40,25,15]) for p in [-1, 1]], #irreps_hidden\n", 72 | " #\"irreps_hidden\": \"100x0e + 100x0o\",\n", 73 | " \"irreps_out\": \"12x0e + 5x1o + 4x2e + 2x3o + 1x4e\", #irreps_out\n", 74 | " \"irreps_node_attr\": None, #irreps_node_attr\n", 75 | " \"irreps_edge_attr\": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr\n", 76 | " \"layers\": 3,\n", 77 | " \"max_radius\": 3.5,\n", 78 | " \"number_of_basis\": 10,\n", 79 | " \"radial_layers\": 1,\n", 80 | " \"radial_neurons\": 128,\n", 81 | " \"num_neighbors\": 12.2298,\n", 82 | " \"num_nodes\": 24,\n", 83 | " \"reduce_output\": False,\n", 84 | " }\n", 85 | "\n", 86 | "model = Network(**model_kwargs)\n", 87 | "model.to(device)\n", 88 | "\n", 89 | "model.load_state_dict(torch.load('pretrained_model.pt'))" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": null, 95 | "metadata": {}, 96 | "outputs": [], 97 | "source": [ 98 | "# import ploting stuff\n", 99 | "\n", 100 | "import plotly\n", 101 | "from plotly.subplots import make_subplots\n", 102 | "import plotly.graph_objects as go\n", 103 | "\n", 104 | "from utils import generate_grid, gau2grid_density_kdtree" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": null, 110 | "metadata": {}, 111 | "outputs": [], 112 | "source": [ 113 | "# plot the density\n", 114 | "# for first structure\n", 115 | "\n", 116 | "num = 0\n", 117 | "data = data_loader.dataset[num]\n", 118 | "\n", 119 | "# generate grid\n", 120 | "x,y,z,vol,x_spacing,y_spacing,z_spacing = generate_grid(data,spacing=0.15,buffer=1.0)\n", 121 | "\n", 122 | "# evaluate model\n", 123 | "mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach()\n", 124 | "y_ml = model(data.to(device))*mask.to(device)\n", 125 | "\n", 126 | "# get densities\n", 127 | "Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)]\n", 128 | "target_density, ml_density = gau2grid_density_kdtree(x.flatten(),y.flatten(),z.flatten(),data,y_ml,Rs)\n", 129 | "\n", 130 | "# plot densities\n", 131 | "rows = 1\n", 132 | "cols = 2\n", 133 | "specs = [[{'is_3d': True} for i in range(cols)]\n", 134 | " for j in range(rows)]\n", 135 | "fig = go.FigureWidget(make_subplots(rows=rows, cols=cols, specs=specs, vertical_spacing=0.0))\n", 136 | "\n", 137 | "points = data.pos_orig\n", 138 | "xs = points.cpu().numpy()[:,0]\n", 139 | "ys = points.cpu().numpy()[:,1]\n", 140 | "zs = points.cpu().numpy()[:,2]\n", 141 | "geom = go.Scatter3d(x=xs,y=ys,z=zs,mode='markers',marker=dict(size=[30,15,15]*64,color=[\"red\",\"black\",\"black\"]*64,opacity=1.0))\n", 142 | "fig.add_trace(geom)\n", 143 | "fig.add_trace(geom,row=1,col=2)\n", 144 | "\n", 145 | "fig.add_trace(go.Volume(\n", 146 | " x=x.flatten(),\n", 147 | " y=y.flatten(),\n", 148 | " z=z.flatten(),\n", 149 | " value=target_density.flatten(),\n", 150 | " isomax=0.05,\n", 151 | " colorscale='BuGn',\n", 152 | " opacity=0.1, # needs to be small to see through all surfaces\n", 153 | " surface_count=12, # needs to be a large number for good volume rendering\n", 154 | " showscale=False,\n", 155 | " ),row=1,col=1)\n", 156 | "\n", 157 | "fig.add_trace(go.Volume(\n", 158 | " x=x.flatten(),\n", 159 | " y=y.flatten(),\n", 160 | " z=z.flatten(),\n", 161 | " value=ml_density.flatten(),\n", 162 | " isomax=0.05,\n", 163 | " colorscale='BuGn',\n", 164 | " opacity=0.1, # needs to be small to see through all surfaces\n", 165 | " surface_count=12, # needs to be a large number for good volume rendering\n", 166 | " showscale=False,\n", 167 | " ),row=1,col=2)\n", 168 | "\n", 169 | "fig.update_layout(showlegend=False, width=1000, height=500)\n", 170 | "\n", 171 | "fig.show()" 172 | ] 173 | }, 174 | { 175 | "cell_type": "code", 176 | "execution_count": null, 177 | "metadata": {}, 178 | "outputs": [], 179 | "source": [ 180 | "# now plot the difference\n", 181 | "\n", 182 | "fig = go.FigureWidget()\n", 183 | "\n", 184 | "points = data.pos_orig\n", 185 | "xs = points.cpu().numpy()[:,0]\n", 186 | "ys = points.cpu().numpy()[:,1]\n", 187 | "zs = points.cpu().numpy()[:,2]\n", 188 | "geom = go.Scatter3d(x=xs,y=ys,z=zs,mode='markers',marker=dict(size=[30,15,15]*64,color=[\"red\",\"black\",\"black\"]*64,opacity=1.0))\n", 189 | "fig.add_trace(geom)\n", 190 | "\n", 191 | "fig.add_trace(go.Volume(\n", 192 | " x=x.flatten(),\n", 193 | " y=y.flatten(),\n", 194 | " z=z.flatten(),\n", 195 | " value=ml_density.flatten() - target_density.flatten(),\n", 196 | " isomin=-0.05,\n", 197 | " isomax=0.05,\n", 198 | " #colorscale='BuGn',\n", 199 | " opacity=0.1, # needs to be small to see through all surfaces\n", 200 | " surface_count=12, # needs to be a large number for good volume rendering\n", 201 | " ))\n", 202 | "\n", 203 | "fig.update_layout(width=600, height=600)\n", 204 | "\n", 205 | "fig.show()" 206 | ] 207 | }, 208 | { 209 | "cell_type": "code", 210 | "execution_count": null, 211 | "metadata": {}, 212 | "outputs": [], 213 | "source": [ 214 | "# now calculate ep\n", 215 | "ep = 100 * np.sum(np.abs(ml_density-target_density)) / np.sum(target_density)\n", 216 | "print(\"Density Difference Error (%)\", ep)" 217 | ] 218 | }, 219 | { 220 | "cell_type": "code", 221 | "execution_count": null, 222 | "metadata": {}, 223 | "outputs": [], 224 | "source": [] 225 | }, 226 | { 227 | "cell_type": "code", 228 | "execution_count": null, 229 | "metadata": {}, 230 | "outputs": [], 231 | "source": [] 232 | }, 233 | { 234 | "cell_type": "code", 235 | "execution_count": null, 236 | "metadata": {}, 237 | "outputs": [], 238 | "source": [] 239 | } 240 | ], 241 | "metadata": { 242 | "kernelspec": { 243 | "display_name": "e3nn_sept", 244 | "language": "python", 245 | "name": "e3nn_sept" 246 | }, 247 | "language_info": { 248 | "codemirror_mode": { 249 | "name": "ipython", 250 | "version": 3 251 | }, 252 | "file_extension": ".py", 253 | "mimetype": "text/x-python", 254 | "name": "python", 255 | "nbconvert_exporter": "python", 256 | "pygments_lexer": "ipython3", 257 | "version": "3.8.10" 258 | } 259 | }, 260 | "nbformat": 4, 261 | "nbformat_minor": 4 262 | } 263 | -------------------------------------------------------------------------------- /analysis/plot_esp.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "0af871e5-b535-41aa-b947-453e60c45267", 6 | "metadata": {}, 7 | "source": [ 8 | "# Calculating and Plotting Electrostatic Potential\n", 9 | "\n", 10 | "This code shows how to calculate the electrostatic potential (and electric field) around a molecular cluster. This requires a custom-built version of psi4 available at https://github.com/JoshRackers/psi4 . It will also show how to use the marching cubes algorithm to generate a density isosurface and plot the potential on the surface." 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": null, 16 | "id": "0d0f9c17-c329-45ba-a1f4-a4a52ea292dd", 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "import sys\n", 21 | "if \"/home/jracker/codes/psi4/build/stage/lib\" not in sys.path:\n", 22 | " sys.path.append(\"/home/jracker/codes/psi4/build/stage/lib\")\n", 23 | " #print(sys.path)\n", 24 | "import psi4" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": null, 30 | "id": "signed-spring", 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "%load_ext autoreload\n", 35 | "%autoreload 2\n", 36 | "\n", 37 | "import sys\n", 38 | "import os\n", 39 | "import math\n", 40 | "import numpy as np\n", 41 | "\n", 42 | "import torch\n", 43 | "import torch_geometric\n", 44 | "\n", 45 | "sys.path.append(os.path.dirname(os.path.abspath('')))\n", 46 | "from utils import get_iso_permuted_dataset\n", 47 | "from utils import flatten_list\n", 48 | "\n", 49 | "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n", 50 | "#device = torch.device(\"cpu\")\n", 51 | "print (device)\n", 52 | "\n", 53 | "# conversion from Hartrees to kcal/mol\n", 54 | "ha2kcalmol = 627.5094740631" 55 | ] 56 | }, 57 | { 58 | "cell_type": "code", 59 | "execution_count": null, 60 | "id": "028e350d-4b7a-40e7-a5f1-796ab6e4610d", 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "# first, get dataset\n", 65 | "hhh = \"../data/h_s_only_def2-universal-jfit-decontract_density.out\"\n", 66 | "ooo = \"../data/o_s_only_def2-universal-jfit-decontract_density.out\"\n", 67 | "\n", 68 | "fours = \"../tests/test_data_generation/testdata_w4.pkl\"\n", 69 | "w04_dataset = get_iso_permuted_dataset(fours,o_iso=ooo,h_iso=hhh)\n", 70 | "\n", 71 | "data_loader = torch_geometric.data.DataLoader(w04_dataset[:], batch_size=1, shuffle=False)" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": null, 77 | "id": "2a56702a-a0ae-4757-ac3d-02d9992b77b5", 78 | "metadata": {}, 79 | "outputs": [], 80 | "source": [ 81 | "# now get model\n", 82 | "from e3nn.nn.models.gate_points_2101 import Network\n", 83 | "from e3nn import o3\n", 84 | "\n", 85 | "model_kwargs = {\n", 86 | " \"irreps_in\": \"2x 0e\", #irreps_in \n", 87 | " \"irreps_hidden\": [(mul, (l, p)) for l, mul in enumerate([125,40,25,15]) for p in [-1, 1]], #irreps_hidden\n", 88 | " #\"irreps_hidden\": \"100x0e + 100x0o\",\n", 89 | " \"irreps_out\": \"12x0e + 5x1o + 4x2e + 2x3o + 1x4e\", #irreps_out\n", 90 | " \"irreps_node_attr\": None, #irreps_node_attr\n", 91 | " \"irreps_edge_attr\": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr\n", 92 | " \"layers\": 3,\n", 93 | " \"max_radius\": 3.5,\n", 94 | " \"number_of_basis\": 10,\n", 95 | " \"radial_layers\": 1,\n", 96 | " \"radial_neurons\": 128,\n", 97 | " \"num_neighbors\": 12.2298,\n", 98 | " \"num_nodes\": 24,\n", 99 | " \"reduce_output\": False,\n", 100 | " }\n", 101 | "\n", 102 | "model = Network(**model_kwargs)\n", 103 | "model.to(device)\n", 104 | "\n", 105 | "model.load_state_dict(torch.load('pretrained_model.pt'))" 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "id": "4592fa97-3eb9-47e0-8e87-1b6c29610e73", 112 | "metadata": {}, 113 | "outputs": [], 114 | "source": [ 115 | "# generate density on a grid for the first structure\n", 116 | "from utils import generate_grid, gau2grid_density_kdtree\n", 117 | "\n", 118 | "data = data_loader.dataset[0]\n", 119 | "\n", 120 | "mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach()\n", 121 | "y_ml = model(data.to(device))*mask.to(device)\n", 122 | "\n", 123 | "x,y,z,vol,x_spacing,y_spacing,z_spacing = generate_grid(data,spacing=0.1,buffer=2.0)\n", 124 | "\n", 125 | "Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)]\n", 126 | "target_density, ml_density = gau2grid_density_kdtree(x.flatten(),y.flatten(),z.flatten(),data,y_ml,Rs)\n", 127 | "print(\"done!\")" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": null, 133 | "id": "9b34d335-9175-4e1f-97c5-9c12b811f45e", 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [ 137 | "## Now compute isosurface with marching cubes\n", 138 | "\n", 139 | "from skimage import measure\n", 140 | "\n", 141 | "l = round((target_density.shape[0])**(1/3))\n", 142 | "t_density = target_density.reshape(l,l,l)\n", 143 | "m_density = ml_density.reshape(l,l,l)\n", 144 | "\n", 145 | "# level sets what the density isosurface is\n", 146 | "level = 0.002\n", 147 | "t_verts, t_faces, t_normals, t_values = measure.marching_cubes(t_density, spacing=(x_spacing, y_spacing, z_spacing), level=level, step_size=3)\n", 148 | "ml_verts, ml_faces, ml_normals, ml_values = measure.marching_cubes(m_density, spacing=(x_spacing, y_spacing, z_spacing), level=level, step_size=3)\n", 149 | "\n", 150 | "# now scale to get back to real coordinates\n", 151 | "xyz_min = np.array([x[0,0,0],y[0,0,0],z[0,0,0]])\n", 152 | "t_verts = t_verts + xyz_min\n", 153 | "ml_verts = ml_verts + xyz_min\n", 154 | "print(t_verts[:,0].shape)" 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": null, 160 | "id": "94944bd8-b040-4be3-9d45-a7299652e046", 161 | "metadata": {}, 162 | "outputs": [], 163 | "source": [ 164 | "# now compute the electrostatic potential and field at the points on the isosurface\n", 165 | "\n", 166 | "from utils import compute_potential_field\n", 167 | "t_isopot, t_isofield, m_isopot, m_isofield = compute_potential_field(t_verts[:,0].flatten(),t_verts[:,1].flatten(),t_verts[:,2].flatten(),data,y_ml,Rs)" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": null, 173 | "id": "b3955231-dc81-4c47-92e7-402da9e07b6a", 174 | "metadata": {}, 175 | "outputs": [], 176 | "source": [ 177 | "import plotly\n", 178 | "from plotly.subplots import make_subplots\n", 179 | "import plotly.graph_objects as go\n", 180 | "\n", 181 | "#plotly.offline.init_notebook_mode(connected=True)\n", 182 | "\n", 183 | "rows = 1\n", 184 | "cols = 3\n", 185 | "specs = [[{'is_3d': True} for i in range(cols)]\n", 186 | " for j in range(rows)]\n", 187 | "\n", 188 | "# FigureWidget apparently works faster with numpy arrays\n", 189 | "fig = go.FigureWidget(make_subplots(rows=rows, cols=cols, specs=specs, subplot_titles=('ML Electrostatic Potential','Target Electrostatic Potential','Difference')))\n", 190 | "\n", 191 | "traces = []\n", 192 | "for verts, faces, intense, name in zip([t_verts, t_verts], [t_faces, t_faces], [m_isopot, t_isopot], ['ML Density','Target Density']):\n", 193 | " traces.append(go.Mesh3d(\n", 194 | " x=verts[:,0].flatten(),\n", 195 | " y=verts[:,1].flatten(),\n", 196 | " z=verts[:,2].flatten(),\n", 197 | " i=faces[:,0].flatten(),\n", 198 | " j=faces[:,1].flatten(),\n", 199 | " k=faces[:,2].flatten(),\n", 200 | " intensity=intense.flatten(),\n", 201 | " colorscale=\"RdBu\",\n", 202 | " cmin=-0.075,\n", 203 | " cmax=0.075,\n", 204 | " opacity=0.5,\n", 205 | " name=name,\n", 206 | " showlegend=False,\n", 207 | " showscale=False\n", 208 | " ))\n", 209 | "\n", 210 | "#fig.add_traces(traces[0], rows=[1] * len(traces[0]), cols=[1] * len(traces[0]))\n", 211 | "#fig.add_traces(traces[1], rows=[1] * len(traces[1]), cols=[2] * len(traces[1]))\n", 212 | "fig.add_trace(traces[0], row=1, col=1)\n", 213 | "fig.add_trace(traces[1], row=1, col=2)\n", 214 | "\n", 215 | "traces.append(go.Mesh3d(\n", 216 | " x=t_verts[:,0].flatten(),\n", 217 | " y=t_verts[:,1].flatten(),\n", 218 | " z=t_verts[:,2].flatten(),\n", 219 | " i=t_faces[:,0].flatten(),\n", 220 | " j=t_faces[:,1].flatten(),\n", 221 | " k=t_faces[:,2].flatten(),\n", 222 | " intensity=(m_isopot.flatten() - t_isopot.flatten()),\n", 223 | " colorscale=\"RdBu\",\n", 224 | " cmin=-0.075,\n", 225 | " cmax=0.075,\n", 226 | " opacity=0.5,\n", 227 | " name='Difference',\n", 228 | " showlegend=False,\n", 229 | "))\n", 230 | "\n", 231 | "fig.add_trace(traces[2], row=1, col=3)\n", 232 | "\n", 233 | "\n", 234 | "points = data.pos_orig\n", 235 | "\n", 236 | "xs = points.cpu().numpy()[:,0]\n", 237 | "ys = points.cpu().numpy()[:,1]\n", 238 | "zs = points.cpu().numpy()[:,2]\n", 239 | "geom = go.Scatter3d(x=xs,y=ys,z=zs,mode='markers',marker=dict(size=5,color='Black',opacity=1.0))\n", 240 | "#fig.add_scatter3d(x=xs,y=ys,z=zs,mode='markers',marker=dict(size=12,color='Black',opacity=1.0))\n", 241 | "fig.add_trace(geom, row=1, col=1)\n", 242 | "fig.add_trace(geom, row=1, col=2)\n", 243 | "fig.add_trace(geom, row=1, col=3)\n", 244 | "\n", 245 | "\n", 246 | "#fig.update_layout(showlegend=True)\n", 247 | "\n", 248 | "# this is subtracted off the buffer defined above\n", 249 | "modbuf = 0.0\n", 250 | "\n", 251 | "fig.update_layout(showlegend=False, \n", 252 | " scene = dict(\n", 253 | " xaxis = dict(visible=False,showgrid=False,zeroline=False,range=[x[0,0,0]+modbuf,x[-1,-1,-1]-modbuf]),\n", 254 | " yaxis = dict(visible=False,showgrid=False,zeroline=False,range=[y[0,0,0]+modbuf,y[-1,-1,-1]-modbuf]),\n", 255 | " zaxis = dict(visible=False,showgrid=False,zeroline=False,range=[z[0,0,0]+modbuf,z[-1,-1,-1]-modbuf]),\n", 256 | " ),\n", 257 | " scene2 = dict(\n", 258 | " xaxis = dict(visible=False,showgrid=False,zeroline=False,range=[x[0,0,0]+modbuf,x[-1,-1,-1]-modbuf]),\n", 259 | " yaxis = dict(visible=False,showgrid=False,zeroline=False,range=[y[0,0,0]+modbuf,y[-1,-1,-1]-modbuf]),\n", 260 | " zaxis = dict(visible=False,showgrid=False,zeroline=False,range=[z[0,0,0]+modbuf,z[-1,-1,-1]-modbuf])\n", 261 | " ),\n", 262 | " scene3 = dict(\n", 263 | " xaxis = dict(visible=False,showgrid=False,zeroline=False,range=[x[0,0,0]+modbuf,x[-1,-1,-1]-modbuf]),\n", 264 | " yaxis = dict(visible=False,showgrid=False,zeroline=False,range=[y[0,0,0]+modbuf,y[-1,-1,-1]-modbuf]),\n", 265 | " zaxis = dict(visible=False,showgrid=False,zeroline=False,range=[z[0,0,0]+modbuf,z[-1,-1,-1]-modbuf])\n", 266 | " ),\n", 267 | " width = 1000,\n", 268 | " height = 500,\n", 269 | " )\n", 270 | "\n", 271 | "fig.show()" 272 | ] 273 | } 274 | ], 275 | "metadata": { 276 | "kernelspec": { 277 | "display_name": "e3nn_psi4_sept", 278 | "language": "python", 279 | "name": "e3nn_psi4_sept" 280 | }, 281 | "language_info": { 282 | "codemirror_mode": { 283 | "name": "ipython", 284 | "version": 3 285 | }, 286 | "file_extension": ".py", 287 | "mimetype": "text/x-python", 288 | "name": "python", 289 | "nbconvert_exporter": "python", 290 | "pygments_lexer": "ipython3", 291 | "version": "3.7.9" 292 | } 293 | }, 294 | "nbformat": 4, 295 | "nbformat_minor": 5 296 | } 297 | -------------------------------------------------------------------------------- /analysis/pretrained_model.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/analysis/pretrained_model.pt -------------------------------------------------------------------------------- /data/ccsd_h_s_only_def2-universal-jfit-decontract_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 5 3 | 0 0.01376775 15.6752927 5.614638980502037 4 | 0 0.04666004 3.6063578 1.8651411400891058 5 | 0 0.0873967 1.2080016 0.821222281824621 6 | 0 0.06740509 0.4726794 0.4062890324224442 7 | 0 0.011536 0.20181 0.2145937672719459 8 | -------------------------------------------------------------------------------- /data/ccsd_o_s_only_def2-universal-jfit-decontract_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.14197214 2876.8216605 279.9592344302619 4 | 0 0.29814825 1004.7443032 127.18964541427866 5 | 0 1.01821779 369.7579954 60.096374478263876 6 | 0 2.31643685 142.9442404 29.463551033919583 7 | 0 3.56784094 57.8366425 14.947287826773351 8 | 0 2.4477294 24.3864983 7.821178090123978 9 | 0 -0.02258749 10.6622662 4.205302419986137 10 | 0 0.10031151 4.8070437 -2.3137617908121966 11 | 0 0.79102057 2.221077 1.2966799732646255 12 | 0 0.72569744 1.0447795 0.7365098749756717 13 | 0 0.2112244 0.4968425 0.42176850477180133 14 | 0 0.03170793 0.2371384 0.24219295507675304 15 | -------------------------------------------------------------------------------- /data/h_s_only_def2-universal-jfit-decontract_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 5 3 | 0 0.01489391 15.6752927 5.614638980502037 4 | 0 0.04768351 3.6063578 1.8651411400891058 5 | 0 0.08761071 1.2080016 0.821222281824621 6 | 0 0.063234 0.4726794 0.4062890324224442 7 | 0 0.01352236 0.20181 0.2145937672719459 -------------------------------------------------------------------------------- /data/o_s_only_def2-universal-jfit-decontract_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.14449045 2876.8216605 279.9592344302619 4 | 0 0.28917466 1004.7443032 127.18964541427866 5 | 0 1.03130642 369.7579954 60.096374478263876 6 | 0 2.27387954 142.9442404 29.463551033919583 7 | 0 3.6191889 57.8366425 14.947287826773351 8 | 0 2.37829758 24.3864983 7.821178090123978 9 | 0 0.01823271 10.6622662 4.205302419986137 10 | 0 0.09633632 4.8070437 -2.3137617908121966 11 | 0 0.81364481 2.221077 1.2966799732646255 12 | 0 0.70851893 1.0447795 0.7365098749756717 13 | 0 0.21179102 0.4968425 0.42176850477180133 14 | 0 0.03166878 0.2371384 0.24219295507675304 -------------------------------------------------------------------------------- /data/water_density_dataset.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/data/water_density_dataset.pkl -------------------------------------------------------------------------------- /data/water_density_testset.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/data/water_density_testset.pkl -------------------------------------------------------------------------------- /generate_density_datasets/create_dataset.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=invalid-name, no-member, arguments-differ, missing-docstring, line-too-long 2 | 3 | import sys 4 | import os 5 | import pickle 6 | import time 7 | import numpy as np 8 | import torch 9 | 10 | #sys.path.append("../") 11 | # get the utils.py module in the path 12 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 13 | from utils import flatten_list 14 | from itertools import zip_longest 15 | import periodictable as pt 16 | 17 | 18 | def get_densities(filepath,dens_file,elements,num_atoms): 19 | """ 20 | inputs: 21 | - density file 22 | - number of atoms 23 | 24 | returns: 25 | - shape [N, X] list of basis function coefficients, where X is the number of basis functions per atom 26 | """ 27 | ## get density coefficients for each atom 28 | ## ordered in ascending l order 29 | ## also get Rs_out for each atom 30 | dens_file = filepath + "/" + dens_file 31 | 32 | basis_coeffs = [] 33 | basis_exponents = [] 34 | basis_norms = [] 35 | num_basis_func = [] 36 | Rs_outs = [] 37 | for l in range(0,20): 38 | flag = 0 39 | atom_index = -1 40 | counter = 0 41 | multiplicity = 0 42 | with open (dens_file,"r") as density_file: 43 | for line in density_file: 44 | if (flag == 1): 45 | split = line.split() 46 | if (int(split[0])==l): 47 | basis_coeffs[atom_index].append(float(split[1])) 48 | basis_exponents[atom_index].append(float(split[2])) 49 | basis_norms[atom_index].append(float(split[3])) 50 | multiplicity += 1 51 | counter += 1 52 | if (counter == num_lines): 53 | flag = 0 54 | if (multiplicity != 0): 55 | Rs_outs[atom_index].append((multiplicity//(2*l+1),l)) 56 | if ("functions" in line): 57 | num_lines = int(line.split()[3]) 58 | num_basis_func.append(num_lines) 59 | counter = 0 60 | multiplicity = 0 61 | flag = 1 62 | atom_index += 1 63 | if (l == 0): 64 | basis_coeffs.append([]) 65 | basis_exponents.append([]) 66 | basis_norms.append([]) 67 | Rs_outs.append([]) 68 | 69 | 70 | # break coefficients list up into l-based vectors 71 | newbasis_coeffs = [] 72 | newbasis_exponents = [] 73 | newbasis_norms = [] 74 | atom_index = -1 75 | for atom in Rs_outs: 76 | atom_index += 1 77 | counter = 0 78 | newbasis_coeffs.append([]) 79 | newbasis_exponents.append([]) 80 | newbasis_norms.append([]) 81 | for Rs in atom: 82 | number = Rs[0] 83 | l = Rs[1] 84 | for i in range(0,number): 85 | newbasis_coeffs[atom_index].append(basis_coeffs[atom_index][counter:counter+(2*l+1)]) 86 | newbasis_exponents[atom_index].append(basis_exponents[atom_index][counter:counter+(2*l+1)]) 87 | newbasis_norms[atom_index].append(basis_norms[atom_index][counter:counter+(2*l+1)]) 88 | counter += 2*l+1 89 | 90 | Rs_out_list = [] 91 | elementdict = {} 92 | for i, elem in enumerate(elements): 93 | if elem not in elementdict: 94 | elementdict[elem] = Rs_outs[i] 95 | Rs_out_list.append(Rs_outs[i]) 96 | 97 | ''' 98 | #psi4 99 | S: 0 100 | P: 0, +1, -1 101 | D: 0, +1, -1, +2, -2 102 | F: 0, +1, -1, +2, -2, +3, -3 103 | G: 0, +1, -1, +2, -2, +3, -3, +4, -4 104 | H: 0, +1, -1, +2, -2, +3, -3, +4, -4, +5, -5 105 | I: 0, +1, -1, +2, -2, +3, -3, +4, -4, +5, -5, +6, -6 106 | 107 | #e3nn (wikipedia) 108 | S: 0 109 | P: -1, 0, +1 110 | D: -2, -1, 0, +1, +2 111 | F: -3, -2, -1, 0, +1, +2, +3 112 | G: -4, -3, -2, -1, 0, +1, +2, +3, +4 113 | H: -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5 114 | I: -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6 115 | ''' 116 | 117 | ## s p d f g h i 118 | psi4_2_e3nn = [[0],[2,0,1],[4,2,0,1,3],[6,4,2,0,1,3,5],[8,6,4,2,0,1,3,5,7],[10,8,6,4,2,0,1,3,5,7,9],[12,10,8,6,4,2,0,1,3,5,7,9,11]] 119 | 120 | ''' 121 | test = [[0],[0, +1, -1],[0, +1, -1, +2, -2],[0, +1, -1, +2, -2, +3, -3], 122 | [0, +1, -1, +2, -2, +3, -3, +4, -4]] 123 | for i, item in enumerate(test): 124 | l = (len(item)-1)//2 125 | print (l) 126 | test[i] = [item[i] for i in psi4_2_e3nn[l]] 127 | ''' 128 | 129 | 130 | #change convention from psi4 to e3nn 131 | for i, atom in enumerate(newbasis_coeffs): 132 | for j, item in enumerate(atom): 133 | l = (len(item)-1)//2 134 | if l > 6: 135 | raise ValueError('L is too high. Currently only supports L<7') 136 | newbasis_coeffs[i][j] = [item[k] for k in psi4_2_e3nn[l]] 137 | 138 | 139 | return newbasis_coeffs, newbasis_exponents, newbasis_norms, Rs_outs 140 | 141 | 142 | def get_energy_force(filepath,out_file,num_atoms): 143 | file = filepath + "/" + out_file 144 | 145 | flag = False 146 | with open (file,"r") as f: 147 | for line in f: 148 | if "Total Energy =" in line: 149 | energy = float(line.split()[3]) 150 | if "Total Gradient:" in line: 151 | flag = True 152 | counter = 0 153 | forces = [] 154 | if flag == True: 155 | if 2 < counter < num_atoms+3: 156 | forces.append([float(line.split()[1]), float(line.split()[2]), float(line.split()[3])]) 157 | counter += 1 158 | 159 | energy = np.array(energy) 160 | forces = np.array(forces) 161 | 162 | return energy, forces 163 | 164 | 165 | 166 | def get_coordinates(filepath,inputfile): 167 | """ 168 | reads in coordinates and atomic number from psi4 input file 169 | 170 | returns: 171 | -shape [N, 3] numpy array of points 172 | -shape [N] numpy array of masses 173 | -shape [N] list of element symbols 174 | """ 175 | # read in coords and atomic numbers 176 | inputfile = filepath + "/" + inputfile 177 | 178 | if not os.path.exists(inputfile): 179 | inputfile = inputfile + ".xyz" 180 | 181 | points = np.loadtxt(inputfile, skiprows=2, usecols=range(1,4)) 182 | numatoms = len(points) 183 | elements = np.genfromtxt(inputfile, skip_header=2, usecols=0,dtype='str') 184 | atomic_numbers = [getattr(pt,i).number for i in elements] 185 | unique_elements = len(np.unique(atomic_numbers)) 186 | onehot = np.zeros((numatoms,unique_elements)) 187 | 188 | #get one hot vector 189 | weighted_onehot = onehot 190 | typedict = {} 191 | counter = -1 192 | for i, num in enumerate(atomic_numbers): 193 | if num not in typedict: 194 | # dictionary: key = atomic number 195 | # value = 0,1,2,3 (ascending types) 196 | counter += 1 197 | typedict[num] = counter 198 | weighted_onehot[i, typedict[num]] = num 199 | 200 | #print(weighted_onehot) 201 | 202 | return points, numatoms, atomic_numbers, elements, weighted_onehot 203 | 204 | 205 | def get_dataset(filepath): 206 | dataset = [] 207 | 208 | #coeff_by_type_list = [] 209 | for filename in sorted(os.listdir(filepath)): 210 | if filename.endswith("density.out"): 211 | # read in stuff 212 | densityfile = filename 213 | split = filename.split("_") 214 | xyzfile = split[0] + "_" + split[1] 215 | print(xyzfile) 216 | doforces = True 217 | outfile = "output_" + xyzfile + ".dat" 218 | if not os.path.exists(filepath + outfile): 219 | outfile = "output_" + xyzfile + ".xyz.dat" 220 | if not os.path.exists(filepath + outfile): 221 | outfile = xyzfile + "_output.dat" 222 | if not os.path.exists(filepath + outfile): 223 | outfile = xyzfile + ".xyz_output.dat" 224 | if not os.path.exists(filepath + outfile): 225 | doforces = False 226 | print("No energies or forces because ", outfile, "does not exist") 227 | 228 | # read in xyz file 229 | # get number of atoms 230 | # get onehot encoding 231 | points, num_atoms, atomic_numbers, elements, weighted_onehot = get_coordinates(filepath,xyzfile) 232 | N = num_atoms 233 | 234 | doPac = False 235 | if os.path.exists(filepath + xyzfile+"_charge"): 236 | pac = get_pac(filepath, xyzfile, N) 237 | doPac = True 238 | 239 | # construct one hot encoding 240 | onehot = weighted_onehot 241 | # replace all nonzero values with 1 242 | onehot[onehot > 0.001] = 1 243 | 244 | # read in density file 245 | coefficients, exponents, norms, Rs_out_list = get_densities(filepath,densityfile,elements,N) 246 | 247 | if doforces: 248 | energy, forces = get_energy_force(filepath,outfile,N) 249 | 250 | # compute Rs_out_max 251 | # this is necessary because O and H have different Rs_out 252 | # to deal with this, I set the global Rs_out to be the maximum 253 | # basically, for each L, 254 | # i take whichever entry that has the higher multiplicity 255 | 256 | from itertools import zip_longest 257 | 258 | #print(Rs_out_list) 259 | 260 | a = list(zip_longest(*Rs_out_list)) 261 | # remove Nones 262 | b = [[v if v is not None else (0,0) for v in nested] for nested in a] 263 | 264 | Rs_out_max = [] 265 | for rss in b: 266 | Rs_out_max.append(max(rss)) 267 | 268 | # HACKY: MANUAL OVERRIDE OF RS_OUT_MAX 269 | # set manual Rs_out_max (comment out if desired) 270 | #Rs_out_max=[(14, 0), (5, 1), (5, 2), (2, 3), (1, 4)] 271 | #print("Using manual Rs_out_max:", Rs_out_max) 272 | 273 | ## now construct coefficient, exponent and norm arrays 274 | ## from Rs_out_max 275 | ## pad with zeros 276 | 277 | coeff_dim = 0 278 | for mul, l in Rs_out_max: 279 | coeff_dim += mul*((2*l) + 1) 280 | 281 | rect_coeffs = torch.zeros(len(Rs_out_list),coeff_dim) 282 | rect_expos = torch.zeros(len(Rs_out_list),coeff_dim) 283 | rect_norms = torch.zeros(len(Rs_out_list),coeff_dim) 284 | 285 | for i, (atom, coeff_list, expo_list, norm_list) in enumerate(zip(Rs_out_list, coefficients, exponents, norms)): 286 | counter = 0 287 | list_counter = 0 288 | for (mul, l), (max_mul, max_l) in zip(atom, Rs_out_max): 289 | n = mul*((2*l) + 1) 290 | rect_coeffs[i,counter:counter+n] = torch.Tensor(list(flatten_list(coeff_list[list_counter:list_counter+mul]))) 291 | rect_expos[i,counter:counter+n] = torch.Tensor(list(flatten_list(expo_list[list_counter:list_counter+mul]))) 292 | rect_norms[i,counter:counter+n] = torch.Tensor(list(flatten_list(norm_list[list_counter:list_counter+mul]))) 293 | list_counter += mul 294 | max_n = max_mul*((2*max_l)+1) 295 | counter += max_n 296 | 297 | # dataset includes partial atomic charges 298 | if doPac: 299 | 300 | print("Dataset includes PAC") 301 | 302 | # dataset includes energies and forces 303 | if doforces: 304 | cluster_dict = { 305 | 'type' : torch.Tensor(atomic_numbers), 306 | 'pos' : torch.Tensor(points), 307 | 'onehot' : torch.Tensor(onehot), 308 | 'coefficients' : rect_coeffs, 309 | 'exponents' : rect_expos, 310 | 'norms' : rect_norms, 311 | 'rs_max' : Rs_out_max, 312 | 'energy' : torch.Tensor(energy), 313 | 'forces' : torch.Tensor(forces), 314 | 'pa_charges' : torch.Tensor(pac) 315 | } 316 | else: 317 | cluster_dict = { 318 | 'type' : torch.Tensor(atomic_numbers), 319 | 'pos' : torch.Tensor(points), 320 | 'onehot' : torch.Tensor(onehot), 321 | 'coefficients' : rect_coeffs, 322 | 'exponents' : rect_expos, 323 | 'norms' : rect_norms, 324 | 'rs_max' : Rs_out_max, 325 | 'pa_charges' : torch.Tensor(pac) 326 | } 327 | 328 | # dataset does NOT include partial atomic charges 329 | elif doforces: 330 | cluster_dict = { 331 | 'type' : torch.Tensor(atomic_numbers), 332 | 'pos' : torch.Tensor(points), 333 | 'onehot' : torch.Tensor(onehot), 334 | 'coefficients' : rect_coeffs, 335 | 'exponents' : rect_expos, 336 | 'norms' : rect_norms, 337 | 'rs_max' : Rs_out_max, 338 | 'energy' : torch.Tensor(energy), 339 | 'forces' : torch.Tensor(forces), 340 | } 341 | else: 342 | cluster_dict = { 343 | 'type' : torch.Tensor(atomic_numbers), 344 | 'pos' : torch.Tensor(points), 345 | 'onehot' : torch.Tensor(onehot), 346 | 'coefficients' : rect_coeffs, 347 | 'exponents' : rect_expos, 348 | 'norms' : rect_norms, 349 | 'rs_max' : Rs_out_max, 350 | } 351 | dataset.append(cluster_dict) 352 | 353 | # reset onehot based on whole dataset 354 | # need list of unique atomic numbers, in ascending order 355 | # then iterate through atoms 356 | # onehot[i, index_of_matching_atom_in_unique_elements] = 1 357 | # look up how to get index- np.where 358 | 359 | all_anum = [] 360 | for item in dataset: 361 | anum = item["type"] 362 | all_anum.extend(anum) 363 | 364 | unique_elements = np.unique(all_anum) 365 | num_unique_elements = len(unique_elements) 366 | 367 | for item in dataset: 368 | numatoms = item['pos'].shape[0] 369 | onehot = np.zeros((numatoms,num_unique_elements)) 370 | for i, num in enumerate(item["type"]): 371 | n = num.item() 372 | index = np.where(unique_elements == n) 373 | onehot[i, index] = 1 374 | item['onehot'] = torch.Tensor(onehot) 375 | 376 | 377 | # now get Rs_out_max for whole dataset 378 | all_rs = [] 379 | for item in dataset: 380 | rs = item["rs_max"] 381 | all_rs.append(rs) 382 | 383 | #print(all_rs) 384 | 385 | a = list(zip_longest(*all_rs)) 386 | # remove Nones 387 | b = [[v if v is not None else (0,0) for v in nested] for nested in a] 388 | 389 | Rs_out_max = [] 390 | for rss in b: 391 | Rs_out_max.append(max(rss)) 392 | 393 | print("irreps_out",Rs_out_max) 394 | 395 | return dataset 396 | 397 | # get partial atomic charges (from classical force field, for example) 398 | def get_pac(filepath, inputfile, N): 399 | # partial atomic charges *_charge obtained from Amber parameter file 400 | # assumes charges are ordered the same as the atoms in the *.xyz file 401 | 402 | inputfile = filepath + "/" + inputfile 403 | inputfile = inputfile+"_charge" 404 | 405 | charge = [] 406 | 407 | with open(inputfile) as f: 408 | charge_data=f.readlines() 409 | 410 | for lines in charge_data: 411 | line = lines.split() 412 | if len(line)==1: 413 | charge.append(float(line[0])) 414 | else: 415 | pass 416 | 417 | if N != len(charge): 418 | print("ERROR! Number of charges does not correspond to number of atoms!") 419 | exit() 420 | 421 | return charge 422 | 423 | ############################### 424 | # Start Program 425 | ############################## 426 | 427 | 428 | datapath = sys.argv[1] 429 | picklename = sys.argv[2] 430 | dataset = get_dataset(datapath) 431 | 432 | #print("TACO") 433 | #print(dataset[0]) 434 | 435 | pickle_file = open(picklename, 'wb') 436 | pickle.dump(dataset,pickle_file) 437 | -------------------------------------------------------------------------------- /generate_density_datasets/densityfit_q.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | import numpy as np 4 | import psi4 5 | 6 | 7 | # read in args 8 | 9 | # structure file 10 | xyzfile = sys.argv[1] 11 | # orbital basis 12 | basisname = sys.argv[2] 13 | # auxiliary basis 14 | auxbasis = sys.argv[3] 15 | # level of theory 16 | theory = sys.argv[4] 17 | 18 | xyzprefix = xyzfile.split('.')[0] 19 | 20 | psi4.set_memory('128 GB') 21 | psi4.set_num_threads(16) 22 | psi4.core.set_output_file('output_' + xyzfile + '.dat', False) 23 | 24 | ang2bohr = 1.88973 25 | bohr2ang = 1/ang2bohr 26 | 27 | #necessary to skip the first two lines of standard xyz file format 28 | with open(xyzfile) as f: 29 | temp = f.readlines()[2:] 30 | 31 | molstr = ' '.join(temp) 32 | molstr = molstr + "\n symmetry c1 \n no_reorient \n no_com \n" 33 | mol = psi4.geometry(molstr) 34 | 35 | print("Computing " + theory + " gradient...") 36 | grad, wfn = psi4.gradient('{}/{}'.format(theory,basisname), return_wfn=True) 37 | print("finished gradient calculation") 38 | print("") 39 | 40 | print("Performing density fit with " + auxbasis + " basis set...") 41 | psi4.core.set_global_option('df_basis_scf', auxbasis) 42 | 43 | orbital_basis = wfn.basisset() 44 | aux_basis = psi4.core.BasisSet.build(mol, "DF_BASIS_SCF", "", "JFIT", auxbasis) 45 | #aux_basis.print_detail_out() 46 | 47 | numfuncatom = np.zeros(mol.natom()) 48 | funcmap = [] 49 | shells = [] 50 | 51 | # note: atoms are 0 indexed 52 | for func in range(0, aux_basis.nbf()): 53 | current = aux_basis.function_to_center(func) 54 | shell = aux_basis.function_to_shell(func) 55 | shells.append(shell) 56 | 57 | funcmap.append(current) 58 | numfuncatom[current] += 1 59 | 60 | shellmap = [] 61 | for shell in range(0, aux_basis.nshell()): 62 | count = shells.count(shell) 63 | shellmap.append((count-1)//2) 64 | 65 | # print(numfuncatom) 66 | 67 | zero_basis = psi4.core.BasisSet.zero_ao_basis_set() 68 | mints = psi4.core.MintsHelper(orbital_basis) 69 | 70 | # 71 | # Check normalization of the aux basis 72 | # 73 | #Saux = np.array(mints.ao_overlap(aux_basis, aux_basis)) 74 | #print(Saux) 75 | 76 | # 77 | # Form 3 center integrals (P|mn) 78 | # 79 | J_Pmn = np.squeeze(mints.ao_eri( 80 | aux_basis, zero_basis, orbital_basis, orbital_basis)) 81 | 82 | # 83 | # Form metric (P|Q) and invert, filtering out small eigenvalues for stability 84 | # 85 | J_PQ = np.squeeze(mints.ao_eri(aux_basis, zero_basis, aux_basis, zero_basis)) 86 | evals, evecs = np.linalg.eigh(J_PQ) 87 | evals = np.where(evals < 1e-10, 0.0, 1.0/evals) 88 | J_PQinv = np.einsum('ik,k,jk->ij', evecs, evals, evecs) 89 | 90 | ## THIS IS SLOW 91 | # 92 | # Recompute the integrals, as a simple sanity check (mn|rs) = (mn|P) PQinv[P,Q] (Q|rs) 93 | # where PQinv[P,Q] is the P,Qth element of the invert of the matrix (P|Q) (a Coulomb integral) 94 | # 95 | #approx = np.einsum('Pmn,PQ,Qrs->mnrs', J_Pmn, 96 | # J_PQinv, J_Pmn, optimize=True) 97 | #exact = mints.ao_eri() 98 | #print("checking how good the fit is") 99 | #print(approx - exact) 100 | 101 | # 102 | # Finally, compute and print the fit coefficients. From the density matrix, D, the 103 | # coefficients of the vector of basis aux basis funcions |P) is given by 104 | # 105 | # D_P = Sum_mnQ D_mn (mn|Q) PQinv[P,Q] 106 | # 107 | 108 | # compute q from equations 15-17 in Dunlap paper 109 | # "Variational fitting methods for electronic structure calculations" 110 | q = [] 111 | counter = 0 112 | for i in range(0, mol.natom()): 113 | for j in range(counter, counter + int(numfuncatom[i])): 114 | # print(D_P[j]) 115 | shell_num = aux_basis.function_to_shell(j) 116 | shell = aux_basis.shell(shell_num) 117 | # assumes that each shell only has 1 primitive. true for a2 basis 118 | normalization = shell.coef(0) 119 | exponent = shell.exp(0) 120 | if shellmap[shell_num] == 0: 121 | integral = (1/(4*exponent))*np.sqrt(np.pi/exponent) 122 | q.append(4*np.pi*normalization*integral) 123 | else: 124 | q.append(0.0) 125 | counter += 1 126 | 127 | q = np.array(q) 128 | bigQ = wfn.nalpha() + wfn.nbeta() 129 | 130 | D = np.array(wfn.Da()) + np.array(wfn.Db()) 131 | 132 | # these are the old coefficients 133 | D_P = np.einsum('mn,Pmn,PQ->Q', D, J_Pmn, J_PQinv, optimize=True) 134 | 135 | # compute lambda 136 | numer = bigQ - np.dot(q,D_P) 137 | denom = np.dot(np.dot(q,J_PQinv),q) 138 | lambchop = numer/denom 139 | 140 | new_D_P = D_P + np.dot(J_PQinv, lambchop*q) 141 | 142 | 143 | f = open(xyzprefix + "_" + auxbasis + "_density.out", "w+") 144 | counter = 0 145 | totalq = 0.0 146 | newtotalq = 0.0 147 | for i in range(0, mol.natom()): 148 | f.write("Atom number: %i \n" % i) 149 | f.write("number of functions: %i \n" % int(numfuncatom[i])) 150 | for j in range(counter, counter + int(numfuncatom[i])): 151 | shell_num = aux_basis.function_to_shell(j) 152 | shell = aux_basis.shell(shell_num) 153 | # assumes that each shell only has 1 primitive. true for a2 basis 154 | normalization = shell.coef(0) 155 | exponent = shell.exp(0) 156 | integral = (1/(4*exponent))*np.sqrt(np.pi/exponent) 157 | 158 | if shellmap[shell_num] == 0: 159 | totalq += D_P[j]*4*np.pi*normalization*integral 160 | newtotalq += new_D_P[j]*4*np.pi*normalization*integral 161 | 162 | f.write(str(shellmap[shell_num]) + " " + np.array2string(new_D_P[j]) + 163 | " " + str(exponent) + " " + str(normalization) + "\n") 164 | counter += 1 165 | 166 | f.close() 167 | -------------------------------------------------------------------------------- /ml-dna/data/c_s_only_augccpvdz_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.06927052 1861.0916331 201.94630426246215 4 | 0 0.1783505 642.9939764 91.0050034712799 5 | 0 0.5391459 235.1105725 42.79216027235321 6 | 0 1.34220933 90.7028894 20.947197802874577 7 | 0 2.13839132 36.7794552 10.644225366933398 8 | 0 1.81446949 15.6046273 5.595644851503858 9 | 0 0.24526264 6.8907294 3.0311608903618095 10 | 0 0.14633524 3.147885 -1.6843185659365103 11 | 0 0.15242587 1.4777287 0.9552259746167155 12 | 0 0.43269841 0.7076466 0.54988568060601 13 | 0 0.1245583 0.3430122 0.3194421847561347 14 | 0 0.03476461 0.1669453 0.18614044160090212 15 | -------------------------------------------------------------------------------- /ml-dna/data/def2-universal-jfit-dna.gbs: -------------------------------------------------------------------------------- 1 | **** 2 | H 0 3 | S 1 1.00 4 | 15.6752927 0.0186886 5 | S 1 1.00 6 | 3.6063578 0.0631670 7 | S 1 1.00 8 | 1.2080016 0.1204609 9 | S 1 1.00 10 | 0.4726794 0.0592485 11 | S 1 1.00 12 | 0.2018100 0.0051272 13 | P 1 1.00 14 | 2.0281365 1.0 15 | P 1 1.00 16 | 0.5358730 1.0 17 | D 1 1.00 18 | 2.2165124 0.0033116 19 | **** 20 | C 0 21 | S 1 1.00 22 | 1861.0916331 0.0744171 23 | S 1 1.00 24 | 642.9939764 0.1653957 25 | S 1 1.00 26 | 235.1105725 0.5576484 27 | S 1 1.00 28 | 90.7028894 1.3108298 29 | S 1 1.00 30 | 36.7794552 2.1694681 31 | S 1 1.00 32 | 15.6046273 1.7668846 33 | S 1 1.00 34 | 6.8907294 0.2930769 35 | S 1 1.00 36 | 3.1478850 -0.1708702 37 | S 1 1.00 38 | 1.4777287 0.1641553 39 | S 1 1.00 40 | 0.7076466 0.4149941 41 | S 1 1.00 42 | 0.3430122 0.1624366 43 | S 1 1.00 44 | 0.1669453 0.0207675 45 | P 1 1.00 46 | 13.5472892 -0.0206477 47 | P 1 1.00 48 | 5.4669419 -0.0115282 49 | P 1 1.00 50 | 2.1751721 0.0455914 51 | P 1 1.00 52 | 0.8582194 0.0028360 53 | P 1 1.00 54 | 0.3376720 0.0181875 55 | D 1 1.00 56 | 5.9287253 -0.0225948 57 | D 1 1.00 58 | 1.9809209 -0.0476827 59 | D 1 1.00 60 | 0.8055417 -0.0365372 61 | D 1 1.00 62 | 0.3531244 -0.0145417 63 | F 1 1.00 64 | 1.6755626 0.0088798 65 | F 1 1.00 66 | 0.5997536 0.0069903 67 | G 1 1.00 68 | 1.0024600 -0.0022192 69 | **** 70 | N 0 71 | S 1 1.00 72 | 2542.9401785 0.0904668 73 | S 1 1.00 74 | 1029.5472946 0.1455675 75 | S 1 1.00 76 | 424.9053546 0.4594090 77 | S 1 1.00 78 | 178.4573708 1.1392859 79 | S 1 1.00 80 | 76.1362742 2.1795891 81 | S 1 1.00 82 | 32.9338653 2.7604305 83 | S 1 1.00 84 | 14.4155436 1.2837451 85 | S 1 1.00 86 | 6.3718891 -0.1702642 87 | S 1 1.00 88 | 2.8381742 0.0504472 89 | S 1 1.00 90 | 1.2711793 0.6634588 91 | S 1 1.00 92 | 0.5712407 0.4116559 93 | S 1 1.00 94 | 0.2569887 0.0489167 95 | P 1 1.00 96 | 17.8975990 -0.0330656 97 | P 1 1.00 98 | 6.5346319 0.0041582 99 | P 1 1.00 100 | 2.3523645 0.0525824 101 | P 1 1.00 102 | 0.8397377 0.0017058 103 | P 1 1.00 104 | 0.2989335 0.0122960 105 | D 1 1.00 106 | 7.6909870 0.0035820 107 | D 1 1.00 108 | 2.3044972 0.0180403 109 | D 1 1.00 110 | 0.8403987 0.0194441 111 | D 1 1.00 112 | 0.3303797 0.0002361 113 | F 1 1.00 114 | 2.3331076 0.0067248 115 | F 1 1.00 116 | 0.8446137 0.0054427 117 | G 1 1.00 118 | 1.4037700 -0.0023051 119 | **** 120 | O 0 121 | S 1 1.00 122 | 2876.8216605 0.1443558 123 | S 1 1.00 124 | 1004.7443032 0.2920041 125 | S 1 1.00 126 | 369.7579954 1.0258517 127 | S 1 1.00 128 | 142.9442404 2.2875516 129 | S 1 1.00 130 | 57.8366425 3.6080237 131 | S 1 1.00 132 | 24.3864983 2.3737865 133 | S 1 1.00 134 | 10.6622662 0.0489414 135 | S 1 1.00 136 | 4.8070437 -0.1295186 137 | S 1 1.00 138 | 2.2210770 0.7747158 139 | S 1 1.00 140 | 1.0447795 0.7647816 141 | S 1 1.00 142 | 0.4968425 0.2369803 143 | S 1 1.00 144 | 0.2371384 0.0208099 145 | P 1 1.00 146 | 64.2613382 -0.0126659 147 | P 1 1.00 148 | 16.3006076 -0.0378744 149 | P 1 1.00 150 | 4.3550542 0.0638078 151 | P 1 1.00 152 | 1.2019554 0.0169516 153 | P 1 1.00 154 | 0.3354196 0.0065743 155 | D 1 1.00 156 | 9.2146611 -0.0597914 157 | D 1 1.00 158 | 2.8435251 -0.0846724 159 | D 1 1.00 160 | 0.9955759 -0.0466066 161 | D 1 1.00 162 | 0.3649441 -0.0096978 163 | F 1 1.00 164 | 2.6420115 1.0 165 | F 1 1.00 166 | 0.7345613 1.0 167 | G 1 1.00 168 | 1.3931000 -0.0016533 169 | **** 170 | P 0 171 | S 1 1.00 172 | 7402.6405628 0.6312551 173 | S 1 1.00 174 | 2444.3806296 1.0410015 175 | S 1 1.00 176 | 1031.0485275 3.5177235 177 | S 1 1.00 178 | 387.5215861 7.8577024 179 | S 1 1.00 180 | 159.3342518 9.3323916 181 | S 1 1.00 182 | 72.5438912 3.5808385 183 | S 1 1.00 184 | 29.2976155 -1.1039880 185 | S 1 1.00 186 | 13.1685047 2.8706692 187 | S 1 1.00 188 | 6.4235268 4.9937953 189 | S 1 1.00 190 | 3.1479365 1.2003750 191 | S 1 1.00 192 | 1.4941282 -0.4895877 193 | S 1 1.00 194 | 0.6745215 0.3794973 195 | S 1 1.00 196 | 0.3252877 0.3625040 197 | S 1 1.00 198 | 0.1527285 0.0512179 199 | P 1 1.00 200 | 10.6100703 0.0333958 201 | P 1 1.00 202 | 3.3972489 -0.0239301 203 | P 1 1.00 204 | 1.0821336 0.0194214 205 | P 1 1.00 206 | 0.3436265 0.0184052 207 | P 1 1.00 208 | 0.1090044 0.0008768 209 | D 1 1.00 210 | 5.5575593 0.0066400 211 | D 1 1.00 212 | 2.6033240 -0.0123559 213 | D 1 1.00 214 | 1.2378589 0.0087029 215 | D 1 1.00 216 | 0.5939646 0.0072180 217 | D 1 1.00 218 | 0.2858732 -0.0025575 219 | F 1 1.00 220 | 1.0262041 0.0104661 221 | F 1 1.00 222 | 0.2959414 0.0038742 223 | G 1 1.00 224 | 0.5510844 -0.0032181 225 | **** 226 | -------------------------------------------------------------------------------- /ml-dna/data/h_s_only_augccpvdz_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 5 3 | 0 0.01419227 15.6752927 5.614638980502037 4 | 0 0.04509363 3.6063578 1.8651411400891058 5 | 0 0.08891183 1.2080016 0.821222281824621 6 | 0 0.06375281 0.4726794 0.4062890324224442 7 | 0 0.01323314 0.20181 0.2145937672719459 8 | -------------------------------------------------------------------------------- /ml-dna/data/n_s_only_augccpvdz_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.06836028 2542.9401785 255.21852830250864 4 | 0 0.20489191 1029.5472946 129.53729340379954 5 | 0 0.36859207 424.9053546 66.70052392457843 6 | 0 1.25726207 178.4573708 34.79853493309847 7 | 0 2.05996332 76.1362742 18.369773755849923 8 | 0 2.88331098 32.9338653 9.798105715194534 9 | 0 1.18757001 14.4155436 5.272703619894508 10 | 0 0.10286123 6.3718891 -2.858322635668605 11 | 0 -0.0207373 2.8381742 1.5584374576977444 12 | 0 0.74954293 1.2711793 0.8532282009690848 13 | 0 0.31864503 0.5712407 0.4683003142669729 14 | 0 0.07462986 0.2569887 0.2572442125464426 15 | -------------------------------------------------------------------------------- /ml-dna/data/o_s_only_augccpvdz_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.13975724 2876.8216605 279.9592344302619 4 | 0 0.30364767 1004.7443032 127.18964541427866 5 | 0 1.00948103 369.7579954 60.096374478263876 6 | 0 2.32725359 142.9442404 29.463551033919583 7 | 0 3.55056587 57.8366425 14.947287826773351 8 | 0 2.46153849 24.3864983 7.821178090123978 9 | 0 -0.04355171 10.6622662 4.205302419986137 10 | 0 0.07668174 4.8070437 -2.3137617908121966 11 | 0 0.7722682 2.221077 1.2966799732646255 12 | 0 0.75716529 1.0447795 0.7365098749756717 13 | 0 0.18911844 0.4968425 0.42176850477180133 14 | 0 0.03608055 0.2371384 0.24219295507675304 15 | -------------------------------------------------------------------------------- /ml-dna/data/p_s_only_augccpvdz_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 14 3 | 0 0.62947533 7402.6405628 568.7875598025535 4 | 0 1.04774919 2444.3806296 247.76315197594624 5 | 0 3.5018585 1031.0485275 129.6789310615813 6 | 0 7.88611072 387.5215861 62.24894802546478 7 | 0 9.29824293 159.3342518 31.962589066731116 8 | 0 3.62253522 72.5438912 17.715798320084602 9 | 0 1.15209684 29.2976155 -8.97499671966167 10 | 0 2.92303926 13.1685047 4.926771716165324 11 | 0 4.90825116 6.4235268 2.8756779510992794 12 | 0 1.26928452 3.1479365 1.684339232724391 13 | 0 0.55385943 1.4941282 -0.9631656578723533 14 | 0 0.45158615 0.6745215 0.5304652510946215 15 | 0 0.32980284 0.3252877 0.3069805243309288 16 | 0 0.06493879 0.1527285 0.17412060081168126 17 | -------------------------------------------------------------------------------- /ml-dna/test-models/saux/def2-universal-jfit-dna.gbs: -------------------------------------------------------------------------------- 1 | **** 2 | H 0 3 | S 1 1.00 4 | 15.6752927 0.0186886 5 | S 1 1.00 6 | 3.6063578 0.0631670 7 | S 1 1.00 8 | 1.2080016 0.1204609 9 | S 1 1.00 10 | 0.4726794 0.0592485 11 | S 1 1.00 12 | 0.2018100 0.0051272 13 | P 1 1.00 14 | 2.0281365 1.0 15 | P 1 1.00 16 | 0.5358730 1.0 17 | D 1 1.00 18 | 2.2165124 0.0033116 19 | **** 20 | C 0 21 | S 1 1.00 22 | 1861.0916331 0.0744171 23 | S 1 1.00 24 | 642.9939764 0.1653957 25 | S 1 1.00 26 | 235.1105725 0.5576484 27 | S 1 1.00 28 | 90.7028894 1.3108298 29 | S 1 1.00 30 | 36.7794552 2.1694681 31 | S 1 1.00 32 | 15.6046273 1.7668846 33 | S 1 1.00 34 | 6.8907294 0.2930769 35 | S 1 1.00 36 | 3.1478850 -0.1708702 37 | S 1 1.00 38 | 1.4777287 0.1641553 39 | S 1 1.00 40 | 0.7076466 0.4149941 41 | S 1 1.00 42 | 0.3430122 0.1624366 43 | S 1 1.00 44 | 0.1669453 0.0207675 45 | P 1 1.00 46 | 13.5472892 -0.0206477 47 | P 1 1.00 48 | 5.4669419 -0.0115282 49 | P 1 1.00 50 | 2.1751721 0.0455914 51 | P 1 1.00 52 | 0.8582194 0.0028360 53 | P 1 1.00 54 | 0.3376720 0.0181875 55 | D 1 1.00 56 | 5.9287253 -0.0225948 57 | D 1 1.00 58 | 1.9809209 -0.0476827 59 | D 1 1.00 60 | 0.8055417 -0.0365372 61 | D 1 1.00 62 | 0.3531244 -0.0145417 63 | F 1 1.00 64 | 1.6755626 0.0088798 65 | F 1 1.00 66 | 0.5997536 0.0069903 67 | G 1 1.00 68 | 1.0024600 -0.0022192 69 | **** 70 | N 0 71 | S 1 1.00 72 | 2542.9401785 0.0904668 73 | S 1 1.00 74 | 1029.5472946 0.1455675 75 | S 1 1.00 76 | 424.9053546 0.4594090 77 | S 1 1.00 78 | 178.4573708 1.1392859 79 | S 1 1.00 80 | 76.1362742 2.1795891 81 | S 1 1.00 82 | 32.9338653 2.7604305 83 | S 1 1.00 84 | 14.4155436 1.2837451 85 | S 1 1.00 86 | 6.3718891 -0.1702642 87 | S 1 1.00 88 | 2.8381742 0.0504472 89 | S 1 1.00 90 | 1.2711793 0.6634588 91 | S 1 1.00 92 | 0.5712407 0.4116559 93 | S 1 1.00 94 | 0.2569887 0.0489167 95 | P 1 1.00 96 | 17.8975990 -0.0330656 97 | P 1 1.00 98 | 6.5346319 0.0041582 99 | P 1 1.00 100 | 2.3523645 0.0525824 101 | P 1 1.00 102 | 0.8397377 0.0017058 103 | P 1 1.00 104 | 0.2989335 0.0122960 105 | D 1 1.00 106 | 7.6909870 0.0035820 107 | D 1 1.00 108 | 2.3044972 0.0180403 109 | D 1 1.00 110 | 0.8403987 0.0194441 111 | D 1 1.00 112 | 0.3303797 0.0002361 113 | F 1 1.00 114 | 2.3331076 0.0067248 115 | F 1 1.00 116 | 0.8446137 0.0054427 117 | G 1 1.00 118 | 1.4037700 -0.0023051 119 | **** 120 | O 0 121 | S 1 1.00 122 | 2876.8216605 0.1443558 123 | S 1 1.00 124 | 1004.7443032 0.2920041 125 | S 1 1.00 126 | 369.7579954 1.0258517 127 | S 1 1.00 128 | 142.9442404 2.2875516 129 | S 1 1.00 130 | 57.8366425 3.6080237 131 | S 1 1.00 132 | 24.3864983 2.3737865 133 | S 1 1.00 134 | 10.6622662 0.0489414 135 | S 1 1.00 136 | 4.8070437 -0.1295186 137 | S 1 1.00 138 | 2.2210770 0.7747158 139 | S 1 1.00 140 | 1.0447795 0.7647816 141 | S 1 1.00 142 | 0.4968425 0.2369803 143 | S 1 1.00 144 | 0.2371384 0.0208099 145 | P 1 1.00 146 | 64.2613382 -0.0126659 147 | P 1 1.00 148 | 16.3006076 -0.0378744 149 | P 1 1.00 150 | 4.3550542 0.0638078 151 | P 1 1.00 152 | 1.2019554 0.0169516 153 | P 1 1.00 154 | 0.3354196 0.0065743 155 | D 1 1.00 156 | 9.2146611 -0.0597914 157 | D 1 1.00 158 | 2.8435251 -0.0846724 159 | D 1 1.00 160 | 0.9955759 -0.0466066 161 | D 1 1.00 162 | 0.3649441 -0.0096978 163 | F 1 1.00 164 | 2.6420115 1.0 165 | F 1 1.00 166 | 0.7345613 1.0 167 | G 1 1.00 168 | 1.3931000 -0.0016533 169 | **** 170 | P 0 171 | S 1 1.00 172 | 7402.6405628 0.6312551 173 | S 1 1.00 174 | 2444.3806296 1.0410015 175 | S 1 1.00 176 | 1031.0485275 3.5177235 177 | S 1 1.00 178 | 387.5215861 7.8577024 179 | S 1 1.00 180 | 159.3342518 9.3323916 181 | S 1 1.00 182 | 72.5438912 3.5808385 183 | S 1 1.00 184 | 29.2976155 -1.1039880 185 | S 1 1.00 186 | 13.1685047 2.8706692 187 | S 1 1.00 188 | 6.4235268 4.9937953 189 | S 1 1.00 190 | 3.1479365 1.2003750 191 | S 1 1.00 192 | 1.4941282 -0.4895877 193 | S 1 1.00 194 | 0.6745215 0.3794973 195 | S 1 1.00 196 | 0.3252877 0.3625040 197 | S 1 1.00 198 | 0.1527285 0.0512179 199 | P 1 1.00 200 | 10.6100703 0.0333958 201 | P 1 1.00 202 | 3.3972489 -0.0239301 203 | P 1 1.00 204 | 1.0821336 0.0194214 205 | P 1 1.00 206 | 0.3436265 0.0184052 207 | P 1 1.00 208 | 0.1090044 0.0008768 209 | D 1 1.00 210 | 5.5575593 0.0066400 211 | D 1 1.00 212 | 2.6033240 -0.0123559 213 | D 1 1.00 214 | 1.2378589 0.0087029 215 | D 1 1.00 216 | 0.5939646 0.0072180 217 | D 1 1.00 218 | 0.2858732 -0.0025575 219 | F 1 1.00 220 | 1.0262041 0.0104661 221 | F 1 1.00 222 | 0.2959414 0.0038742 223 | G 1 1.00 224 | 0.5510844 -0.0032181 225 | **** 226 | -------------------------------------------------------------------------------- /ml-dna/test-models/saux/h_s_only_dzhf_def2_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 5 3 | 0 0.01319375 15.6752927 5.614638980502037 4 | 0 0.04976504 3.6063578 1.8651411400891058 5 | 0 0.08519881 1.2080016 0.821222281824621 6 | 0 0.06782745 0.4726794 0.4062890324224442 7 | 0 0.01155194 0.20181 0.2145937672719459 8 | -------------------------------------------------------------------------------- /ml-dna/test-models/saux/o_s_only_dzhf_def2_density.out: -------------------------------------------------------------------------------- 1 | Atom number: 0 2 | number of functions: 12 3 | 0 0.143864 2876.8216605 279.9592344302619 4 | 0 0.29511877 1004.7443032 127.18964541427866 5 | 0 1.02413363 369.7579954 60.096374478263876 6 | 0 2.29726893 142.9442404 29.463551033919583 7 | 0 3.60439626 57.8366425 14.947287826773351 8 | 0 2.38587151 24.3864983 7.821178090123978 9 | 0 0.01854437 10.6622662 4.205302419986137 10 | 0 0.09176851 4.8070437 -2.3137617908121966 11 | 0 0.80531989 2.221077 1.2966799732646255 12 | 0 0.7065782 1.0447795 0.7365098749756717 13 | 0 0.22192882 0.4968425 0.42176850477180133 14 | 0 0.02737538 0.2371384 0.24219295507675304 15 | -------------------------------------------------------------------------------- /ml-dna/test-models/saux/train_saux.py: -------------------------------------------------------------------------------- 1 | import math 2 | import numpy as np 3 | import torch 4 | import torch_geometric 5 | from torch_cluster import radius_graph 6 | from torch_scatter import scatter 7 | from utils import get_iso_permuted_dataset 8 | from utils import get_scalar_density_comparisons 9 | from utils import get_iso_permuted_dataset_lpop_scale 10 | from e3nn.nn.models.gate_points_2101 import Network 11 | from e3nn import o3 12 | import wandb 13 | import random 14 | import psi4 15 | import time 16 | 17 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 18 | #device = torch.device("cpu") 19 | print (device) 20 | 21 | torch.set_default_dtype(torch.float32) 22 | #torch.set_default_dtype(torch.float64) 23 | 24 | # first, get dataset 25 | # eights = "../density_data/w8_def2_constrainQ_padded.pkl" 26 | # hhh = "../density_data/h_s_only_def2-universal-jfit-decontract_density.out" 27 | # ooo = "../density_data/o_s_only_def2-universal-jfit-decontract_density.out" 28 | # w8_dataset = get_iso_permuted_dataset(eights,ooo,hhh) 29 | 30 | # tens = "../density_data/w10_def2_constrainQ_padded.pkl" 31 | # w10_dataset = get_iso_permuted_dataset(tens,ooo,hhh) 32 | 33 | # thirties = "../density_data/w30_def2_constrainQ_padded.pkl" 34 | # w30_dataset = get_iso_permuted_dataset(thirties,ooo,hhh) 35 | 36 | hhh = "h_s_only_dzhf_def2_density.out" 37 | ooo = "o_s_only_dzhf_def2_density.out" 38 | 39 | #Rs = [(16, 0), (14, 1), (13, 2), (7, 3), (7, 4)] 40 | Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)] 41 | 42 | train_data_file = "./w3_dzhf_def2_train_energyforce.pkl" 43 | test_data_file = "./w3_dzhf_def2_test_energyforce.pkl" 44 | #w30_datafile = "../h20-ml-tut/data_water/w30_def2_constrainQ_padded_big.pkl" 45 | 46 | train_dataset = get_iso_permuted_dataset_lpop_scale(train_data_file, Rs, o_iso=ooo,h_iso=hhh) 47 | test_dataset = get_iso_permuted_dataset_lpop_scale(test_data_file, Rs, o_iso=ooo,h_iso=hhh) 48 | random.shuffle(train_dataset) 49 | random.shuffle(test_dataset) 50 | 51 | train_split = [1] 52 | #split = 40 53 | b = 1 54 | 55 | # normalize coefficients in training data 56 | # Rs = [(16, 0), (14, 1), (13, 2), (7, 3), (7, 4)] 57 | 58 | #train_all = torch_geometric.data.DataLoader(dataset[:split], batch_size=b, shuffle=True) 59 | train_loader = torch_geometric.data.DataLoader(train_dataset, batch_size=b, shuffle=True) 60 | test_loader = torch_geometric.data.DataLoader(test_dataset, batch_size=b, shuffle=True) 61 | 62 | num_epochs = 501 63 | 64 | # second, check if num_ele is correct 65 | # def2 basis set max irreps 66 | 67 | # this assumes that l=0 is first!!! 68 | # for mul, l in Rs: 69 | # if l == 0: 70 | # w8_ele = sum(sum(w8_dataset[0]['y'][:,:mul])) 71 | # w10_ele = sum(sum(w10_dataset[0]['y'][:,:mul])) 72 | # w30_ele = sum(sum(w30_dataset[0]['y'][:,:mul])) 73 | 74 | 75 | for train_size in train_split: 76 | 77 | model_kwargs = { 78 | "irreps_in": "2x 0e", #irreps_in 79 | "irreps_hidden": [(mul, l, p) for l, mul in enumerate([200,67,40,29]) for p in [-1, 1]], #irreps_hidden 80 | #"irreps_hidden": "100x0e + 100x0o", 81 | "irreps_out": "12x0e + 5x1o + 4x2e + 2x3o + 1x4e", #irreps_out 82 | "irreps_node_attr": None, #irreps_node_attr 83 | "irreps_edge_attr": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr 84 | "layers": 3, 85 | "max_radius": 3.5, 86 | "number_of_basis": 10, 87 | "radial_layers": 1, 88 | "radial_neurons": 128, 89 | "num_neighbors": 12.2298, 90 | "num_nodes": 24, 91 | "reduce_output": False, 92 | } 93 | 94 | model = Network(**model_kwargs) 95 | 96 | optim = torch.optim.Adam(model.parameters(), lr=1e-2) 97 | optim.zero_grad() 98 | 99 | model.to(device) 100 | 101 | model_kwargs["train_dataset"] = train_data_file 102 | model_kwargs["training set size"] = train_size 103 | run = wandb.init(name='w3_dzhf_def2_saux_e3nn2psi4',project='h20-debug', entity='density-lab', config=model_kwargs, reinit=True) 104 | wandb.watch(model) 105 | 106 | print("train set length:", len(train_loader)) 107 | print("test set length:", len(test_loader)) 108 | 109 | ele_diff_cum_save = 0.0 110 | bigIs_cum_save = 0.0 111 | eps_cum_save = 0.0 112 | 113 | for epoch in range(num_epochs): 114 | 115 | tic = time.perf_counter() 116 | 117 | loss_cum = 0.0 118 | mae_cum = 0.0 119 | mue_cum = 0.0 120 | for step, data in enumerate(train_loader): 121 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 122 | y_ml = model(data.to(device))*mask.to(device) 123 | 124 | # calculate Saux for current sample 125 | basisname = 'dzhf-dna' 126 | auxbasis = 'def2-universal-jfit-dna' 127 | 128 | # define molecule 129 | coords = data.pos.tolist() 130 | atomic_nums = data.z.tolist() 131 | string_coords = [] 132 | for item, anum in zip(coords, atomic_nums): 133 | string = ' '.join([str(elem) for elem in item]) 134 | if anum[0] == 1.0: 135 | line = ' H ' + string 136 | if anum[0] == 8.0: 137 | line = ' O ' + string 138 | string_coords.append(line) 139 | molstr = """ 140 | {} 141 | symmetry c1 142 | no_reorient 143 | units angstrom 144 | no_com 145 | 0 1 146 | """.format("\n".join(string_coords)) 147 | #print(molstr) 148 | mol = psi4.geometry(molstr) 149 | 150 | psi4.core.set_global_option('df_basis_scf', auxbasis) 151 | 152 | orbital_basis = psi4.core.BasisSet.build(mol, key="ORBITAL", target=basisname, fitrole="ORBITAL", quiet=True) 153 | aux_basis = psi4.core.BasisSet.build(mol, "DF_BASIS_SCF", "", "JFIT", auxbasis, quiet=True) 154 | 155 | mints = psi4.core.MintsHelper(orbital_basis) 156 | Saux = np.array(mints.ao_overlap(aux_basis, aux_basis), dtype='f') 157 | Saux = torch.from_numpy(Saux) 158 | #Saux = torch.eye(Saux.size()[0],Saux.size()[1]) #debug identity matrix for Saux 159 | Saux = Saux.cuda() 160 | 161 | # err is size Ncoeff x 1 162 | 163 | e3nnorder_err = (y_ml - data.y.to(device)) 164 | psi4order_err = torch.clone(e3nnorder_err) 165 | 166 | # convert e3nn_err to psi4 ordering so you can multiply by psi4's Saux 167 | 168 | e3nn_2_psi4 = [[0],[1,2,0],[2,3,1,4,0],[3,4,2,5,1,6,0],[4,5,3,6,2,7,1,8,0],[5,6,4,7,3,8,2,9,1,10,0],[6,7,5,8,4,9,3,10,2,11,1,12,0]] 169 | 170 | for atom_ind in range(torch.Tensor.size(psi4order_err)[0]): 171 | coeff_counter = 0 172 | for mul, l in Rs: 173 | for j in range(mul): 174 | k_counter = 0 175 | for k in e3nn_2_psi4[l]: 176 | psi4order_err[atom_ind][coeff_counter+k_counter]=e3nnorder_err[atom_ind][coeff_counter+k] 177 | k_counter +=1 178 | coeff_counter += 2*l+1 179 | 180 | for mul, l in Rs: 181 | if l == 0: 182 | num_ele = sum(sum(y_ml[:,:mul])).detach() 183 | 184 | mue_cum += num_ele 185 | mae_cum += abs(num_ele) 186 | 187 | errtosaux = torch.zeros(Saux.size()[0]).cuda() 188 | 189 | # eliminate 0 mask components in err so you can multiply by Saux 190 | 191 | k = 0 192 | for i in range(np.shape(data.norm)[0]): 193 | for j in range(np.shape(data.norm)[1]): 194 | if(data.norm[i,j]==0.0): 195 | pass 196 | else: 197 | errtosaux[k]=psi4order_err[i,j] 198 | k+=1 199 | 200 | if (k!=Saux.size()[0]): 201 | print("ERROR! Incompatible matrix sizes: k, Saux ", k, Saux.size()[0]) 202 | exit() 203 | 204 | # Saux is size Ncoeff x Ncoeff; err is Ncoeff x 1 205 | # New error is Saux*err, which is still Ncoeff x 1; use mean squared error as loss function 206 | 207 | loss = torch.mv(Saux, errtosaux) 208 | 209 | loss_cum += loss.pow(2).mean().detach().abs() 210 | loss.pow(2).mean().backward() 211 | 212 | optim.step() 213 | optim.zero_grad() 214 | 215 | 216 | # now the test loop 217 | # if epoch % 10 == 0: 218 | with torch.no_grad(): 219 | metrics = [] 220 | for testset in [test_loader]: 221 | test_loss_cum = 0.0 222 | test_mae_cum = 0.0 223 | test_mue_cum = 0.0 224 | bigIs_cum = 0.0 225 | eps_cum = 0.0 226 | ele_diff_cum = 0.0 227 | 228 | for step, data in enumerate(testset): 229 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 230 | y_ml = model(data.to(device))*mask.to(device) 231 | 232 | # calculate Saux for current sample 233 | basisname = 'dzhf-dna' 234 | auxbasis = 'def2-universal-jfit-dna' 235 | 236 | # define molecule 237 | coords = data.pos.tolist() 238 | atomic_nums = data.z.tolist() 239 | string_coords = [] 240 | for item, anum in zip(coords, atomic_nums): 241 | string = ' '.join([str(elem) for elem in item]) 242 | if anum[0] == 1.0: 243 | line = ' H ' + string 244 | if anum[0] == 8.0: 245 | line = ' O ' + string 246 | string_coords.append(line) 247 | molstr = """ 248 | {} 249 | symmetry c1 250 | no_reorient 251 | units angstrom 252 | no_com 253 | 0 1 254 | """.format("\n".join(string_coords)) 255 | mol = psi4.geometry(molstr) 256 | 257 | psi4.core.set_global_option('df_basis_scf', auxbasis) 258 | 259 | orbital_basis = psi4.core.BasisSet.build(mol, key="ORBITAL", target=basisname, fitrole="ORBITAL", quiet=True) 260 | aux_basis = psi4.core.BasisSet.build(mol, "DF_BASIS_SCF", "", "JFIT", auxbasis, quiet=True) 261 | 262 | mints = psi4.core.MintsHelper(orbital_basis) 263 | Saux = np.array(mints.ao_overlap(aux_basis, aux_basis), dtype='f') 264 | Saux = torch.from_numpy(Saux) 265 | #Saux = torch.eye(Saux.size()[0],Saux.size()[1]) #debug identity matrix for Saux 266 | Saux = Saux.cuda() 267 | 268 | # err is size Ncoeff x 1 269 | 270 | e3nnorder_err = (y_ml - data.y.to(device)) 271 | psi4order_err = torch.clone(e3nnorder_err) 272 | 273 | for atom_ind in range(torch.Tensor.size(psi4order_err)[0]): 274 | coeff_counter = 0 275 | for mul, l in Rs: 276 | for j in range(mul): 277 | k_counter = 0 278 | for k in e3nn_2_psi4[l]: 279 | psi4order_err[atom_ind][coeff_counter+k_counter]=e3nnorder_err[atom_ind][coeff_counter+k] 280 | k_counter +=1 281 | coeff_counter += 2*l+1 282 | 283 | for mul, l in Rs: 284 | if l == 0: 285 | num_ele = sum(sum(y_ml[:,:mul])).detach() 286 | 287 | test_mue_cum += num_ele 288 | test_mae_cum += abs(num_ele) 289 | 290 | errtosaux = torch.zeros(Saux.size()[0]).cuda() 291 | 292 | k = 0 293 | for i in range(np.shape(data.norm)[0]): 294 | for j in range(np.shape(data.norm)[1]): 295 | if(data.norm[i,j]==0.0): 296 | pass 297 | else: 298 | errtosaux[k]=psi4order_err[i,j] 299 | k+=1 300 | 301 | if (k!=Saux.size()[0]): 302 | print("ERROR! Incompatible matrix sizes: k, Saux ", k, Saux.size()[0]) 303 | exit() 304 | 305 | # Saux is size Ncoeff x Ncoeff 306 | 307 | loss = torch.mv(Saux, errtosaux) 308 | 309 | test_loss_cum += loss.pow(2).mean().detach().abs() 310 | 311 | if (epoch != 0 and epoch%10==0): 312 | num_ele_target, num_ele_ml, bigI, ep = get_scalar_density_comparisons(data, y_ml, Rs, spacing=0.2, buffer=4.0) 313 | n_ele = np.sum(data.z.cpu().detach().numpy()) 314 | ele_diff_cum += np.abs(n_ele-num_ele_target) 315 | bigIs_cum += bigI 316 | eps_cum += ep 317 | 318 | ele_diff_cum_save = ele_diff_cum 319 | bigIs_cum_save = bigIs_cum 320 | eps_cum_save = eps_cum 321 | 322 | #savename = "./saved_model/def2_lpop/"+str(epoch)+".pkl" 323 | #torch.save(model.state_dict(), savename) 324 | 325 | metrics.append([test_loss_cum, test_mae_cum, test_mue_cum]) 326 | 327 | if (epoch ==0 or epoch%10!=0): 328 | ele_diff_cum = ele_diff_cum_save 329 | bigIs_cum = bigIs_cum_save 330 | eps_cum = eps_cum_save 331 | 332 | 333 | toc = time.perf_counter() 334 | epoch_time = toc-tic 335 | 336 | wandb.log({ 337 | "Epoch": epoch, 338 | "Epoch time": epoch_time, 339 | "Train_Loss": float(loss_cum)/len(train_loader), 340 | "Train_MAE": mae_cum/len(train_loader), 341 | "Train_MUE": mue_cum/len(train_loader), 342 | 343 | "test_Loss": float(metrics[0][0].item())/len(test_loader), 344 | "test_MAE": metrics[0][1].item()/len(test_loader), 345 | "test_MUE": metrics[0][2].item()/len(test_loader), 346 | 347 | "test electron difference": ele_diff_cum/len(test_loader), 348 | "test big I": bigIs_cum/len(test_loader), 349 | "test epsilon": eps_cum/len(test_loader), 350 | 351 | }) 352 | 353 | if epoch % 1 == 0: 354 | print(str(epoch) + " " + f"{float(loss_cum)/len(train_loader):.10f}") 355 | print(" MAE",mae_cum/(len(train_loader)*b)) 356 | print(" MUE",mue_cum/(len(train_loader)*b)) 357 | 358 | #torch.save(model.state_dict(), 'saved_model.pkl') 359 | run.finish() 360 | 361 | 362 | -------------------------------------------------------------------------------- /ml-dna/test-models/saux/w3_dzhf_def2_test_energyforce.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/ml-dna/test-models/saux/w3_dzhf_def2_test_energyforce.pkl -------------------------------------------------------------------------------- /ml-dna/test-models/saux/w3_dzhf_def2_train_energyforce.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/ml-dna/test-models/saux/w3_dzhf_def2_train_energyforce.pkl -------------------------------------------------------------------------------- /ml-dna/train_dna.py: -------------------------------------------------------------------------------- 1 | import math 2 | import numpy as np 3 | import torch 4 | import torch_geometric 5 | from torch_cluster import radius_graph 6 | from torch_scatter import scatter 7 | from utils import get_iso_permuted_dataset 8 | from utils import get_scalar_density_comparisons 9 | from e3nn.nn.models.gate_points_2101 import Network 10 | from e3nn import o3 11 | import wandb 12 | import random 13 | 14 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 15 | #device = torch.device("cpu") 16 | print (device) 17 | 18 | torch.set_default_dtype(torch.float32) 19 | #torch.set_default_dtype(torch.float64) 20 | 21 | # first, get dataset 22 | 23 | hhh = "./data/h_s_only_augccpvdz_density.out" 24 | ooo = "./data/o_s_only_augccpvdz_density.out" 25 | ccc = "./data/c_s_only_augccpvdz_density.out" 26 | nnn = "./data/n_s_only_augccpvdz_density.out" 27 | ppp = "./data/p_s_only_augccpvdz_density.out" 28 | 29 | train_datasets = ["1at-400.pkl", 30 | "2ta-400.pkl", 31 | "3aa-400.pkl", 32 | "4ca-400.pkl", 33 | "5gt-400.pkl", 34 | "6ct-400.pkl", 35 | "7ga-400.pkl", 36 | "8cg-400.pkl", 37 | "9gc-400.pkl", 38 | "10gg-400.pkl"] 39 | 40 | print(train_datasets) 41 | 42 | test_datafile = "2mer-test.pkl" 43 | test_dataset = get_iso_permuted_dataset(test_datafile,h_iso=hhh,c_iso=ccc,n_iso=nnn,o_iso=ooo,p_iso=ppp) 44 | random.shuffle(test_dataset) 45 | 46 | b = 1 47 | train_split = [100] 48 | 49 | test_loader = torch_geometric.data.DataLoader(test_dataset, batch_size=b, shuffle=True) 50 | num_epochs = 251 51 | 52 | # second, check if num_ele is correct 53 | # def2 basis set max irreps 54 | Rs = [(14, 0), (5, 1), (5, 2), (2, 3), (1, 4)] 55 | 56 | for train_size in train_split: 57 | 58 | model_kwargs = { 59 | "irreps_in": "5x 0e", #irreps_in 60 | "irreps_hidden": [(mul, l, p) for l, mul in enumerate([200,67,40,29]) for p in [-1, 1]], #irreps_hidden 61 | #"irreps_hidden": "100x0e + 100x0o", 62 | "irreps_out": "14x0e + 5x1o + 5x2e + 2x3o + 1x4e", #irreps_out 63 | "irreps_node_attr": None, #irreps_node_attr 64 | "irreps_edge_attr": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr 65 | "layers": 5, 66 | "max_radius": 3.5, 67 | "num_neighbors": 12.666666, 68 | "number_of_basis": 10, 69 | "radial_layers": 1, 70 | "radial_neurons": 128, 71 | "num_nodes": 24, 72 | "reduce_output": False, 73 | } 74 | 75 | model = Network(**model_kwargs) 76 | 77 | optim = torch.optim.Adam(model.parameters(), lr=1e-2) 78 | optim.zero_grad() 79 | 80 | model.to(device) 81 | 82 | # load previous model 83 | #checkpoint = torch.load('trainall-100.pkl') 84 | #model.load_state_dict(checkpoint) 85 | 86 | run = wandb.init(config=model_kwargs, reinit=True) 87 | wandb.watch(model) 88 | 89 | ele_diff_cum_save = 0.0 90 | bigIs_cum_save = 0.0 91 | eps_cum_save = 0.0 92 | 93 | for epoch in range(num_epochs): 94 | loss_cum = 0.0 95 | mae_cum = 0.0 96 | mue_cum = 0.0 97 | 98 | train_num_ele = [] 99 | test_num_ele = [] 100 | 101 | for data_file in train_datasets: 102 | 103 | print("Data file: ", data_file) 104 | 105 | train_dataset = get_iso_permuted_dataset(data_file,h_iso=hhh,c_iso=ccc,n_iso=nnn,o_iso=ooo,p_iso=ppp) 106 | random.shuffle(train_dataset) 107 | train_loader = torch_geometric.data.DataLoader(train_dataset[:train_size], batch_size=b, shuffle=True) 108 | 109 | for step, data in enumerate(train_loader): 110 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 111 | y_ml = model(data.to(device))*mask.to(device) 112 | err = (y_ml - data.y.to(device)) 113 | 114 | for mul, l in Rs: 115 | if l == 0: 116 | num_ele = sum(sum(y_ml[:,:mul])).detach() 117 | 118 | train_num_ele.append(num_ele.item()) 119 | 120 | mue_cum += num_ele 121 | mae_cum += abs(num_ele) 122 | 123 | loss_cum += err.pow(2).mean().detach().abs() 124 | err.pow(2).mean().backward() 125 | optim.step() 126 | optim.zero_grad() 127 | 128 | print("Train num ele: ", len(train_num_ele)) 129 | train_tot = len(train_num_ele) 130 | train_stdev = np.std(train_num_ele) 131 | 132 | # now the test loop 133 | # if epoch % 10 == 0: 134 | with torch.no_grad(): 135 | metrics = [] 136 | for testset in [test_loader]: 137 | test_loss_cum = 0.0 138 | test_mae_cum = 0.0 139 | test_mue_cum = 0.0 140 | bigIs_cum = 0.0 141 | eps_cum = 0.0 142 | ele_diff_cum = 0.0 143 | for step, data in enumerate(testset): 144 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 145 | y_ml = model(data.to(device))*mask.to(device) 146 | err = (y_ml - data.y.to(device)) 147 | 148 | for mul, l in Rs: 149 | if l == 0: 150 | num_ele = sum(sum(y_ml[:,:mul])).detach() 151 | 152 | test_num_ele.append(num_ele.item()) 153 | 154 | test_mue_cum += num_ele 155 | test_mae_cum += abs(num_ele) 156 | test_loss_cum += err.pow(2).mean().detach().abs() 157 | 158 | if (epoch != 0 and epoch%10==0): 159 | num_ele_target, num_ele_ml, bigI, ep = get_scalar_density_comparisons(data, y_ml, Rs, spacing=0.2, buffer=4.0) 160 | n_ele = np.sum(data.z.cpu().detach().numpy()) 161 | ele_diff_cum += np.abs(n_ele-num_ele_target) 162 | bigIs_cum += bigI 163 | eps_cum += ep 164 | 165 | ele_diff_cum_save = ele_diff_cum 166 | bigIs_cum_save = bigIs_cum 167 | eps_cum_save = eps_cum 168 | 169 | metrics.append([test_loss_cum, test_mae_cum, test_mue_cum]) 170 | 171 | test_stdev = np.std(test_num_ele) 172 | 173 | if (epoch ==0 or epoch%10!=0): 174 | ele_diff_cum = ele_diff_cum_save 175 | bigIs_cum = bigIs_cum_save 176 | eps_cum = eps_cum_save 177 | 178 | wandb.log({ 179 | "Epoch": epoch, 180 | "Train_Loss": float(loss_cum)/train_tot, 181 | "Train_MAE": mae_cum/train_tot, 182 | "Train_MUE": mue_cum/train_tot, 183 | "Train_STDEV": train_stdev, 184 | "Train_tot": train_tot, 185 | 186 | "test_Loss": float(metrics[0][0].item())/len(test_loader), 187 | "test_MAE": metrics[0][1].item()/len(test_loader), 188 | "test_MUE": metrics[0][2].item()/len(test_loader), 189 | "test_STDEV": test_stdev, 190 | 191 | "test electron difference": ele_diff_cum/len(test_loader), 192 | "test big I": bigIs_cum/len(test_loader), 193 | "test epsilon": eps_cum/len(test_loader), 194 | 195 | }) 196 | 197 | savename = "trainerror-100-"+str(epoch)+".pkl" 198 | torch.save(model.state_dict(), savename) 199 | 200 | run.finish() 201 | 202 | 203 | -------------------------------------------------------------------------------- /tests/test_data_generation/def2-universal-jfit-decontract.gbs: -------------------------------------------------------------------------------- 1 | **** 2 | H 0 3 | S 1 1.00 4 | 15.6752927 0.0186886 5 | S 1 1.00 6 | 3.6063578 0.0631670 7 | S 1 1.00 8 | 1.2080016 0.1204609 9 | S 1 1.00 10 | 0.4726794 0.0592485 11 | S 1 1.00 12 | 0.2018100 0.0051272 13 | P 1 1.00 14 | 2.0281365 1.0 15 | P 1 1.00 16 | 0.5358730 1.0 17 | D 1 1.00 18 | 2.2165124 0.0033116 19 | **** 20 | O 0 21 | S 1 1.00 22 | 2876.8216605 0.1443558 23 | S 1 1.00 24 | 1004.7443032 0.2920041 25 | S 1 1.00 26 | 369.7579954 1.0258517 27 | S 1 1.00 28 | 142.9442404 2.2875516 29 | S 1 1.00 30 | 57.8366425 3.6080237 31 | S 1 1.00 32 | 24.3864983 2.3737865 33 | S 1 1.00 34 | 10.6622662 0.0489414 35 | S 1 1.00 36 | 4.8070437 -0.1295186 37 | S 1 1.00 38 | 2.2210770 0.7747158 39 | S 1 1.00 40 | 1.0447795 0.7647816 41 | S 1 1.00 42 | 0.4968425 0.2369803 43 | S 1 1.00 44 | 0.2371384 0.0208099 45 | P 1 1.00 46 | 64.2613382 -0.0126659 47 | P 1 1.00 48 | 16.3006076 -0.0378744 49 | P 1 1.00 50 | 4.3550542 0.0638078 51 | P 1 1.00 52 | 1.2019554 0.0169516 53 | P 1 1.00 54 | 0.3354196 0.0065743 55 | D 1 1.00 56 | 9.2146611 -0.0597914 57 | D 1 1.00 58 | 2.8435251 -0.0846724 59 | D 1 1.00 60 | 0.9955759 -0.0466066 61 | D 1 1.00 62 | 0.3649441 -0.0096978 63 | F 1 1.00 64 | 2.6420115 1.0 65 | F 1 1.00 66 | 0.7345613 1.0 67 | G 1 1.00 68 | 1.3931000 -0.0016533 69 | **** 70 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_00.dat: -------------------------------------------------------------------------------- 1 | 2 | Scratch directory: /tmp/ 3 | 4 | Scratch directory: /tmp/ 5 | gradient() will perform analytic gradient computation. 6 | 7 | *** tstart() called on dumpster 8 | *** at Thu Dec 2 14:19:40 2021 9 | 10 | => Loading Basis Set <= 11 | 12 | Name: CC-PVDZ 13 | Role: ORBITAL 14 | Keyword: BASIS 15 | atoms 1, 4, 7, 10 entry O line 198 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 16 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 22 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 17 | 18 | 19 | --------------------------------------------------------- 20 | SCF 21 | by Justin Turney, Rob Parrish, Andy Simmonett 22 | and Daniel G. A. Smith 23 | RKS Reference 24 | 16 Threads, 122070 MiB Core 25 | --------------------------------------------------------- 26 | 27 | ==> Geometry <== 28 | 29 | Molecular point group: c1 30 | Full point group: C1 31 | 32 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 33 | 34 | Center X Y Z Mass 35 | ------------ ----------------- ----------------- ----------------- ----------------- 36 | O 29.729877500000 28.790569300000 13.366950000000 15.994914619570 37 | H 28.916242600000 28.547872500000 12.932184200000 1.007825032230 38 | H 30.057731600000 29.576114700000 12.897954000000 1.007825032230 39 | O 30.710048700000 31.154172900000 12.319838500000 15.994914619570 40 | H 30.858392700000 31.591817900000 13.174817100000 1.007825032230 41 | H 31.429014200000 31.430532500000 11.757132500000 1.007825032230 42 | O 30.536991100000 29.595315900000 15.885829000000 15.994914619570 43 | H 31.014757200000 28.893430700000 16.320594800000 1.007825032230 44 | H 30.215210000000 29.219343200000 15.049391700000 1.007825032230 45 | O 31.074792900000 32.116214800000 14.886010200000 15.994914619570 46 | H 30.920375800000 31.269001000000 15.336464900000 1.007825032230 47 | H 30.691696200000 32.784439100000 15.448716200000 1.007825032230 48 | 49 | Running in c1 symmetry. 50 | 51 | Rotational constants: A = 0.10371 B = 0.00011 C = 0.00011 [cm^-1] 52 | Rotational constants: A = 3109.06520 B = 3.40988 C = 3.40718 [MHz] 53 | Nuclear repulsion = 140.625659163546317 54 | 55 | Charge = 0 56 | Multiplicity = 1 57 | Electrons = 40 58 | Nalpha = 20 59 | Nbeta = 20 60 | 61 | ==> Algorithm <== 62 | 63 | SCF Algorithm Type is DF. 64 | DIIS enabled. 65 | MOM disabled. 66 | Fractional occupation disabled. 67 | Guess Type is SAD. 68 | Energy threshold = 1.00e-08 69 | Density threshold = 1.00e-08 70 | Integral threshold = 0.00e+00 71 | 72 | ==> Primary Basis <== 73 | 74 | Basis Set: CC-PVDZ 75 | Blend: CC-PVDZ 76 | Number of shells: 48 77 | Number of basis function: 96 78 | Number of Cartesian functions: 100 79 | Spherical Harmonics?: true 80 | Max angular momentum: 2 81 | 82 | ==> DFT Potential <== 83 | 84 | => Composite Functional: PBE0 <= 85 | 86 | PBE0 Hyb-GGA Exchange-Correlation Functional 87 | 88 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 89 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 90 | 91 | Deriv = 1 92 | GGA = TRUE 93 | Meta = FALSE 94 | 95 | Exchange Hybrid = TRUE 96 | MP2 Hybrid = FALSE 97 | 98 | => Exchange Functionals <= 99 | 100 | 0.7500 Perdew, Burke & Ernzerhof 101 | 102 | => Exact (HF) Exchange <= 103 | 104 | 0.2500 HF 105 | 106 | => Correlation Functionals <= 107 | 108 | 1.0000 Perdew, Burke & Ernzerhof 109 | 110 | => LibXC Density Thresholds <== 111 | 112 | XC_HYB_GGA_XC_PBEH: 1.00E-32 113 | 114 | => Molecular Quadrature <= 115 | 116 | Radial Scheme = TREUTLER 117 | Pruning Scheme = NONE 118 | Nuclear Scheme = TREUTLER 119 | 120 | BS radius alpha = 1 121 | Pruning alpha = 1 122 | Radial Points = 75 123 | Spherical Points = 302 124 | Total Points = 259674 125 | Total Blocks = 2009 126 | Max Points = 256 127 | Max Functions = 96 128 | Weights Tolerance = 1.00E-15 129 | 130 | => Loading Basis Set <= 131 | 132 | Name: (CC-PVDZ AUX) 133 | Role: JKFIT 134 | Keyword: DF_BASIS_SCF 135 | atoms 1, 4, 7, 10 entry O line 221 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 136 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 51 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 137 | 138 | ==> Integral Setup <== 139 | 140 | DFHelper Memory: AOs need 0.035 GiB; user supplied 88.919 GiB. Using in-core AOs. 141 | 142 | ==> MemDFJK: Density-Fitted J/K Matrices <== 143 | 144 | J tasked: Yes 145 | K tasked: Yes 146 | wK tasked: No 147 | OpenMP threads: 16 148 | Memory [MiB]: 91053 149 | Algorithm: Core 150 | Schwarz Cutoff: 1E-12 151 | Mask sparsity (%): 4.2752 152 | Fitting Condition: 1E-10 153 | 154 | => Auxiliary Basis Set <= 155 | 156 | Basis Set: (CC-PVDZ AUX) 157 | Blend: CC-PVDZ-JKFIT 158 | Number of shells: 168 159 | Number of basis function: 464 160 | Number of Cartesian functions: 524 161 | Spherical Harmonics?: true 162 | Max angular momentum: 3 163 | 164 | Cached 100.0% of DFT collocation blocks in 0.488 [GiB]. 165 | 166 | Minimum eigenvalue in the overlap matrix is 2.3939613030E-02. 167 | Reciprocal condition number of the overlap matrix is 5.4155654099E-03. 168 | Using symmetric orthogonalization. 169 | 170 | ==> Pre-Iterations <== 171 | 172 | SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information). 173 | 174 | ------------------------- 175 | Irrep Nso Nmo 176 | ------------------------- 177 | A 96 96 178 | ------------------------- 179 | Total 96 96 180 | ------------------------- 181 | 182 | ==> Iterations <== 183 | 184 | Total Energy Delta E RMS |[F,P]| 185 | 186 | @DF-RKS iter SAD: -304.26162068463128 -3.04262e+02 0.00000e+00 187 | @DF-RKS iter 1: -304.99327838019934 -7.31658e-01 1.13581e-02 DIIS 188 | @DF-RKS iter 2: -304.77252069798487 2.20758e-01 1.39429e-02 DIIS 189 | @DF-RKS iter 3: -305.41966443107441 -6.47144e-01 1.28233e-04 DIIS 190 | @DF-RKS iter 4: -305.41974186419412 -7.74331e-05 3.30655e-05 DIIS 191 | @DF-RKS iter 5: -305.41974529206891 -3.42787e-06 7.34422e-06 DIIS 192 | @DF-RKS iter 6: -305.41974547027121 -1.78202e-07 1.11429e-06 DIIS 193 | @DF-RKS iter 7: -305.41974547460774 -4.33653e-09 8.02824e-08 DIIS 194 | @DF-RKS iter 8: -305.41974547465259 -4.48495e-11 9.83846e-09 DIIS 195 | Energy and wave function converged. 196 | 197 | 198 | ==> Post-Iterations <== 199 | 200 | Electrons on quadrature grid: 201 | Ntotal = 40.0000060484 ; deviation = 6.048e-06 202 | 203 | Orbital Energies [Eh] 204 | --------------------- 205 | 206 | Doubly Occupied: 207 | 208 | 1A -19.195054 2A -19.195041 3A -19.195040 209 | 4A -19.195019 5A -1.030792 6A -1.018565 210 | 7A -1.018564 8A -1.006806 9A -0.548353 211 | 10A -0.530145 11A -0.530144 12A -0.511524 212 | 13A -0.424148 14A -0.386376 15A -0.386375 213 | 16A -0.352326 17A -0.308648 18A -0.305691 214 | 19A -0.305691 20A -0.304628 215 | 216 | Virtual: 217 | 218 | 21A 0.058689 22A 0.097375 23A 0.097375 219 | 24A 0.120243 25A 0.219084 26A 0.264466 220 | 27A 0.264466 28A 0.288924 29A 0.532659 221 | 30A 0.576934 31A 0.576935 32A 0.584731 222 | 33A 0.633145 34A 0.637567 35A 0.655316 223 | 36A 0.655317 37A 0.865569 38A 0.925610 224 | 39A 0.925610 40A 0.966927 41A 0.995521 225 | 42A 1.005313 43A 1.005313 44A 1.037462 226 | 45A 1.058789 46A 1.058789 47A 1.120538 227 | 48A 1.173828 49A 1.250264 50A 1.254800 228 | 51A 1.254801 52A 1.267588 53A 1.291483 229 | 54A 1.352881 55A 1.352881 56A 1.374258 230 | 57A 1.447328 58A 1.492527 59A 1.509597 231 | 60A 1.509597 61A 1.673150 62A 1.673150 232 | 63A 1.686351 64A 1.693761 65A 1.741336 233 | 66A 1.770287 67A 1.806924 68A 1.806924 234 | 69A 2.164190 70A 2.165160 71A 2.171134 235 | 72A 2.171135 73A 2.413411 74A 2.418544 236 | 75A 2.418544 76A 2.465051 77A 2.913938 237 | 78A 2.935582 79A 2.935582 80A 2.947571 238 | 81A 2.980240 82A 3.009629 83A 3.009629 239 | 84A 3.038367 85A 3.149333 86A 3.157210 240 | 87A 3.157748 88A 3.157748 89A 3.529654 241 | 90A 3.531584 91A 3.531585 92A 3.554491 242 | 93A 3.791896 94A 3.791896 95A 3.802568 243 | 96A 3.810192 244 | 245 | Final Occupation by Irrep: 246 | A 247 | DOCC [ 20 ] 248 | 249 | @DF-RKS Final Energy: -305.41974547465259 250 | 251 | => Energetics <= 252 | 253 | Nuclear Repulsion Energy = 140.6256591635463167 254 | One-Electron Energy = -700.5083337918509869 255 | Two-Electron Energy = 282.6486850675162259 256 | DFT Exchange-Correlation Energy = -28.1857559138641349 257 | Empirical Dispersion Energy = 0.0000000000000000 258 | VV10 Nonlocal Energy = 0.0000000000000000 259 | Total Energy = -305.4197454746525864 260 | 261 | Computation Completed 262 | 263 | 264 | Properties will be evaluated at 0.000000, 0.000000, 0.000000 [a0] 265 | 266 | Properties computed using the SCF density matrix 267 | 268 | Nuclear Dipole Moment: [e a0] 269 | X: 2306.4431 Y: 2298.9704 Z: 1066.9134 270 | 271 | Electronic Dipole Moment: [e a0] 272 | X: -2306.4431 Y: -2298.9704 Z: -1066.9134 273 | 274 | Dipole Moment: [e a0] 275 | X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000 276 | 277 | Dipole Moment: [D] 278 | X: 0.0000 Y: 0.0000 Z: 0.0000 Total: 0.0000 279 | 280 | 281 | *** tstop() called on dumpster at Thu Dec 2 14:19:42 2021 282 | Module time: 283 | user time = 27.91 seconds = 0.47 minutes 284 | system time = 1.46 seconds = 0.02 minutes 285 | total time = 2 seconds = 0.03 minutes 286 | Total time: 287 | user time = 27.91 seconds = 0.47 minutes 288 | system time = 1.46 seconds = 0.02 minutes 289 | total time = 2 seconds = 0.03 minutes 290 | 291 | *** tstart() called on dumpster 292 | *** at Thu Dec 2 14:19:42 2021 293 | 294 | 295 | ------------------------------------------------------------ 296 | SCF GRAD 297 | Rob Parrish, Justin Turney, 298 | Andy Simmonett, and Alex Sokolov 299 | ------------------------------------------------------------ 300 | 301 | ==> Geometry <== 302 | 303 | Molecular point group: c1 304 | Full point group: C1 305 | 306 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 307 | 308 | Center X Y Z Mass 309 | ------------ ----------------- ----------------- ----------------- ----------------- 310 | O 29.729877500000 28.790569300000 13.366950000000 15.994914619570 311 | H 28.916242600000 28.547872500000 12.932184200000 1.007825032230 312 | H 30.057731600000 29.576114700000 12.897954000000 1.007825032230 313 | O 30.710048700000 31.154172900000 12.319838500000 15.994914619570 314 | H 30.858392700000 31.591817900000 13.174817100000 1.007825032230 315 | H 31.429014200000 31.430532500000 11.757132500000 1.007825032230 316 | O 30.536991100000 29.595315900000 15.885829000000 15.994914619570 317 | H 31.014757200000 28.893430700000 16.320594800000 1.007825032230 318 | H 30.215210000000 29.219343200000 15.049391700000 1.007825032230 319 | O 31.074792900000 32.116214800000 14.886010200000 15.994914619570 320 | H 30.920375800000 31.269001000000 15.336464900000 1.007825032230 321 | H 30.691696200000 32.784439100000 15.448716200000 1.007825032230 322 | 323 | Nuclear repulsion = 140.625659163546317 324 | 325 | ==> Basis Set <== 326 | 327 | Basis Set: CC-PVDZ 328 | Blend: CC-PVDZ 329 | Number of shells: 48 330 | Number of basis function: 96 331 | Number of Cartesian functions: 100 332 | Spherical Harmonics?: true 333 | Max angular momentum: 2 334 | 335 | ==> DFJKGrad: Density-Fitted SCF Gradients <== 336 | 337 | Gradient: 1 338 | J tasked: Yes 339 | K tasked: Yes 340 | wK tasked: No 341 | OpenMP threads: 16 342 | Integrals threads: 16 343 | Memory [MiB]: 91552 344 | Schwarz Cutoff: 0E+00 345 | Fitting Condition: 1E-10 346 | 347 | => Auxiliary Basis Set <= 348 | 349 | Basis Set: (CC-PVDZ AUX) 350 | Blend: CC-PVDZ-JKFIT 351 | Number of shells: 168 352 | Number of basis function: 464 353 | Number of Cartesian functions: 524 354 | Spherical Harmonics?: true 355 | Max angular momentum: 3 356 | 357 | ==> DFT Potential <== 358 | 359 | => Composite Functional: PBE0 <= 360 | 361 | PBE0 Hyb-GGA Exchange-Correlation Functional 362 | 363 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 364 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 365 | 366 | Deriv = 1 367 | GGA = TRUE 368 | Meta = FALSE 369 | 370 | Exchange Hybrid = TRUE 371 | MP2 Hybrid = FALSE 372 | 373 | => Exchange Functionals <= 374 | 375 | 0.7500 Perdew, Burke & Ernzerhof 376 | 377 | => Exact (HF) Exchange <= 378 | 379 | 0.2500 HF 380 | 381 | => Correlation Functionals <= 382 | 383 | 1.0000 Perdew, Burke & Ernzerhof 384 | 385 | => LibXC Density Thresholds <== 386 | 387 | XC_HYB_GGA_XC_PBEH: 1.00E-32 388 | 389 | => Molecular Quadrature <= 390 | 391 | Radial Scheme = TREUTLER 392 | Pruning Scheme = NONE 393 | Nuclear Scheme = TREUTLER 394 | 395 | BS radius alpha = 1 396 | Pruning alpha = 1 397 | Radial Points = 75 398 | Spherical Points = 302 399 | Total Points = 259674 400 | Total Blocks = 2009 401 | Max Points = 256 402 | Max Functions = 96 403 | Weights Tolerance = 1.00E-15 404 | 405 | 406 | -Total Gradient: 407 | Atom X Y Z 408 | ------ ----------------- ----------------- ----------------- 409 | 1 -0.009462658695 0.004569265394 -0.011391600317 410 | 2 0.008325722681 -0.000129504871 0.003158731494 411 | 3 -0.003888684699 -0.006771117973 0.008670145367 412 | 4 0.012929258129 0.008543484591 0.000201588977 413 | 5 -0.001452543083 -0.008490549767 -0.007869999872 414 | 6 -0.008126874950 -0.001285170768 0.003408917578 415 | 7 0.004418384569 -0.014712208516 -0.002057080555 416 | 8 -0.005994766692 0.006306339186 -0.001898966628 417 | 9 0.005685048290 0.006986095033 0.007418115137 418 | 10 -0.007884869800 0.001598211767 0.013246485438 419 | 11 -0.000343602288 0.008276872041 -0.008217975867 420 | 12 0.005795586606 -0.004891716228 -0.004668360631 421 | 422 | 423 | *** tstop() called on dumpster at Thu Dec 2 14:19:44 2021 424 | Module time: 425 | user time = 18.59 seconds = 0.31 minutes 426 | system time = 0.45 seconds = 0.01 minutes 427 | total time = 2 seconds = 0.03 minutes 428 | Total time: 429 | user time = 46.52 seconds = 0.78 minutes 430 | system time = 1.92 seconds = 0.03 minutes 431 | total time = 4 seconds = 0.07 minutes 432 | => Loading Basis Set <= 433 | 434 | Name: DEF2-UNIVERSAL-JFIT-DECONTRACT 435 | Role: JFIT 436 | Keyword: DF_BASIS_SCF 437 | atoms 1, 4, 7, 10 entry O line 21 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 438 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 3 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 439 | 440 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_02.dat: -------------------------------------------------------------------------------- 1 | 2 | Scratch directory: /tmp/ 3 | 4 | Scratch directory: /tmp/ 5 | gradient() will perform analytic gradient computation. 6 | 7 | *** tstart() called on dumpster 8 | *** at Thu Dec 2 14:19:52 2021 9 | 10 | => Loading Basis Set <= 11 | 12 | Name: CC-PVDZ 13 | Role: ORBITAL 14 | Keyword: BASIS 15 | atoms 1, 4, 7, 10 entry O line 198 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 16 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 22 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 17 | 18 | 19 | --------------------------------------------------------- 20 | SCF 21 | by Justin Turney, Rob Parrish, Andy Simmonett 22 | and Daniel G. A. Smith 23 | RKS Reference 24 | 16 Threads, 122070 MiB Core 25 | --------------------------------------------------------- 26 | 27 | ==> Geometry <== 28 | 29 | Molecular point group: c1 30 | Full point group: C1 31 | 32 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 33 | 34 | Center X Y Z Mass 35 | ------------ ----------------- ----------------- ----------------- ----------------- 36 | O 0.167683527000 11.469247800000 12.963254000000 15.994914619570 37 | H -0.367710412000 12.210190800000 13.240134200000 1.007825032230 38 | H -0.130690366000 10.719049500000 13.495695100000 1.007825032230 39 | O 0.084739022000 9.259938240000 11.150783500000 15.994914619570 40 | H 0.226559624000 10.162498500000 11.468349500000 1.007825032230 41 | H 0.864334106000 8.761456490000 11.432428400000 1.007825032230 42 | O 1.839501740000 7.796654700000 12.869092000000 15.994914619570 43 | H 2.051640510000 6.895442960000 13.103870400000 1.007825032230 44 | H 1.088337060000 8.041131020000 13.427036300000 1.007825032230 45 | O -0.726602614000 8.823991780000 13.748842200000 15.994914619570 46 | H -1.574807640000 8.432949070000 13.941034300000 1.007825032230 47 | H -0.662101626000 8.878237720000 12.778276400000 1.007825032230 48 | 49 | Running in c1 symmetry. 50 | 51 | Rotational constants: A = 0.09435 B = 0.00093 C = 0.00093 [cm^-1] 52 | Rotational constants: A = 2828.49839 B = 28.01147 C = 27.90292 [MHz] 53 | Nuclear repulsion = 143.639072125148317 54 | 55 | Charge = 0 56 | Multiplicity = 1 57 | Electrons = 40 58 | Nalpha = 20 59 | Nbeta = 20 60 | 61 | ==> Algorithm <== 62 | 63 | SCF Algorithm Type is DF. 64 | DIIS enabled. 65 | MOM disabled. 66 | Fractional occupation disabled. 67 | Guess Type is SAD. 68 | Energy threshold = 1.00e-08 69 | Density threshold = 1.00e-08 70 | Integral threshold = 0.00e+00 71 | 72 | ==> Primary Basis <== 73 | 74 | Basis Set: CC-PVDZ 75 | Blend: CC-PVDZ 76 | Number of shells: 48 77 | Number of basis function: 96 78 | Number of Cartesian functions: 100 79 | Spherical Harmonics?: true 80 | Max angular momentum: 2 81 | 82 | ==> DFT Potential <== 83 | 84 | => Composite Functional: PBE0 <= 85 | 86 | PBE0 Hyb-GGA Exchange-Correlation Functional 87 | 88 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 89 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 90 | 91 | Deriv = 1 92 | GGA = TRUE 93 | Meta = FALSE 94 | 95 | Exchange Hybrid = TRUE 96 | MP2 Hybrid = FALSE 97 | 98 | => Exchange Functionals <= 99 | 100 | 0.7500 Perdew, Burke & Ernzerhof 101 | 102 | => Exact (HF) Exchange <= 103 | 104 | 0.2500 HF 105 | 106 | => Correlation Functionals <= 107 | 108 | 1.0000 Perdew, Burke & Ernzerhof 109 | 110 | => LibXC Density Thresholds <== 111 | 112 | XC_HYB_GGA_XC_PBEH: 1.00E-32 113 | 114 | => Molecular Quadrature <= 115 | 116 | Radial Scheme = TREUTLER 117 | Pruning Scheme = NONE 118 | Nuclear Scheme = TREUTLER 119 | 120 | BS radius alpha = 1 121 | Pruning alpha = 1 122 | Radial Points = 75 123 | Spherical Points = 302 124 | Total Points = 258866 125 | Total Blocks = 1976 126 | Max Points = 256 127 | Max Functions = 96 128 | Weights Tolerance = 1.00E-15 129 | 130 | => Loading Basis Set <= 131 | 132 | Name: (CC-PVDZ AUX) 133 | Role: JKFIT 134 | Keyword: DF_BASIS_SCF 135 | atoms 1, 4, 7, 10 entry O line 221 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 136 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 51 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 137 | 138 | ==> Integral Setup <== 139 | 140 | DFHelper Memory: AOs need 0.035 GiB; user supplied 88.893 GiB. Using in-core AOs. 141 | 142 | ==> MemDFJK: Density-Fitted J/K Matrices <== 143 | 144 | J tasked: Yes 145 | K tasked: Yes 146 | wK tasked: No 147 | OpenMP threads: 16 148 | Memory [MiB]: 91026 149 | Algorithm: Core 150 | Schwarz Cutoff: 1E-12 151 | Mask sparsity (%): 3.3854 152 | Fitting Condition: 1E-10 153 | 154 | => Auxiliary Basis Set <= 155 | 156 | Basis Set: (CC-PVDZ AUX) 157 | Blend: CC-PVDZ-JKFIT 158 | Number of shells: 168 159 | Number of basis function: 464 160 | Number of Cartesian functions: 524 161 | Spherical Harmonics?: true 162 | Max angular momentum: 3 163 | 164 | Cached 100.0% of DFT collocation blocks in 0.514 [GiB]. 165 | 166 | Minimum eigenvalue in the overlap matrix is 2.8275782795E-02. 167 | Reciprocal condition number of the overlap matrix is 5.9215646846E-03. 168 | Using symmetric orthogonalization. 169 | 170 | ==> Pre-Iterations <== 171 | 172 | SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information). 173 | 174 | ------------------------- 175 | Irrep Nso Nmo 176 | ------------------------- 177 | A 96 96 178 | ------------------------- 179 | Total 96 96 180 | ------------------------- 181 | 182 | ==> Iterations <== 183 | 184 | Total Energy Delta E RMS |[F,P]| 185 | 186 | @DF-RKS iter SAD: -304.26202197615959 -3.04262e+02 0.00000e+00 187 | @DF-RKS iter 1: -304.98604872634979 -7.24027e-01 1.13585e-02 DIIS 188 | @DF-RKS iter 2: -304.73738884600738 2.48660e-01 1.42049e-02 DIIS 189 | @DF-RKS iter 3: -305.41431735221113 -6.76929e-01 1.71547e-04 DIIS 190 | @DF-RKS iter 4: -305.41439445638889 -7.71042e-05 1.26182e-04 DIIS 191 | @DF-RKS iter 5: -305.41444384809535 -4.93917e-05 3.18887e-05 DIIS 192 | @DF-RKS iter 6: -305.41444713112872 -3.28303e-06 3.68173e-06 DIIS 193 | @DF-RKS iter 7: -305.41444716878516 -3.76564e-08 1.70646e-06 DIIS 194 | @DF-RKS iter 8: -305.41444717823498 -9.44982e-09 2.51032e-07 DIIS 195 | @DF-RKS iter 9: -305.41444717847537 -2.40391e-10 4.18012e-08 DIIS 196 | @DF-RKS iter 10: -305.41444717848225 -6.87805e-12 4.18080e-09 DIIS 197 | Energy and wave function converged. 198 | 199 | 200 | ==> Post-Iterations <== 201 | 202 | Electrons on quadrature grid: 203 | Ntotal = 40.0000062298 ; deviation = 6.230e-06 204 | 205 | Orbital Energies [Eh] 206 | --------------------- 207 | 208 | Doubly Occupied: 209 | 210 | 1A -19.224525 2A -19.204453 3A -19.204450 211 | 4A -19.193194 5A -1.051512 6A -1.027701 212 | 7A -1.027036 8A -1.011021 9A -0.568084 213 | 10A -0.544300 11A -0.527763 12A -0.513219 214 | 13A -0.418251 14A -0.400269 15A -0.393527 215 | 16A -0.366365 17A -0.335362 18A -0.316733 216 | 19A -0.310317 20A -0.302102 217 | 218 | Virtual: 219 | 220 | 21A 0.046076 22A 0.086529 23A 0.096340 221 | 24A 0.159033 25A 0.192306 26A 0.222817 222 | 27A 0.229777 28A 0.243263 29A 0.539204 223 | 30A 0.546543 31A 0.565870 32A 0.590828 224 | 33A 0.621045 34A 0.642252 35A 0.651192 225 | 36A 0.683480 37A 0.859273 38A 0.916981 226 | 39A 0.930931 40A 0.943722 41A 0.968754 227 | 42A 0.984057 43A 1.017276 44A 1.041632 228 | 45A 1.045572 46A 1.091055 47A 1.099750 229 | 48A 1.149972 49A 1.192462 50A 1.219504 230 | 51A 1.254754 52A 1.268247 53A 1.298985 231 | 54A 1.306712 55A 1.340558 56A 1.367111 232 | 57A 1.443015 58A 1.478908 59A 1.509862 233 | 60A 1.539114 61A 1.573896 62A 1.652306 234 | 63A 1.655931 64A 1.704730 65A 1.750251 235 | 66A 1.752351 67A 1.752810 68A 1.789963 236 | 69A 2.145946 70A 2.155333 71A 2.155631 237 | 72A 2.228265 73A 2.243853 74A 2.287326 238 | 75A 2.333825 76A 2.446897 77A 2.891721 239 | 78A 2.918353 79A 2.920324 80A 2.947897 240 | 81A 2.961253 82A 2.974002 83A 3.012197 241 | 84A 3.031889 85A 3.133123 86A 3.141037 242 | 87A 3.144797 88A 3.187832 89A 3.482257 243 | 90A 3.522039 91A 3.529648 92A 3.533769 244 | 93A 3.769817 94A 3.772829 95A 3.800303 245 | 96A 3.865972 246 | 247 | Final Occupation by Irrep: 248 | A 249 | DOCC [ 20 ] 250 | 251 | @DF-RKS Final Energy: -305.41444717848225 252 | 253 | => Energetics <= 254 | 255 | Nuclear Repulsion Energy = 143.6390721251483171 256 | One-Electron Energy = -706.1530571915094470 257 | Two-Electron Energy = 285.2686333721193819 258 | DFT Exchange-Correlation Energy = -28.1690954842405183 259 | Empirical Dispersion Energy = 0.0000000000000000 260 | VV10 Nonlocal Energy = 0.0000000000000000 261 | Total Energy = -305.4144471784822485 262 | 263 | Computation Completed 264 | 265 | 266 | Properties will be evaluated at 0.000000, 0.000000, 0.000000 [a0] 267 | 268 | Properties computed using the SCF density matrix 269 | 270 | Nuclear Dipole Moment: [e a0] 271 | X: 23.4669 Y: 704.6781 Z: 961.3842 272 | 273 | Electronic Dipole Moment: [e a0] 274 | X: -24.2876 Y: -705.0765 Z: -960.4205 275 | 276 | Dipole Moment: [e a0] 277 | X: -0.8207 Y: -0.3983 Z: 0.9637 Total: 1.3270 278 | 279 | Dipole Moment: [D] 280 | X: -2.0861 Y: -1.0124 Z: 2.4495 Total: 3.3729 281 | 282 | 283 | *** tstop() called on dumpster at Thu Dec 2 14:19:55 2021 284 | Module time: 285 | user time = 31.85 seconds = 0.53 minutes 286 | system time = 1.69 seconds = 0.03 minutes 287 | total time = 3 seconds = 0.05 minutes 288 | Total time: 289 | user time = 31.85 seconds = 0.53 minutes 290 | system time = 1.69 seconds = 0.03 minutes 291 | total time = 3 seconds = 0.05 minutes 292 | 293 | *** tstart() called on dumpster 294 | *** at Thu Dec 2 14:19:55 2021 295 | 296 | 297 | ------------------------------------------------------------ 298 | SCF GRAD 299 | Rob Parrish, Justin Turney, 300 | Andy Simmonett, and Alex Sokolov 301 | ------------------------------------------------------------ 302 | 303 | ==> Geometry <== 304 | 305 | Molecular point group: c1 306 | Full point group: C1 307 | 308 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 309 | 310 | Center X Y Z Mass 311 | ------------ ----------------- ----------------- ----------------- ----------------- 312 | O 0.167683527000 11.469247800000 12.963254000000 15.994914619570 313 | H -0.367710412000 12.210190800000 13.240134200000 1.007825032230 314 | H -0.130690366000 10.719049500000 13.495695100000 1.007825032230 315 | O 0.084739022000 9.259938240000 11.150783500000 15.994914619570 316 | H 0.226559624000 10.162498500000 11.468349500000 1.007825032230 317 | H 0.864334106000 8.761456490000 11.432428400000 1.007825032230 318 | O 1.839501740000 7.796654700000 12.869092000000 15.994914619570 319 | H 2.051640510000 6.895442960000 13.103870400000 1.007825032230 320 | H 1.088337060000 8.041131020000 13.427036300000 1.007825032230 321 | O -0.726602614000 8.823991780000 13.748842200000 15.994914619570 322 | H -1.574807640000 8.432949070000 13.941034300000 1.007825032230 323 | H -0.662101626000 8.878237720000 12.778276400000 1.007825032230 324 | 325 | Nuclear repulsion = 143.639072125148317 326 | 327 | ==> Basis Set <== 328 | 329 | Basis Set: CC-PVDZ 330 | Blend: CC-PVDZ 331 | Number of shells: 48 332 | Number of basis function: 96 333 | Number of Cartesian functions: 100 334 | Spherical Harmonics?: true 335 | Max angular momentum: 2 336 | 337 | ==> DFJKGrad: Density-Fitted SCF Gradients <== 338 | 339 | Gradient: 1 340 | J tasked: Yes 341 | K tasked: Yes 342 | wK tasked: No 343 | OpenMP threads: 16 344 | Integrals threads: 16 345 | Memory [MiB]: 91552 346 | Schwarz Cutoff: 0E+00 347 | Fitting Condition: 1E-10 348 | 349 | => Auxiliary Basis Set <= 350 | 351 | Basis Set: (CC-PVDZ AUX) 352 | Blend: CC-PVDZ-JKFIT 353 | Number of shells: 168 354 | Number of basis function: 464 355 | Number of Cartesian functions: 524 356 | Spherical Harmonics?: true 357 | Max angular momentum: 3 358 | 359 | ==> DFT Potential <== 360 | 361 | => Composite Functional: PBE0 <= 362 | 363 | PBE0 Hyb-GGA Exchange-Correlation Functional 364 | 365 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 366 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 367 | 368 | Deriv = 1 369 | GGA = TRUE 370 | Meta = FALSE 371 | 372 | Exchange Hybrid = TRUE 373 | MP2 Hybrid = FALSE 374 | 375 | => Exchange Functionals <= 376 | 377 | 0.7500 Perdew, Burke & Ernzerhof 378 | 379 | => Exact (HF) Exchange <= 380 | 381 | 0.2500 HF 382 | 383 | => Correlation Functionals <= 384 | 385 | 1.0000 Perdew, Burke & Ernzerhof 386 | 387 | => LibXC Density Thresholds <== 388 | 389 | XC_HYB_GGA_XC_PBEH: 1.00E-32 390 | 391 | => Molecular Quadrature <= 392 | 393 | Radial Scheme = TREUTLER 394 | Pruning Scheme = NONE 395 | Nuclear Scheme = TREUTLER 396 | 397 | BS radius alpha = 1 398 | Pruning alpha = 1 399 | Radial Points = 75 400 | Spherical Points = 302 401 | Total Points = 258866 402 | Total Blocks = 1976 403 | Max Points = 256 404 | Max Functions = 96 405 | Weights Tolerance = 1.00E-15 406 | 407 | 408 | -Total Gradient: 409 | Atom X Y Z 410 | ------ ----------------- ----------------- ----------------- 411 | 1 -0.010094600207 0.005901245102 0.007734659130 412 | 2 0.006362805193 -0.004811569488 -0.002245030389 413 | 3 0.004144992444 0.002160704591 -0.006364154871 414 | 4 0.011565594076 0.005272437098 -0.000294603009 415 | 5 -0.003833969547 -0.007164064585 -0.002158471073 416 | 6 -0.007960012921 0.001899943548 -0.001926048211 417 | 7 -0.002033147342 -0.011806862407 0.007280201471 418 | 8 0.000509518540 0.008046416081 -0.001915220533 419 | 9 0.004228093748 0.001977432074 -0.006368564730 420 | 10 -0.014516579863 -0.006384899503 -0.008707600112 421 | 11 0.009332862408 0.004267931888 -0.000759668352 422 | 12 0.002289023849 0.000639369979 0.015702991158 423 | 424 | 425 | *** tstop() called on dumpster at Thu Dec 2 14:19:56 2021 426 | Module time: 427 | user time = 18.49 seconds = 0.31 minutes 428 | system time = 0.33 seconds = 0.01 minutes 429 | total time = 1 seconds = 0.02 minutes 430 | Total time: 431 | user time = 50.36 seconds = 0.84 minutes 432 | system time = 2.02 seconds = 0.03 minutes 433 | total time = 4 seconds = 0.07 minutes 434 | => Loading Basis Set <= 435 | 436 | Name: DEF2-UNIVERSAL-JFIT-DECONTRACT 437 | Role: JFIT 438 | Keyword: DF_BASIS_SCF 439 | atoms 1, 4, 7, 10 entry O line 21 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 440 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 3 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 441 | 442 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_04.dat: -------------------------------------------------------------------------------- 1 | 2 | Scratch directory: /tmp/ 3 | 4 | Scratch directory: /tmp/ 5 | gradient() will perform analytic gradient computation. 6 | 7 | *** tstart() called on dumpster 8 | *** at Thu Dec 2 14:20:03 2021 9 | 10 | => Loading Basis Set <= 11 | 12 | Name: CC-PVDZ 13 | Role: ORBITAL 14 | Keyword: BASIS 15 | atoms 1, 4, 7, 10 entry O line 198 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 16 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 22 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 17 | 18 | 19 | --------------------------------------------------------- 20 | SCF 21 | by Justin Turney, Rob Parrish, Andy Simmonett 22 | and Daniel G. A. Smith 23 | RKS Reference 24 | 16 Threads, 122070 MiB Core 25 | --------------------------------------------------------- 26 | 27 | ==> Geometry <== 28 | 29 | Molecular point group: c1 30 | Full point group: C1 31 | 32 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 33 | 34 | Center X Y Z Mass 35 | ------------ ----------------- ----------------- ----------------- ----------------- 36 | O 21.400169400000 19.161609600000 17.474529300000 15.994914619570 37 | H 21.103427900000 18.622793200000 16.734008800000 1.007825032230 38 | H 21.596614800000 18.550788900000 18.201759300000 1.007825032230 39 | O 19.253093700000 18.362224600000 15.985901800000 15.994914619570 40 | H 18.858875300000 18.954641300000 15.346695900000 1.007825032230 41 | H 19.465053600000 18.917673100000 16.746564900000 1.007825032230 42 | O 22.611236600000 17.790420500000 19.587654100000 15.994914619570 43 | H 23.249465900000 18.485126500000 19.358280200000 1.007825032230 44 | H 23.124401100000 16.993564600000 19.700515700000 1.007825032230 45 | O 23.917846700000 19.968465800000 18.402519200000 15.994914619570 46 | H 23.086509700000 19.876886400000 17.909414300000 1.007825032230 47 | H 23.978111300000 20.891761800000 18.638053900000 1.007825032230 48 | 49 | Running in c1 symmetry. 50 | 51 | Rotational constants: A = 0.12631 B = 0.00020 C = 0.00020 [cm^-1] 52 | Rotational constants: A = 3786.77348 B = 6.08654 C = 6.08000 [MHz] 53 | Nuclear repulsion = 134.158445398370219 54 | 55 | Charge = 0 56 | Multiplicity = 1 57 | Electrons = 40 58 | Nalpha = 20 59 | Nbeta = 20 60 | 61 | ==> Algorithm <== 62 | 63 | SCF Algorithm Type is DF. 64 | DIIS enabled. 65 | MOM disabled. 66 | Fractional occupation disabled. 67 | Guess Type is SAD. 68 | Energy threshold = 1.00e-08 69 | Density threshold = 1.00e-08 70 | Integral threshold = 0.00e+00 71 | 72 | ==> Primary Basis <== 73 | 74 | Basis Set: CC-PVDZ 75 | Blend: CC-PVDZ 76 | Number of shells: 48 77 | Number of basis function: 96 78 | Number of Cartesian functions: 100 79 | Spherical Harmonics?: true 80 | Max angular momentum: 2 81 | 82 | ==> DFT Potential <== 83 | 84 | => Composite Functional: PBE0 <= 85 | 86 | PBE0 Hyb-GGA Exchange-Correlation Functional 87 | 88 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 89 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 90 | 91 | Deriv = 1 92 | GGA = TRUE 93 | Meta = FALSE 94 | 95 | Exchange Hybrid = TRUE 96 | MP2 Hybrid = FALSE 97 | 98 | => Exchange Functionals <= 99 | 100 | 0.7500 Perdew, Burke & Ernzerhof 101 | 102 | => Exact (HF) Exchange <= 103 | 104 | 0.2500 HF 105 | 106 | => Correlation Functionals <= 107 | 108 | 1.0000 Perdew, Burke & Ernzerhof 109 | 110 | => LibXC Density Thresholds <== 111 | 112 | XC_HYB_GGA_XC_PBEH: 1.00E-32 113 | 114 | => Molecular Quadrature <= 115 | 116 | Radial Scheme = TREUTLER 117 | Pruning Scheme = NONE 118 | Nuclear Scheme = TREUTLER 119 | 120 | BS radius alpha = 1 121 | Pruning alpha = 1 122 | Radial Points = 75 123 | Spherical Points = 302 124 | Total Points = 259955 125 | Total Blocks = 1960 126 | Max Points = 256 127 | Max Functions = 95 128 | Weights Tolerance = 1.00E-15 129 | 130 | => Loading Basis Set <= 131 | 132 | Name: (CC-PVDZ AUX) 133 | Role: JKFIT 134 | Keyword: DF_BASIS_SCF 135 | atoms 1, 4, 7, 10 entry O line 221 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 136 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 51 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 137 | 138 | ==> Integral Setup <== 139 | 140 | DFHelper Memory: AOs need 0.032 GiB; user supplied 88.936 GiB. Using in-core AOs. 141 | 142 | ==> MemDFJK: Density-Fitted J/K Matrices <== 143 | 144 | J tasked: Yes 145 | K tasked: Yes 146 | wK tasked: No 147 | OpenMP threads: 16 148 | Memory [MiB]: 91070 149 | Algorithm: Core 150 | Schwarz Cutoff: 1E-12 151 | Mask sparsity (%): 11.7622 152 | Fitting Condition: 1E-10 153 | 154 | => Auxiliary Basis Set <= 155 | 156 | Basis Set: (CC-PVDZ AUX) 157 | Blend: CC-PVDZ-JKFIT 158 | Number of shells: 168 159 | Number of basis function: 464 160 | Number of Cartesian functions: 524 161 | Spherical Harmonics?: true 162 | Max angular momentum: 3 163 | 164 | Cached 100.0% of DFT collocation blocks in 0.471 [GiB]. 165 | 166 | Minimum eigenvalue in the overlap matrix is 2.9464662801E-02. 167 | Reciprocal condition number of the overlap matrix is 6.4380646340E-03. 168 | Using symmetric orthogonalization. 169 | 170 | ==> Pre-Iterations <== 171 | 172 | SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information). 173 | 174 | ------------------------- 175 | Irrep Nso Nmo 176 | ------------------------- 177 | A 96 96 178 | ------------------------- 179 | Total 96 96 180 | ------------------------- 181 | 182 | ==> Iterations <== 183 | 184 | Total Energy Delta E RMS |[F,P]| 185 | 186 | @DF-RKS iter SAD: -304.26452467903454 -3.04265e+02 0.00000e+00 187 | @DF-RKS iter 1: -304.97519651823603 -7.10672e-01 1.13979e-02 DIIS 188 | @DF-RKS iter 2: -304.72408081155243 2.51116e-01 1.42641e-02 DIIS 189 | @DF-RKS iter 3: -305.40681403508984 -6.82733e-01 2.02682e-04 DIIS 190 | @DF-RKS iter 4: -305.40688683378181 -7.27987e-05 1.71882e-04 DIIS 191 | @DF-RKS iter 5: -305.40698102110304 -9.41873e-05 2.95746e-05 DIIS 192 | @DF-RKS iter 6: -305.40698375915935 -2.73806e-06 6.73667e-06 DIIS 193 | @DF-RKS iter 7: -305.40698387181180 -1.12652e-07 3.49301e-06 DIIS 194 | @DF-RKS iter 8: -305.40698391179427 -3.99825e-08 2.73301e-07 DIIS 195 | @DF-RKS iter 9: -305.40698391208105 -2.86775e-10 5.05415e-08 DIIS 196 | @DF-RKS iter 10: -305.40698391209293 -1.18803e-11 5.36572e-09 DIIS 197 | Energy and wave function converged. 198 | 199 | 200 | ==> Post-Iterations <== 201 | 202 | Electrons on quadrature grid: 203 | Ntotal = 39.9999936307 ; deviation = -6.369e-06 204 | 205 | Orbital Energies [Eh] 206 | --------------------- 207 | 208 | Doubly Occupied: 209 | 210 | 1A -19.209954 2A -19.208807 3A -19.203455 211 | 4A -19.202201 5A -1.044048 6A -1.033268 212 | 7A -1.020318 8A -1.019459 9A -0.571226 213 | 10A -0.544096 11A -0.524120 12A -0.515938 214 | 13A -0.407393 14A -0.402254 15A -0.393579 215 | 16A -0.371259 17A -0.325097 18A -0.316685 216 | 19A -0.312669 20A -0.308533 217 | 218 | Virtual: 219 | 220 | 21A 0.055687 22A 0.077810 23A 0.101676 221 | 24A 0.143878 25A 0.166256 26A 0.226210 222 | 27A 0.232257 28A 0.247523 29A 0.530539 223 | 30A 0.547372 31A 0.577945 32A 0.604868 224 | 33A 0.609597 34A 0.628956 35A 0.648136 225 | 36A 0.668701 37A 0.854014 38A 0.897134 226 | 39A 0.915129 40A 0.937517 41A 0.957066 227 | 42A 0.967370 43A 0.990951 44A 1.021679 228 | 45A 1.042176 46A 1.068831 47A 1.095689 229 | 48A 1.130488 49A 1.168937 50A 1.219262 230 | 51A 1.242155 52A 1.255867 53A 1.283917 231 | 54A 1.312646 55A 1.345419 56A 1.401840 232 | 57A 1.453269 58A 1.494026 59A 1.501960 233 | 60A 1.534955 61A 1.610467 62A 1.629741 234 | 63A 1.676653 64A 1.688396 65A 1.716226 235 | 66A 1.766962 67A 1.796467 68A 1.808566 236 | 69A 2.115234 70A 2.154495 71A 2.161804 237 | 72A 2.169932 73A 2.214133 74A 2.322609 238 | 75A 2.344402 76A 2.380567 77A 2.899794 239 | 78A 2.916027 79A 2.928191 80A 2.932658 240 | 81A 2.981080 82A 2.982883 83A 2.997978 241 | 84A 3.036728 85A 3.112555 86A 3.151179 242 | 87A 3.157333 88A 3.190152 89A 3.489523 243 | 90A 3.497742 91A 3.513966 92A 3.539074 244 | 93A 3.763374 94A 3.772720 95A 3.804887 245 | 96A 3.821764 246 | 247 | Final Occupation by Irrep: 248 | A 249 | DOCC [ 20 ] 250 | 251 | @DF-RKS Final Energy: -305.40698391209293 252 | 253 | => Energetics <= 254 | 255 | Nuclear Repulsion Energy = 134.1584453983702190 256 | One-Electron Energy = -687.1853637412422131 257 | Two-Electron Energy = 275.7935731247849276 258 | DFT Exchange-Correlation Energy = -28.1736386940058097 259 | Empirical Dispersion Energy = 0.0000000000000000 260 | VV10 Nonlocal Energy = 0.0000000000000000 261 | Total Energy = -305.4069839120929259 262 | 263 | Computation Completed 264 | 265 | 266 | Properties will be evaluated at 0.000000, 0.000000, 0.000000 [a0] 267 | 268 | Properties computed using the SCF density matrix 269 | 270 | Nuclear Dipole Moment: [e a0] 271 | X: 1647.6923 Y: 1424.0126 Z: 1349.7182 272 | 273 | Electronic Dipole Moment: [e a0] 274 | X: -1647.6405 Y: -1423.5546 Z: -1349.9134 275 | 276 | Dipole Moment: [e a0] 277 | X: 0.0518 Y: 0.4580 Z: -0.1952 Total: 0.5005 278 | 279 | Dipole Moment: [D] 280 | X: 0.1316 Y: 1.1640 Z: -0.4960 Total: 1.2721 281 | 282 | 283 | *** tstop() called on dumpster at Thu Dec 2 14:20:06 2021 284 | Module time: 285 | user time = 31.84 seconds = 0.53 minutes 286 | system time = 1.44 seconds = 0.02 minutes 287 | total time = 3 seconds = 0.05 minutes 288 | Total time: 289 | user time = 31.84 seconds = 0.53 minutes 290 | system time = 1.44 seconds = 0.02 minutes 291 | total time = 3 seconds = 0.05 minutes 292 | 293 | *** tstart() called on dumpster 294 | *** at Thu Dec 2 14:20:06 2021 295 | 296 | 297 | ------------------------------------------------------------ 298 | SCF GRAD 299 | Rob Parrish, Justin Turney, 300 | Andy Simmonett, and Alex Sokolov 301 | ------------------------------------------------------------ 302 | 303 | ==> Geometry <== 304 | 305 | Molecular point group: c1 306 | Full point group: C1 307 | 308 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 309 | 310 | Center X Y Z Mass 311 | ------------ ----------------- ----------------- ----------------- ----------------- 312 | O 21.400169400000 19.161609600000 17.474529300000 15.994914619570 313 | H 21.103427900000 18.622793200000 16.734008800000 1.007825032230 314 | H 21.596614800000 18.550788900000 18.201759300000 1.007825032230 315 | O 19.253093700000 18.362224600000 15.985901800000 15.994914619570 316 | H 18.858875300000 18.954641300000 15.346695900000 1.007825032230 317 | H 19.465053600000 18.917673100000 16.746564900000 1.007825032230 318 | O 22.611236600000 17.790420500000 19.587654100000 15.994914619570 319 | H 23.249465900000 18.485126500000 19.358280200000 1.007825032230 320 | H 23.124401100000 16.993564600000 19.700515700000 1.007825032230 321 | O 23.917846700000 19.968465800000 18.402519200000 15.994914619570 322 | H 23.086509700000 19.876886400000 17.909414300000 1.007825032230 323 | H 23.978111300000 20.891761800000 18.638053900000 1.007825032230 324 | 325 | Nuclear repulsion = 134.158445398370219 326 | 327 | ==> Basis Set <== 328 | 329 | Basis Set: CC-PVDZ 330 | Blend: CC-PVDZ 331 | Number of shells: 48 332 | Number of basis function: 96 333 | Number of Cartesian functions: 100 334 | Spherical Harmonics?: true 335 | Max angular momentum: 2 336 | 337 | ==> DFJKGrad: Density-Fitted SCF Gradients <== 338 | 339 | Gradient: 1 340 | J tasked: Yes 341 | K tasked: Yes 342 | wK tasked: No 343 | OpenMP threads: 16 344 | Integrals threads: 16 345 | Memory [MiB]: 91552 346 | Schwarz Cutoff: 0E+00 347 | Fitting Condition: 1E-10 348 | 349 | => Auxiliary Basis Set <= 350 | 351 | Basis Set: (CC-PVDZ AUX) 352 | Blend: CC-PVDZ-JKFIT 353 | Number of shells: 168 354 | Number of basis function: 464 355 | Number of Cartesian functions: 524 356 | Spherical Harmonics?: true 357 | Max angular momentum: 3 358 | 359 | ==> DFT Potential <== 360 | 361 | => Composite Functional: PBE0 <= 362 | 363 | PBE0 Hyb-GGA Exchange-Correlation Functional 364 | 365 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 366 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 367 | 368 | Deriv = 1 369 | GGA = TRUE 370 | Meta = FALSE 371 | 372 | Exchange Hybrid = TRUE 373 | MP2 Hybrid = FALSE 374 | 375 | => Exchange Functionals <= 376 | 377 | 0.7500 Perdew, Burke & Ernzerhof 378 | 379 | => Exact (HF) Exchange <= 380 | 381 | 0.2500 HF 382 | 383 | => Correlation Functionals <= 384 | 385 | 1.0000 Perdew, Burke & Ernzerhof 386 | 387 | => LibXC Density Thresholds <== 388 | 389 | XC_HYB_GGA_XC_PBEH: 1.00E-32 390 | 391 | => Molecular Quadrature <= 392 | 393 | Radial Scheme = TREUTLER 394 | Pruning Scheme = NONE 395 | Nuclear Scheme = TREUTLER 396 | 397 | BS radius alpha = 1 398 | Pruning alpha = 1 399 | Radial Points = 75 400 | Spherical Points = 302 401 | Total Points = 259955 402 | Total Blocks = 1960 403 | Max Points = 256 404 | Max Functions = 95 405 | Weights Tolerance = 1.00E-15 406 | 407 | 408 | -Total Gradient: 409 | Atom X Y Z 410 | ------ ----------------- ----------------- ----------------- 411 | 1 -0.000924888337 -0.014465599203 -0.002711319768 412 | 2 -0.004575615055 0.007151658603 0.005910812680 413 | 3 0.000427607945 0.011095258144 -0.005080049950 414 | 4 -0.003717944893 0.010610081668 -0.003180151840 415 | 5 0.001945591746 -0.006754569551 0.004275050242 416 | 6 0.005382591605 -0.005164232535 -0.002740454612 417 | 7 0.012604982305 -0.007027437623 0.000708776084 418 | 8 -0.008092755885 -0.005167098738 -0.001739010558 419 | 9 -0.005544680186 0.006901019130 0.001546292929 420 | 10 -0.004970240477 0.013724627071 -0.000773453428 421 | 11 0.005440845879 -0.002644595809 0.007040204698 422 | 12 0.002028211995 -0.008262930922 -0.003259843877 423 | 424 | 425 | *** tstop() called on dumpster at Thu Dec 2 14:20:07 2021 426 | Module time: 427 | user time = 18.09 seconds = 0.30 minutes 428 | system time = 0.39 seconds = 0.01 minutes 429 | total time = 1 seconds = 0.02 minutes 430 | Total time: 431 | user time = 49.95 seconds = 0.83 minutes 432 | system time = 1.83 seconds = 0.03 minutes 433 | total time = 4 seconds = 0.07 minutes 434 | => Loading Basis Set <= 435 | 436 | Name: DEF2-UNIVERSAL-JFIT-DECONTRACT 437 | Role: JFIT 438 | Keyword: DF_BASIS_SCF 439 | atoms 1, 4, 7, 10 entry O line 21 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 440 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 3 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 441 | 442 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_06.dat: -------------------------------------------------------------------------------- 1 | 2 | Scratch directory: /tmp/ 3 | 4 | Scratch directory: /tmp/ 5 | gradient() will perform analytic gradient computation. 6 | 7 | *** tstart() called on dumpster 8 | *** at Thu Dec 2 14:20:14 2021 9 | 10 | => Loading Basis Set <= 11 | 12 | Name: CC-PVDZ 13 | Role: ORBITAL 14 | Keyword: BASIS 15 | atoms 1, 4, 7, 10 entry O line 198 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 16 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 22 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 17 | 18 | 19 | --------------------------------------------------------- 20 | SCF 21 | by Justin Turney, Rob Parrish, Andy Simmonett 22 | and Daniel G. A. Smith 23 | RKS Reference 24 | 16 Threads, 122070 MiB Core 25 | --------------------------------------------------------- 26 | 27 | ==> Geometry <== 28 | 29 | Molecular point group: c1 30 | Full point group: C1 31 | 32 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 33 | 34 | Center X Y Z Mass 35 | ------------ ----------------- ----------------- ----------------- ----------------- 36 | O -5.797778610000 9.924620630000 12.402226400000 15.994914619570 37 | H -6.537137510000 9.861463550000 13.005549400000 1.007825032230 38 | H -5.585468770000 10.865934400000 12.362499200000 1.007825032230 39 | O -3.764295340000 11.693656900000 12.829463000000 15.994914619570 40 | H -3.639020680000 11.960021000000 13.753290200000 1.007825032230 41 | H -3.997259140000 10.759982100000 12.839189500000 1.007825032230 42 | O -1.432180290000 13.242768300000 12.812077500000 15.994914619570 43 | H -2.177422520000 12.674921000000 12.557568600000 1.007825032230 44 | H -1.405841230000 13.941485400000 12.162127500000 1.007825032230 45 | O -2.797551160000 12.786034600000 15.211802500000 15.994914619570 46 | H -2.170397280000 13.086211200000 14.533721900000 1.007825032230 47 | H -2.264236930000 12.521721800000 15.957865700000 1.007825032230 48 | 49 | Running in c1 symmetry. 50 | 51 | Rotational constants: A = 0.05839 B = 0.00070 C = 0.00070 [cm^-1] 52 | Rotational constants: A = 1750.46243 B = 21.05084 C = 20.84531 [MHz] 53 | Nuclear repulsion = 134.164773279177695 54 | 55 | Charge = 0 56 | Multiplicity = 1 57 | Electrons = 40 58 | Nalpha = 20 59 | Nbeta = 20 60 | 61 | ==> Algorithm <== 62 | 63 | SCF Algorithm Type is DF. 64 | DIIS enabled. 65 | MOM disabled. 66 | Fractional occupation disabled. 67 | Guess Type is SAD. 68 | Energy threshold = 1.00e-08 69 | Density threshold = 1.00e-08 70 | Integral threshold = 0.00e+00 71 | 72 | ==> Primary Basis <== 73 | 74 | Basis Set: CC-PVDZ 75 | Blend: CC-PVDZ 76 | Number of shells: 48 77 | Number of basis function: 96 78 | Number of Cartesian functions: 100 79 | Spherical Harmonics?: true 80 | Max angular momentum: 2 81 | 82 | ==> DFT Potential <== 83 | 84 | => Composite Functional: PBE0 <= 85 | 86 | PBE0 Hyb-GGA Exchange-Correlation Functional 87 | 88 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 89 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 90 | 91 | Deriv = 1 92 | GGA = TRUE 93 | Meta = FALSE 94 | 95 | Exchange Hybrid = TRUE 96 | MP2 Hybrid = FALSE 97 | 98 | => Exchange Functionals <= 99 | 100 | 0.7500 Perdew, Burke & Ernzerhof 101 | 102 | => Exact (HF) Exchange <= 103 | 104 | 0.2500 HF 105 | 106 | => Correlation Functionals <= 107 | 108 | 1.0000 Perdew, Burke & Ernzerhof 109 | 110 | => LibXC Density Thresholds <== 111 | 112 | XC_HYB_GGA_XC_PBEH: 1.00E-32 113 | 114 | => Molecular Quadrature <= 115 | 116 | Radial Scheme = TREUTLER 117 | Pruning Scheme = NONE 118 | Nuclear Scheme = TREUTLER 119 | 120 | BS radius alpha = 1 121 | Pruning alpha = 1 122 | Radial Points = 75 123 | Spherical Points = 302 124 | Total Points = 260007 125 | Total Blocks = 1977 126 | Max Points = 256 127 | Max Functions = 95 128 | Weights Tolerance = 1.00E-15 129 | 130 | => Loading Basis Set <= 131 | 132 | Name: (CC-PVDZ AUX) 133 | Role: JKFIT 134 | Keyword: DF_BASIS_SCF 135 | atoms 1, 4, 7, 10 entry O line 221 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 136 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 51 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 137 | 138 | ==> Integral Setup <== 139 | 140 | DFHelper Memory: AOs need 0.032 GiB; user supplied 88.935 GiB. Using in-core AOs. 141 | 142 | ==> MemDFJK: Density-Fitted J/K Matrices <== 143 | 144 | J tasked: Yes 145 | K tasked: Yes 146 | wK tasked: No 147 | OpenMP threads: 16 148 | Memory [MiB]: 91069 149 | Algorithm: Core 150 | Schwarz Cutoff: 1E-12 151 | Mask sparsity (%): 11.7188 152 | Fitting Condition: 1E-10 153 | 154 | => Auxiliary Basis Set <= 155 | 156 | Basis Set: (CC-PVDZ AUX) 157 | Blend: CC-PVDZ-JKFIT 158 | Number of shells: 168 159 | Number of basis function: 464 160 | Number of Cartesian functions: 524 161 | Spherical Harmonics?: true 162 | Max angular momentum: 3 163 | 164 | Cached 100.0% of DFT collocation blocks in 0.472 [GiB]. 165 | 166 | Minimum eigenvalue in the overlap matrix is 2.9286707047E-02. 167 | Reciprocal condition number of the overlap matrix is 6.4070991921E-03. 168 | Using symmetric orthogonalization. 169 | 170 | ==> Pre-Iterations <== 171 | 172 | SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information). 173 | 174 | ------------------------- 175 | Irrep Nso Nmo 176 | ------------------------- 177 | A 96 96 178 | ------------------------- 179 | Total 96 96 180 | ------------------------- 181 | 182 | ==> Iterations <== 183 | 184 | Total Energy Delta E RMS |[F,P]| 185 | 186 | @DF-RKS iter SAD: -304.26530338354411 -3.04265e+02 0.00000e+00 187 | @DF-RKS iter 1: -304.97412807384143 -7.08825e-01 1.14040e-02 DIIS 188 | @DF-RKS iter 2: -304.72377609874923 2.50352e-01 1.42623e-02 DIIS 189 | @DF-RKS iter 3: -305.40609405111371 -6.82318e-01 1.94540e-04 DIIS 190 | @DF-RKS iter 4: -305.40616807955075 -7.40284e-05 1.60733e-04 DIIS 191 | @DF-RKS iter 5: -305.40625002254393 -8.19430e-05 2.86566e-05 DIIS 192 | @DF-RKS iter 6: -305.40625259723629 -2.57469e-06 6.27638e-06 DIIS 193 | @DF-RKS iter 7: -305.40625269439676 -9.71605e-08 3.29457e-06 DIIS 194 | @DF-RKS iter 8: -305.40625272995203 -3.55553e-08 2.71757e-07 DIIS 195 | @DF-RKS iter 9: -305.40625273023625 -2.84217e-10 5.21518e-08 DIIS 196 | @DF-RKS iter 10: -305.40625273024835 -1.21076e-11 6.72537e-09 DIIS 197 | Energy and wave function converged. 198 | 199 | 200 | ==> Post-Iterations <== 201 | 202 | Electrons on quadrature grid: 203 | Ntotal = 39.9999970032 ; deviation = -2.997e-06 204 | 205 | Orbital Energies [Eh] 206 | --------------------- 207 | 208 | Doubly Occupied: 209 | 210 | 1A -19.210371 2A -19.207136 3A -19.204227 211 | 4A -19.204076 5A -1.044464 6A -1.032683 212 | 7A -1.021530 8A -1.020055 9A -0.573658 213 | 10A -0.544371 11A -0.524906 12A -0.513865 214 | 13A -0.408543 14A -0.404411 15A -0.392580 215 | 16A -0.372644 17A -0.326834 18A -0.314814 216 | 19A -0.313174 20A -0.308643 217 | 218 | Virtual: 219 | 220 | 21A 0.054700 22A 0.078343 23A 0.100446 221 | 24A 0.143374 25A 0.170488 26A 0.225486 222 | 27A 0.229884 28A 0.242331 29A 0.540640 223 | 30A 0.547338 31A 0.577381 32A 0.586189 224 | 33A 0.608694 34A 0.626211 35A 0.652481 225 | 36A 0.664223 37A 0.855442 38A 0.908232 226 | 39A 0.913018 40A 0.932615 41A 0.964014 227 | 42A 0.973423 43A 0.981422 44A 1.015689 228 | 45A 1.053224 46A 1.065845 47A 1.096905 229 | 48A 1.121580 49A 1.166397 50A 1.219066 230 | 51A 1.243406 52A 1.270637 53A 1.274440 231 | 54A 1.317528 55A 1.345049 56A 1.401132 232 | 57A 1.450155 58A 1.487104 59A 1.501564 233 | 60A 1.537167 61A 1.623109 62A 1.630593 234 | 63A 1.676409 64A 1.708151 65A 1.720355 235 | 66A 1.758662 67A 1.783396 68A 1.803764 236 | 69A 2.116583 70A 2.155286 71A 2.159370 237 | 72A 2.169554 73A 2.213218 74A 2.317993 238 | 75A 2.337357 76A 2.382441 77A 2.898063 239 | 78A 2.914134 79A 2.927561 80A 2.933325 240 | 81A 2.979779 82A 2.985326 83A 2.996487 241 | 84A 3.031238 85A 3.133662 86A 3.147960 242 | 87A 3.156451 88A 3.179773 89A 3.468811 243 | 90A 3.506167 91A 3.516688 92A 3.554226 244 | 93A 3.748391 94A 3.776581 95A 3.807940 245 | 96A 3.836994 246 | 247 | Final Occupation by Irrep: 248 | A 249 | DOCC [ 20 ] 250 | 251 | @DF-RKS Final Energy: -305.40625273024835 252 | 253 | => Energetics <= 254 | 255 | Nuclear Repulsion Energy = 134.1647732791776946 256 | One-Electron Energy = -687.1787657886574152 257 | Two-Electron Energy = 275.7821478202830576 258 | DFT Exchange-Correlation Energy = -28.1744080410516382 259 | Empirical Dispersion Energy = 0.0000000000000000 260 | VV10 Nonlocal Energy = 0.0000000000000000 261 | Total Energy = -305.4062527302483545 262 | 263 | Computation Completed 264 | 265 | 266 | Properties will be evaluated at 0.000000, 0.000000, 0.000000 [a0] 267 | 268 | Properties computed using the SCF density matrix 269 | 270 | Nuclear Dipole Moment: [e a0] 271 | X: -260.9924 Y: 901.1128 Z: 1007.6329 272 | 273 | Electronic Dipole Moment: [e a0] 274 | X: 260.8754 Y: -900.8753 Z: -1007.1830 275 | 276 | Dipole Moment: [e a0] 277 | X: -0.1170 Y: 0.2375 Z: 0.4499 Total: 0.5221 278 | 279 | Dipole Moment: [D] 280 | X: -0.2975 Y: 0.6037 Z: 1.1436 Total: 1.3270 281 | 282 | 283 | *** tstop() called on dumpster at Thu Dec 2 14:20:17 2021 284 | Module time: 285 | user time = 32.76 seconds = 0.55 minutes 286 | system time = 1.35 seconds = 0.02 minutes 287 | total time = 3 seconds = 0.05 minutes 288 | Total time: 289 | user time = 32.76 seconds = 0.55 minutes 290 | system time = 1.35 seconds = 0.02 minutes 291 | total time = 3 seconds = 0.05 minutes 292 | 293 | *** tstart() called on dumpster 294 | *** at Thu Dec 2 14:20:17 2021 295 | 296 | 297 | ------------------------------------------------------------ 298 | SCF GRAD 299 | Rob Parrish, Justin Turney, 300 | Andy Simmonett, and Alex Sokolov 301 | ------------------------------------------------------------ 302 | 303 | ==> Geometry <== 304 | 305 | Molecular point group: c1 306 | Full point group: C1 307 | 308 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 309 | 310 | Center X Y Z Mass 311 | ------------ ----------------- ----------------- ----------------- ----------------- 312 | O -5.797778610000 9.924620630000 12.402226400000 15.994914619570 313 | H -6.537137510000 9.861463550000 13.005549400000 1.007825032230 314 | H -5.585468770000 10.865934400000 12.362499200000 1.007825032230 315 | O -3.764295340000 11.693656900000 12.829463000000 15.994914619570 316 | H -3.639020680000 11.960021000000 13.753290200000 1.007825032230 317 | H -3.997259140000 10.759982100000 12.839189500000 1.007825032230 318 | O -1.432180290000 13.242768300000 12.812077500000 15.994914619570 319 | H -2.177422520000 12.674921000000 12.557568600000 1.007825032230 320 | H -1.405841230000 13.941485400000 12.162127500000 1.007825032230 321 | O -2.797551160000 12.786034600000 15.211802500000 15.994914619570 322 | H -2.170397280000 13.086211200000 14.533721900000 1.007825032230 323 | H -2.264236930000 12.521721800000 15.957865700000 1.007825032230 324 | 325 | Nuclear repulsion = 134.164773279177695 326 | 327 | ==> Basis Set <== 328 | 329 | Basis Set: CC-PVDZ 330 | Blend: CC-PVDZ 331 | Number of shells: 48 332 | Number of basis function: 96 333 | Number of Cartesian functions: 100 334 | Spherical Harmonics?: true 335 | Max angular momentum: 2 336 | 337 | ==> DFJKGrad: Density-Fitted SCF Gradients <== 338 | 339 | Gradient: 1 340 | J tasked: Yes 341 | K tasked: Yes 342 | wK tasked: No 343 | OpenMP threads: 16 344 | Integrals threads: 16 345 | Memory [MiB]: 91552 346 | Schwarz Cutoff: 0E+00 347 | Fitting Condition: 1E-10 348 | 349 | => Auxiliary Basis Set <= 350 | 351 | Basis Set: (CC-PVDZ AUX) 352 | Blend: CC-PVDZ-JKFIT 353 | Number of shells: 168 354 | Number of basis function: 464 355 | Number of Cartesian functions: 524 356 | Spherical Harmonics?: true 357 | Max angular momentum: 3 358 | 359 | ==> DFT Potential <== 360 | 361 | => Composite Functional: PBE0 <= 362 | 363 | PBE0 Hyb-GGA Exchange-Correlation Functional 364 | 365 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 366 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 367 | 368 | Deriv = 1 369 | GGA = TRUE 370 | Meta = FALSE 371 | 372 | Exchange Hybrid = TRUE 373 | MP2 Hybrid = FALSE 374 | 375 | => Exchange Functionals <= 376 | 377 | 0.7500 Perdew, Burke & Ernzerhof 378 | 379 | => Exact (HF) Exchange <= 380 | 381 | 0.2500 HF 382 | 383 | => Correlation Functionals <= 384 | 385 | 1.0000 Perdew, Burke & Ernzerhof 386 | 387 | => LibXC Density Thresholds <== 388 | 389 | XC_HYB_GGA_XC_PBEH: 1.00E-32 390 | 391 | => Molecular Quadrature <= 392 | 393 | Radial Scheme = TREUTLER 394 | Pruning Scheme = NONE 395 | Nuclear Scheme = TREUTLER 396 | 397 | BS radius alpha = 1 398 | Pruning alpha = 1 399 | Radial Points = 75 400 | Spherical Points = 302 401 | Total Points = 260007 402 | Total Blocks = 1977 403 | Max Points = 256 404 | Max Functions = 95 405 | Weights Tolerance = 1.00E-15 406 | 407 | 408 | -Total Gradient: 409 | Atom X Y Z 410 | ------ ----------------- ----------------- ----------------- 411 | 1 -0.007833916674 0.004730867520 0.007174947501 412 | 2 0.005135331717 -0.001475759913 -0.006187738255 413 | 3 0.006117418346 -0.005282856485 0.000850634898 414 | 4 -0.000999698072 -0.010556120053 0.010637685115 415 | 5 0.001421256400 0.002442810251 -0.011772136464 416 | 6 -0.004867381347 0.008449826387 -0.004844422129 417 | 7 -0.004398057580 0.006627558971 -0.012248535876 418 | 8 0.003943302435 0.004933597091 0.006531162314 419 | 9 0.002407320677 -0.006961627662 0.005297057053 420 | 10 0.012638754526 -0.001410279312 0.006931809848 421 | 11 -0.007462923357 -0.005735373950 0.002738459272 422 | 12 -0.006097316428 0.004233857970 -0.005105491294 423 | 424 | 425 | *** tstop() called on dumpster at Thu Dec 2 14:20:18 2021 426 | Module time: 427 | user time = 18.31 seconds = 0.31 minutes 428 | system time = 0.43 seconds = 0.01 minutes 429 | total time = 1 seconds = 0.02 minutes 430 | Total time: 431 | user time = 51.09 seconds = 0.85 minutes 432 | system time = 1.78 seconds = 0.03 minutes 433 | total time = 4 seconds = 0.07 minutes 434 | => Loading Basis Set <= 435 | 436 | Name: DEF2-UNIVERSAL-JFIT-DECONTRACT 437 | Role: JFIT 438 | Keyword: DF_BASIS_SCF 439 | atoms 1, 4, 7, 10 entry O line 21 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 440 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 3 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 441 | 442 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_07.dat: -------------------------------------------------------------------------------- 1 | 2 | Scratch directory: /tmp/ 3 | 4 | Scratch directory: /tmp/ 5 | gradient() will perform analytic gradient computation. 6 | 7 | *** tstart() called on dumpster 8 | *** at Thu Dec 2 14:20:20 2021 9 | 10 | => Loading Basis Set <= 11 | 12 | Name: CC-PVDZ 13 | Role: ORBITAL 14 | Keyword: BASIS 15 | atoms 1, 4, 7, 10 entry O line 198 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 16 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 22 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz.gbs 17 | 18 | 19 | --------------------------------------------------------- 20 | SCF 21 | by Justin Turney, Rob Parrish, Andy Simmonett 22 | and Daniel G. A. Smith 23 | RKS Reference 24 | 16 Threads, 122070 MiB Core 25 | --------------------------------------------------------- 26 | 27 | ==> Geometry <== 28 | 29 | Molecular point group: c1 30 | Full point group: C1 31 | 32 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 33 | 34 | Center X Y Z Mass 35 | ------------ ----------------- ----------------- ----------------- ----------------- 36 | O 18.058397300000 14.858424200000 14.395162600000 15.994914619570 37 | H 17.842571300000 14.929949800000 15.322226500000 1.007825032230 38 | H 17.298299800000 15.231307000000 13.919323000000 1.007825032230 39 | O 19.192886400000 16.516769400000 12.454833000000 15.994914619570 40 | H 19.869442000000 16.128664000000 11.890848200000 1.007825032230 41 | H 19.046995200000 15.894498800000 13.183489800000 1.007825032230 42 | O 16.405475600000 16.308294300000 12.664764400000 15.994914619570 43 | H 17.304439500000 16.564575200000 12.402813000000 1.007825032230 44 | H 15.926864600000 16.171190300000 11.850396200000 1.007825032230 45 | O 21.699699400000 16.886272400000 11.454784400000 15.994914619570 46 | H 21.031745900000 17.298778500000 12.017573400000 1.007825032230 47 | H 22.465101200000 16.774414100000 12.017235800000 1.007825032230 48 | 49 | Running in c1 symmetry. 50 | 51 | Rotational constants: A = 0.05984 B = 0.00030 C = 0.00030 [cm^-1] 52 | Rotational constants: A = 1793.92547 B = 8.98780 C = 8.96254 [MHz] 53 | Nuclear repulsion = 134.048062875225355 54 | 55 | Charge = 0 56 | Multiplicity = 1 57 | Electrons = 40 58 | Nalpha = 20 59 | Nbeta = 20 60 | 61 | ==> Algorithm <== 62 | 63 | SCF Algorithm Type is DF. 64 | DIIS enabled. 65 | MOM disabled. 66 | Fractional occupation disabled. 67 | Guess Type is SAD. 68 | Energy threshold = 1.00e-08 69 | Density threshold = 1.00e-08 70 | Integral threshold = 0.00e+00 71 | 72 | ==> Primary Basis <== 73 | 74 | Basis Set: CC-PVDZ 75 | Blend: CC-PVDZ 76 | Number of shells: 48 77 | Number of basis function: 96 78 | Number of Cartesian functions: 100 79 | Spherical Harmonics?: true 80 | Max angular momentum: 2 81 | 82 | ==> DFT Potential <== 83 | 84 | => Composite Functional: PBE0 <= 85 | 86 | PBE0 Hyb-GGA Exchange-Correlation Functional 87 | 88 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 89 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 90 | 91 | Deriv = 1 92 | GGA = TRUE 93 | Meta = FALSE 94 | 95 | Exchange Hybrid = TRUE 96 | MP2 Hybrid = FALSE 97 | 98 | => Exchange Functionals <= 99 | 100 | 0.7500 Perdew, Burke & Ernzerhof 101 | 102 | => Exact (HF) Exchange <= 103 | 104 | 0.2500 HF 105 | 106 | => Correlation Functionals <= 107 | 108 | 1.0000 Perdew, Burke & Ernzerhof 109 | 110 | => LibXC Density Thresholds <== 111 | 112 | XC_HYB_GGA_XC_PBEH: 1.00E-32 113 | 114 | => Molecular Quadrature <= 115 | 116 | Radial Scheme = TREUTLER 117 | Pruning Scheme = NONE 118 | Nuclear Scheme = TREUTLER 119 | 120 | BS radius alpha = 1 121 | Pruning alpha = 1 122 | Radial Points = 75 123 | Spherical Points = 302 124 | Total Points = 260009 125 | Total Blocks = 1986 126 | Max Points = 256 127 | Max Functions = 95 128 | Weights Tolerance = 1.00E-15 129 | 130 | => Loading Basis Set <= 131 | 132 | Name: (CC-PVDZ AUX) 133 | Role: JKFIT 134 | Keyword: DF_BASIS_SCF 135 | atoms 1, 4, 7, 10 entry O line 221 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 136 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 51 file /home/jracker/miniconda3/envs/psi4/share/psi4/basis/cc-pvdz-jkfit.gbs 137 | 138 | ==> Integral Setup <== 139 | 140 | DFHelper Memory: AOs need 0.032 GiB; user supplied 88.936 GiB. Using in-core AOs. 141 | 142 | ==> MemDFJK: Density-Fitted J/K Matrices <== 143 | 144 | J tasked: Yes 145 | K tasked: Yes 146 | wK tasked: No 147 | OpenMP threads: 16 148 | Memory [MiB]: 91070 149 | Algorithm: Core 150 | Schwarz Cutoff: 1E-12 151 | Mask sparsity (%): 12.1962 152 | Fitting Condition: 1E-10 153 | 154 | => Auxiliary Basis Set <= 155 | 156 | Basis Set: (CC-PVDZ AUX) 157 | Blend: CC-PVDZ-JKFIT 158 | Number of shells: 168 159 | Number of basis function: 464 160 | Number of Cartesian functions: 524 161 | Spherical Harmonics?: true 162 | Max angular momentum: 3 163 | 164 | Cached 100.0% of DFT collocation blocks in 0.471 [GiB]. 165 | 166 | Minimum eigenvalue in the overlap matrix is 2.9372534755E-02. 167 | Reciprocal condition number of the overlap matrix is 6.4318565190E-03. 168 | Using symmetric orthogonalization. 169 | 170 | ==> Pre-Iterations <== 171 | 172 | SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information). 173 | 174 | ------------------------- 175 | Irrep Nso Nmo 176 | ------------------------- 177 | A 96 96 178 | ------------------------- 179 | Total 96 96 180 | ------------------------- 181 | 182 | ==> Iterations <== 183 | 184 | Total Energy Delta E RMS |[F,P]| 185 | 186 | @DF-RKS iter SAD: -304.26569860048556 -3.04266e+02 0.00000e+00 187 | @DF-RKS iter 1: -304.97421209182380 -7.08513e-01 1.14028e-02 DIIS 188 | @DF-RKS iter 2: -304.72382466736832 2.50387e-01 1.42620e-02 DIIS 189 | @DF-RKS iter 3: -305.40609814565806 -6.82273e-01 2.01955e-04 DIIS 190 | @DF-RKS iter 4: -305.40616627051440 -6.81249e-05 1.75036e-04 DIIS 191 | @DF-RKS iter 5: -305.40626426675396 -9.79962e-05 2.76924e-05 DIIS 192 | @DF-RKS iter 6: -305.40626664693275 -2.38018e-06 6.61461e-06 DIIS 193 | @DF-RKS iter 7: -305.40626675618614 -1.09253e-07 3.38294e-06 DIIS 194 | @DF-RKS iter 8: -305.40626679370303 -3.75169e-08 2.56287e-07 DIIS 195 | @DF-RKS iter 9: -305.40626679395916 -2.56136e-10 5.19428e-08 DIIS 196 | @DF-RKS iter 10: -305.40626679397104 -1.18803e-11 5.10855e-09 DIIS 197 | Energy and wave function converged. 198 | 199 | 200 | ==> Post-Iterations <== 201 | 202 | Electrons on quadrature grid: 203 | Ntotal = 40.0000046083 ; deviation = 4.608e-06 204 | 205 | Orbital Energies [Eh] 206 | --------------------- 207 | 208 | Doubly Occupied: 209 | 210 | 1A -19.209977 2A -19.207454 3A -19.204586 211 | 4A -19.203503 5A -1.044376 6A -1.032740 212 | 7A -1.021419 8A -1.019927 9A -0.573883 213 | 10A -0.544994 11A -0.524458 12A -0.513187 214 | 13A -0.407603 14A -0.405069 15A -0.392595 215 | 16A -0.372628 17A -0.326416 18A -0.315106 216 | 19A -0.313519 20A -0.308248 217 | 218 | Virtual: 219 | 220 | 21A 0.054983 22A 0.078374 23A 0.100555 221 | 24A 0.143218 25A 0.171308 26A 0.225406 222 | 27A 0.229143 28A 0.243211 29A 0.539489 223 | 30A 0.558672 31A 0.567946 32A 0.586181 224 | 33A 0.603287 34A 0.636677 35A 0.644204 225 | 36A 0.665204 37A 0.863032 38A 0.900162 226 | 39A 0.908086 40A 0.939318 41A 0.960288 227 | 42A 0.977532 43A 0.982815 44A 1.022773 228 | 45A 1.050540 46A 1.064098 47A 1.096573 229 | 48A 1.117897 49A 1.165759 50A 1.222352 230 | 51A 1.236816 52A 1.257172 53A 1.282546 231 | 54A 1.322950 55A 1.356042 56A 1.398257 232 | 57A 1.443170 58A 1.488448 59A 1.515065 233 | 60A 1.544129 61A 1.599107 62A 1.632763 234 | 63A 1.663793 64A 1.708808 65A 1.734519 235 | 66A 1.763816 67A 1.773957 68A 1.814731 236 | 69A 2.113850 70A 2.156265 71A 2.158506 237 | 72A 2.169866 73A 2.213039 74A 2.322284 238 | 75A 2.333704 76A 2.380705 77A 2.895536 239 | 78A 2.911215 79A 2.927399 80A 2.940738 240 | 81A 2.978387 82A 2.987170 83A 2.995422 241 | 84A 3.030441 85A 3.133644 86A 3.145308 242 | 87A 3.154092 88A 3.182824 89A 3.470606 243 | 90A 3.505051 91A 3.515262 92A 3.554078 244 | 93A 3.745882 94A 3.775235 95A 3.803947 245 | 96A 3.846670 246 | 247 | Final Occupation by Irrep: 248 | A 249 | DOCC [ 20 ] 250 | 251 | @DF-RKS Final Energy: -305.40626679397104 252 | 253 | => Energetics <= 254 | 255 | Nuclear Repulsion Energy = 134.0480628752253551 256 | One-Electron Energy = -686.9479466577716948 257 | Two-Electron Energy = 275.6680671483016454 258 | DFT Exchange-Correlation Energy = -28.1744501597263728 259 | Empirical Dispersion Energy = 0.0000000000000000 260 | VV10 Nonlocal Energy = 0.0000000000000000 261 | Total Energy = -305.4062667939710423 262 | 263 | Computation Completed 264 | 265 | 266 | Properties will be evaluated at 0.000000, 0.000000, 0.000000 [a0] 267 | 268 | Properties computed using the SCF density matrix 269 | 270 | Nuclear Dipole Moment: [e a0] 271 | X: 1424.1678 Y: 1219.9155 Z: 964.4411 272 | 273 | Electronic Dipole Moment: [e a0] 274 | X: -1424.1157 Y: -1220.0333 Z: -963.9995 275 | 276 | Dipole Moment: [e a0] 277 | X: 0.0520 Y: -0.1178 Z: 0.4416 Total: 0.4600 278 | 279 | Dipole Moment: [D] 280 | X: 0.1322 Y: -0.2995 Z: 1.1225 Total: 1.1693 281 | 282 | 283 | *** tstop() called on dumpster at Thu Dec 2 14:20:22 2021 284 | Module time: 285 | user time = 32.25 seconds = 0.54 minutes 286 | system time = 1.54 seconds = 0.03 minutes 287 | total time = 2 seconds = 0.03 minutes 288 | Total time: 289 | user time = 32.25 seconds = 0.54 minutes 290 | system time = 1.54 seconds = 0.03 minutes 291 | total time = 2 seconds = 0.03 minutes 292 | 293 | *** tstart() called on dumpster 294 | *** at Thu Dec 2 14:20:22 2021 295 | 296 | 297 | ------------------------------------------------------------ 298 | SCF GRAD 299 | Rob Parrish, Justin Turney, 300 | Andy Simmonett, and Alex Sokolov 301 | ------------------------------------------------------------ 302 | 303 | ==> Geometry <== 304 | 305 | Molecular point group: c1 306 | Full point group: C1 307 | 308 | Geometry (in Angstrom), charge = 0, multiplicity = 1: 309 | 310 | Center X Y Z Mass 311 | ------------ ----------------- ----------------- ----------------- ----------------- 312 | O 18.058397300000 14.858424200000 14.395162600000 15.994914619570 313 | H 17.842571300000 14.929949800000 15.322226500000 1.007825032230 314 | H 17.298299800000 15.231307000000 13.919323000000 1.007825032230 315 | O 19.192886400000 16.516769400000 12.454833000000 15.994914619570 316 | H 19.869442000000 16.128664000000 11.890848200000 1.007825032230 317 | H 19.046995200000 15.894498800000 13.183489800000 1.007825032230 318 | O 16.405475600000 16.308294300000 12.664764400000 15.994914619570 319 | H 17.304439500000 16.564575200000 12.402813000000 1.007825032230 320 | H 15.926864600000 16.171190300000 11.850396200000 1.007825032230 321 | O 21.699699400000 16.886272400000 11.454784400000 15.994914619570 322 | H 21.031745900000 17.298778500000 12.017573400000 1.007825032230 323 | H 22.465101200000 16.774414100000 12.017235800000 1.007825032230 324 | 325 | Nuclear repulsion = 134.048062875225355 326 | 327 | ==> Basis Set <== 328 | 329 | Basis Set: CC-PVDZ 330 | Blend: CC-PVDZ 331 | Number of shells: 48 332 | Number of basis function: 96 333 | Number of Cartesian functions: 100 334 | Spherical Harmonics?: true 335 | Max angular momentum: 2 336 | 337 | ==> DFJKGrad: Density-Fitted SCF Gradients <== 338 | 339 | Gradient: 1 340 | J tasked: Yes 341 | K tasked: Yes 342 | wK tasked: No 343 | OpenMP threads: 16 344 | Integrals threads: 16 345 | Memory [MiB]: 91552 346 | Schwarz Cutoff: 0E+00 347 | Fitting Condition: 1E-10 348 | 349 | => Auxiliary Basis Set <= 350 | 351 | Basis Set: (CC-PVDZ AUX) 352 | Blend: CC-PVDZ-JKFIT 353 | Number of shells: 168 354 | Number of basis function: 464 355 | Number of Cartesian functions: 524 356 | Spherical Harmonics?: true 357 | Max angular momentum: 3 358 | 359 | ==> DFT Potential <== 360 | 361 | => Composite Functional: PBE0 <= 362 | 363 | PBE0 Hyb-GGA Exchange-Correlation Functional 364 | 365 | C. Adamo and V. Barone, J. Chem. Phys. 110, 6158 (1999) 366 | M. Ernzerhof and G. E. Scuseria, J. Chem. Phys. 110, 5029 (1999) 367 | 368 | Deriv = 1 369 | GGA = TRUE 370 | Meta = FALSE 371 | 372 | Exchange Hybrid = TRUE 373 | MP2 Hybrid = FALSE 374 | 375 | => Exchange Functionals <= 376 | 377 | 0.7500 Perdew, Burke & Ernzerhof 378 | 379 | => Exact (HF) Exchange <= 380 | 381 | 0.2500 HF 382 | 383 | => Correlation Functionals <= 384 | 385 | 1.0000 Perdew, Burke & Ernzerhof 386 | 387 | => LibXC Density Thresholds <== 388 | 389 | XC_HYB_GGA_XC_PBEH: 1.00E-32 390 | 391 | => Molecular Quadrature <= 392 | 393 | Radial Scheme = TREUTLER 394 | Pruning Scheme = NONE 395 | Nuclear Scheme = TREUTLER 396 | 397 | BS radius alpha = 1 398 | Pruning alpha = 1 399 | Radial Points = 75 400 | Spherical Points = 302 401 | Total Points = 260009 402 | Total Blocks = 1986 403 | Max Points = 256 404 | Max Functions = 95 405 | Weights Tolerance = 1.00E-15 406 | 407 | 408 | -Total Gradient: 409 | Atom X Y Z 410 | ------ ----------------- ----------------- ----------------- 411 | 1 -0.009043389418 0.002958553996 0.011303621861 412 | 2 0.002318153369 -0.003447284647 -0.008124114332 413 | 3 0.009475955866 0.000198905454 0.002009685525 414 | 4 0.007297453983 -0.011421434109 0.001527524377 415 | 5 -0.000934122437 0.009943716841 0.004269060485 416 | 6 -0.003451604385 0.006817435288 -0.009507711193 417 | 7 -0.001081502607 -0.000702721759 -0.015346840380 418 | 8 -0.005206347873 -0.003311797881 0.006894854006 419 | 9 0.002247444588 0.003064760112 0.008109699116 420 | 10 0.005778656286 0.001051550583 0.010333272780 421 | 11 -0.002771171282 -0.006271037899 -0.004813377295 422 | 12 -0.004630951337 0.001121126252 -0.006660495629 423 | 424 | 425 | *** tstop() called on dumpster at Thu Dec 2 14:20:23 2021 426 | Module time: 427 | user time = 18.11 seconds = 0.30 minutes 428 | system time = 0.44 seconds = 0.01 minutes 429 | total time = 1 seconds = 0.02 minutes 430 | Total time: 431 | user time = 50.38 seconds = 0.84 minutes 432 | system time = 1.98 seconds = 0.03 minutes 433 | total time = 3 seconds = 0.05 minutes 434 | => Loading Basis Set <= 435 | 436 | Name: DEF2-UNIVERSAL-JFIT-DECONTRACT 437 | Role: JFIT 438 | Keyword: DF_BASIS_SCF 439 | atoms 1, 4, 7, 10 entry O line 21 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 440 | atoms 2-3, 5-6, 8-9, 11-12 entry H line 3 file /home/jracker/codes/equivariant_electron_density/tests/test_data_generation/def2-universal-jfit-decontract.gbs 441 | 442 | -------------------------------------------------------------------------------- /tests/test_data_generation/output_w4_testdata.pkl.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/tests/test_data_generation/output_w4_testdata.pkl.dat -------------------------------------------------------------------------------- /tests/test_data_generation/testdata_w4.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JoshRackers/equivariant_electron_density/97a27ccb833e843d5e89981bab4f8dedec86d9ae/tests/test_data_generation/testdata_w4.pkl -------------------------------------------------------------------------------- /tests/test_data_generation/w4_00: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -27.6242619 3 | O 29.7298775 28.7905693 13.3669500 4 | H 28.9162426 28.5478725 12.9321842 5 | H 30.0577316 29.5761147 12.8979540 6 | O 30.7100487 31.1541729 12.3198385 7 | H 30.8583927 31.5918179 13.1748171 8 | H 31.4290142 31.4305325 11.7571325 9 | O 30.5369911 29.5953159 15.8858290 10 | H 31.0147572 28.8934307 16.3205948 11 | H 30.2152100 29.2193432 15.0493917 12 | O 31.0747929 32.1162148 14.8860102 13 | H 30.9203758 31.2690010 15.3364649 14 | H 30.6916962 32.7844391 15.4487162 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_01: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -22.7146149 3 | O -5.53075600 10.3657351 9.81144714 4 | H -4.82172823 10.9135828 9.48520088 5 | H -5.27732801 9.44425201 9.62378311 6 | O -7.67931080 9.06865978 8.33719921 7 | H -8.51859760 9.09587860 8.79461098 8 | H -7.12696886 9.72836018 8.77828503 9 | O -6.43213892 8.73366070 12.0000134 10 | H -6.02779865 8.90147972 12.8491650 11 | H -6.18732929 9.48593712 11.4424953 12 | O -5.50095224 7.62536049 9.51926517 13 | H -5.82035398 7.64972496 10.4316378 14 | H -6.28217745 7.79054928 8.97363758 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_02: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -22.3836079 3 | O 0.167683527 11.4692478 12.9632540 4 | H -0.367710412 12.2101908 13.2401342 5 | H -0.130690366 10.7190495 13.4956951 6 | O 8.47390220E-02 9.25993824 11.1507835 7 | H 0.226559624 10.1624985 11.4683495 8 | H 0.864334106 8.76145649 11.4324284 9 | O 1.83950174 7.79665470 12.8690920 10 | H 2.05164051 6.89544296 13.1038704 11 | H 1.08833706 8.04113102 13.4270363 12 | O -0.726602614 8.82399178 13.7488422 13 | H -1.57480764 8.43294907 13.9410343 14 | H -0.662101626 8.87823772 12.7782764 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_03: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -21.1561985 3 | O -5.48702192 10.9789057 9.36735535 4 | H -5.36201668 10.0658655 9.67956161 5 | H -4.63873243 11.2510233 9.02470875 6 | O -7.48075294 9.45928383 8.09337234 7 | H -6.88804913 10.1574326 8.41556168 8 | H -8.36410618 9.79893112 8.21794891 9 | O -6.68101454 6.85336304 12.1152859 10 | H -6.92389727 7.25150681 12.9514675 11 | H -6.52661467 5.92832756 12.3083668 12 | O -5.59515858 8.26714134 9.86116791 13 | H -6.31706095 8.37809372 9.22643566 14 | H -5.96611977 7.78967047 10.6112223 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_04: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -20.1573620 3 | O 21.4001694 19.1616096 17.4745293 4 | H 21.1034279 18.6227932 16.7340088 5 | H 21.5966148 18.5507889 18.2017593 6 | O 19.2530937 18.3622246 15.9859018 7 | H 18.8588753 18.9546413 15.3466959 8 | H 19.4650536 18.9176731 16.7465649 9 | O 22.6112366 17.7904205 19.5876541 10 | H 23.2494659 18.4851265 19.3582802 11 | H 23.1244011 16.9935646 19.7005157 12 | O 23.9178467 19.9684658 18.4025192 13 | H 23.0865097 19.8768864 17.9094143 14 | H 23.9781113 20.8917618 18.6380539 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_05: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -20.1261406 3 | O 27.9445286 25.6461639 12.7237949 4 | H 28.7711811 25.3404408 13.1311207 5 | H 27.9257126 26.5917130 12.8542967 6 | O 27.1957645 23.4466553 14.2912207 7 | H 27.1936111 24.2129307 13.6950293 8 | H 26.6796818 22.7745399 13.8517733 9 | O 29.8613567 24.2703590 14.2310410 10 | H 30.3965054 24.2264729 15.0289164 11 | H 29.0313168 23.8078213 14.4249411 12 | O 32.0994492 23.1253986 15.2876301 13 | H 31.5492821 23.1621132 14.4945145 14 | H 32.9621964 23.4271660 15.0059423 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_06: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -20.1100388 3 | O -5.79777861 9.92462063 12.4022264 4 | H -6.53713751 9.86146355 13.0055494 5 | H -5.58546877 10.8659344 12.3624992 6 | O -3.76429534 11.6936569 12.8294630 7 | H -3.63902068 11.9600210 13.7532902 8 | H -3.99725914 10.7599821 12.8391895 9 | O -1.43218029 13.2427683 12.8120775 10 | H -2.17742252 12.6749210 12.5575686 11 | H -1.40584123 13.9414854 12.1621275 12 | O -2.79755116 12.7860346 15.2118025 13 | H -2.17039728 13.0862112 14.5337219 14 | H -2.26423693 12.5217218 15.9578657 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_07: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -20.0915661 3 | O 18.0583973 14.8584242 14.3951626 4 | H 17.8425713 14.9299498 15.3222265 5 | H 17.2982998 15.2313070 13.9193230 6 | O 19.1928864 16.5167694 12.4548330 7 | H 19.8694420 16.1286640 11.8908482 8 | H 19.0469952 15.8944988 13.1834898 9 | O 16.4054756 16.3082943 12.6647644 10 | H 17.3044395 16.5645752 12.4028130 11 | H 15.9268646 16.1711903 11.8503962 12 | O 21.6996994 16.8862724 11.4547844 13 | H 21.0317459 17.2987785 12.0175734 14 | H 22.4651012 16.7744141 12.0172358 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_08: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -20.0008640 3 | O 6.03437424 -2.87535620 -8.70135975 4 | H 6.60670185 -2.45705724 -8.04515171 5 | H 6.50582409 -2.79535127 -9.52970695 6 | O 5.18159246 -0.535551071 -4.33672571 7 | H 5.43410349 0.370577544 -4.57722521 8 | H 5.34759092 -0.614267290 -3.40058708 9 | O 6.20146227 -0.822353959 -6.91317034 10 | H 5.60860395 -1.23520291 -7.54915857 11 | H 5.81920624 -0.979532182 -6.03571892 12 | O 6.16350031 1.70700133 -5.69605732 13 | H 6.27890348 0.968324780 -6.31523228 14 | H 6.93141317 2.26214314 -5.80871630 15 | -------------------------------------------------------------------------------- /tests/test_data_generation/w4_09: -------------------------------------------------------------------------------- 1 | 12 2 | Ord_Energy -19.9902763 3 | O -5.27236843 -1.40601456 -2.88432240 4 | H -5.46596289 -1.14241982 -3.78996444 5 | H -4.83828926 -0.649056017 -2.46164775 6 | O -4.57165718 0.699521124 -1.19511712 7 | H -4.00386906 0.966021895 -0.476186305 8 | H -5.36626625 0.325453043 -0.780375123 9 | O -6.79103327 -0.885731936 -0.582287371 10 | H -6.44867897 -1.26580203 -1.40721941 11 | H -7.17426634 -1.61423278 -0.100020699 12 | O -4.67638063 -1.94532835 -5.48967075 13 | H -3.83469343 -1.65443397 -5.83860683 14 | H -4.49187374 -2.21762776 -4.58143330 15 | -------------------------------------------------------------------------------- /training/train_density.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import math 4 | import numpy as np 5 | import torch 6 | import torch_geometric 7 | from torch_cluster import radius_graph 8 | from torch_scatter import scatter 9 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 10 | from utils import get_iso_permuted_dataset 11 | from e3nn.nn.models.gate_points_2101 import Network 12 | from e3nn import o3 13 | from utils import get_scalar_density_comparisons 14 | import wandb 15 | import random 16 | from datetime import date 17 | import argparse 18 | import os 19 | 20 | 21 | def lossPerChannel(y_ml, y_target, 22 | Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)]): 23 | 24 | err = y_ml - y_target 25 | pct_dev = torch.div(err.abs(),y_target) 26 | loss_perChannel_list = np.zeros(len(Rs)) 27 | normalization = err.sum()/err.mean() 28 | 29 | counter = 0 30 | for mul, l in Rs: 31 | if l==0: 32 | temp_loss = err[:,:mul].pow(2).sum().abs()/normalization 33 | else: 34 | temp_loss = err[:,counter:counter+mul*(2*l+1)].pow(2).sum().abs()/normalization 35 | 36 | 37 | loss_perChannel_list[l]+=temp_loss.detach().cpu().numpy() 38 | pct_deviation_list[l]+=temp_pct_deviation.detach().cpu().numpy() 39 | 40 | counter += mul*(2*l+1) 41 | 42 | return loss_perChannel_list 43 | 44 | def main(): 45 | parser = argparse.ArgumentParser(description='train electron density') 46 | parser.add_argument('--dataset', type=str) 47 | parser.add_argument('--testset', type=str) 48 | parser.add_argument('--split', type=int) 49 | parser.add_argument('--epochs', type=int, default=300) 50 | parser.add_argument('--qm', type=str, default="pbe0") 51 | parser.add_argument('ldep',type=bool, default=False) 52 | args = parser.parse_args() 53 | 54 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 55 | print ("What device am I using?", device) 56 | 57 | torch.set_default_dtype(torch.float32) 58 | 59 | if args.qm == 'ccsd': 60 | hhh = os.path.dirname(os.path.realpath(__file__)) + "/../data/ccsd_h_s_only_def2-universal-jfit-decontract_density.out" 61 | ooo = os.path.dirname(os.path.realpath(__file__)) + "/../data/ccsd_o_s_only_def2-universal-jfit-decontract_density.out" 62 | else: 63 | hhh = os.path.dirname(os.path.realpath(__file__)) + "/../data/h_s_only_def2-universal-jfit-decontract_density.out" 64 | ooo = os.path.dirname(os.path.realpath(__file__)) + "/../data/o_s_only_def2-universal-jfit-decontract_density.out" 65 | 66 | test_dataset = args.testset 67 | num_epochs = args.epochs 68 | ldep_bool = args.ldep 69 | 70 | # def2 basis set max irreps 71 | # WARNING. this is currently hard-coded for def2_universal 72 | Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)] 73 | 74 | test_dataset = get_iso_permuted_dataset(args.testset,o_iso=ooo,h_iso=hhh) 75 | 76 | split = args.split 77 | data_file = args.dataset 78 | lr = 1e-2 79 | density_spacing = 0.1 80 | save_interval = 5 81 | model_kwargs = { 82 | "irreps_in": "2x 0e", #irreps_in 83 | "irreps_hidden": [(mul, (l, p)) for l, mul in enumerate([125,40,25,15]) for p in [-1, 1]], #irreps_hidden 84 | "irreps_out": "12x0e + 5x1o + 4x2e + 2x3o + 1x4e", #irreps_out 85 | "irreps_node_attr": None, #irreps_node_attr 86 | "irreps_edge_attr": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr 87 | "layers": 3, 88 | "max_radius": 3.5, 89 | "number_of_basis": 10, 90 | "radial_layers": 1, 91 | "radial_neurons": 128, 92 | "num_neighbors": 12.2298, 93 | "num_nodes": 24, 94 | "reduce_output": False, 95 | } 96 | 97 | dataset = get_iso_permuted_dataset(data_file,o_iso=ooo,h_iso=hhh) 98 | random.shuffle(dataset) 99 | if split > len(dataset): 100 | raise ValueError('Split is too large for the dataset.') 101 | 102 | b = 1 103 | train_loader = torch_geometric.data.DataLoader(dataset[:split], batch_size=b, shuffle=True) 104 | 105 | test_loader = torch_geometric.data.DataLoader(test_dataset, batch_size=b, shuffle=True) 106 | 107 | model = Network(**model_kwargs) 108 | 109 | optim = torch.optim.Adam(model.parameters(), lr=lr) 110 | optim.zero_grad() 111 | 112 | model.to(device) 113 | 114 | model_kwargs["train_dataset"] = data_file 115 | model_kwargs["train_dataset_size"] = split 116 | model_kwargs["lr"] = lr 117 | model_kwargs["density_spacing"] = density_spacing 118 | wandb.init(config=model_kwargs, reinit=True) 119 | wandb.run.name = 'DATASET_' + args.dataset + '_SPLIT_' + str(args.split) + '_' + date.today().strftime("%b-%d-%Y") 120 | wandb.watch(model) 121 | 122 | for epoch in range(num_epochs): 123 | loss_cum = 0.0 124 | loss_perchannel_cum = np.zeros(len(Rs)) 125 | mae_cum = 0.0 126 | mue_cum = 0.0 127 | for step, data in enumerate(train_loader): 128 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 129 | y_ml = model(data.to(device))*mask.to(device) 130 | err = (y_ml - data.y.to(device)) 131 | 132 | for mul, l in Rs: 133 | if l == 0: 134 | num_ele = sum(sum(y_ml[:,:mul])).detach() 135 | 136 | mue_cum += num_ele 137 | mae_cum += abs(num_ele) 138 | 139 | #compute loss per channel 140 | if ldep_bool: 141 | loss_perchannel_cum += lossPerChannel(y_ml,data.y.to(device), Rs) 142 | 143 | loss_cum += err.pow(2).mean().detach().abs() 144 | err.pow(2).mean().backward() 145 | optim.step() 146 | optim.zero_grad() 147 | 148 | # now the test loop 149 | with torch.no_grad(): 150 | metrics = [] 151 | for testset in [test_loader]: 152 | test_loss_cum = 0.0 153 | test_mae_cum = 0.0 154 | test_mue_cum = 0.0 155 | bigIs_cum = 0.0 156 | eps_cum = 0.0 157 | ep_per_l_cum = np.zeros(len(Rs)) 158 | 159 | ele_diff_cum = 0.0 160 | for step, data in enumerate(testset): 161 | mask = torch.where(data.y == 0, torch.zeros_like(data.y), torch.ones_like(data.y)).detach() 162 | y_ml = model(data.to(device))*mask.to(device) 163 | err = (y_ml - data.y.to(device)) 164 | 165 | for mul, l in Rs: 166 | if l == 0: 167 | num_ele = torch.mean(y_ml[:,:mul]).detach() 168 | # num_ele = sum(sum(y_ml[:,:mul])).detach() 169 | 170 | test_mue_cum += num_ele 171 | test_mae_cum += abs(num_ele) 172 | test_loss_cum += err.pow(2).mean().detach().abs() 173 | 174 | if epoch % save_interval == 0: 175 | torch.save(model.state_dict(), os.path.join(wandb.run.dir, "model_weights_epoch_"+str(epoch)+".pt")) 176 | wandb.save("model_weights_epoch_"+str(epoch)+".pt") 177 | 178 | if ldep_bool: 179 | num_ele_target, num_ele_ml, bigI, ep, ep_per_l= get_scalar_density_comparisons(data, y_ml, Rs, spacing=density_spacing, buffer=3.0, ldep=ldep_bool) 180 | ep_per_l_cum += ep_per_l 181 | else: 182 | num_ele_target, num_ele_ml, bigI, ep = get_scalar_density_comparisons(data, y_ml, Rs, spacing=density_spacing, buffer=3.0, ldep=ldeb_bool) 183 | 184 | n_ele = np.sum(data.z.cpu().detach().numpy()) 185 | ele_diff_cum += np.abs(n_ele-num_ele_target) 186 | bigIs_cum += bigI 187 | eps_cum += ep 188 | 189 | metrics.append([test_loss_cum, test_mae_cum, test_mue_cum, ele_diff_cum, bigIs_cum, eps_cum, ep_per_l_cum]) 190 | 191 | # eps per l and loss per l hard coded for def2 below 192 | wandb.log({ 193 | "Epoch": epoch, 194 | "Train_Loss": float(loss_cum)/len(train_loader), 195 | 196 | 197 | "Train_Loss l=0": float(loss_cum_per_l[0])/len(train_loader), 198 | "Train_Loss l=1": float(loss_cum_per_l[1])/len(train_loader), 199 | "Train_Loss l=2": float(loss_cum_per_l[2])/len(train_loader), 200 | "Train_Loss l=3": float(loss_cum_per_l[3])/len(train_loader), 201 | "Train_Loss l=4": float(loss_cum_per_l[4])/len(train_loader), 202 | 203 | 204 | "Train_MAE": mae_cum/len(train_loader), 205 | "Train_MUE": mue_cum/len(train_loader), 206 | 207 | 208 | 209 | "Test_Loss": float(metrics[0][0].item())/len(test_loader), 210 | "Test_MAE": metrics[0][1].item()/len(test_loader), 211 | "Test_MUE": metrics[0][2].item()/len(test_loader), 212 | "Test_Electron_Difference": metrics[0][3].item()/len(test_loader), 213 | "Test_big_I": metrics[0][4].item()/len(test_loader), 214 | "Test_Epsilon": metrics[0][5].item()/len(test_loader), 215 | "Test_Epsilon l=0": metrics[0][-1][0].item()/len(test_loader), 216 | "Test_Epsilon l=1": metrics[0][-1][1].item()/len(test_loader), 217 | "Test_Epsilon l=2": metrics[0][-1][2].item()/len(test_loader), 218 | "Test_Epsilon l=3": metrics[0][-1][3].item()/len(test_loader), 219 | "Test_Epsilon l=4": metrics[0][-1][4].item()/len(test_loader), 220 | }) 221 | 222 | if epoch % 1 == 0: 223 | print(str(epoch) + " " + f"{float(loss_cum)/len(train_loader):.10f}") 224 | 225 | 226 | print("Train_Loss l=0", float(loss_cum_per_l[0])/len(train_loader)) 227 | print("Train_Loss l=1",float(loss_cum_per_l[1])/len(train_loader)) 228 | print("Train_Loss l=2", float(loss_cum_per_l[2])/len(train_loader)) 229 | print("Train_Loss l=3",float(loss_cum_per_l[3])/len(train_loader)) 230 | print("Train_Loss l=4", float(loss_cum_per_l[4])/len(train_loader)) 231 | 232 | print(" MAE",mae_cum/(len(train_loader)*b)) 233 | print(" MUE",mue_cum/(len(train_loader)*b)) 234 | print(" Test_Loss", float(metrics[0][0].item())/len(test_loader)) 235 | print(" Test_MAE",metrics[0][1].item()/len(test_loader)) 236 | print(" Test_MUE",metrics[0][2].item()/len(test_loader)) 237 | print(" Test_Electron_Difference",metrics[0][3].item()/len(test_loader)) 238 | print(" Test_big_I",metrics[0][4].item()/len(test_loader)) 239 | print(" Test_Epsilon",metrics[0][5].item()/len(test_loader)) 240 | print(" Test_Epsilon l=0",metrics[0][-1][0].item()/len(test_loader) 241 | print(" Test_Epsilon l=1",metrics[0][-1][1].item()/len(test_loader) 242 | print(" Test_Epsilon l=2",metrics[0][-1][2].item()/len(test_loader) 243 | print(" Test_Epsilon l=3",metrics[0][-1][3].item()/len(test_loader) 244 | print(" Test_Epsilon l=4",metrics[0][-1][4].item()/len(test_loader) 245 | 246 | 247 | wandb.finish() 248 | 249 | if __name__ == '__main__': 250 | main() -------------------------------------------------------------------------------- /training/train_energy_force.py: -------------------------------------------------------------------------------- 1 | import math 2 | import numpy as np 3 | import torch 4 | import torch_geometric 5 | from torch_cluster import radius_graph 6 | from torch_scatter import scatter 7 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 8 | from utils import get_iso_dataset 9 | from e3nn.nn.models.gate_points_2101 import Network 10 | from e3nn import o3 11 | from utils import get_scalar_density_comparisons 12 | import wandb 13 | import random 14 | from datetime import date 15 | import argparse 16 | 17 | def main(): 18 | parser = argparse.ArgumentParser(description='train energy and force') 19 | parser.add_argument('--dataset', type=str) 20 | parser.add_argument('--testset', type=str) 21 | parser.add_argument('--split', type=int) 22 | parser.add_argument('--epochs', type=int, default=300) 23 | parser.add_argument('--gpu', type=str) 24 | args = parser.parse_args() 25 | 26 | device = torch.device(args.gpu if torch.cuda.is_available() else "cpu") 27 | print ("What device am I using?", device) 28 | 29 | torch.set_default_dtype(torch.float32) 30 | 31 | hhh = "../data/h_s_only_def2-universal-jfit-decontract_density.out" 32 | ooo = "../data/o_s_only_def2-universal-jfit-decontract_density.out" 33 | 34 | num_epochs = args.epochs 35 | 36 | # def2 basis set max irreps 37 | Rs = [(12, 0), (5, 1), (4, 2), (2, 3), (1, 4)] 38 | 39 | test_dataset = get_iso_dataset(args.testset,o_iso=ooo,h_iso=hhh) 40 | 41 | split = args.split 42 | data_file = args.dataset 43 | lr = 1e-2 44 | model_kwargs = { 45 | "irreps_in": "2x 0e", #irreps_in 46 | "irreps_hidden": [(mul, (l, p)) for l, mul in enumerate([125,40,25,15]) for p in [-1, 1]], #irreps_hidden 47 | "irreps_out": "1x0e", #irreps_out 48 | "irreps_node_attr": None, #irreps_node_attr 49 | "irreps_edge_attr": o3.Irreps.spherical_harmonics(3), #irreps_edge_attr 50 | "layers": 3, 51 | "max_radius": 3.5, 52 | "number_of_basis": 10, 53 | "radial_layers": 1, 54 | "radial_neurons": 128, 55 | "num_neighbors": 12.2298, 56 | "num_nodes": 24, 57 | "reduce_output": True, 58 | } 59 | 60 | dataset = get_iso_dataset(data_file,o_iso=ooo,h_iso=hhh) 61 | random.shuffle(dataset) 62 | 63 | if split > len(dataset): 64 | # continue # Only run when the split is contained in the dataset 65 | raise ValueError('Split it too large for the dataset.') 66 | 67 | b = 1 68 | train_loader = torch_geometric.data.DataLoader(dataset[:split], batch_size=b, shuffle=True) 69 | test_loader = torch_geometric.data.DataLoader(test_dataset, batch_size=b, shuffle=True) 70 | 71 | model = Network(**model_kwargs) 72 | 73 | optim = torch.optim.Adam(model.parameters(), lr=lr) 74 | optim.zero_grad() 75 | 76 | model.to(device) 77 | 78 | energy_coefficient = 1.0 79 | force_coefficient = 1.0 80 | 81 | model_kwargs["energy_coefficient"] = energy_coefficient 82 | model_kwargs["force_coefficient"] = force_coefficient 83 | model_kwargs["train_dataset"] = data_file 84 | model_kwargs["train_dataset_size"] = split 85 | model_kwargs["lr"] = lr 86 | wandb.init(config=model_kwargs, reinit=True) 87 | wandb.run.name = 'DATASET_' + args.dataset + '_SPLIT_' + str(args.split) + '_' + date.today().strftime("%b-%d-%Y") 88 | wandb.watch(model) 89 | 90 | for epoch in range(num_epochs): 91 | loss_cum = 0.0 92 | e_mae = 0.0 93 | e_mue = 0.0 94 | f_mae = 0.0 95 | for step, data in enumerate(train_loader): 96 | data.pos.requires_grad = True 97 | y_ml = model(data.to(device)) 98 | 99 | # get ml force 100 | forces = torch.autograd.grad(y_ml, data.pos.to(device), create_graph=True, retain_graph=True)[0] 101 | 102 | # subtract energy of water monomers (PBE0) 103 | monomer_energy = -76.379999960410643 104 | energy_err = y_ml - (data.energy.to(device) - monomer_energy*data.pos.shape[0]/3 ) 105 | forces_err = forces - data.forces.to(device) 106 | 107 | e_mue += energy_err.detach() 108 | e_mae += energy_err.detach().abs() 109 | f_mae += forces_err.detach().flatten().abs().mean() 110 | 111 | energy_loss = energy_err.pow(2).mean() 112 | force_loss = forces_err.pow(2).mean() 113 | err = (energy_coefficient * energy_loss) + (force_coefficient * force_loss) 114 | err.backward() 115 | loss_cum += err.detach() 116 | 117 | optim.step() 118 | optim.zero_grad() 119 | 120 | # now the test loop 121 | for testset in [test_loader]: 122 | test_loss_cum = 0.0 123 | test_e_mae = 0.0 124 | test_e_mue = 0.0 125 | test_f_mae = 0.0 126 | for step, data in enumerate(testset): 127 | data.pos.requires_grad = True 128 | y_ml = model(data.to(device)) 129 | 130 | # get ml force 131 | forces = torch.autograd.grad(y_ml, data.pos.to(device), create_graph=True, retain_graph=True)[0] 132 | 133 | # subtract energy of water monomers 134 | monomer_energy = -76.379999960410643 135 | energy_err = y_ml - (data.energy.to(device) - monomer_energy*data.pos.shape[0]/3 ) 136 | forces_err = forces - data.forces.to(device) 137 | 138 | test_e_mue += energy_err.detach() 139 | test_e_mae += energy_err.detach().abs() 140 | test_f_mae += forces_err.detach().flatten().abs().mean() 141 | 142 | energy_loss = energy_err.pow(2).mean() 143 | force_loss = forces_err.pow(2).mean() 144 | err = (energy_coefficient * energy_loss) + (force_coefficient * force_loss) 145 | test_loss_cum += err.detach() 146 | 147 | wandb.log({ 148 | "Epoch": epoch, 149 | "Train_Loss": float(loss_cum)/len(train_loader), 150 | "Train_Energy_MAE": float(e_mae)/len(train_loader), 151 | "Train_Energy_MUE": float(e_mue)/len(train_loader), 152 | "Train_Forces_MAE": float(f_mae)/len(train_loader), 153 | 154 | "Test_Loss": float(test_loss_cum)/len(test_loader), 155 | "Test_Energy_MAE": float(test_e_mae)/len(test_loader), 156 | "Test_Energy_MUE": float(test_e_mue)/len(test_loader), 157 | "Test_Forces_MAE": float(test_f_mae)/len(test_loader) 158 | 159 | }) 160 | 161 | if epoch % 1 == 0: 162 | print(str(epoch) + " " + f"{float(loss_cum)/len(train_loader):.10f}") 163 | 164 | wandb.finish() 165 | 166 | if __name__ == '__main__': 167 | main() 168 | 169 | --------------------------------------------------------------------------------