├── .dockerignore ├── .gitattributes ├── .github └── workflows │ ├── anaconda-deploy.yml │ ├── anaconda-test-upload.yml │ ├── docker.yml │ ├── mamba-build-test.yml │ ├── package-test.yml │ ├── python-publish.yml │ └── python-test-pypi.yml ├── .gitignore ├── .readthedocs.yml ├── Dockerfile ├── LICENSE ├── MANIFEST.in ├── README.md ├── benchmarks ├── archive_collection_comparison.py └── hd5f_collection_comparison.py ├── conda-recipe ├── conda_build_config.yaml └── meta.yaml ├── docker-compose.yml ├── docs ├── Makefile ├── imgs │ ├── chem_inheritance.png │ └── molli_logo.svg ├── make.bat ├── requirements.txt └── source │ ├── 01-molli-preamble.md │ ├── 02-basics.md │ ├── API │ ├── molli.chem │ │ ├── _index.rst │ │ ├── atom.rst │ │ ├── atomtypes.rst │ │ ├── bond.rst │ │ ├── ensemble.rst │ │ ├── geometry.rst │ │ ├── legacy.rst │ │ ├── library.rst │ │ ├── molecule.rst │ │ └── structure.rst │ ├── molli.data │ │ ├── _index.rst │ │ ├── atomic_weight.rst │ │ ├── color_cpk.rst │ │ ├── covalent_radius_1.rst │ │ ├── covalent_radius_grimme.rst │ │ ├── electron_affinity.rst │ │ ├── group.rst │ │ └── vdw_radius.rst │ ├── molli.descriptor │ │ ├── _index.rst │ │ ├── aso.rst │ │ ├── cov_cn.rst │ │ └── gridbased.rst │ ├── molli.external │ │ ├── _index.rst │ │ ├── openbabel.rst │ │ └── rdkit.rst │ ├── molli.ftypes │ │ ├── _index.rst │ │ └── cdxml.rst │ ├── molli.math │ │ ├── _index.rst │ │ └── rotation.rst │ └── molli.pipeline │ │ └── pipeline-notes.md │ ├── command_line │ └── commands.ipynb │ ├── conf.py │ ├── cookbook │ ├── 001-helloworld.ipynb │ ├── 002-atom.ipynb │ ├── 003-bond.ipynb │ ├── 004-geometry.ipynb │ ├── 005-conformerensemble.ipynb │ ├── 006-libraries.ipynb │ ├── 007-visualization.ipynb │ ├── 008-chemdraw.ipynb │ ├── 009-openbabel.ipynb │ ├── 010-rdkit.ipynb │ ├── 011-gbca.ipynb │ ├── 012-jobmap.ipynb │ └── 013-BOX_workflow.ipynb │ ├── index.rst │ ├── miscellaneous │ ├── diagram_code.png │ ├── extensions.rst │ ├── inheritance_diagram.png │ └── inheritance_diagram.rst │ ├── requirements.txt │ └── zenodo │ ├── 001-molnet.ipynb │ ├── 002-crude.ipynb │ ├── 003-buildlibrary.ipynb │ ├── 004-readwrite.ipynb │ ├── 05-gbca-benchmark │ ├── 005-gbca.ipynb │ ├── 005-mollixt.ipynb │ ├── 005-sparsity.ipynb │ └── _index.rst │ ├── 06-gbca-calculation-vis │ ├── 006-calc.ipynb │ ├── 006-calcvis.ipynb │ └── _index.rst │ ├── 07-kras-inhibitor-rotation-barrier │ ├── 007-kras.ipynb │ ├── _index.rst │ ├── rb_w1_opt.py │ ├── rb_w1_opt.rst │ ├── rb_w2_opt.py │ ├── rb_w2_opt.rst │ ├── rb_w3_opt.py │ ├── rb_w3_opt.rst │ ├── scan.py │ └── scan.rst │ └── 08-workflow-nmr-prediction │ ├── 008-cladosporin.ipynb │ ├── _index.rst │ ├── workflow.py │ └── workflow.rst ├── environment.yml ├── examples-jupyter ├── 001-helloworld.ipynb ├── 002-atom.ipynb ├── 003-bond.ipynb ├── 004-geometry.ipynb ├── 005-conformerensemble.ipynb ├── 006-libraries.ipynb ├── 007-visualization.ipynb ├── 008-chemdraw.ipynb ├── 009-openbabel.ipynb ├── 010-rdkit.ipynb ├── 011-gbca.ipynb ├── 012-jobmap.ipynb ├── 013-BOX_workflow.ipynb └── README.md ├── examples-scripts ├── 001_pyvista1.py ├── 002_pyvista2.py └── 003_pyvista_vdw.py ├── examples-zenodo ├── 01-geom-molnet-dataset │ └── 001-molnet.ipynb ├── 02-geom-crude-dataset │ └── 002-crude.ipynb ├── 03-combinatorial-library │ └── 003-buildlibrary.ipynb ├── 04-collection-comparison │ └── 004-readwrite.ipynb ├── 05-gbca-benchmark │ ├── 005-gbca.ipynb │ ├── 005-mollixt.ipynb │ └── 005-sparsity.ipynb ├── 06-gbca-calculation-vis │ ├── 006-calc.ipynb │ └── 006-calcvis.ipynb ├── 07-kras-inhibitor-rotation-barrier │ ├── 007-kras.ipynb │ ├── rb_w1_opt.py │ ├── rb_w2_opt.py │ ├── rb_w3_opt.py │ └── scan.py └── 08-workflow-nmr-prediction │ ├── 008-cladosporin.ipynb │ └── workflow.py ├── molli ├── __init__.py ├── __main__.py ├── _aux │ ├── __init__.py │ ├── db.py │ ├── iterators.py │ ├── lock.py │ ├── misc.py │ └── version.py ├── chem │ ├── __init__.py │ ├── atom.py │ ├── bond.py │ ├── ensemble.py │ ├── geometry.py │ ├── io.py │ ├── legacy.py │ ├── library.py │ ├── molecule.py │ └── structure.py ├── config.py ├── data │ ├── __init__.py │ ├── element.atomic_weight.yml │ ├── element.c6_grimme.yml │ ├── element.color_cpk.yml │ ├── element.covalent_radius_1.yml │ ├── element.covalent_radius_2.yml │ ├── element.covalent_radius_3.yml │ ├── element.covalent_radius_grimme.yml │ ├── element.electron_affinity.yml │ ├── element.en_pauling.yml │ ├── element.group.yml │ ├── element.vdw_radius.yml │ └── isotope.exact_mass.yml ├── descriptor │ ├── __init__.py │ ├── aso.py │ ├── cov_cn.py │ └── gridbased.py ├── external │ ├── __init__.py │ ├── openbabel.py │ └── rdkit.py ├── files │ ├── BOX_4position_fragments.cdxml │ ├── BOX_bridging_fragments.cdxml │ ├── BOX_cores.cdxml │ ├── __init__.py │ ├── benzene.mol2 │ ├── box_alignment_core.mol2 │ ├── box_ligands.mlib │ ├── bpa_core.mol2 │ ├── charges_mult.cdxml │ ├── cinchonidine.mlib │ ├── cinchonidine_mcs.mol2 │ ├── cinchonidine_query.mol2 │ ├── cinchonidine_rdconfs.clib │ ├── dendrobine.mol │ ├── dendrobine.mol2 │ ├── dendrobine.xyz │ ├── dimethyl_sulfone.mol2 │ ├── dmf.mol2 │ ├── dummy.mol2 │ ├── dummy.xyz │ ├── fletcher_phosphoramidite_cats.mlib │ ├── fxyl.mol2 │ ├── hadd_test.mol2 │ ├── isornitrate.mol2 │ ├── nanotube.mol2 │ ├── oldstyle.xml │ ├── parser_demo.cdxml │ ├── parser_demo2.cdxml │ ├── pdb_4a05.mol2 │ ├── pentane_confs.mol │ ├── pentane_confs.mol2 │ ├── pentane_confs.xyz │ ├── propyne.mol2 │ ├── substituents.cdxml │ ├── test_mol2s.zip │ ├── test_mol2s_ml02.zip │ ├── tiny_test_bpa_raw_conf.mlib │ ├── zincdb_fda.mol │ └── zincdb_fda.mol2 ├── ftypes │ ├── __init__.py │ └── cdxml.py ├── math │ ├── __init__.py │ ├── distance.py │ ├── plane.py │ ├── polyhedra.py │ └── rotation.py ├── parsing │ ├── __init__.py │ ├── _reader.py │ ├── mol2.py │ ├── xtbout.py │ └── xyz.py ├── pipeline │ ├── __init__.py │ ├── crest.py │ ├── driver.py │ ├── job.py │ ├── nwchem.py │ ├── orca.py │ ├── runner.py │ └── xtb.py ├── reader.py ├── scripts │ ├── __init__.py │ ├── align.py │ ├── combine.py │ ├── compile.py │ ├── gbca.py │ ├── grid.py │ ├── info.py │ ├── ls.py │ ├── parse.py │ ├── recollect.py │ ├── run.py │ ├── show.py │ ├── stats.py │ └── test.py ├── storage │ ├── __init__.py │ ├── backends.py │ ├── bmffile.py │ ├── collection.py │ └── ukvfile.py ├── visual │ ├── __init__.py │ ├── _py3dmol.py │ ├── _pyvista.py │ └── primitives.py └── writer.py ├── molli_test ├── __init__.py ├── test_cdxml_parse.py ├── test_chem_connectivity.py ├── test_chem_geometry.py ├── test_chem_molecule.py ├── test_chem_promolecule.py ├── test_chem_structure.py ├── test_collections.py ├── test_conformer_ensemble.py ├── test_descriptor.py ├── test_external_openbabel.py ├── test_external_rdkit.py ├── test_external_xtb.py ├── test_install.py ├── test_molli_extensions.py └── test_read_write.py ├── molli_xt ├── _molli_xt.cpp ├── _molli_xt.hpp └── distance.cpp ├── optional-deps.txt ├── pyproject.toml └── setup.py /.dockerignore: -------------------------------------------------------------------------------- 1 | .git* 2 | .github 3 | .gitattributes 4 | .gitignore 5 | .vscode/ 6 | examples-jupyter/ 7 | examples-scripts 8 | Dockerfile* 9 | Dockerfile 10 | **/README* 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # These overrides are needed to prevent documentation files from destroying code statistics 2 | examples-jupyter/* linguist-documentation 3 | examples-scripts/* linguist-documentation 4 | dev/* linguist-generated 5 | -------------------------------------------------------------------------------- /.github/workflows/anaconda-deploy.yml: -------------------------------------------------------------------------------- 1 | name: Upload Anaconda Package 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | 8 | 9 | jobs: 10 | conda_build: 11 | name: Conda ${{ matrix.os }} build and upload 12 | runs-on: ${{ matrix.os }} 13 | 14 | defaults: 15 | run: 16 | shell: bash -l {0} 17 | 18 | strategy: 19 | matrix: 20 | os: [ubuntu-latest, windows-latest, macos-latest] 21 | steps: 22 | - name: Set up MSVC (Windows only) 23 | if: matrix.os == 'windows-latest' 24 | uses: ilammy/msvc-dev-cmd@v1 25 | 26 | - name: Delete Incorrect Link from Path 27 | if: matrix.os == 'windows-latest' 28 | run: rm /usr/bin/link.exe 29 | 30 | - uses: actions/checkout@v4 31 | 32 | - name: Install micromamba 33 | uses: mamba-org/setup-micromamba@v1 34 | env: 35 | ACTIONS_STEP_DEBUG: true 36 | with: 37 | init-shell: >- 38 | bash 39 | powershell 40 | 41 | create-args: >- 42 | python=3.11 43 | conda 44 | 45 | environment-name: molli 46 | 47 | - name: Install conda build and upload dependencies 48 | run: | 49 | conda install -y conda-build anaconda-client 50 | 51 | - name: Build conda package 52 | env: 53 | ACTIONS_STEP_DEBUG: true 54 | run: | 55 | mkdir conda-dist; 56 | conda build --output-folder conda-dist conda-recipe; 57 | 58 | - name: Upload conda package 59 | env: 60 | ACTIONS_STEP_DEBUG: true 61 | run: | 62 | anaconda --token ${{ secrets.CONDA_TOKEN }} upload --user esalx --force conda-dist/*/molli-*.tar.bz2; 63 | -------------------------------------------------------------------------------- /.github/workflows/anaconda-test-upload.yml: -------------------------------------------------------------------------------- 1 | name: Anaconda Test Upload 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | conda_build: 10 | name: Conda ${{ matrix.os }} build and upload 11 | runs-on: ${{ matrix.os }} 12 | 13 | defaults: 14 | run: 15 | shell: bash -l {0} 16 | 17 | strategy: 18 | matrix: 19 | os: [ubuntu-latest, windows-latest, macos-latest] 20 | steps: 21 | - name: Set up MSVC (Windows only) 22 | if: matrix.os == 'windows-latest' 23 | uses: ilammy/msvc-dev-cmd@v1 24 | 25 | - name: Delete Incorrect Link from Path 26 | if: matrix.os == 'windows-latest' 27 | run: rm /usr/bin/link.exe 28 | 29 | - uses: actions/checkout@v4 30 | 31 | - name: Install micromamba 32 | uses: mamba-org/setup-micromamba@v1 33 | env: 34 | ACTIONS_STEP_DEBUG: true 35 | with: 36 | init-shell: >- 37 | bash 38 | powershell 39 | 40 | create-args: >- 41 | python=3.11 42 | conda 43 | 44 | environment-name: molli 45 | 46 | - name: Install conda build and upload dependencies 47 | run: | 48 | conda install -y conda-build anaconda-client 49 | 50 | - name: Build conda package 51 | env: 52 | ACTIONS_STEP_DEBUG: true 53 | run: | 54 | mkdir conda-dist; 55 | conda build --output-folder conda-dist conda-recipe; 56 | 57 | - name: Upload conda package 58 | env: 59 | ACTIONS_STEP_DEBUG: true 60 | run: | 61 | anaconda --token ${{ secrets.CONDA_TOKEN }} upload --label test --user esalx --force conda-dist/*/molli-*.tar.bz2; -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker 2 | 3 | # This will run when: 4 | # - when new code is pushed to main/develop to push the tags 5 | # latest and develop 6 | # - when a pull request is created and updated, to make sure the 7 | # Dockerfile is still valid. 8 | # To be able to push to the GitHub Container Registry, this expects the following 9 | # secrets to be set in the project: 10 | # - GH_USERNAME : username that write push packages to the moleculemaker GitHub org 11 | # - GH_PASSWORD : PAT associated with the username 12 | 13 | on: 14 | # Trigger the workflow on release activity 15 | release: 16 | # Only use the types keyword to narrow down the activity types that will trigger your workflow. 17 | types: 18 | - published 19 | - edited 20 | # - created 21 | 22 | # Certain actions will only run when this is the main repo. 23 | env: 24 | MAIN_REPO: SEDenmarkLab/molli 25 | 26 | jobs: 27 | docker: 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Set up Docker Buildx 31 | uses: docker/setup-buildx-action@v3 32 | 33 | - uses: actions/checkout@v4 34 | 35 | - name: Docker meta 36 | id: meta 37 | uses: docker/metadata-action@v4 38 | with: 39 | images: | 40 | ghcr.io/moleculemaker/molli 41 | ghcr.io/SEDenmarkLab/molli 42 | tags: | 43 | # set latest tag for default branch 44 | type=raw,value=latest,enable={{is_default_branch}} 45 | type=ref,event=branch 46 | type=ref,event=pr 47 | type=ref,event=tag 48 | type=semver,pattern={{version}} 49 | type=semver,pattern={{major}}.{{minor}} 50 | 51 | - name: Login to GitHub Container Registry 52 | uses: docker/login-action@v3 53 | with: 54 | registry: ghcr.io 55 | username: ${{ secrets.GH_USERNAME }} 56 | password: ${{ secrets.GH_PASSWORD }} 57 | 58 | 59 | - name: Build and push 60 | uses: docker/build-push-action@v6 61 | with: 62 | context: . 63 | platforms: linux/amd64 64 | push: true 65 | tags: ${{ steps.meta.outputs.tags }} 66 | labels: ${{ steps.meta.outputs.labels }} 67 | -------------------------------------------------------------------------------- /.github/workflows/mamba-build-test.yml: -------------------------------------------------------------------------------- 1 | name: Mamba Build test 2 | 3 | on: 4 | pull_request: 5 | 6 | 7 | jobs: 8 | mamba_build: 9 | name: ${{ matrix.os }} -> mamba build 10 | runs-on: ${{ matrix.os }} 11 | 12 | defaults: 13 | run: 14 | shell: bash -l {0} 15 | 16 | strategy: 17 | matrix: 18 | os: [ubuntu-latest, windows-latest, macos-latest] 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Set up MSVC (Windows only) 24 | if: matrix.os == 'windows-latest' 25 | uses: ilammy/msvc-dev-cmd@v1 26 | 27 | - name: Delete Incorrect Link from Path 28 | if: matrix.os == 'windows-latest' 29 | run: rm /usr/bin/link.exe 30 | 31 | - name: Install micromamba 32 | uses: mamba-org/setup-micromamba@v1 33 | env: 34 | ACTIONS_STEP_DEBUG: true 35 | with: 36 | init-shell: >- 37 | bash 38 | create-args: >- 39 | python=3.11 40 | conda 41 | environment-name: molli 42 | 43 | - name: Install conda build and upload dependencies 44 | run: | 45 | conda install boa; 46 | conda install conda-verify; 47 | 48 | - name: Build package 49 | env: 50 | ACTIONS_STEP_DEBUG: true 51 | run: | 52 | mkdir conda-dist; 53 | conda mambabuild conda-recipe --output-folder conda-dist --python 3.10 --no-anaconda-upload; 54 | -------------------------------------------------------------------------------- /.github/workflows/package-test.yml: -------------------------------------------------------------------------------- 1 | name: molli_package_test 2 | on: 3 | pull_request: 4 | 5 | 6 | permissions: 7 | contents: read 8 | 9 | jobs: 10 | molli_test: 11 | name: Testing on py${{ matrix.py_version }}, ${{ matrix.os }} 12 | runs-on: ${{ matrix.os }} 13 | 14 | # defaults: 15 | # run: 16 | # shell: bash -l {0} 17 | 18 | strategy: 19 | matrix: 20 | os: 21 | - ubuntu-latest 22 | - windows-latest 23 | - macos-latest 24 | 25 | py_version: 26 | - "3.10" 27 | - "3.11" 28 | - "3.12" 29 | 30 | steps: 31 | - uses: actions/checkout@v4 32 | - name: Set up Python ${{ matrix.py_version }} 33 | uses: actions/setup-python@v5 34 | with: 35 | python-version: ${{ matrix.py_version }} 36 | 37 | - name: Install dependencies for testing 38 | run: | 39 | python -m pip install --upgrade pip; 40 | mkdir temp; 41 | 42 | - name: Install molli package 43 | run: | 44 | pip install . -vv 45 | 46 | - name: Run molli test suite 47 | working-directory: temp 48 | run: | 49 | molli test -vvv 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: 14 | - published 15 | # - edited 16 | # - created 17 | 18 | permissions: 19 | contents: read 20 | 21 | 22 | jobs: 23 | build_wheels: 24 | name: Build wheels on ${{ matrix.os }} 25 | runs-on: ${{ matrix.os }} 26 | env: 27 | # Skip pypy builds (something goes wrong when trying to build) 28 | CIBW_SKIP: 'pp3*' 29 | strategy: 30 | matrix: 31 | os: [ubuntu-latest, windows-latest, macos-latest] 32 | 33 | steps: 34 | - uses: actions/checkout@v4 35 | 36 | - name: Build wheels 37 | uses: pypa/cibuildwheel@v2.17.0 38 | 39 | - uses: actions/upload-artifact@v4 40 | with: 41 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} 42 | path: ./wheelhouse/*.whl 43 | 44 | build_sdist: 45 | name: Build source distribution 46 | runs-on: ubuntu-latest 47 | steps: 48 | - uses: actions/checkout@v4 49 | 50 | - name: Build sdist 51 | run: pipx run build --sdist 52 | 53 | - uses: actions/upload-artifact@v4 54 | with: 55 | name: cibw-sdist 56 | path: dist/*.tar.gz 57 | 58 | upload_pypi: 59 | needs: [build_wheels, build_sdist] 60 | runs-on: ubuntu-latest 61 | environment: pypi 62 | permissions: 63 | id-token: write 64 | # if: github.event_name == 'release' && github.event.action == 'published' 65 | # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) 66 | # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') 67 | steps: 68 | - uses: actions/download-artifact@v4 69 | with: 70 | # unpacks all CIBW artifacts into dist/ 71 | pattern: cibw-* 72 | path: dist 73 | merge-multiple: true 74 | 75 | - uses: pypa/gh-action-pypi-publish@release/v1 76 | with: 77 | user: __token__ 78 | password: ${{ secrets.PYPI_API_TOKEN }} 79 | -------------------------------------------------------------------------------- /.github/workflows/python-test-pypi.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Test Python Packages 10 | 11 | on: 12 | push: 13 | branches: 14 | - main 15 | 16 | permissions: 17 | contents: read 18 | 19 | 20 | jobs: 21 | build_wheels: 22 | name: Build wheels on ${{ matrix.os }} 23 | runs-on: ${{ matrix.os }} 24 | env: 25 | # Skip pypy builds (something goes wrong when trying to build) 26 | CIBW_SKIP: 'pp3*' 27 | strategy: 28 | matrix: 29 | os: [ubuntu-latest, windows-latest, macos-latest] 30 | 31 | steps: 32 | - uses: actions/checkout@v4 33 | 34 | - name: Build wheels 35 | uses: pypa/cibuildwheel@v2.17.0 36 | 37 | - uses: actions/upload-artifact@v4 38 | with: 39 | name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} 40 | path: ./wheelhouse/*.whl 41 | 42 | build_sdist: 43 | name: Build source distribution 44 | runs-on: ubuntu-latest 45 | steps: 46 | - uses: actions/checkout@v4 47 | 48 | - name: Build sdist 49 | run: pipx run build --sdist 50 | 51 | - uses: actions/upload-artifact@v4 52 | with: 53 | name: cibw-sdist 54 | path: dist/*.tar.gz 55 | 56 | upload_pypi: 57 | needs: [build_wheels, build_sdist] 58 | runs-on: ubuntu-latest 59 | environment: testpypi 60 | permissions: 61 | id-token: write 62 | # if: github.event_name == 'release' && github.event.action == 'published' 63 | # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) 64 | # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') 65 | steps: 66 | - uses: actions/download-artifact@v4 67 | with: 68 | # unpacks all CIBW artifacts into dist/ 69 | pattern: cibw-* 70 | path: dist 71 | merge-multiple: true 72 | 73 | - name: Upload test packages to the TestPyPI repository 74 | uses: pypa/gh-action-pypi-publish@release/v1 75 | with: 76 | repository-url: https://test.pypi.org/legacy/ 77 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Unnecessary folders 2 | /scratch 3 | /temp 4 | /build 5 | /docs/build 6 | /dist 7 | /misc 8 | 9 | # Python residues 10 | # **/.vscode/ # This allows easier sharing of black formatter settings 11 | **/__pycache__ 12 | **/*.pyd 13 | **/*.pyc 14 | molli.egg-info/ 15 | 16 | # Jupyter residues 17 | **/.ipynb_checkpoints 18 | molli_xt.*.so 19 | 20 | # Files not to be uploaded to repo 21 | **/_temp_* 22 | **/*.lock 23 | **/.vscode/ 24 | /.vscode/c_cpp_properties.json 25 | molli/chem/molli_dev.code-workspace 26 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: "ubuntu-22.04" 5 | tools: 6 | python: "mambaforge-22.9" 7 | 8 | # version: 2 9 | 10 | # build: 11 | # os: ubuntu-22.04 12 | # tools: 13 | # python: "3.11" 14 | 15 | # You can also specify other tool versions: 16 | # nodejs: "19" 17 | # rust: "1.64" 18 | # golang: "1.19" 19 | 20 | conda: 21 | environment: environment.yml 22 | 23 | # Build documentation in the docs/ directory with Sphinx 24 | sphinx: 25 | configuration: docs/source/conf.py 26 | 27 | # If using Sphinx, optionally build your docs in additional formats such as PDF 28 | formats: 29 | - pdf 30 | - epub 31 | 32 | # Optionally declare the Python requirements required to build your docs 33 | 34 | # python: 35 | # install: 36 | # - method: pip 37 | # path: . 38 | # - requirements: docs/requirements.txt 39 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Start with miniconda3 based on debian:bullseye 2 | FROM condaforge/mambaforge 3 | WORKDIR / 4 | 5 | # Install essential build tools 6 | RUN apt-get -qq update && \ 7 | apt-get -qq install build-essential && \ 8 | rm -rf /var/cache/apt/archives /var/lib/apt/lists/* 9 | 10 | # Configure conda base environment 11 | RUN mamba init bash 12 | RUN mamba install boa -n base && mamba clean -afy 13 | 14 | # Copy source code into the container image 15 | COPY . /molli/ 16 | 17 | # Use conda to build provided conda-recipe 18 | RUN mamba mambabuild --python=3.11 molli/ && mamba clean -afy 19 | 20 | # Create + activate a new environment for Python 11 21 | RUN mamba create -y -n molli python=3.11 && mamba clean -afy 22 | RUN echo "mamba activate molli" >> ~/.bashrc 23 | SHELL ["/bin/bash", "--login", "-c"] 24 | 25 | # Install the molli package in the new environment 26 | RUN mamba install molli -c local -n molli -y 27 | RUN mamba install --file /molli/optional-deps.txt -y -n molli && mamba clean -afy 28 | 29 | ENTRYPOINT ["molli"] 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022-2023 The Board of Trustees of the University of Illinois 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft molli 2 | graft molli_test 3 | graft molli_xt 4 | include README.md 5 | include LICENSE 6 | -------------------------------------------------------------------------------- /benchmarks/archive_collection_comparison.py: -------------------------------------------------------------------------------- 1 | # This script is to show the process of timing measurement 2 | import molli as ml 3 | import timeit 4 | 5 | N = 3 6 | 7 | # ml.aux.assert_molli_version_min("1.0.0b2") 8 | 9 | _clib = ml.ConformerLibrary("bpa_test.clib") 10 | 11 | with _clib.reading(): 12 | ensembles = {k: v for k, v in _clib.items()} 13 | 14 | 15 | def _dir_col(path, overwrite=False): 16 | return ml.storage.Collection( 17 | path, 18 | backend=ml.storage.DirCollectionBackend, 19 | value_decoder=lambda x: ml.ConformerEnsemble.loads_mol2(x.decode()), 20 | value_encoder=lambda x: ml.ConformerEnsemble.dumps_mol2(x).encode(), 21 | ext=".mol2", 22 | readonly=False, 23 | overwrite=overwrite, 24 | ) 25 | 26 | 27 | def _zip_col(path, overwrite=False): 28 | return ml.storage.Collection( 29 | path, 30 | backend=ml.storage.ZipCollectionBackend, 31 | value_decoder=lambda x: ml.ConformerEnsemble.loads_mol2(x.decode()), 32 | value_encoder=lambda x: ml.ConformerEnsemble.dumps_mol2(x).encode(), 33 | ext=".mol2", 34 | readonly=False, 35 | overwrite=overwrite, 36 | ) 37 | 38 | 39 | def _tar_col(path, overwrite=False): 40 | return ml.storage.Collection( 41 | path, 42 | backend=ml.storage.TarCollectionBackend, 43 | value_decoder=lambda x: ml.ConformerEnsemble.loads_mol2(x.decode()), 44 | value_encoder=lambda x: ml.ConformerEnsemble.dumps_mol2(x).encode(), 45 | ext=".mol2", 46 | readonly=False, 47 | overwrite=overwrite, 48 | ) 49 | 50 | 51 | def _ukv_col(path, overwrite=False): 52 | return ml.ConformerLibrary( 53 | path, 54 | readonly=False, 55 | overwrite=overwrite, 56 | ) 57 | 58 | 59 | # Note: bpa_test_deflate5.zip is not here as you cannot write into the compressed format 60 | for prep, path in ( 61 | (_ukv_col, "bpa_test.clib"), 62 | (_tar_col, "bpa_test.tar"), 63 | (_zip_col, "bpa_test.zip"), 64 | # (_dir_col, "bpa_test"), 65 | ): 66 | clib_write_times = timeit.Timer( 67 | stmt="""with library.writing():\n for k, v in ensembles.items(): library[k]=v""", 68 | setup="""library = prep(path, overwrite=True)""", 69 | globals=globals(), 70 | ).repeat(5, number=1) 71 | 72 | print("Writing times", path, min(clib_write_times), clib_write_times, flush=True) 73 | 74 | # Note: bpa_test_deflate5.zip is written from the compressed "bpa_test" directory created after the first one 75 | for prep, path in ( 76 | (_ukv_col, "bpa_test.clib"), 77 | (_tar_col, "bpa_test.tar"), 78 | (_zip_col, "bpa_test.zip"), 79 | # (_zip_col, "bpa_test_deflate5.zip"), 80 | # (_dir_col, "bpa_test"), 81 | ): 82 | clib_read_times = timeit.Timer( 83 | stmt="""with library.reading():\n for k, v in library.items(): pass""", 84 | setup="""library = prep(path, overwrite=False)""", 85 | globals=globals(), 86 | ).repeat(5, number=1) 87 | 88 | print("Read times", path, min(clib_read_times), clib_read_times, flush=True) 89 | -------------------------------------------------------------------------------- /benchmarks/hd5f_collection_comparison.py: -------------------------------------------------------------------------------- 1 | import molli as ml 2 | import timeit 3 | import h5py 4 | import numpy as np 5 | 6 | _clib = ml.ConformerLibrary("bpa_test.clib") 7 | 8 | with _clib.reading(): 9 | ensembles = {k: v for k, v in _clib.items()} 10 | 11 | path = "bpa_test.hdf5" 12 | 13 | 14 | def write_hdf5(): 15 | with h5py.File(path, "w") as f: 16 | for entry_key, ensemble in ensembles.items(): 17 | group = f.create_group(entry_key) 18 | group.create_dataset( 19 | name="coords", 20 | data=ensemble.coords, 21 | dtype="float32", 22 | ) 23 | 24 | group.create_dataset( 25 | name="atomic_charges", data=ensemble.atomic_charges, dtype="float32" 26 | ) 27 | group.create_dataset(name="weights", data=ensemble.weights, dtype="float32") 28 | group.create_dataset( 29 | name="atoms", 30 | data=[int(a.element) for a in ensemble.atoms], 31 | dtype="int16", 32 | ) 33 | atom_idxs = {a: i for i, a in enumerate(ensemble.atoms)} 34 | group.create_dataset( 35 | name="bonds", 36 | data=[ 37 | [atom_idxs[bond.a1], atom_idxs[bond.a2], int(bond.btype)] 38 | for bond in ensemble.bonds 39 | ], 40 | dtype="int16", 41 | ) 42 | 43 | 44 | def read_hdf5(): 45 | with h5py.File(path, "r") as f: 46 | for entry_key in f.keys(): 47 | group = f[entry_key] 48 | ens = ml.ConformerEnsemble( 49 | [int(i) for i in group["atoms"][:]], 50 | n_conformers=group["coords"].shape[0], 51 | name=entry_key, 52 | coords=group["coords"][:], 53 | weights=group["weights"][:], 54 | atomic_charges=group["atomic_charges"][:], 55 | ) 56 | for a1, a2, bt in group["bonds"][:]: 57 | ens.connect(int(a1), int(a2), btype=ml.BondType(bt)) 58 | 59 | 60 | # Measure writing speed 61 | write_times = timeit.repeat(write_hdf5, repeat=5, number=1) 62 | print(f"Writing time: min {min(write_times):.6f} seconds of {write_times}") 63 | 64 | # Measure reading speed 65 | read_times = timeit.repeat(read_hdf5, repeat=5, number=1) 66 | print(f"Reading time: min {min(read_times):.6f} seconds of {read_times}") 67 | -------------------------------------------------------------------------------- /conda-recipe/conda_build_config.yaml: -------------------------------------------------------------------------------- 1 | python: 2 | - 3.10 3 | - 3.11 4 | 5 | # numpy: 6 | # - 1.23 7 | # - 1.24 8 | -------------------------------------------------------------------------------- /conda-recipe/meta.yaml: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # ================================================================================ 5 | 6 | {% set pyproject = load_file_data("../pyproject.toml", from_recipe_dir=True) %} 7 | # tool.setuptools.dynamic 8 | {% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.999') %} 9 | 10 | 11 | package: 12 | name: molli 13 | version: {{ version }} 14 | 15 | about: 16 | home: https://github.com/SEDenmarkLab/molli 17 | license: MIT 18 | license_file: LICENSE 19 | summary: "Molecular Library Toolkit" 20 | description: | 21 | Molli is a toolbox that allows storage and fast manipulations of full molecule and conformer ensembles. 22 | This project takes advantage of numpy mathematics in its core, as well as binary information storage. 23 | Molli offers a convenient interface to familiar chemical concepts such as Atom, Molecule, ConformerEnsemble, etc. 24 | See README.md for more details. 25 | dev_url: https://github.com/SEDenmarkLab/molli 26 | doc_url: https://molli.readthedocs.io/en/latest/ 27 | 28 | source: 29 | path: .. 30 | 31 | requirements: 32 | host: 33 | - python {{ python }} 34 | - setuptools>=60 35 | - {{ compiler("cxx") }} 36 | - pybind11~=2.10 37 | 38 | run: 39 | - python {{ python }} 40 | - numpy~=1.24.0 41 | - scipy~=1.9.1 42 | - h5py>=3.8 43 | - msgpack-python>=1.0.4 44 | - msgpack-numpy>=0.4.8 45 | - attrs>=22.1.0 46 | - bidict>=0.21.2 47 | - networkx~=3.0 48 | - colorama>=0.4.5 49 | - tqdm>=4.64.0 50 | - pyyaml>=5.4.1 51 | - requests>=2.28 52 | - packaging>=23.1 53 | - deprecated>=1.2.14 54 | - fasteners>=0.16 55 | - joblib>=1.3.2 56 | 57 | build: 58 | number: 0 59 | include_recipe: True 60 | script: "python -m pip install --no-deps -vvv ." 61 | entry_points: 62 | - molli = molli.__main__:main 63 | - _molli_run = molli.pipeline.runner:run_local 64 | - _molli_run_sched = molli.pipeline.runner:run_sched 65 | 66 | test: 67 | imports: 68 | - molli 69 | - molli_test 70 | - molli_xt 71 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | 2 | # Usage: docker compose run molli list 3 | 4 | version: '3.9' 5 | services: 6 | 7 | molli: 8 | image: hub.ncsa.illinois.edu/mmli/molli 9 | stdin_open: true 10 | tty: true 11 | build: 12 | context: . 13 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/imgs/chem_inheritance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/docs/imgs/chem_inheritance.png -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | ipykernel 2 | myst_parser 3 | sphinx-rtd-theme 4 | sphinx-autobuild 5 | nbsphinx 6 | furo -------------------------------------------------------------------------------- /docs/source/02-basics.md: -------------------------------------------------------------------------------- 1 | # Hello, World! 2 | 3 | This chapter discusses your first steps in the world of `molli`-enabled computing. 4 | 5 | ````{note} 6 | All examples of code showin in these sections assumes that molli is imported the following way: 7 | 8 | ```python 9 | import molli as ml 10 | ``` 11 | ```` 12 | 13 | ## Overview 14 | 15 | `molli` package provides a user-friendly and easily extensible object-oriented code that features objects that have familiar to chemists meaning and behavior. These classes are summarized below ({ref}`chem_inherit`) for the convenience of user. For detailed documentation, check out the next chapter. 16 | 17 | ```{figure} ../imgs/chem_inheritance.png 18 | :name: chem_inherit 19 | :alt: molli_inherit 20 | :class: bg-primary 21 | :width: 300px 22 | :align: center 23 | 24 | Module `molli.chem` class inheritance diagram 25 | 26 | ``` 27 | 28 | ## Input and output 29 | ### Reading / writing molecule objects from files 30 | 31 | molli *natively* supports only `.mol2` and `.xyz` files for molecule reading. Through the powerful OpenBabel library interface, arbitrary file formats can be read. The following example shows one possible way loading a `.mol2` file: 32 | 33 | ```python 34 | mol = ml.Molecule.load_mol2("./path/to/file.mol2") 35 | ``` 36 | 37 | Using a syntax that would be familiar to users of `json` and other libraries, one can also serialize molecules: 38 | 39 | ```python 40 | with open("./path/to/other.mol2", "wt") as f: 41 | mol.dump_mol2("f") 42 | ``` 43 | 44 | ```{important} 45 | Molli implements objects that are more complex than what some of the existing chemical formats, including mol2, can encode. 46 | It is therefore recommended to exercise caution. 47 | The best way to save molli objects is in the libraries (see below.) 48 | ``` 49 | 50 | ### Default files 51 | 52 | molli provides some files for testing and prototyping purposes in the `molli.files` package. 53 | They are installed with the package, and one can access their full path without knowing the exact installation directory: 54 | 55 | ```python 56 | >>> ml.files.dendrobine_mol2 57 | PosixPath('/home/username/dev/molli/molli/files/dendrobine.mol2') 58 | ``` 59 | 60 | One can therefore access the test molecule files conveniently: 61 | ```python 62 | mol = ml.Molecule.load_mol2(ml.files.dendrobine_mol2) 63 | ``` 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/source/API/molli.chem/_index.rst: -------------------------------------------------------------------------------- 1 | molli.chem 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.chem 7 | 8 | atom 9 | atomtypes 10 | bond 11 | ensemble 12 | geometry 13 | legacy 14 | library 15 | molecule 16 | structure 17 | -------------------------------------------------------------------------------- /docs/source/API/molli.chem/atom.rst: -------------------------------------------------------------------------------- 1 | Atom 2 | ====== 3 | 4 | This is the pydoc code for the ``atom`` module. 5 | 6 | .. automodule:: molli.chem.atom 7 | :members: 8 | :show-inheritance: 9 | -------------------------------------------------------------------------------- /docs/source/API/molli.chem/atomtypes.rst: -------------------------------------------------------------------------------- 1 | Classifications for Types of Atoms 2 | =================================== 3 | 4 | This section contains all the classifications for the types of atoms that are available. Each classification is stored as a class with the same name. 5 | The attributes show the possible assignments that can be made to the atom. 6 | 7 | AtomType: 8 | --------- 9 | Unknown = 0 10 | 11 | Regular = 1 12 | 13 | Aromatic = 2 14 | 15 | CoordinationCenter = 10 16 | 17 | Hypervalent = 20 18 | 19 | **Main Group Types** 20 | 21 | MainGroup_sp3 = 31 22 | 23 | MainGroup_sp2 = 32 24 | 25 | MainGroup_sp = 33 26 | 27 | **Non-atom placeholders** 28 | 29 | Dummy = 100 30 | 31 | AttachmentPoint = 101 32 | 33 | LonePair = 102 34 | 35 | **Specific atom classes** 36 | 37 | C_Guanidinium = 201 38 | 39 | N_Amide = 202 40 | 41 | N_Nitro = 203 42 | 43 | N_Ammonium = 204 44 | 45 | O_Sulfoxide = 205 46 | 47 | O_Sulfone = 206 48 | 49 | O_Carboxylate = 207 50 | 51 | AtomStereo 52 | ---------- 53 | Unknown = 0 54 | 55 | NotStereogenic = 1 56 | 57 | R = 10 58 | 59 | S = 11 60 | 61 | Delta = 20 62 | 63 | Lambda = 21 64 | 65 | AtomGeom 66 | -------- 67 | Unknown = 0 68 | 69 | R1 = 10 70 | 71 | R2 = 20 72 | 73 | R2_Linear = 21 74 | 75 | R2_Bent = 22 76 | 77 | R3 = 30 78 | 79 | R3_Planar = 31 80 | 81 | R3_Pyramidal = 32 82 | 83 | R3_TShape = 33 84 | 85 | R4 = 40 86 | 87 | R4_Tetrahedral = 41 88 | 89 | R4_SquarePlanar = 42 90 | 91 | R4_Seesaw = 43 92 | 93 | R5 = 50 94 | 95 | R5_TrigonalBipyramidal = 51 96 | 97 | R5_SquarePyramid = 52 98 | 99 | R6 = 60 100 | 101 | R6_Octahedral = 61 102 | 103 | -------------------------------------------------------------------------------- /docs/source/API/molli.chem/bond.rst: -------------------------------------------------------------------------------- 1 | Bond 2 | ====== 3 | 4 | This is the pydoc code for the ``bond`` module. 5 | 6 | .. automodule:: molli.chem.bond 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.chem/ensemble.rst: -------------------------------------------------------------------------------- 1 | Ensemble 2 | =========== 3 | 4 | This is the pydoc code for the ``ensemble`` module. 5 | 6 | .. automodule:: molli.chem.ensemble 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.chem/geometry.rst: -------------------------------------------------------------------------------- 1 | Geometry 2 | ============== 3 | 4 | This is the pydoc code for the ``geometry`` module. 5 | 6 | .. automodule:: molli.chem.geometry 7 | :members: 8 | :show-inheritance: 9 | -------------------------------------------------------------------------------- /docs/source/API/molli.chem/legacy.rst: -------------------------------------------------------------------------------- 1 | Legacy 2 | =========== 3 | 4 | This is the pydoc code for the ``legacy`` module. 5 | 6 | .. automodule:: molli.chem.legacy 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.chem/library.rst: -------------------------------------------------------------------------------- 1 | Library 2 | =========== 3 | 4 | This is the pydoc code for the ``library`` module. 5 | 6 | .. automodule:: molli.chem.library 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.chem/molecule.rst: -------------------------------------------------------------------------------- 1 | Molecule 2 | =================== 3 | 4 | This is the pydoc code for the ``molecule`` module. 5 | 6 | .. automodule:: molli.chem.molecule 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.chem/structure.rst: -------------------------------------------------------------------------------- 1 | Structure 2 | =================== 3 | 4 | This is the pydoc code for the ``structure`` module. 5 | 6 | .. automodule:: molli.chem.structure 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.data/_index.rst: -------------------------------------------------------------------------------- 1 | molli.data 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.data 7 | 8 | atomic_weight 9 | color_cpk 10 | covalent_radius_1 11 | covalent_radius_grimme 12 | electron_affinity 13 | group 14 | vdw_radius 15 | 16 | .. note:: 17 | Missing the following files due to being empty: 18 | 19 | - c6_grimme 20 | - covalent_radius_2 21 | - covalent_radius_3 22 | - en_pauling 23 | - isotope.exact_mass.yml -------------------------------------------------------------------------------- /docs/source/API/molli.data/atomic_weight.rst: -------------------------------------------------------------------------------- 1 | Atomic Weights 2 | ========================= 3 | 4 | H: 1.008 5 | 6 | He: 4.002602 7 | 8 | Li: 6.94 9 | 10 | Be: 9.0121831 11 | 12 | B: 10.81 13 | 14 | C: 12.011 15 | 16 | N: 14.007 17 | 18 | O: 15.999 19 | 20 | F: 18.998403163 21 | 22 | Ne: 20.1797 23 | 24 | Na: 22.98976928 25 | 26 | Mg: 24.305 27 | 28 | Al: 26.9815385 29 | 30 | Si: 28.085 31 | 32 | P: 30.973761998 33 | 34 | S: 32.06 35 | 36 | Cl: 35.45 37 | 38 | Ar: 39.948 39 | 40 | K: 39.0983 41 | 42 | Ca: 40.078 43 | 44 | Sc: 44.955908 45 | 46 | Ti: 47.867 47 | 48 | V: 50.9415 49 | 50 | Cr: 51.9961 51 | 52 | Mn: 54.938044 53 | 54 | Fe: 55.845 55 | 56 | Co: 58.933194 57 | 58 | Ni: 58.6934 59 | 60 | Cu: 63.546 61 | 62 | Zn: 65.38 63 | 64 | Ga: 69.723 65 | 66 | Ge: 72.63 67 | 68 | As: 74.921595 69 | 70 | Se: 78.971 71 | 72 | Br: 79.904 73 | 74 | Kr: 83.798 75 | 76 | Rb: 85.4678 77 | 78 | Sr: 87.62 79 | 80 | Y: 88.90584 81 | 82 | Zr: 91.224 83 | 84 | Nb: 92.90637 85 | 86 | Mo: 95.95 87 | 88 | Tc: 97.90721 89 | 90 | Ru: 101.07 91 | 92 | Rh: 102.9055 93 | 94 | Pd: 106.42 95 | 96 | Ag: 107.8682 97 | 98 | Cd: 112.414 99 | 100 | In: 114.818 101 | 102 | Sn: 118.71 103 | 104 | Sb: 121.76 105 | 106 | Te: 127.6 107 | 108 | I: 126.90447 109 | 110 | Xe: 131.293 111 | 112 | Cs: 132.90545196 113 | 114 | Ba: 137.327 115 | 116 | La: 138.90547 117 | 118 | Ce: 140.116 119 | 120 | Pr: 140.90766 121 | 122 | Nd: 144.242 123 | 124 | Pm: 144.91276 125 | 126 | Sm: 150.36 127 | 128 | Eu: 151.964 129 | 130 | Gd: 157.25 131 | 132 | Tb: 158.92535 133 | 134 | Dy: 162.5 135 | 136 | Ho: 164.93033 137 | 138 | Er: 167.259 139 | 140 | Tm: 168.93422 141 | 142 | Yb: 173.045 143 | 144 | Lu: 174.9668 145 | 146 | Hf: 178.49 147 | 148 | Ta: 180.94788 149 | 150 | W: 183.84 151 | 152 | Re: 186.207 153 | 154 | Os: 190.23 155 | 156 | Ir: 192.217 157 | 158 | Pt: 195.084 159 | 160 | Au: 196.966569 161 | 162 | Hg: 200.592 163 | 164 | Tl: 204.38 165 | 166 | Pb: 207.2 167 | 168 | Bi: 208.9804 169 | 170 | Po: 209.0 171 | 172 | At: 210.0 173 | 174 | Rn: 222.0 175 | 176 | Fr: 223.0 177 | 178 | Ra: 226.0 179 | 180 | Ac: 227.0 181 | 182 | Th: 232.0377 183 | 184 | Pa: 231.03588 185 | 186 | U: 238.02891 187 | 188 | Np: 237.0 189 | 190 | Pu: 244.0 191 | 192 | Am: 243.0 193 | 194 | Cm: 247.0 195 | 196 | Bk: 247.0 197 | 198 | Cf: 251.0 199 | 200 | Es: 252.0 201 | 202 | Fm: 257.0 203 | 204 | Md: 258.0 205 | 206 | 'No': 259.0 207 | 208 | Lr: 262.0 209 | 210 | Rf: 267.0 211 | 212 | Db: 268.0 213 | 214 | Sg: 271.0 215 | 216 | Bh: 274.0 217 | 218 | Hs: 269.0 219 | 220 | Mt: 276.0 221 | 222 | Ds: 281.0 223 | 224 | Rg: 281.0 225 | 226 | Cn: 285.0 227 | 228 | Nh: 286.0 229 | 230 | Fl: 289.0 231 | 232 | Mc: 288.0 233 | 234 | Lv: 293.0 235 | 236 | Ts: 294.0 237 | 238 | Og: 294.0 -------------------------------------------------------------------------------- /docs/source/API/molli.data/color_cpk.rst: -------------------------------------------------------------------------------- 1 | Color CPKs 2 | ========================= 3 | 4 | H: '#ffffff' 5 | 6 | He: '#ffc0cb' 7 | 8 | Li: '#b22222' 9 | 10 | Be: '#ff1493' 11 | 12 | B: '#00ff00' 13 | 14 | C: '#c8c8c8' 15 | 16 | N: '#8f8fff' 17 | 18 | O: '#f00000' 19 | 20 | F: '#daa520' 21 | 22 | Ne: '#ff1493' 23 | 24 | Na: '#0000ff' 25 | 26 | Mg: '#228b22' 27 | 28 | Al: '#808090' 29 | 30 | Si: '#daa520' 31 | 32 | P: '#ffa500' 33 | 34 | S: '#ffc832' 35 | 36 | Cl: '#00ff00' 37 | 38 | Ar: '#ff1493' 39 | 40 | K: '#ff1493' 41 | 42 | Ca: '#808090' 43 | 44 | Sc: '#ff1493' 45 | 46 | Ti: '#808090' 47 | 48 | V: '#ff1493' 49 | 50 | Cr: '#808090' 51 | 52 | Mn: '#808090' 53 | 54 | Fe: '#ffa500' 55 | 56 | Co: '#ff1493' 57 | 58 | Ni: '#a52a2a' 59 | 60 | Cu: '#a52a2a' 61 | 62 | Zn: '#a52a2a' 63 | 64 | Ga: '#ff1493' 65 | 66 | Ge: '#ff1493' 67 | 68 | As: '#ff1493' 69 | 70 | Se: '#ff1493' 71 | 72 | Br: '#a52a2a' 73 | 74 | Kr: '#ff1493' 75 | 76 | Rb: '#ff1493' 77 | 78 | Sr: '#ff1493' 79 | 80 | Y: '#ff1493' 81 | 82 | Zr: '#ff1493' 83 | 84 | Nb: '#ff1493' 85 | 86 | Mo: '#ff1493' 87 | 88 | Tc: '#ff1493' 89 | 90 | Ru: '#ff1493' 91 | 92 | Rh: '#ff1493' 93 | 94 | Pd: '#ff1493' 95 | 96 | Ag: '#808090' 97 | 98 | Cd: '#ff1493' 99 | 100 | In: '#ff1493' 101 | 102 | Sn: '#ff1493' 103 | 104 | Sb: '#ff1493' 105 | 106 | Te: '#ff1493' 107 | 108 | I: '#a020f0' 109 | 110 | Xe: '#ff1493' 111 | 112 | Cs: '#ff1493' 113 | 114 | Ba: '#ffa500' 115 | 116 | La: '#ff1493' 117 | 118 | Ce: '#ff1493' 119 | 120 | Pr: '#ff1493' 121 | 122 | Nd: '#ff1493' 123 | 124 | Pm: '#ff1493' 125 | 126 | Sm: '#ff1493' 127 | 128 | Eu: '#ff1493' 129 | 130 | Gd: '#ff1493' 131 | 132 | Tb: '#ff1493' 133 | 134 | Dy: '#ff1493' 135 | 136 | Ho: '#ff1493' 137 | 138 | Er: '#ff1493' 139 | 140 | Tm: '#ff1493' 141 | 142 | Yb: '#ff1493' 143 | 144 | Lu: '#ff1493' 145 | 146 | Hf: '#ff1493' 147 | 148 | Ta: '#ff1493' 149 | 150 | W: '#ff1493' 151 | 152 | Re: '#ff1493' 153 | 154 | Os: '#ff1493' 155 | 156 | Ir: '#ff1493' 157 | 158 | Pt: '#ff1493' 159 | 160 | Au: '#daa520' 161 | 162 | Hg: '#ff1493' 163 | 164 | Tl: '#ff1493' 165 | 166 | Pb: '#ff1493' 167 | 168 | Bi: '#ff1493' 169 | 170 | Po: '#ff1493' 171 | 172 | At: '#ff1493' 173 | 174 | Rn: '#ffffff' 175 | 176 | Fr: '#ffffff' 177 | 178 | Ra: '#ffffff' 179 | 180 | Ac: '#ffffff' 181 | 182 | Th: '#ff1493' 183 | 184 | Pa: '#ffffff' 185 | 186 | U: '#ff1493' 187 | 188 | Np: '#ffffff' 189 | 190 | Pu: '#ffffff' 191 | 192 | Am: '#ffffff' 193 | 194 | Cm: '#ffffff' 195 | 196 | Bk: '#ffffff' 197 | 198 | Cf: '#ffffff' 199 | 200 | Es: '#ffffff' 201 | 202 | Fm: '#ffffff' 203 | 204 | Md: '#ffffff' 205 | 206 | 'No': '#ffffff' 207 | 208 | Lr: '#ffffff' -------------------------------------------------------------------------------- /docs/source/API/molli.data/covalent_radius_1.rst: -------------------------------------------------------------------------------- 1 | Covalent Radii for Single Bonds 2 | ===================================== 3 | 4 | Covalent radii in single bonds. 5 | 6 | reference_doi: 10.1021/jp5065819 7 | 8 | H: .32 9 | 10 | He: .46 11 | 12 | Li: 1.33 13 | 14 | Be: 1.02 15 | 16 | B: .85 17 | 18 | C: .75 19 | 20 | N: .71 21 | 22 | O: .63 23 | 24 | F: .64 25 | 26 | Ne: .67 27 | 28 | Na: 1.55 29 | 30 | Mg: 1.39 31 | 32 | Al: 1.26 33 | 34 | Si: 1.16 35 | 36 | P: 1.11 37 | 38 | S: 1.03 39 | 40 | Cl: .99 41 | 42 | Ar: .96 43 | 44 | K: 1.96 45 | 46 | Ca: 1.71 47 | 48 | Sc: 1.48 49 | 50 | Ti: 1.36 51 | 52 | V: 1.34 53 | 54 | Cr: 1.22 55 | 56 | Mn: 1.19 57 | 58 | Fe: 1.16 59 | 60 | Co: 1.11 61 | 62 | Ni: 1.10 63 | 64 | Cu: 1.12 65 | 66 | Zn: 1.18 67 | 68 | Ga: 1.24 69 | 70 | Ge: 1.21 71 | 72 | As: 1.21 73 | 74 | Se: 1.16 75 | 76 | Br: 1.14 77 | 78 | Kr: 1.17 79 | 80 | Rb: 2.10 81 | 82 | Sr: 1.85 83 | 84 | Y: 1.63 85 | 86 | Zr: 1.54 87 | 88 | Nb: 1.47 89 | 90 | Mo: 1.38 91 | 92 | Tc: 1.28 93 | 94 | Ru: 1.25 95 | 96 | Rh: 1.25 97 | 98 | Pd: 1.20 99 | 100 | Ag: 1.28 101 | 102 | Cd: 1.36 103 | 104 | In: 1.42 105 | 106 | Sn: 1.40 107 | 108 | Sb: 1.40 109 | 110 | Te: 1.36 111 | 112 | I: 1.33 113 | 114 | Xe: 1.31 115 | 116 | Cs: 2.32 117 | 118 | Ba: 1.96 119 | 120 | La: 1.80 121 | 122 | Ce: 1.63 123 | 124 | Pr: 1.76 125 | 126 | Nd: 1.74 127 | 128 | Pm: 1.73 129 | 130 | Sm: 1.72 131 | 132 | Eu: 1.68 133 | 134 | Gd: 1.69 135 | 136 | Tb: 1.68 137 | 138 | Dy: 1.67 139 | 140 | Ho: 1.66 141 | 142 | Er: 1.65 143 | 144 | Tm: 1.64 145 | 146 | Yb: 1.70 147 | 148 | Lu: 1.62 149 | 150 | Hf: 1.52 151 | 152 | Ta: 1.46 153 | 154 | W: 1.37 155 | 156 | Re: 1.31 157 | 158 | Os: 1.29 159 | 160 | Ir: 1.22 161 | 162 | Pt: 1.23 163 | 164 | Au: 1.24 165 | 166 | Hg: 1.33 167 | 168 | Tl: 1.44 169 | 170 | Pb: 1.44 171 | 172 | Bi: 1.51 173 | 174 | Po: 1.45 175 | 176 | At: 1.47 177 | 178 | Rn: 1.42 179 | 180 | Fr: 2.23 181 | 182 | Ra: 2.01 183 | 184 | Ac: 1.86 185 | 186 | Th: 1.75 187 | 188 | Pa: 1.69 189 | 190 | U: 1.70 191 | 192 | Np: 1.71 193 | 194 | Pu: 1.72 195 | 196 | Am: 1.66 197 | 198 | Cm: 1.66 199 | 200 | Bk: 1.68 201 | 202 | Cf: 1.68 203 | 204 | Es: 1.65 205 | 206 | Fm: 1.67 207 | 208 | Md: 1.73 209 | 210 | 'No': 176 211 | 212 | Lr: 1.61 213 | 214 | Rf: 1.57 215 | 216 | Db: 1.49 217 | 218 | Sg: 1.43 219 | 220 | Bh: 1.41 221 | 222 | Hs: 1.34 223 | 224 | Mt: 1.29 225 | 226 | Ds: 1.28 227 | 228 | Rg: 1.21 229 | 230 | Cn: 1.22 231 | 232 | Nh: 1.36 233 | 234 | Fl: 1.43 235 | 236 | Mc: 1.62 237 | 238 | Lv: 1.75 239 | 240 | Ts: 1.65 241 | 242 | Og: 1.57 -------------------------------------------------------------------------------- /docs/source/API/molli.data/covalent_radius_grimme.rst: -------------------------------------------------------------------------------- 1 | Covalent Radii for Grimme's definition 2 | ===================================== 3 | 4 | Covalent radii, where any metal has been scaled down by 10% for use with grimme's definition of covalent coordination number. 5 | 6 | reference_doi: 10.1063/1.3382344 7 | 8 | H: 0.32 9 | 10 | He: 0.46 11 | 12 | Li: 1.2 13 | 14 | Be: 0.94 15 | 16 | B: 0.77 17 | 18 | C: 0.75 19 | 20 | N: 0.71 21 | 22 | O: 0.63 23 | 24 | F: 0.64 25 | 26 | Ne: 0.67 27 | 28 | Na: 1.4 29 | 30 | Mg: 1.25 31 | 32 | Al: 1.13 33 | 34 | Si: 1.04 35 | 36 | P: 1.1 37 | 38 | S: 1.02 39 | 40 | Cl: 0.99 41 | 42 | Ar: 0.96 43 | 44 | K: 1.76 45 | 46 | Ca: 1.54 47 | 48 | Sc: 1.33 49 | 50 | Ti: 1.22 51 | 52 | V: 1.21 53 | 54 | Cr: 1.1 55 | 56 | Mn: 1.07 57 | 58 | Fe: 1.04 59 | 60 | Co: 1.0 61 | 62 | Ni: 0.99 63 | 64 | Cu: 1.01 65 | 66 | Zn: 1.09 67 | 68 | Ga: 1.12 69 | 70 | Ge: 1.09 71 | 72 | As: 1.15 73 | 74 | Se: 1.1 75 | 76 | Br: 1.14 77 | 78 | Kr: 1.17 79 | 80 | Rb: 1.89 81 | 82 | Sr: 1.67 83 | 84 | Y: 1.47 85 | 86 | Zr: 1.39 87 | 88 | Nb: 1.32 89 | 90 | Mo: 1.24 91 | 92 | Tc: 1.15 93 | 94 | Ru: 1.13 95 | 96 | Rh: 1.13 97 | 98 | Pd: 1.08 99 | 100 | Ag: 1.15 101 | 102 | Cd: 1.23 103 | 104 | In: 1.28 105 | 106 | Sn: 1.26 107 | 108 | Sb: 1.26 109 | 110 | Te: 1.23 111 | 112 | I: 1.32 113 | 114 | Xe: 1.31 115 | 116 | Cs: 2.09 117 | 118 | Ba: 1.76 119 | 120 | La: 1.62 121 | 122 | Ce: 1.47 123 | 124 | Pr: 1.58 125 | 126 | Nd: 1.57 127 | 128 | Pm: 1.56 129 | 130 | Sm: 1.55 131 | 132 | Eu: 1.51 133 | 134 | Gd: 1.52 135 | 136 | Tb: 1.51 137 | 138 | Dy: 1.5 139 | 140 | Ho: 1.49 141 | 142 | Er: 1.49 143 | 144 | Tm: 1.48 145 | 146 | Yb: 1.53 147 | 148 | Lu: 1.46 149 | 150 | Hf: 1.37 151 | 152 | Ta: 1.31 153 | 154 | W: 1.23 155 | 156 | Re: 1.18 157 | 158 | Os: 1.16 159 | 160 | Ir: 1.11 161 | 162 | Pt: 1.12 163 | 164 | Au: 1.13 165 | 166 | Hg: 1.32 167 | 168 | Tl: 1.3 169 | 170 | Pb: 1.3 171 | 172 | Bi: 1.36 173 | 174 | Po: 1.31 175 | 176 | At: 1.38 177 | 178 | Rn: 1.42 179 | 180 | Fr: 2.01 181 | 182 | Ra: 1.81 183 | 184 | Ac: 1.67 185 | 186 | Th: 1.58 187 | 188 | Pa: 1.52 189 | 190 | U: 1.53 191 | 192 | Np: 1.54 193 | 194 | Pu: 1.55 195 | 196 | Am: 1.49 197 | 198 | Cm: 1.49 199 | 200 | Bk: 1.51 201 | 202 | Cf: 1.51 203 | 204 | Es: 1.49 205 | 206 | Fm: 1.5 207 | 208 | Md: 1.56 209 | 210 | 'No': 1.58 211 | 212 | Lr: 1.45 213 | 214 | Rf: 1.41 215 | 216 | Db: 1.34 217 | 218 | Sg: 1.29 219 | 220 | Bh: 1.27 221 | 222 | Hs: 1.21 223 | 224 | Mt: 1.16 225 | 226 | Ds: 1.15 227 | 228 | Rg: 1.09 229 | 230 | Cn: 1.1 231 | 232 | Nh: 1.22 233 | 234 | Fl: 1.29 235 | 236 | Mc: 1.46 237 | 238 | Lv: 1.57 239 | 240 | Ts: 1.65 241 | 242 | Og: 1.57 -------------------------------------------------------------------------------- /docs/source/API/molli.data/electron_affinity.rst: -------------------------------------------------------------------------------- 1 | Electron Affinities 2 | ========================= 3 | 4 | H: 0.754195 5 | 6 | He: -19.7 7 | 8 | Li: 0.618049 9 | 10 | Be: -2.4 11 | 12 | B: 0.279723 13 | 14 | C: 1.262119 15 | 16 | N: -1.4 17 | 18 | O: 1.4611135 19 | 20 | F: 3.401189700000001 21 | 22 | Ne: .nan 23 | 24 | Na: 0.547926 25 | 26 | Mg: .nan 27 | 28 | Al: 0.43283 29 | 30 | Si: 1.3895211 31 | 32 | P: 0.746607 33 | 34 | S: 2.07710403 35 | 36 | Cl: 3.612725 37 | 38 | Ar: -11.5 39 | 40 | K: 0.50147 41 | 42 | Ca: 0.02455 43 | 44 | Sc: 0.188 45 | 46 | Ti: 0.079 47 | 48 | V: 0.525 49 | 50 | Cr: 0.6659999999999999 51 | 52 | Mn: .nan 53 | 54 | Fe: 0.151 55 | 56 | Co: 0.66225646 57 | 58 | Ni: 1.156 59 | 60 | Cu: 1.235 61 | 62 | Zn: .nan 63 | 64 | Ga: 0.43 65 | 66 | Ge: 1.232712 67 | 68 | As: 0.804 69 | 70 | Se: 2.02067 71 | 72 | Br: 3.363588200000001 73 | 74 | Kr: .nan 75 | 76 | Rb: 0.48592 77 | 78 | Sr: 0.048 79 | 80 | Y: 0.307 81 | 82 | Zr: 0.426 83 | 84 | Nb: 0.917406 85 | 86 | Mo: 0.748 87 | 88 | Tc: 0.55 89 | 90 | Ru: 1.05 91 | 92 | Rh: 1.137 93 | 94 | Pd: 0.562 95 | 96 | Ag: 1.302 97 | 98 | Cd: .nan 99 | 100 | In: 0.3 101 | 102 | Sn: 1.112067 103 | 104 | Sb: 1.046 105 | 106 | Te: 1.970876 107 | 108 | I: 3.0590368 109 | 110 | Xe: -0.05599999999999999 111 | 112 | Cs: 0.471626 113 | 114 | Ba: 0.14462 115 | 116 | La: 0.47 117 | 118 | Ce: 0.65 119 | 120 | Pr: 0.9620000000000001 121 | 122 | Nd: 1.916 123 | 124 | Pm: .nan 125 | 126 | Sm: .nan 127 | 128 | Eu: 0.8640000000000001 129 | 130 | Gd: .nan 131 | 132 | Tb: 1.165 133 | 134 | Dy: 0.352 135 | 136 | Ho: .nan 137 | 138 | Er: .nan 139 | 140 | Tm: 1.029 141 | 142 | Yb: -0.02 143 | 144 | Lu: 0.34 145 | 146 | Hf: 0.014 147 | 148 | Ta: 0.322 149 | 150 | W: 0.81626 151 | 152 | Re: 0.15 153 | 154 | Os: 1.1 155 | 156 | Ir: 1.5638 157 | 158 | Pt: 2.128 159 | 160 | Au: 2.30863 161 | 162 | Hg: .nan 163 | 164 | Tl: 0.377 165 | 166 | Pb: 0.35674316 167 | 168 | Bi: 0.942362 169 | 170 | Po: 1.9 171 | 172 | At: 2.8 173 | 174 | Rn: .nan 175 | 176 | Fr: 0.486 177 | 178 | Ra: 0.1 179 | 180 | Ac: 0.35 181 | 182 | Th: .nan 183 | 184 | Pa: .nan 185 | 186 | U: .nan 187 | 188 | Np: .nan 189 | 190 | Pu: .nan 191 | 192 | Am: .nan 193 | 194 | Cm: .nan 195 | 196 | Bk: .nan 197 | 198 | Cf: .nan 199 | 200 | Es: .nan 201 | 202 | Fm: .nan 203 | 204 | Md: .nan 205 | 206 | 'No': .nan 207 | 208 | Lr: .nan 209 | 210 | Rf: .nan 211 | 212 | Db: .nan 213 | 214 | Sg: .nan 215 | 216 | Bh: .nan 217 | 218 | Hs: .nan 219 | 220 | Mt: .nan 221 | 222 | Ds: .nan 223 | 224 | Rg: .nan 225 | 226 | Cn: .nan 227 | 228 | Nh: .nan 229 | 230 | Fl: .nan 231 | 232 | Mc: .nan 233 | 234 | Lv: .nan 235 | 236 | Ts: .nan 237 | 238 | Og: 0.05599999999999999 -------------------------------------------------------------------------------- /docs/source/API/molli.data/group.rst: -------------------------------------------------------------------------------- 1 | Electron Groups 2 | ========================= 3 | 4 | 1: 1 5 | 6 | 2: 18 7 | 8 | 3: 1 9 | 10 | 4: 2 11 | 12 | 5: 13 13 | 14 | 6: 14 15 | 16 | 7: 15 17 | 18 | 8: 16 19 | 20 | 9: 17 21 | 22 | 10: 18 23 | 24 | 11: 1 25 | 26 | 12: 2 27 | 28 | 13: 13 29 | 30 | 14: 14 31 | 32 | 15: 15 33 | 34 | 16: 16 35 | 36 | 17: 17 37 | 38 | 18: 18 39 | 40 | 19: 1 41 | 42 | 20: 2 43 | 44 | 21: 3 45 | 46 | 22: 4 47 | 48 | 23: 5 49 | 50 | 24: 6 51 | 52 | 25: 7 53 | 54 | 26: 8 55 | 27: 9 56 | 57 | 28: 10 58 | 59 | 29: 11 60 | 61 | 30: 12 62 | 63 | 31: 13 64 | 65 | 32: 14 66 | 67 | 33: 15 68 | 69 | 34: 16 70 | 71 | 35: 17 72 | 73 | 36: 18 74 | 75 | 37: 1 76 | 77 | 38: 2 78 | 79 | 39: 3 80 | 81 | 40: 4 82 | 83 | 41: 5 84 | 85 | 42: 6 86 | 87 | 43: 7 88 | 89 | 44: 8 90 | 91 | 45: 9 92 | 93 | 46: 10 94 | 95 | 47: 11 96 | 97 | 48: 12 98 | 99 | 49: 13 100 | 101 | 50: 14 102 | 103 | 51: 15 104 | 105 | 52: 16 106 | 107 | 53: 17 108 | 109 | 54: 18 110 | 111 | 55: 1 112 | 113 | 56: 2 114 | 115 | 57: 3 116 | 117 | 58: lanthanoid 118 | 119 | 59: lanthanoid 120 | 121 | 60: lanthanoid 122 | 123 | 61: lanthanoid 124 | 125 | 62: lanthanoid 126 | 127 | 63: lanthanoid 128 | 129 | 64: lanthanoid 130 | 131 | 65: lanthanoid 132 | 133 | 66: lanthanoid 134 | 135 | 67: lanthanoid 136 | 137 | 68: lanthanoid 138 | 139 | 69: lanthanoid 140 | 141 | 70: lanthanoid 142 | 143 | 71: lanthanoid 144 | 145 | 72: 4 146 | 147 | 73: 5 148 | 149 | 74: 6 150 | 151 | 75: 7 152 | 153 | 76: 8 154 | 155 | 77: 9 156 | 157 | 78: 10 158 | 159 | 79: 11 160 | 161 | 80: 12 162 | 163 | 81: 13 164 | 165 | 82: 14 166 | 167 | 83: 15 168 | 169 | 84: 16 170 | 171 | 85: 17 172 | 173 | 86: 18 174 | 175 | 87: 1 176 | 177 | 88: 2 178 | 179 | 89: 3 180 | 181 | 90: actinoid 182 | 183 | 91: actinoid 184 | 185 | 92: actinoid 186 | 187 | 93: actinoid 188 | 189 | 94: actinoid 190 | 191 | 95: actinoid 192 | 193 | 96: actinoid 194 | 195 | 97: actinoid 196 | 197 | 98: actinoid 198 | 199 | 99: actinoid 200 | 201 | 100: actinoid 202 | 203 | 101: actinoid 204 | 205 | 102: actinoid 206 | 207 | 103: actinoid 208 | 209 | 104: 4 210 | 211 | 105: 5 212 | 213 | 106: 6 214 | 215 | 107: 7 216 | 217 | 108: 8 218 | 219 | 109: 9 220 | 221 | 110: 10 222 | 223 | 111: 11 224 | 225 | 112: 12 226 | 227 | 113: 13 228 | 229 | 114: 14 230 | 231 | 115: 15 232 | 233 | 116: 16 234 | 235 | 117: 17 236 | 237 | 118: 18 238 | -------------------------------------------------------------------------------- /docs/source/API/molli.data/vdw_radius.rst: -------------------------------------------------------------------------------- 1 | Van der Waals Radii 2 | ========================= 3 | 4 | van der Waals radii collected from multiple sources 5 | 6 | units: distance/A 7 | 8 | reference_doi: 9 | - 10.1021/jp8111556 10 | - 10.1021/j100785a001 11 | 12 | 13 | H: 1.100 14 | 15 | He: 1.400 16 | 17 | Li: 1.820 18 | 19 | Be: 1.530 20 | 21 | B: 1.920 22 | 23 | C: 1.700 24 | 25 | N: 1.550 26 | 27 | O: 1.520 28 | 29 | F: 1.470 30 | 31 | Ne: 1.540 32 | 33 | Na: 2.270 34 | 35 | Mg: 1.730 36 | 37 | Al: 1.840 38 | 39 | Si: 2.100 40 | 41 | P: 1.800 42 | 43 | S: 1.800 44 | 45 | Cl: 1.750 46 | 47 | Ar: 1.880 48 | 49 | K: 2.750 50 | 51 | Ca: 2.310 52 | 53 | Sc: 2.150 54 | 55 | Ti: 2.110 56 | 57 | V: 2.070 58 | 59 | Cr: 2.060 60 | 61 | Mn: 2.050 62 | 63 | Fe: 2.040 64 | 65 | Co: 2.000 66 | 67 | Ni: 1.970 68 | 69 | Cu: 1.960 70 | 71 | Zn: 2.010 72 | 73 | Ga: 1.870 74 | 75 | Ge: 2.110 76 | 77 | As: 1.850 78 | 79 | Se: 1.900 80 | 81 | Br: 1.850 82 | 83 | Kr: 2.020 84 | 85 | Rb: 3.030 86 | 87 | Sr: 2.490 88 | 89 | Y: 2.320 90 | 91 | Zr: 2.230 92 | 93 | Nb: 2.180 94 | 95 | Mo: 2.170 96 | 97 | Tc: 2.160 98 | 99 | Ru: 2.130 100 | 101 | Rh: 2.100 102 | 103 | Pd: 2.100 104 | 105 | Ag: 2.110 106 | 107 | Cd: 2.180 108 | 109 | In: 1.930 110 | 111 | Sn: 2.170 112 | 113 | Sb: 2.060 114 | 115 | Te: 2.060 116 | 117 | I: 1.980 118 | 119 | Xe: 2.160 120 | 121 | Cs: 3.430 122 | 123 | Ba: 2.680 124 | 125 | La: 2.430 126 | 127 | Ce: 2.420 128 | 129 | Pr: 2.400 130 | 131 | Nd: 2.390 132 | 133 | Pm: 2.380 134 | 135 | Sm: 2.360 136 | 137 | Eu: 2.350 138 | 139 | Gd: 2.340 140 | 141 | Tb: 2.330 142 | 143 | Dy: 2.310 144 | 145 | Ho: 2.300 146 | 147 | Er: 2.290 148 | 149 | Tm: 2.270 150 | 151 | Yb: 2.260 152 | 153 | Lu: 2.240 154 | 155 | Hf: 2.230 156 | 157 | Ta: 2.220 158 | 159 | W: 2.180 160 | 161 | Re: 2.160 162 | 163 | Os: 2.160 164 | 165 | Ir: 2.130 166 | 167 | Pt: 2.130 168 | 169 | Au: 2.140 170 | 171 | Hg: 2.230 172 | 173 | Tl: 1.960 174 | 175 | Pb: 2.020 176 | 177 | Bi: 2.070 178 | 179 | Po: 1.970 180 | 181 | At: 2.020 182 | 183 | Rn: 2.200 184 | 185 | Fr: 3.480 186 | 187 | Ra: 2.830 188 | 189 | Ac: 2.470 190 | 191 | Th: 2.450 192 | 193 | Pa: 2.430 194 | 195 | U: 2.410 196 | 197 | Np: 2.390 198 | 199 | Pu: 2.430 200 | 201 | Am: 2.440 202 | 203 | Cm: 2.450 204 | 205 | Bk: 2.440 206 | 207 | Cf: 2.450 208 | 209 | Es: 2.450 210 | 211 | Fm: 2.450 212 | 213 | Md: 2.460 214 | 215 | 'No': 2.460 216 | 217 | Lr: 2.460 218 | 219 | Rf: .nan 220 | 221 | Db: .nan 222 | 223 | Sg: .nan 224 | 225 | Bh: .nan 226 | 227 | Hs: .nan 228 | 229 | Mt: .nan 230 | 231 | Ds: .nan 232 | 233 | Rg: .nan 234 | 235 | Cn: .nan 236 | 237 | Nh: .nan 238 | 239 | Fl: .nan 240 | 241 | Mc: .nan 242 | 243 | Lv: .nan 244 | 245 | Ts: .nan 246 | 247 | Og: .nan -------------------------------------------------------------------------------- /docs/source/API/molli.descriptor/_index.rst: -------------------------------------------------------------------------------- 1 | molli.descriptor 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.descriptor 7 | 8 | aso 9 | cov_cn 10 | gridbased 11 | -------------------------------------------------------------------------------- /docs/source/API/molli.descriptor/aso.rst: -------------------------------------------------------------------------------- 1 | ASO 2 | ====== 3 | 4 | This is the pydoc code for the ``aso`` module. 5 | 6 | .. automodule:: molli.descriptor.aso 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.descriptor/cov_cn.rst: -------------------------------------------------------------------------------- 1 | COV_CN 2 | =========== 3 | 4 | This is the pydoc code for the ``cov_cn`` module. 5 | 6 | .. automodule:: molli.descriptor.cov_cn 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.descriptor/gridbased.rst: -------------------------------------------------------------------------------- 1 | GridBased 2 | ========== 3 | 4 | This is the pydoc code for the ``gridbased`` module. 5 | 6 | .. automodule:: molli.descriptor.gridbased 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.external/_index.rst: -------------------------------------------------------------------------------- 1 | molli.external 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.external 7 | 8 | rdkit 9 | openbabel -------------------------------------------------------------------------------- /docs/source/API/molli.external/openbabel.rst: -------------------------------------------------------------------------------- 1 | OpenBabel 2 | ====== 3 | 4 | This is the pydoc code for the ``openbabel`` module. 5 | 6 | .. automodule:: molli.external.openbabel 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.external/rdkit.rst: -------------------------------------------------------------------------------- 1 | RDKit 2 | ====== 3 | 4 | This is the pydoc code for the ``rdkit`` module. 5 | 6 | .. automodule:: molli.external.rdkit 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.ftypes/_index.rst: -------------------------------------------------------------------------------- 1 | molli.ftypes 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.ftypes 7 | 8 | cdxml -------------------------------------------------------------------------------- /docs/source/API/molli.ftypes/cdxml.rst: -------------------------------------------------------------------------------- 1 | CDXML Parser 2 | ====== 3 | 4 | This is the pydoc code for the ``cdxml`` module. 5 | 6 | .. automodule:: molli.ftypes.cdxml 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/API/molli.math/_index.rst: -------------------------------------------------------------------------------- 1 | molli.math 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: molli.math 7 | 8 | rotation 9 | 10 | .. note:: 11 | Missing the following files due to no documentation: 12 | 13 | - polyhedra 14 | - distance 15 | - plane -------------------------------------------------------------------------------- /docs/source/API/molli.math/rotation.rst: -------------------------------------------------------------------------------- 1 | Rotation 2 | ====== 3 | 4 | This is the pydoc code for the ``rotation`` module. 5 | 6 | .. automodule:: molli.math.rotation 7 | :members: 8 | :show-inheritance: -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # For the full list of built-in configuration values, see the documentation: 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 5 | 6 | import os 7 | import sys 8 | 9 | sys.path.insert(0, os.path.abspath("..")) 10 | 11 | import molli.chem 12 | 13 | # -- Project information ----------------------------------------------------- 14 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 15 | 16 | project = "molli" 17 | copyright = "2022, Alexander Shved" 18 | author = "Alexander Shved" 19 | release = molli.config.VERSION 20 | version = ".".join(release.split(".")[:3]) 21 | 22 | # -- General configuration --------------------------------------------------- 23 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 24 | 25 | extensions = [ 26 | "sphinx.ext.autodoc", 27 | "myst_parser", 28 | "nbsphinx", 29 | "sphinx.ext.napoleon", 30 | "sphinx.ext.intersphinx", 31 | ] 32 | 33 | # Ensures that Jupyter notebook files area always read through this extension 34 | nbsphinx_execute = "auto" 35 | 36 | autodoc_member_order = "bysource" 37 | 38 | autoyaml_level = 2 39 | 40 | source_suffix = [".rst", ".md"] 41 | autodoc_typehints_format = "short" 42 | autodoc_type_aliases = { 43 | "ArrayLike": "ArrayLike", 44 | } 45 | python_use_unqualified_type_names = True 46 | 47 | # Removes the type hints from the documentation, this makes the documentation legible 48 | # autodoc_typehints = "none" 49 | 50 | templates_path = ["_templates"] 51 | exclude_patterns = [] 52 | 53 | # Mapping for outside references. 54 | 55 | intersphinx_mapping = { 56 | "rdkit": ("https://www.rdkit.org/docs/", None), 57 | } 58 | 59 | latex_engine = "xelatex" 60 | 61 | # latex_elements = { 62 | # "preamble": r"\usepackage{pmboxdraw}", 63 | # } 64 | # -- Options for HTML output ------------------------------------------------- 65 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 66 | 67 | html_theme = "furo" 68 | html_static_path = ["_static"] 69 | html_logo = "../imgs/molli_logo.svg" 70 | html_title = f"molli {version} documentation" 71 | 72 | html_theme_options = { 73 | "sidebar_hide_name": True, 74 | } 75 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Molli documentation master file, created by 2 | sphinx-quickstart on Sat Apr 8 20:25:17 2023. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Table of Contents 7 | ***************** 8 | 9 | .. toctree:: 10 | :caption: Table of Contents 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :caption: Introduction 15 | 16 | 01-molli-preamble.md 17 | 02-basics.md 18 | 19 | .. toctree:: 20 | :maxdepth: 3 21 | :caption: Detailed Package Documentation 22 | 23 | API/molli.chem/_index 24 | API/molli.data/_index 25 | API/molli.descriptor/_index 26 | API/molli.external/_index 27 | API/molli.ftypes/_index 28 | API/molli.math/_index 29 | API/molli.pipeline/pipeline-notes.md 30 | 31 | 32 | .. toctree:: 33 | :maxdepth: 2 34 | :caption: Command Line Reference 35 | 36 | command_line/commands 37 | 38 | .. toctree:: 39 | :maxdepth: 2 40 | :caption: Molli Cookbook 41 | 42 | cookbook/001-helloworld.ipynb 43 | cookbook/002-atom.ipynb 44 | cookbook/003-bond.ipynb 45 | cookbook/004-geometry.ipynb 46 | cookbook/005-conformerensemble.ipynb 47 | cookbook/006-libraries.ipynb 48 | cookbook/007-visualization.ipynb 49 | cookbook/008-chemdraw.ipynb 50 | cookbook/009-openbabel.ipynb 51 | cookbook/010-rdkit.ipynb 52 | cookbook/011-gbca.ipynb 53 | cookbook/012-jobmap.ipynb 54 | cookbook/013-BOX_workflow.ipynb 55 | 56 | .. toctree:: 57 | :maxdepth: 2 58 | :caption: Benchmarks and Workflows 59 | 60 | zenodo/001-molnet.ipynb 61 | zenodo/002-crude.ipynb 62 | zenodo/003-buildlibrary.ipynb 63 | zenodo/004-readwrite 64 | zenodo/05-gbca-benchmark/_index 65 | zenodo/06-gbca-calculation-vis/_index 66 | zenodo/07-kras-inhibitor-rotation-barrier/_index 67 | zenodo/08-workflow-nmr-prediction/_index 68 | 69 | .. toctree:: 70 | :maxdepth: 2 71 | :caption: Miscellaneous 72 | 73 | miscellaneous/inheritance_diagram 74 | miscellaneous/extensions 75 | 76 | 77 | Indices and tables 78 | ****************** 79 | * :ref:`genindex` 80 | * :ref:`modindex` 81 | * :ref:`search` 82 | -------------------------------------------------------------------------------- /docs/source/miscellaneous/diagram_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/docs/source/miscellaneous/diagram_code.png -------------------------------------------------------------------------------- /docs/source/miscellaneous/extensions.rst: -------------------------------------------------------------------------------- 1 | Extensions 2 | =========== 3 | 4 | Currently there is one extension for Molli. This extension allows Molli to interact with rdkit 5 | 6 | - ref:: rdkit -------------------------------------------------------------------------------- /docs/source/miscellaneous/inheritance_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/docs/source/miscellaneous/inheritance_diagram.png -------------------------------------------------------------------------------- /docs/source/miscellaneous/inheritance_diagram.rst: -------------------------------------------------------------------------------- 1 | Inheritance Diagram for Molli 2 | ====================================== 3 | 4 | This diagram represents the inheritance of the Molli classes. 5 | 6 | This graph can either be used to get a quick overview of how each class in Molli relates to another. Additionally, it can be used to 7 | navigate to the documentation of a specific class. 8 | 9 | .. image:: diagram_code.png 10 | :width: 100% 11 | :align: center 12 | :alt: Molli inheritance diagram 13 | 14 | -------------------------------------------------------------------------------- /docs/source/requirements.txt: -------------------------------------------------------------------------------- 1 | ipykernel 2 | myst_parser 3 | sphinx-rtd-theme 4 | sphinx-autobuild 5 | nbsphinx 6 | furo 7 | rdkit 8 | openbabel -------------------------------------------------------------------------------- /docs/source/zenodo/05-gbca-benchmark/005-mollixt.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Example 5.2: Molli XT Benchmark\n", 8 | "\n", 9 | "## Hardware Specification for Rerun\n", 10 | "\n", 11 | "Desktop workstation with 2x (AMD EPYC 7702 64-Core) with total of 128 physical and 256 logical cores, 1024 GB DDR4 with Ubuntu 22.04 LTS operating system." 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "import molli as ml\n", 21 | "import molli_xt\n", 22 | "from scipy.spatial.distance import cdist\n", 23 | "import numpy as np\n", 24 | "import timeit\n", 25 | "\n", 26 | "arr1 = np.random.rand(100, 30, 3).astype(\"f4\")\n", 27 | "test_arrs = {\n", 28 | " size: np.random.rand(size, 3).astype(\"f4\") for size in (10, 100, 1000, 10000, 20000)\n", 29 | "}" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 2, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "name": "stdout", 39 | "output_type": "stream", 40 | "text": [ 41 | "Distance (Euclidean) calculation with scipy.cdist:\n", 42 | "size=10: t_sp/t_ml=9.535875 molli=0.001277 scipy=0.012177\n", 43 | "size=100: t_sp/t_ml=3.079132 molli=0.006536 scipy=0.020125\n", 44 | "size=1000: t_sp/t_ml=4.997022 molli=0.065151 scipy=0.325563\n", 45 | "size=10000: t_sp/t_ml=2.504050 molli=0.744849 scipy=1.865138\n", 46 | "size=20000: t_sp/t_ml=1.908507 molli=1.464665 scipy=2.795323\n" 47 | ] 48 | } 49 | ], 50 | "source": [ 51 | "# Comparison for euclidean distance\n", 52 | "print(\"Distance (Euclidean) calculation with scipy.cdist:\")\n", 53 | "for size, arr2 in test_arrs.items():\n", 54 | " times_scipy = timeit.Timer(\n", 55 | " \"\"\"[cdist(x, arr2, \"sqeuclidean\") for x in arr1]\"\"\",\n", 56 | " globals=globals(),\n", 57 | " ).repeat(5, 10)\n", 58 | "\n", 59 | " times_molli = timeit.Timer(\n", 60 | " \"\"\"molli_xt.cdist32f_eu2(arr1, arr2)\"\"\",\n", 61 | " globals=globals(),\n", 62 | " ).repeat(5, 10)\n", 63 | "\n", 64 | " t_sp = min(times_scipy)\n", 65 | " t_ml = min(times_molli)\n", 66 | "\n", 67 | " print(f\"{size=}: {t_sp/t_ml=:3f} molli={t_ml:4f} scipy={t_sp:4f}\")\n" 68 | ] 69 | } 70 | ], 71 | "metadata": { 72 | "kernelspec": { 73 | "display_name": "dev-blake", 74 | "language": "python", 75 | "name": "python3" 76 | }, 77 | "language_info": { 78 | "codemirror_mode": { 79 | "name": "ipython", 80 | "version": 3 81 | }, 82 | "file_extension": ".py", 83 | "mimetype": "text/x-python", 84 | "name": "python", 85 | "nbconvert_exporter": "python", 86 | "pygments_lexer": "ipython3", 87 | "version": "3.11.6" 88 | } 89 | }, 90 | "nbformat": 4, 91 | "nbformat_minor": 2 92 | } 93 | -------------------------------------------------------------------------------- /docs/source/zenodo/05-gbca-benchmark/005-sparsity.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Example 5.3: Sparsity Benchmark\n", 8 | "\n", 9 | "## Hardware Specification for Rerun\n", 10 | "\n", 11 | "Desktop workstation with 2x (AMD EPYC 7702 64-Core) with total of 128 physical and 256 logical cores, 1024 GB DDR4 with Ubuntu 22.04 LTS operating system." 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 2, 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "name": "stdout", 21 | "output_type": "stream", 22 | "text": [ 23 | "ASO Sparsity for g='15' np.mean(sparsity)=92.00%, np.std(sparsity)=4.42%\n", 24 | "PRUNED Sparsity for g='15' np.mean(sparsity)=86.65%, np.std(sparsity)=6.49%\n", 25 | "ASO Sparsity for g='10' np.mean(sparsity)=91.60%, np.std(sparsity)=4.60%\n", 26 | "PRUNED Sparsity for g='10' np.mean(sparsity)=86.03%, np.std(sparsity)=6.74%\n", 27 | "ASO Sparsity for g='07' np.mean(sparsity)=91.54%, np.std(sparsity)=4.66%\n", 28 | "PRUNED Sparsity for g='07' np.mean(sparsity)=85.92%, np.std(sparsity)=6.78%\n" 29 | ] 30 | } 31 | ], 32 | "source": [ 33 | "import molli as ml\n", 34 | "import h5py\n", 35 | "import numpy as np\n", 36 | "\n", 37 | "for g in \"15\", \"10\", \"07\":\n", 38 | " with h5py.File(f\"bpa_aligned_grid{g}_aso.hdf5\") as f:\n", 39 | " descriptors = np.asarray([f[k] for k in f.keys()])\n", 40 | " sparsity = 1 - np.count_nonzero(descriptors, axis=1) / descriptors.shape[1]\n", 41 | " print(\n", 42 | " f\"ASO Sparsity for {g=} {np.mean(sparsity)=:.2%}, {np.std(sparsity)=:.2%}\"\n", 43 | " )\n", 44 | "\n", 45 | " with h5py.File(f\"bpa_aligned_grid{g}.hdf5\") as f:\n", 46 | " N = f[\"grid\"].shape[0]\n", 47 | " pruned_grp = f[\"grid_pruned_idx\"]\n", 48 | " sparsity = 1 - np.asarray(\n", 49 | " [pruned_grp[k].shape[0] / N for k in pruned_grp.keys()]\n", 50 | " )\n", 51 | " print(\n", 52 | " f\"PRUNED Sparsity for {g=} {np.mean(sparsity)=:.2%}, {np.std(sparsity)=:.2%}\"\n", 53 | " )" 54 | ] 55 | } 56 | ], 57 | "metadata": { 58 | "kernelspec": { 59 | "display_name": "dev-blake", 60 | "language": "python", 61 | "name": "python3" 62 | }, 63 | "language_info": { 64 | "codemirror_mode": { 65 | "name": "ipython", 66 | "version": 3 67 | }, 68 | "file_extension": ".py", 69 | "mimetype": "text/x-python", 70 | "name": "python", 71 | "nbconvert_exporter": "python", 72 | "pygments_lexer": "ipython3", 73 | "version": "3.11.6" 74 | } 75 | }, 76 | "nbformat": 4, 77 | "nbformat_minor": 2 78 | } 79 | -------------------------------------------------------------------------------- /docs/source/zenodo/05-gbca-benchmark/_index.rst: -------------------------------------------------------------------------------- 1 | Example 5: GBCA Benchmark 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :caption: GBCA Benchmark 7 | 8 | 005-gbca.ipynb 9 | 005-mollixt.ipynb 10 | 005-sparsity.ipynb 11 | -------------------------------------------------------------------------------- /docs/source/zenodo/06-gbca-calculation-vis/_index.rst: -------------------------------------------------------------------------------- 1 | Example 6: GBCA Calculation 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :caption: GBCA Calculation 7 | 8 | 006-calc.ipynb 9 | 006-calcvis.ipynb 10 | -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/_index.rst: -------------------------------------------------------------------------------- 1 | ============================================== 2 | molli Case Study 1: KRAS Barrier Calculation 3 | ============================================== 4 | 5 | The objective of this task is to use the `molli` workflow to transition from `.CDXML` molecular drawings to full-fledged 3D structures with subsequent CREST//GFN2-XTB conformer generation, ORCA equilibrium structure minimization, as well as ORCA relaxed surface scan. 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | 007-kras.ipynb 11 | 12 | Supplementary Scripts 13 | --------------------- 14 | 15 | The following supplementary scripts are part of this case study: 16 | 17 | - `Supplementary Script 1: scan.py `_ 18 | - `Supplementary Script 2: rb_w1_opt.py `_ 19 | - `Supplementary Script 3: rb_w2_opt.py `_ 20 | - `Supplementary Script 4: rb_w3_opt.py `_ 21 | 22 | .. toctree:: 23 | :maxdepth: 1 24 | :hidden: 25 | 26 | scan 27 | rb_w1_opt 28 | rb_w2_opt 29 | rb_w3_opt -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w1_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 4 6 | TOTAL_CORES = 4 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | check_exe=False, # Uncheck for actual production ready calculations 13 | find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("=" * 80) 18 | print("Optimizing the equilibrium structures", flush=True) 19 | 20 | source = ml.MoleculeLibrary("rb_eq_g0.mlib", readonly=True) 21 | dest = ml.MoleculeLibrary("rb_eq_g1.mlib", readonly=False) 22 | 23 | ml.pipeline.jobmap( 24 | orca.basic_calc_m, 25 | source=source, 26 | destination=dest, 27 | cache_dir="_orca_eq_opt1", 28 | n_workers=TOTAL_CORES // N_CORES, 29 | kwargs={"keywords": "rks b97-3c tightopt freq miniprint noprintmos"}, 30 | strict_hash=False, 31 | log_level="debug", 32 | ) 33 | 34 | print("=" * 80) 35 | print("Optimizing the transition structures", flush=True) 36 | 37 | source = ml.MoleculeLibrary("rb_ts_g0.mlib", readonly=True) 38 | dest = ml.MoleculeLibrary("rb_ts_g1.mlib", readonly=False) 39 | 40 | ml.pipeline.jobmap( 41 | orca.basic_calc_m, 42 | source=source, 43 | destination=dest, 44 | cache_dir="_orca_ts_opt1", 45 | n_workers=TOTAL_CORES // N_CORES, 46 | kwargs={ 47 | "keywords": "rks b97-3c tightopt optts freq miniprint noprintmos", 48 | "input1": "%geom\n TS_Mode {D 9 2 43 44} end\n Calc_Hess True\n Recalc_Hess 10\nend", 49 | }, 50 | strict_hash=False, 51 | log_level="debug", 52 | ) 53 | -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w1_opt.rst: -------------------------------------------------------------------------------- 1 | Supplementary Script 2: rb_w1_opt.py 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | .. literalinclude:: rb_w1_opt.py 5 | :language: python -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w2_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 4 6 | TOTAL_CORES = 4 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | check_exe=False, # Uncheck for actual production ready calculations 13 | find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("Optimizing the transition structures", flush=True) 18 | 19 | source = ml.MoleculeLibrary("rb_ts_g2.mlib", readonly=True) 20 | dest = ml.MoleculeLibrary("rb_ts_g3.mlib", readonly=False) 21 | 22 | ml.pipeline.jobmap( 23 | orca.basic_calc_m, 24 | source=source, 25 | destination=dest, 26 | cache_dir="_orca_ts_opt2", 27 | n_workers=TOTAL_CORES // N_CORES, 28 | kwargs={ 29 | "keywords": "rks b97-3c tightopt optts freq miniprint noprintmos", 30 | "input1": "%geom\n TS_Mode {D 9 2 43 44} end\n Calc_Hess True\n Recalc_Hess 10\nend", 31 | }, 32 | strict_hash=False, 33 | log_level="debug", 34 | ) 35 | -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w2_opt.rst: -------------------------------------------------------------------------------- 1 | Supplementary Script 3: rb_w2_opt.py 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | .. literalinclude:: rb_w2_opt.py 5 | :language: python -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w3_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 32 6 | TOTAL_CORES = 32 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | # check_exe=False, # Uncheck for actual production ready calculations 13 | # find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("=" * 80) 18 | print("Optimizing the equilibrium structures (again)", flush=True) 19 | 20 | source = ml.MoleculeLibrary("rb_eq_fix.mlib", readonly=True) 21 | dest = ml.MoleculeLibrary("rb_eq_fix_g1.mlib", readonly=False) 22 | 23 | ml.pipeline.jobmap( 24 | orca.basic_calc_m, 25 | source=source, 26 | destination=dest, 27 | cache_dir="_orca_eq_opt2", 28 | n_workers=TOTAL_CORES // N_CORES, 29 | kwargs={"keywords": "rks b97-3c tightopt freq miniprint noprintmos"}, 30 | strict_hash=False, 31 | log_level="debug", 32 | ) 33 | -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/rb_w3_opt.rst: -------------------------------------------------------------------------------- 1 | Supplementary Script 4: rb_w3_opt.py 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | .. literalinclude:: rb_w3_opt.py 5 | :language: python -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/scan.py: -------------------------------------------------------------------------------- 1 | import molli as ml 2 | from molli.pipeline.xtb import XTBDriver 3 | 4 | source = ml.MoleculeLibrary("kras_inhibitors.mlib") 5 | dest = ml.ConformerLibrary("kras_inhibitors_scan.clib", overwrite=True, readonly=False) 6 | 7 | N_CORES = 4 8 | TOTAL_CORES = 4 # increase for a more powerful machine 9 | 10 | xtb = XTBDriver( 11 | "xtb", 12 | nprocs=N_CORES, 13 | memory=N_CORES * 1000, 14 | check_exe=False, # this is only to repeat the workflows 15 | find=False, # This is only to repeat the workflows 16 | ) 17 | 18 | ml.pipeline.jobmap( 19 | xtb.scan_dihedral, 20 | source, 21 | dest, 22 | args=(("1", "2", "3", "4"),), 23 | cache_dir="_xtb_scan", 24 | kwargs={ 25 | "method": "gfn2", 26 | "accuracy": 0.2, 27 | "range_deg": (-15.0, 165.0), 28 | "n_steps": 36, 29 | }, 30 | n_workers=TOTAL_CORES // N_CORES, 31 | log_level="debug", 32 | strict_hash=False, 33 | ) 34 | -------------------------------------------------------------------------------- /docs/source/zenodo/07-kras-inhibitor-rotation-barrier/scan.rst: -------------------------------------------------------------------------------- 1 | Supplementary Script 1: scan.py 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | .. literalinclude:: scan.py 5 | :language: python -------------------------------------------------------------------------------- /docs/source/zenodo/08-workflow-nmr-prediction/_index.rst: -------------------------------------------------------------------------------- 1 | =================================================== 2 | molli Case Study 2: NMR Prediction of Cladosporin 3 | =================================================== 4 | 5 | The objective of this task is to use the `molli` workflow to transition from `.CDXML` molecular drawings to full-fledged 3D structures with subsequent CREST//GFN2-XTB conformer generation, ORCA equilibrium structure minimizations and GIAO-DFT NMR predictions. 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | 008-cladosporin.ipynb 11 | 12 | Supplementary Script 13 | --------------------- 14 | 15 | The following supplementary script is a part of this case study: 16 | 17 | - `Supplementary Script: workflow.py `_ 18 | 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | :hidden: 23 | 24 | workflow -------------------------------------------------------------------------------- /docs/source/zenodo/08-workflow-nmr-prediction/workflow.py: -------------------------------------------------------------------------------- 1 | # This is a separate file just so that we do not run into funny issues with Jupyter and ThreadPoolExecutor problems. 2 | import molli as ml 3 | from molli.pipeline.crest import CrestDriver 4 | from molli.pipeline.orca import ORCADriver 5 | 6 | source = ml.MoleculeLibrary("cladosporin_g1.mlib", readonly=True) 7 | confs_gff = ml.ConformerLibrary("cladosporin_g2.clib", readonly=False) 8 | confs_gfn2 = ml.ConformerLibrary("cladosporin_g3.clib", readonly=False) 9 | 10 | crest = CrestDriver( 11 | "crest", 12 | nprocs=32, 13 | check_exe=False, # this is only to repeat the workflows 14 | find=False, # This is only to repeat the workflows 15 | ) 16 | print("Running conformer generation with:", crest.executable, crest.nprocs) 17 | print("debug: nprocs", crest.conformer_search.nprocs) 18 | 19 | print("=" * 100) 20 | 21 | ml.pipeline.jobmap( 22 | crest.conformer_search, 23 | source=source, 24 | destination=confs_gff, 25 | cache_dir="_01_conf_search", 26 | n_workers=4, 27 | kwargs={"method": "gfnff -i4"}, 28 | strict_hash=False, # Not recommended unless you know precisely that outputs are correct. 29 | ) 30 | 31 | print("=" * 100) 32 | 33 | ml.pipeline.jobmap( 34 | crest.conformer_screen, 35 | source=confs_gff, 36 | destination=confs_gfn2, 37 | cache_dir="_02_conf_screen", 38 | n_workers=4, 39 | kwargs={"method": "gfn2"}, 40 | strict_hash=False, # Not recommended unless you know precisely that outputs are correct. 41 | ) 42 | 43 | 44 | source = ml.ConformerLibrary("cladosporin_g3.clib", readonly=True) 45 | 46 | orca_optimized = ml.ConformerLibrary( 47 | "cladosporin_g4.clib", 48 | readonly=False, 49 | overwrite=True, 50 | ) 51 | 52 | orca = ORCADriver("orca", nprocs=8, memory=4000 * 8, envars={}) 53 | 54 | print("=" * 100) 55 | 56 | ml.pipeline.jobmap( 57 | orca.optimize_ens, 58 | source=source, 59 | cache_dir="_03_dft_geoms", 60 | destination=orca_optimized, 61 | kwargs={ 62 | "keywords": "rks b97-3c opt freq tightopt tightscf miniprint", 63 | # "orca_suffix": "-mca btl ^sm", 64 | }, 65 | n_workers=128 // 8, 66 | verbose=True, 67 | log_level="debug", 68 | strict_hash=False, 69 | ) 70 | 71 | source = ml.ConformerLibrary("cladosporin_g4.clib", readonly=True) 72 | orca_conf_nmr = ml.ConformerLibrary( 73 | "cladosporin_g4_nmr.clib", 74 | readonly=False, 75 | overwrite=True, 76 | ) 77 | 78 | print("=" * 100) 79 | 80 | ml.pipeline.jobmap( 81 | orca.giao_nmr_ens, 82 | source=source, 83 | destination=orca_conf_nmr, 84 | cache_dir="_04_dft_nmr", 85 | kwargs={ 86 | "keywords": "rks pbe0 pcSseg-2 verytightscf nmr cpcm(chloroform)", 87 | "elements": ("C",), 88 | }, 89 | verbose=True, 90 | log_level="debug", 91 | strict_hash=False, 92 | n_workers=128 // 8, 93 | ) 94 | -------------------------------------------------------------------------------- /docs/source/zenodo/08-workflow-nmr-prediction/workflow.rst: -------------------------------------------------------------------------------- 1 | Supplementary Script: workflow.py 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 | 4 | .. literalinclude:: workflow.py 5 | :language: python -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | channels: 2 | - conda-forge 3 | - defaults 4 | dependencies: 5 | - python=3.11 6 | - openbabel 7 | - pip 8 | - pip: 9 | - rdkit 10 | - ipykernel 11 | - myst_parser 12 | - sphinx-rtd-theme 13 | - nbsphinx 14 | - furo 15 | - molli -------------------------------------------------------------------------------- /examples-jupyter/README.md: -------------------------------------------------------------------------------- 1 | # Examples of `MOLLI` usage 2 | 3 | This section requires jupyter notebook -------------------------------------------------------------------------------- /examples-scripts/001_pyvista1.py: -------------------------------------------------------------------------------- 1 | import molli as ml 2 | import pyvista as pv 3 | from PIL import ImageColor 4 | from matplotlib.colors import ListedColormap 5 | import numpy as np 6 | 7 | with ml.files.mol2.dendrobine.open() as f: 8 | _mol = ml.chem.Molecule.from_mol2(f) 9 | 10 | # mol = _mol.heavy 11 | mol = _mol 12 | 13 | mol.translate(-1 * mol.centroid()) 14 | a_sizes = [a.cov_radius_1 for a in mol.atoms] 15 | 16 | sph = pv.Sphere(theta_resolution=24, phi_resolution=24) 17 | 18 | 19 | plotter = pv.Plotter() 20 | 21 | b_lines = [] 22 | for b in mol.bonds: 23 | i1, i2 = map(mol.get_atom_index, (b.a1, b.a2)) 24 | b_lines.append((2, i1, i2)) 25 | 26 | points = pv.PolyData(mol.coords, lines=b_lines, n_lines=mol.n_bonds) 27 | points.point_data["element"] = [a.Z for a in mol.atoms] 28 | points["radius"] = a_sizes 29 | 30 | val = np.linspace(-1, 118, 120) 31 | colors = np.zeros((120, 4)) 32 | for i, elt in enumerate(ml.chem.Element): 33 | clr = elt.color_cpk or "#000000" 34 | r, g, b = ImageColor.getrgb(clr) 35 | colors[val > (elt.z - 0.5)] = [r / 255, g / 255, b / 255, 1] 36 | 37 | cmap_cpk = pv.LookupTable( 38 | ListedColormap(colors), n_values=120, scalar_range=(-1, 118) 39 | ) 40 | 41 | spherez = points.glyph( 42 | geom=sph, 43 | orient=False, 44 | scale="radius", 45 | # progress_bar=True, 46 | ) 47 | 48 | tubez = points.tube( 49 | radius=0.05, 50 | # progress_bar=True, 51 | ) 52 | 53 | plotter.add_mesh( 54 | spherez, 55 | color="white", 56 | smooth_shading=True, 57 | scalars="element", 58 | show_scalar_bar=False, 59 | diffuse=0.7, 60 | specular=0.3, 61 | specular_power=2, 62 | cmap=cmap_cpk, 63 | ) 64 | 65 | plotter.add_mesh( 66 | tubez, 67 | color="white", 68 | smooth_shading=True, 69 | scalars="element", 70 | show_scalar_bar=False, 71 | diffuse=0.7, 72 | specular=0.3, 73 | specular_power=2, 74 | interpolate_before_map=False, 75 | cmap=cmap_cpk, 76 | ) 77 | 78 | 79 | plotter.enable_anti_aliasing(aa_type="ssaa", multi_samples=4) 80 | plotter.background_color = "000002" 81 | plotter.view_xy() 82 | plotter.add_axes() 83 | plotter.show() 84 | -------------------------------------------------------------------------------- /examples-scripts/002_pyvista2.py: -------------------------------------------------------------------------------- 1 | import molli as ml 2 | import pyvista as pv 3 | from PIL import ImageColor 4 | from matplotlib.colors import ListedColormap 5 | import numpy as np 6 | 7 | with ml.files.mol2.pdb_4a05.open() as f, ml.aux.timeit("Parsing mol2"): 8 | _mol = ml.chem.Molecule.load_mol2(f) 9 | 10 | # mol = _mol.heavy 11 | mol = _mol 12 | 13 | for a in mol.atoms: 14 | if a.element.symbol == "N": 15 | a.atype = ml.AtomType.Dummy 16 | 17 | mol.translate(-1 * mol.centroid()) 18 | a_sizes = [a.cov_radius_1 for a in mol.atoms] 19 | 20 | # sph = pv.Sphere(theta_resolution=24, phi_resolution=24) 21 | 22 | plotter = pv.Plotter(line_smoothing=True) 23 | 24 | atoms = pv.MultiBlock() 25 | for i, a in enumerate(mol.atoms): 26 | a_size = a.cov_radius_1 * 0.4 27 | if a.is_dummy: 28 | atoms.append(pv.Cube(mol.coords[i], a_size, a_size, a_size)) 29 | else: 30 | atoms.append( 31 | pv.Sphere( 32 | a_size / 2, 33 | center=mol.coords[i], 34 | phi_resolution=32, 35 | theta_resolution=32, 36 | ) 37 | ) 38 | 39 | bonds = pv.MultiBlock() 40 | for j, b in enumerate(mol.bonds): 41 | r1, r2 = mol.bond_coords(b) 42 | bonds.append(pv.Tube(r1, r2, radius=0.03, n_sides=16)) 43 | 44 | 45 | actor, mapper = plotter.add_composite( 46 | atoms, 47 | smooth_shading=True, 48 | culling=True, 49 | ambient=0.2, 50 | diffuse=0.6, 51 | specular=0.2, 52 | ) 53 | 54 | for i, a in enumerate(mol.atoms): 55 | mapper.block_attr[i + 1].color = a.color_cpk 56 | 57 | actor, mapper = plotter.add_composite( 58 | bonds, 59 | color=(0.9, 0.9, 0.9), 60 | smooth_shading=True, 61 | culling=True, 62 | diffuse=0.9, 63 | specular=0.1, 64 | ) 65 | 66 | # plotter.enable_anti_aliasing(aa_type="fxaa") 67 | plotter.background_color = "000002" 68 | plotter.view_xy() 69 | plotter.add_axes() 70 | plotter.show() 71 | -------------------------------------------------------------------------------- /examples-zenodo/05-gbca-benchmark/005-mollixt.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Example 5.2: Molli XT Benchmark\n", 8 | "\n", 9 | "## Hardware Specification for Rerun\n", 10 | "\n", 11 | "Desktop workstation with 2x (AMD EPYC 7702 64-Core) with total of 128 physical and 256 logical cores, 1024 GB DDR4 with Ubuntu 22.04 LTS operating system." 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 1, 17 | "metadata": {}, 18 | "outputs": [], 19 | "source": [ 20 | "import molli as ml\n", 21 | "import molli_xt\n", 22 | "from scipy.spatial.distance import cdist\n", 23 | "import numpy as np\n", 24 | "import timeit\n", 25 | "\n", 26 | "arr1 = np.random.rand(100, 30, 3).astype(\"f4\")\n", 27 | "test_arrs = {\n", 28 | " size: np.random.rand(size, 3).astype(\"f4\") for size in (10, 100, 1000, 10000, 20000)\n", 29 | "}" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 2, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "name": "stdout", 39 | "output_type": "stream", 40 | "text": [ 41 | "Distance (Euclidean) calculation with scipy.cdist:\n", 42 | "size=10: t_sp/t_ml=9.535875 molli=0.001277 scipy=0.012177\n", 43 | "size=100: t_sp/t_ml=3.079132 molli=0.006536 scipy=0.020125\n", 44 | "size=1000: t_sp/t_ml=4.997022 molli=0.065151 scipy=0.325563\n", 45 | "size=10000: t_sp/t_ml=2.504050 molli=0.744849 scipy=1.865138\n", 46 | "size=20000: t_sp/t_ml=1.908507 molli=1.464665 scipy=2.795323\n" 47 | ] 48 | } 49 | ], 50 | "source": [ 51 | "# Comparison for euclidean distance\n", 52 | "print(\"Distance (Euclidean) calculation with scipy.cdist:\")\n", 53 | "for size, arr2 in test_arrs.items():\n", 54 | " times_scipy = timeit.Timer(\n", 55 | " \"\"\"[cdist(x, arr2, \"sqeuclidean\") for x in arr1]\"\"\",\n", 56 | " globals=globals(),\n", 57 | " ).repeat(5, 10)\n", 58 | "\n", 59 | " times_molli = timeit.Timer(\n", 60 | " \"\"\"molli_xt.cdist32f_eu2(arr1, arr2)\"\"\",\n", 61 | " globals=globals(),\n", 62 | " ).repeat(5, 10)\n", 63 | "\n", 64 | " t_sp = min(times_scipy)\n", 65 | " t_ml = min(times_molli)\n", 66 | "\n", 67 | " print(f\"{size=}: {t_sp/t_ml=:3f} molli={t_ml:4f} scipy={t_sp:4f}\")\n" 68 | ] 69 | } 70 | ], 71 | "metadata": { 72 | "kernelspec": { 73 | "display_name": "dev-blake", 74 | "language": "python", 75 | "name": "python3" 76 | }, 77 | "language_info": { 78 | "codemirror_mode": { 79 | "name": "ipython", 80 | "version": 3 81 | }, 82 | "file_extension": ".py", 83 | "mimetype": "text/x-python", 84 | "name": "python", 85 | "nbconvert_exporter": "python", 86 | "pygments_lexer": "ipython3", 87 | "version": "3.11.6" 88 | } 89 | }, 90 | "nbformat": 4, 91 | "nbformat_minor": 2 92 | } 93 | -------------------------------------------------------------------------------- /examples-zenodo/05-gbca-benchmark/005-sparsity.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Example 5.3: Sparsity Benchmark\n", 8 | "\n", 9 | "## Hardware Specification for Rerun\n", 10 | "\n", 11 | "Desktop workstation with 2x (AMD EPYC 7702 64-Core) with total of 128 physical and 256 logical cores, 1024 GB DDR4 with Ubuntu 22.04 LTS operating system." 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 2, 17 | "metadata": {}, 18 | "outputs": [ 19 | { 20 | "name": "stdout", 21 | "output_type": "stream", 22 | "text": [ 23 | "ASO Sparsity for g='15' np.mean(sparsity)=92.00%, np.std(sparsity)=4.42%\n", 24 | "PRUNED Sparsity for g='15' np.mean(sparsity)=86.65%, np.std(sparsity)=6.49%\n", 25 | "ASO Sparsity for g='10' np.mean(sparsity)=91.60%, np.std(sparsity)=4.60%\n", 26 | "PRUNED Sparsity for g='10' np.mean(sparsity)=86.03%, np.std(sparsity)=6.74%\n", 27 | "ASO Sparsity for g='07' np.mean(sparsity)=91.54%, np.std(sparsity)=4.66%\n", 28 | "PRUNED Sparsity for g='07' np.mean(sparsity)=85.92%, np.std(sparsity)=6.78%\n" 29 | ] 30 | } 31 | ], 32 | "source": [ 33 | "import molli as ml\n", 34 | "import h5py\n", 35 | "import numpy as np\n", 36 | "\n", 37 | "for g in \"15\", \"10\", \"07\":\n", 38 | " with h5py.File(f\"bpa_aligned_grid{g}_aso.hdf5\") as f:\n", 39 | " descriptors = np.asarray([f[k] for k in f.keys()])\n", 40 | " sparsity = 1 - np.count_nonzero(descriptors, axis=1) / descriptors.shape[1]\n", 41 | " print(\n", 42 | " f\"ASO Sparsity for {g=} {np.mean(sparsity)=:.2%}, {np.std(sparsity)=:.2%}\"\n", 43 | " )\n", 44 | "\n", 45 | " with h5py.File(f\"bpa_aligned_grid{g}.hdf5\") as f:\n", 46 | " N = f[\"grid\"].shape[0]\n", 47 | " pruned_grp = f[\"grid_pruned_idx\"]\n", 48 | " sparsity = 1 - np.asarray(\n", 49 | " [pruned_grp[k].shape[0] / N for k in pruned_grp.keys()]\n", 50 | " )\n", 51 | " print(\n", 52 | " f\"PRUNED Sparsity for {g=} {np.mean(sparsity)=:.2%}, {np.std(sparsity)=:.2%}\"\n", 53 | " )" 54 | ] 55 | } 56 | ], 57 | "metadata": { 58 | "kernelspec": { 59 | "display_name": "dev-blake", 60 | "language": "python", 61 | "name": "python3" 62 | }, 63 | "language_info": { 64 | "codemirror_mode": { 65 | "name": "ipython", 66 | "version": 3 67 | }, 68 | "file_extension": ".py", 69 | "mimetype": "text/x-python", 70 | "name": "python", 71 | "nbconvert_exporter": "python", 72 | "pygments_lexer": "ipython3", 73 | "version": "3.11.6" 74 | } 75 | }, 76 | "nbformat": 4, 77 | "nbformat_minor": 2 78 | } 79 | -------------------------------------------------------------------------------- /examples-zenodo/07-kras-inhibitor-rotation-barrier/rb_w1_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 4 6 | TOTAL_CORES = 4 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | check_exe=False, # Uncheck for actual production ready calculations 13 | find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("=" * 80) 18 | print("Optimizing the equilibrium structures", flush=True) 19 | 20 | source = ml.MoleculeLibrary("rb_eq_g0.mlib", readonly=True) 21 | dest = ml.MoleculeLibrary("rb_eq_g1.mlib", readonly=False) 22 | 23 | ml.pipeline.jobmap( 24 | orca.basic_calc_m, 25 | source=source, 26 | destination=dest, 27 | cache_dir="_orca_eq_opt1", 28 | n_workers=TOTAL_CORES // N_CORES, 29 | kwargs={"keywords": "rks b97-3c tightopt freq miniprint noprintmos"}, 30 | strict_hash=False, 31 | log_level="debug", 32 | ) 33 | 34 | print("=" * 80) 35 | print("Optimizing the transition structures", flush=True) 36 | 37 | source = ml.MoleculeLibrary("rb_ts_g0.mlib", readonly=True) 38 | dest = ml.MoleculeLibrary("rb_ts_g1.mlib", readonly=False) 39 | 40 | ml.pipeline.jobmap( 41 | orca.basic_calc_m, 42 | source=source, 43 | destination=dest, 44 | cache_dir="_orca_ts_opt1", 45 | n_workers=TOTAL_CORES // N_CORES, 46 | kwargs={ 47 | "keywords": "rks b97-3c tightopt optts freq miniprint noprintmos", 48 | "input1": "%geom\n TS_Mode {D 9 2 43 44} end\n Calc_Hess True\n Recalc_Hess 10\nend", 49 | }, 50 | strict_hash=False, 51 | log_level="debug", 52 | ) 53 | -------------------------------------------------------------------------------- /examples-zenodo/07-kras-inhibitor-rotation-barrier/rb_w2_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 4 6 | TOTAL_CORES = 4 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | check_exe=False, # Uncheck for actual production ready calculations 13 | find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("Optimizing the transition structures", flush=True) 18 | 19 | source = ml.MoleculeLibrary("rb_ts_g2.mlib", readonly=True) 20 | dest = ml.MoleculeLibrary("rb_ts_g3.mlib", readonly=False) 21 | 22 | ml.pipeline.jobmap( 23 | orca.basic_calc_m, 24 | source=source, 25 | destination=dest, 26 | cache_dir="_orca_ts_opt2", 27 | n_workers=TOTAL_CORES // N_CORES, 28 | kwargs={ 29 | "keywords": "rks b97-3c tightopt optts freq miniprint noprintmos", 30 | "input1": "%geom\n TS_Mode {D 9 2 43 44} end\n Calc_Hess True\n Recalc_Hess 10\nend", 31 | }, 32 | strict_hash=False, 33 | log_level="debug", 34 | ) 35 | -------------------------------------------------------------------------------- /examples-zenodo/07-kras-inhibitor-rotation-barrier/rb_w3_opt.py: -------------------------------------------------------------------------------- 1 | # Both the eq and the TS will be optimized here. 2 | import molli as ml 3 | from molli.pipeline.orca import ORCADriver 4 | 5 | N_CORES = 32 6 | TOTAL_CORES = 32 # increase for a more powerful machine 7 | 8 | orca = ORCADriver( 9 | "orca", 10 | nprocs=N_CORES, 11 | memory=N_CORES * 4000, 12 | # check_exe=False, # Uncheck for actual production ready calculations 13 | # find=False, # Uncheck for actual production ready calculations 14 | ) 15 | 16 | 17 | print("=" * 80) 18 | print("Optimizing the equilibrium structures (again)", flush=True) 19 | 20 | source = ml.MoleculeLibrary("rb_eq_fix.mlib", readonly=True) 21 | dest = ml.MoleculeLibrary("rb_eq_fix_g1.mlib", readonly=False) 22 | 23 | ml.pipeline.jobmap( 24 | orca.basic_calc_m, 25 | source=source, 26 | destination=dest, 27 | cache_dir="_orca_eq_opt2", 28 | n_workers=TOTAL_CORES // N_CORES, 29 | kwargs={"keywords": "rks b97-3c tightopt freq miniprint noprintmos"}, 30 | strict_hash=False, 31 | log_level="debug", 32 | ) 33 | -------------------------------------------------------------------------------- /examples-zenodo/07-kras-inhibitor-rotation-barrier/scan.py: -------------------------------------------------------------------------------- 1 | import molli as ml 2 | from molli.pipeline.xtb import XTBDriver 3 | 4 | source = ml.MoleculeLibrary("kras_inhibitors.mlib") 5 | dest = ml.ConformerLibrary("kras_inhibitors_scan.clib", overwrite=True, readonly=False) 6 | 7 | N_CORES = 4 8 | TOTAL_CORES = 4 # increase for a more powerful machine 9 | 10 | xtb = XTBDriver( 11 | "xtb", 12 | nprocs=N_CORES, 13 | memory=N_CORES * 1000, 14 | check_exe=False, # this is only to repeat the workflows 15 | find=False, # This is only to repeat the workflows 16 | ) 17 | 18 | ml.pipeline.jobmap( 19 | xtb.scan_dihedral, 20 | source, 21 | dest, 22 | args=(("1", "2", "3", "4"),), 23 | cache_dir="_xtb_scan", 24 | kwargs={ 25 | "method": "gfn2", 26 | "accuracy": 0.2, 27 | "range_deg": (-15.0, 165.0), 28 | "n_steps": 36, 29 | }, 30 | n_workers=TOTAL_CORES // N_CORES, 31 | log_level="debug", 32 | strict_hash=False, 33 | ) 34 | -------------------------------------------------------------------------------- /examples-zenodo/08-workflow-nmr-prediction/workflow.py: -------------------------------------------------------------------------------- 1 | # This is a separate file just so that we do not run into funny issues with Jupyter and ThreadPoolExecutor problems. 2 | import molli as ml 3 | from molli.pipeline.crest import CrestDriver 4 | from molli.pipeline.orca import ORCADriver 5 | 6 | source = ml.MoleculeLibrary("cladosporin_g1.mlib", readonly=True) 7 | confs_gff = ml.ConformerLibrary("cladosporin_g2.clib", readonly=False) 8 | confs_gfn2 = ml.ConformerLibrary("cladosporin_g3.clib", readonly=False) 9 | 10 | crest = CrestDriver( 11 | "crest", 12 | nprocs=32, 13 | check_exe=False, # this is only to repeat the workflows 14 | find=False, # This is only to repeat the workflows 15 | ) 16 | print("Running conformer generation with:", crest.executable, crest.nprocs) 17 | print("debug: nprocs", crest.conformer_search.nprocs) 18 | 19 | print("=" * 100) 20 | 21 | ml.pipeline.jobmap( 22 | crest.conformer_search, 23 | source=source, 24 | destination=confs_gff, 25 | cache_dir="_01_conf_search", 26 | n_workers=4, 27 | kwargs={"method": "gfnff -i4"}, 28 | strict_hash=False, # Not recommended unless you know precisely that outputs are correct. 29 | ) 30 | 31 | print("=" * 100) 32 | 33 | ml.pipeline.jobmap( 34 | crest.conformer_screen, 35 | source=confs_gff, 36 | destination=confs_gfn2, 37 | cache_dir="_02_conf_screen", 38 | n_workers=4, 39 | kwargs={"method": "gfn2"}, 40 | strict_hash=False, # Not recommended unless you know precisely that outputs are correct. 41 | ) 42 | 43 | 44 | source = ml.ConformerLibrary("cladosporin_g3.clib", readonly=True) 45 | 46 | orca_optimized = ml.ConformerLibrary( 47 | "cladosporin_g4.clib", 48 | readonly=False, 49 | overwrite=True, 50 | ) 51 | 52 | orca = ORCADriver("orca", nprocs=8, memory=4000 * 8, envars={}) 53 | 54 | print("=" * 100) 55 | 56 | ml.pipeline.jobmap( 57 | orca.optimize_ens, 58 | source=source, 59 | cache_dir="_03_dft_geoms", 60 | destination=orca_optimized, 61 | kwargs={ 62 | "keywords": "rks b97-3c opt freq tightopt tightscf miniprint", 63 | # "orca_suffix": "-mca btl ^sm", 64 | }, 65 | n_workers=128 // 8, 66 | verbose=True, 67 | log_level="debug", 68 | strict_hash=False, 69 | ) 70 | 71 | source = ml.ConformerLibrary("cladosporin_g4.clib", readonly=True) 72 | orca_conf_nmr = ml.ConformerLibrary( 73 | "cladosporin_g4_nmr.clib", 74 | readonly=False, 75 | overwrite=True, 76 | ) 77 | 78 | print("=" * 100) 79 | 80 | ml.pipeline.jobmap( 81 | orca.giao_nmr_ens, 82 | source=source, 83 | destination=orca_conf_nmr, 84 | cache_dir="_04_dft_nmr", 85 | kwargs={ 86 | "keywords": "rks pbe0 pcSseg-2 verytightscf nmr cpcm(chloroform)", 87 | "elements": ("C",), 88 | }, 89 | verbose=True, 90 | log_level="debug", 91 | strict_hash=False, 92 | n_workers=128 // 8, 93 | ) 94 | -------------------------------------------------------------------------------- /molli/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by: 6 | # - Alexander S. Shved , 7 | # - Blake E. Ocampo 8 | # - Elena S. Burlova 9 | # - Casey L. Olen 10 | # - N. Ian Rinehart 11 | # 12 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 13 | # https://denmarkgroup.illinois.edu/ 14 | # 15 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 16 | # All Rights Reserved. 17 | # 18 | # Licensed under the terms MIT License 19 | # The License is included in the distribution as LICENSE file. 20 | # You may not use this file except in compliance with the License. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 23 | # ================================================================================ 24 | 25 | 26 | """ 27 | ------------------------------------ 28 | `MOLLI`: Molecular Library Toolbox 29 | ------------------------------------ 30 | 31 | `Molli`, molecular library toolbox, is a python 3.10+ library that supports 32 | small to medium size full molecular structure manipulations, combinatorial molecular 33 | library generation, structure manipulations, and feature Extraction. 34 | Molli offsers an efficient molecular and conformer library storage format. 35 | 36 | It also implements a lot of command line tools (run `molli --HELP` or `molli list` for more details) 37 | 38 | Copyright 2022-2023 The Board of Trustees of the University of Illinois. 39 | All Rights Reserved. 40 | 41 | Developed by: 42 | - Alexander S. Shved , 43 | - Blake E. Ocampo 44 | - Elena S. Burlova 45 | - Casey L. Olen 46 | - N. Ian Rinehart 47 | 48 | S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 49 | https://denmarkgroup.illinois.edu/ 50 | 51 | Licensed under the terms MIT License 52 | The License is included in the distribution as LICENSE file. 53 | You may not use this file except in compliance with the License. 54 | 55 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 56 | 57 | """ 58 | 59 | 60 | from . import config 61 | 62 | __version__ = config.VERSION 63 | 64 | # Believe it or not, on Windows `aux` is not a valid file/folder name 65 | from . import _aux as aux 66 | 67 | try: 68 | import molli_xt as xt 69 | except: 70 | MOLLI_USING_EXTENSIONS = False 71 | else: 72 | MOLLI_USING_EXTENSIONS = True 73 | 74 | 75 | from . import data 76 | from . import math 77 | from . import parsing 78 | from . import storage 79 | 80 | # from . import chem 81 | from . import external 82 | from . import files 83 | from . import storage 84 | from . import pipeline 85 | from . import visual 86 | 87 | from .chem import * 88 | from .ftypes import * 89 | from . import descriptor 90 | 91 | from .reader import * 92 | from .writer import * 93 | -------------------------------------------------------------------------------- /molli/_aux/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 6 | # All Rights Reserved. 7 | # 8 | # Developed by Alexander S. Shved 9 | # 10 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 11 | # https://denmarkgroup.illinois.edu/ 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | `molli.aux` subpackage defines auxiliary helper functions 23 | """ 24 | 25 | from .misc import ( 26 | timeit, 27 | ForeColor, 28 | unique_path, 29 | load_external_module, 30 | catch_interrupt, 31 | ) 32 | from . import db 33 | from .version import ( 34 | assert_molli_version_min, 35 | assert_molli_version_max, 36 | assert_molli_version_in_range, 37 | ) 38 | from .iterators import sglob, dglob, batched, len_batched 39 | from .lock import rwlock 40 | -------------------------------------------------------------------------------- /molli/_aux/db.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from requests import exceptions 3 | from random import randint 4 | 5 | 6 | def pdb_get(pdb_id: str) -> bytes: 7 | """ 8 | # `retrieve_pdb` 9 | This function downloads a pdb file from the Protein Data Bank (https://files.rcsb.org/download) 10 | 11 | For more details, go to https://wwpdb.org 12 | 13 | 14 | ## Parameters 15 | 16 | `pdb_id: str` 17 | PDB identifier. Example: `'1I10'` for HUMAN MUSCLE L-LACTATE DEHYDROGENASE 18 | 19 | ## Returns 20 | 21 | `bytes` 22 | _description_ 23 | """ 24 | raise NotImplementedError 25 | 26 | 27 | class ZINC15GetError(exceptions.HTTPError): 28 | """Raised when""" 29 | 30 | 31 | def zinc15_get(zinc15_id: int | str, suffix: str = ".mol2"): 32 | _suffix = suffix or "" 33 | _zinc15_id = f"ZINC{zinc15_id:0>15}" if isinstance(zinc15_id, int) else zinc15_id 34 | 35 | req = requests.get(f"https://zinc15.docking.org/substances/{_zinc15_id}{_suffix}") 36 | 37 | if req.status_code == 200: 38 | return req.text 39 | else: 40 | raise ZINC15GetError( 41 | f"Request failed with code {req.status_code}: {req.reason}" 42 | ) 43 | 44 | 45 | def zinc15_yield(*zinc15_idx: int | str, suffix: str = ".mol2"): 46 | for zid in zinc15_idx: 47 | yield zinc15_get(zid, suffix=suffix) 48 | -------------------------------------------------------------------------------- /molli/_aux/lock.py: -------------------------------------------------------------------------------- 1 | from molli import config 2 | from fasteners import InterProcessReaderWriterLock 3 | from hashlib import sha3_512 4 | from pathlib import Path 5 | from base64 import urlsafe_b64encode 6 | 7 | 8 | def rwlock(path: str | Path): 9 | """ 10 | This is a convenience function that returns a reader/writer lock based on a file path. 11 | """ 12 | abspath = Path(path).resolve() 13 | key = abspath.as_posix().encode() 14 | h = sha3_512(key).digest() 15 | (lkdir := config.SHARED_DIR / "lock").mkdir(exist_ok=True, parents=True) 16 | return lkdir / f"{urlsafe_b64encode(h).decode()}.lock" 17 | -------------------------------------------------------------------------------- /molli/_aux/version.py: -------------------------------------------------------------------------------- 1 | from molli.config import VERSION 2 | from .misc import ForeColor 3 | from packaging.version import parse as parse_version 4 | 5 | 6 | current_version = parse_version(VERSION) 7 | 8 | 9 | def assert_molli_version_min(vmin: str): 10 | """ 11 | # `assert_molli_version_min` 12 | Asserts the current version of molli is above the minimum requirement 13 | 14 | This is commonly encountered when scripts were written to use a very specific version of the API. 15 | This is a control step to ensure 16 | 17 | ## Parameters 18 | 19 | `vmin: str` 20 | Minimum required version. For instance, `'1.2.3b4'` 21 | 22 | ## Raises 23 | 24 | `AssertionError` 25 | If the test fails, it raises an error. 26 | """ 27 | if current_version < (_vmin := parse_version(vmin)): 28 | raise AssertionError( 29 | f"Current molli version {current_version} is below the minimum requirement of {_vmin}" 30 | ) 31 | 32 | 33 | def assert_molli_version_max(vmax: str): 34 | """ 35 | # `assert_molli_version_max` 36 | Asserts the current version of molli is below the maximum requirement 37 | 38 | This is commonly encountered when scripts were written to use a very specific version of the API. 39 | This ensures a control step to ensure compatibility. 40 | 41 | ## Parameters 42 | 43 | `vmax: str` 44 | Maximum required version. For instance, `'1.2.3b4'` 45 | 46 | ## Raises 47 | 48 | `AssertionError` 49 | If the test fails, it raises an error. 50 | """ 51 | if current_version > (_vmax := parse_version(vmax)): 52 | raise AssertionError( 53 | f"Current molli version {current_version} is above the maximum requirement of {_vmax}" 54 | ) 55 | 56 | 57 | def assert_molli_version_in_range(vmin: str, vmax: str): 58 | """ 59 | # `assert_molli_version_in_range` 60 | Asserts the current version of molli to be within the specified range 61 | 62 | This is commonly encountered when scripts were written to use a very specific version of the API. 63 | This ensures a control step to ensure compatibility. 64 | 65 | ## Parameters 66 | 67 | `vmin: str` 68 | _description_ 69 | `vmax: str` 70 | _description_ 71 | """ 72 | assert_molli_version_min(vmin) 73 | assert_molli_version_max(vmax) 74 | -------------------------------------------------------------------------------- /molli/chem/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | """ 21 | # `molli.chem` 22 | Main subpackage of the molli library. 23 | Contains all fundamental chemistry data structures: `Atom`, `Bond`, `Molecule`, `ConformerEnsemble`, etc. 24 | """ 25 | 26 | from .atom import ( 27 | Element, 28 | ElementLike, 29 | Atom, 30 | AtomLike, 31 | AtomType, 32 | AtomStereo, 33 | AtomGeom, 34 | Promolecule, 35 | PromoleculeLike, 36 | ) 37 | 38 | from .bond import ( 39 | Bond, 40 | Connectivity, 41 | BondStereo, 42 | BondType, 43 | ) 44 | 45 | from .geometry import CartesianGeometry, DistanceUnit 46 | from .structure import Structure, Substructure 47 | from .molecule import Molecule, StructureLike 48 | from .ensemble import ConformerEnsemble, Conformer 49 | 50 | from .library import ConformerLibrary, MoleculeLibrary 51 | from .legacy import ensemble_from_molli_old_xml 52 | -------------------------------------------------------------------------------- /molli/data/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This file provides cached access to chemically relevant data defined in the *.yml files 23 | in this directory. 24 | """ 25 | 26 | import os 27 | from glob import glob 28 | import re 29 | from enum import Enum 30 | from functools import wraps 31 | import yaml 32 | 33 | # determine data directories 34 | DATA_ROOT = os.path.abspath(os.path.dirname(__file__)) 35 | 36 | # assemble 37 | _data_file_paths = glob(f"{DATA_ROOT}/*.yml") 38 | 39 | DATA_FILES = {} 40 | 41 | for fp in _data_file_paths: 42 | base = os.path.basename(fp) 43 | category, dataset, _ = base.split(".") 44 | 45 | if category not in DATA_FILES: 46 | DATA_FILES[category] = {} 47 | 48 | if dataset not in DATA_FILES[category]: 49 | DATA_FILES[category][dataset] = {} 50 | 51 | DATA_FILES[category][dataset] = fp 52 | 53 | __DATASET_CACHE = {} 54 | 55 | 56 | def _get_dataset_cached(category: str, dataset: str): 57 | """ 58 | Retrieve dataset in a cached mode 59 | example: 60 | ```python 61 | _data = molli.data.get_dataset_cached('element', 'vdw_radius') 62 | ``` 63 | """ 64 | 65 | if (category, dataset) not in __DATASET_CACHE: 66 | with open(DATA_FILES[category][dataset], "rt") as f: 67 | dat = yaml.safe_load(f) 68 | 69 | if not isinstance(dat, dict) or ("data" not in dat) or ("whatis" not in dat): 70 | raise SyntaxError( 71 | f"{DATA_FILES[category][dataset]} is not a valid molli dataset." 72 | ) 73 | else: 74 | __DATASET_CACHE[(category, dataset)] = dat 75 | 76 | return __DATASET_CACHE[(category, dataset)] 77 | 78 | 79 | def remove_from_cache(category: str, dataset: str): 80 | del __DATASET_CACHE[(category, dataset)] 81 | 82 | 83 | def get(category: str, dataset: str, key, noexcept=False): 84 | """ 85 | Retrieves data stored in 86 | """ 87 | 88 | try: 89 | _dset = _get_dataset_cached(category, dataset) 90 | property = _dset["data"][key] 91 | except: 92 | if noexcept: 93 | property = None 94 | else: 95 | if (category, dataset) in __DATASET_CACHE: 96 | raise KeyError( 97 | f"Cannot retrieve key <{key}> from {DATA_FILES[category][dataset]}::data" 98 | ) 99 | else: 100 | raise 101 | return property 102 | 103 | 104 | def whatis(category: str, dataset: str) -> dict: 105 | dataset = _get_dataset_cached(category, dataset) 106 | return dataset["whatis"] 107 | -------------------------------------------------------------------------------- /molli/data/element.atomic_weight.yml: -------------------------------------------------------------------------------- 1 | whatis: stub 2 | data: 3 | H: 1.008 4 | He: 4.002602 5 | Li: 6.94 6 | Be: 9.0121831 7 | B: 10.81 8 | C: 12.011 9 | N: 14.007 10 | O: 15.999 11 | F: 18.998403163 12 | Ne: 20.1797 13 | Na: 22.98976928 14 | Mg: 24.305 15 | Al: 26.9815385 16 | Si: 28.085 17 | P: 30.973761998 18 | S: 32.06 19 | Cl: 35.45 20 | Ar: 39.948 21 | K: 39.0983 22 | Ca: 40.078 23 | Sc: 44.955908 24 | Ti: 47.867 25 | V: 50.9415 26 | Cr: 51.9961 27 | Mn: 54.938044 28 | Fe: 55.845 29 | Co: 58.933194 30 | Ni: 58.6934 31 | Cu: 63.546 32 | Zn: 65.38 33 | Ga: 69.723 34 | Ge: 72.63 35 | As: 74.921595 36 | Se: 78.971 37 | Br: 79.904 38 | Kr: 83.798 39 | Rb: 85.4678 40 | Sr: 87.62 41 | Y: 88.90584 42 | Zr: 91.224 43 | Nb: 92.90637 44 | Mo: 95.95 45 | Tc: 97.90721 46 | Ru: 101.07 47 | Rh: 102.9055 48 | Pd: 106.42 49 | Ag: 107.8682 50 | Cd: 112.414 51 | In: 114.818 52 | Sn: 118.71 53 | Sb: 121.76 54 | Te: 127.6 55 | I: 126.90447 56 | Xe: 131.293 57 | Cs: 132.90545196 58 | Ba: 137.327 59 | La: 138.90547 60 | Ce: 140.116 61 | Pr: 140.90766 62 | Nd: 144.242 63 | Pm: 144.91276 64 | Sm: 150.36 65 | Eu: 151.964 66 | Gd: 157.25 67 | Tb: 158.92535 68 | Dy: 162.5 69 | Ho: 164.93033 70 | Er: 167.259 71 | Tm: 168.93422 72 | Yb: 173.045 73 | Lu: 174.9668 74 | Hf: 178.49 75 | Ta: 180.94788 76 | W: 183.84 77 | Re: 186.207 78 | Os: 190.23 79 | Ir: 192.217 80 | Pt: 195.084 81 | Au: 196.966569 82 | Hg: 200.592 83 | Tl: 204.38 84 | Pb: 207.2 85 | Bi: 208.9804 86 | Po: 209.0 87 | At: 210.0 88 | Rn: 222.0 89 | Fr: 223.0 90 | Ra: 226.0 91 | Ac: 227.0 92 | Th: 232.0377 93 | Pa: 231.03588 94 | U: 238.02891 95 | Np: 237.0 96 | Pu: 244.0 97 | Am: 243.0 98 | Cm: 247.0 99 | Bk: 247.0 100 | Cf: 251.0 101 | Es: 252.0 102 | Fm: 257.0 103 | Md: 258.0 104 | 'No': 259.0 105 | Lr: 262.0 106 | Rf: 267.0 107 | Db: 268.0 108 | Sg: 271.0 109 | Bh: 274.0 110 | Hs: 269.0 111 | Mt: 276.0 112 | Ds: 281.0 113 | Rg: 281.0 114 | Cn: 285.0 115 | Nh: 286.0 116 | Fl: 289.0 117 | Mc: 288.0 118 | Lv: 293.0 119 | Ts: 294.0 120 | Og: 294.0 -------------------------------------------------------------------------------- /molli/data/element.c6_grimme.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/data/element.c6_grimme.yml -------------------------------------------------------------------------------- /molli/data/element.color_cpk.yml: -------------------------------------------------------------------------------- 1 | whatis: stub 2 | data: 3 | H: '#ffffff' 4 | He: '#ffc0cb' 5 | Li: '#b22222' 6 | Be: '#ff1493' 7 | B: '#00ff00' 8 | C: '#c8c8c8' 9 | N: '#8f8fff' 10 | O: '#f00000' 11 | F: '#daa520' 12 | Ne: '#ff1493' 13 | Na: '#0000ff' 14 | Mg: '#228b22' 15 | Al: '#808090' 16 | Si: '#daa520' 17 | P: '#ffa500' 18 | S: '#ffc832' 19 | Cl: '#00ff00' 20 | Ar: '#ff1493' 21 | K: '#ff1493' 22 | Ca: '#808090' 23 | Sc: '#ff1493' 24 | Ti: '#808090' 25 | V: '#ff1493' 26 | Cr: '#808090' 27 | Mn: '#808090' 28 | Fe: '#ffa500' 29 | Co: '#ff1493' 30 | Ni: '#a52a2a' 31 | Cu: '#a52a2a' 32 | Zn: '#a52a2a' 33 | Ga: '#ff1493' 34 | Ge: '#ff1493' 35 | As: '#ff1493' 36 | Se: '#ff1493' 37 | Br: '#a52a2a' 38 | Kr: '#ff1493' 39 | Rb: '#ff1493' 40 | Sr: '#ff1493' 41 | Y: '#ff1493' 42 | Zr: '#ff1493' 43 | Nb: '#ff1493' 44 | Mo: '#ff1493' 45 | Tc: '#ff1493' 46 | Ru: '#ff1493' 47 | Rh: '#ff1493' 48 | Pd: '#ff1493' 49 | Ag: '#808090' 50 | Cd: '#ff1493' 51 | In: '#ff1493' 52 | Sn: '#ff1493' 53 | Sb: '#ff1493' 54 | Te: '#ff1493' 55 | I: '#a020f0' 56 | Xe: '#ff1493' 57 | Cs: '#ff1493' 58 | Ba: '#ffa500' 59 | La: '#ff1493' 60 | Ce: '#ff1493' 61 | Pr: '#ff1493' 62 | Nd: '#ff1493' 63 | Pm: '#ff1493' 64 | Sm: '#ff1493' 65 | Eu: '#ff1493' 66 | Gd: '#ff1493' 67 | Tb: '#ff1493' 68 | Dy: '#ff1493' 69 | Ho: '#ff1493' 70 | Er: '#ff1493' 71 | Tm: '#ff1493' 72 | Yb: '#ff1493' 73 | Lu: '#ff1493' 74 | Hf: '#ff1493' 75 | Ta: '#ff1493' 76 | W: '#ff1493' 77 | Re: '#ff1493' 78 | Os: '#ff1493' 79 | Ir: '#ff1493' 80 | Pt: '#ff1493' 81 | Au: '#daa520' 82 | Hg: '#ff1493' 83 | Tl: '#ff1493' 84 | Pb: '#ff1493' 85 | Bi: '#ff1493' 86 | Po: '#ff1493' 87 | At: '#ff1493' 88 | Rn: '#ffffff' 89 | Fr: '#ffffff' 90 | Ra: '#ffffff' 91 | Ac: '#ffffff' 92 | Th: '#ff1493' 93 | Pa: '#ffffff' 94 | U: '#ff1493' 95 | Np: '#ffffff' 96 | Pu: '#ffffff' 97 | Am: '#ffffff' 98 | Cm: '#ffffff' 99 | Bk: '#ffffff' 100 | Cf: '#ffffff' 101 | Es: '#ffffff' 102 | Fm: '#ffffff' 103 | Md: '#ffffff' 104 | 'No': '#ffffff' 105 | Lr: '#ffffff' -------------------------------------------------------------------------------- /molli/data/element.covalent_radius_1.yml: -------------------------------------------------------------------------------- 1 | whatis: 2 | description: | 3 | Covalent radii in single bonds. 4 | 5 | reference_doi: 6 | - 10.1021/jp5065819 7 | 8 | data: 9 | H: .32 10 | He: .46 11 | Li: 1.33 12 | Be: 1.02 13 | B: .85 14 | C: .75 15 | N: .71 16 | O: .63 17 | F: .64 18 | Ne: .67 19 | Na: 1.55 20 | Mg: 1.39 21 | Al: 1.26 22 | Si: 1.16 23 | P: 1.11 24 | S: 1.03 25 | Cl: .99 26 | Ar: .96 27 | K: 1.96 28 | Ca: 1.71 29 | Sc: 1.48 30 | Ti: 1.36 31 | V: 1.34 32 | Cr: 1.22 33 | Mn: 1.19 34 | Fe: 1.16 35 | Co: 1.11 36 | Ni: 1.10 37 | Cu: 1.12 38 | Zn: 1.18 39 | Ga: 1.24 40 | Ge: 1.21 41 | As: 1.21 42 | Se: 1.16 43 | Br: 1.14 44 | Kr: 1.17 45 | Rb: 2.10 46 | Sr: 1.85 47 | Y: 1.63 48 | Zr: 1.54 49 | Nb: 1.47 50 | Mo: 1.38 51 | Tc: 1.28 52 | Ru: 1.25 53 | Rh: 1.25 54 | Pd: 1.20 55 | Ag: 1.28 56 | Cd: 1.36 57 | In: 1.42 58 | Sn: 1.40 59 | Sb: 1.40 60 | Te: 1.36 61 | I: 1.33 62 | Xe: 1.31 63 | Cs: 2.32 64 | Ba: 1.96 65 | La: 1.80 66 | Ce: 1.63 67 | Pr: 1.76 68 | Nd: 1.74 69 | Pm: 1.73 70 | Sm: 1.72 71 | Eu: 1.68 72 | Gd: 1.69 73 | Tb: 1.68 74 | Dy: 1.67 75 | Ho: 1.66 76 | Er: 1.65 77 | Tm: 1.64 78 | Yb: 1.70 79 | Lu: 1.62 80 | Hf: 1.52 81 | Ta: 1.46 82 | W: 1.37 83 | Re: 1.31 84 | Os: 1.29 85 | Ir: 1.22 86 | Pt: 1.23 87 | Au: 1.24 88 | Hg: 1.33 89 | Tl: 1.44 90 | Pb: 1.44 91 | Bi: 1.51 92 | Po: 1.45 93 | At: 1.47 94 | Rn: 1.42 95 | Fr: 2.23 96 | Ra: 2.01 97 | Ac: 1.86 98 | Th: 1.75 99 | Pa: 1.69 100 | U: 1.70 101 | Np: 1.71 102 | Pu: 1.72 103 | Am: 1.66 104 | Cm: 1.66 105 | Bk: 1.68 106 | Cf: 1.68 107 | Es: 1.65 108 | Fm: 1.67 109 | Md: 1.73 110 | 'No': 176 111 | Lr: 1.61 112 | Rf: 1.57 113 | Db: 1.49 114 | Sg: 1.43 115 | Bh: 1.41 116 | Hs: 1.34 117 | Mt: 1.29 118 | Ds: 1.28 119 | Rg: 1.21 120 | Cn: 1.22 121 | Nh: 1.36 122 | Fl: 1.43 123 | Mc: 1.62 124 | Lv: 1.75 125 | Ts: 1.65 126 | Og: 1.57 -------------------------------------------------------------------------------- /molli/data/element.covalent_radius_2.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/data/element.covalent_radius_2.yml -------------------------------------------------------------------------------- /molli/data/element.covalent_radius_3.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/data/element.covalent_radius_3.yml -------------------------------------------------------------------------------- /molli/data/element.covalent_radius_grimme.yml: -------------------------------------------------------------------------------- 1 | whatis: 2 | description: | 3 | Covalent radii, where any metal has been scaled down by 10% for use with grimme's definition of covalent coordination number. 4 | 5 | reference_doi: 6 | - 10.1063/1.3382344 7 | 8 | data: 9 | H: 0.32 10 | He: 0.46 11 | Li: 1.2 12 | Be: 0.94 13 | B: 0.77 14 | C: 0.75 15 | N: 0.71 16 | O: 0.63 17 | F: 0.64 18 | Ne: 0.67 19 | Na: 1.4 20 | Mg: 1.25 21 | Al: 1.13 22 | Si: 1.04 23 | P: 1.1 24 | S: 1.02 25 | Cl: 0.99 26 | Ar: 0.96 27 | K: 1.76 28 | Ca: 1.54 29 | Sc: 1.33 30 | Ti: 1.22 31 | V: 1.21 32 | Cr: 1.1 33 | Mn: 1.07 34 | Fe: 1.04 35 | Co: 1.0 36 | Ni: 0.99 37 | Cu: 1.01 38 | Zn: 1.09 39 | Ga: 1.12 40 | Ge: 1.09 41 | As: 1.15 42 | Se: 1.1 43 | Br: 1.14 44 | Kr: 1.17 45 | Rb: 1.89 46 | Sr: 1.67 47 | Y: 1.47 48 | Zr: 1.39 49 | Nb: 1.32 50 | Mo: 1.24 51 | Tc: 1.15 52 | Ru: 1.13 53 | Rh: 1.13 54 | Pd: 1.08 55 | Ag: 1.15 56 | Cd: 1.23 57 | In: 1.28 58 | Sn: 1.26 59 | Sb: 1.26 60 | Te: 1.23 61 | I: 1.32 62 | Xe: 1.31 63 | Cs: 2.09 64 | Ba: 1.76 65 | La: 1.62 66 | Ce: 1.47 67 | Pr: 1.58 68 | Nd: 1.57 69 | Pm: 1.56 70 | Sm: 1.55 71 | Eu: 1.51 72 | Gd: 1.52 73 | Tb: 1.51 74 | Dy: 1.5 75 | Ho: 1.49 76 | Er: 1.49 77 | Tm: 1.48 78 | Yb: 1.53 79 | Lu: 1.46 80 | Hf: 1.37 81 | Ta: 1.31 82 | W: 1.23 83 | Re: 1.18 84 | Os: 1.16 85 | Ir: 1.11 86 | Pt: 1.12 87 | Au: 1.13 88 | Hg: 1.32 89 | Tl: 1.3 90 | Pb: 1.3 91 | Bi: 1.36 92 | Po: 1.31 93 | At: 1.38 94 | Rn: 1.42 95 | Fr: 2.01 96 | Ra: 1.81 97 | Ac: 1.67 98 | Th: 1.58 99 | Pa: 1.52 100 | U: 1.53 101 | Np: 1.54 102 | Pu: 1.55 103 | Am: 1.49 104 | Cm: 1.49 105 | Bk: 1.51 106 | Cf: 1.51 107 | Es: 1.49 108 | Fm: 1.5 109 | Md: 1.56 110 | 'No': 1.58 111 | Lr: 1.45 112 | Rf: 1.41 113 | Db: 1.34 114 | Sg: 1.29 115 | Bh: 1.27 116 | Hs: 1.21 117 | Mt: 1.16 118 | Ds: 1.15 119 | Rg: 1.09 120 | Cn: 1.1 121 | Nh: 1.22 122 | Fl: 1.29 123 | Mc: 1.46 124 | Lv: 1.57 125 | Ts: 1.65 126 | Og: 1.57 -------------------------------------------------------------------------------- /molli/data/element.electron_affinity.yml: -------------------------------------------------------------------------------- 1 | whatis: stub 2 | data: 3 | H: 0.754195 4 | He: -19.7 5 | Li: 0.618049 6 | Be: -2.4 7 | B: 0.279723 8 | C: 1.262119 9 | N: -1.4 10 | O: 1.4611135 11 | F: 3.401189700000001 12 | Ne: .nan 13 | Na: 0.547926 14 | Mg: .nan 15 | Al: 0.43283 16 | Si: 1.3895211 17 | P: 0.746607 18 | S: 2.07710403 19 | Cl: 3.612725 20 | Ar: -11.5 21 | K: 0.50147 22 | Ca: 0.02455 23 | Sc: 0.188 24 | Ti: 0.079 25 | V: 0.525 26 | Cr: 0.6659999999999999 27 | Mn: .nan 28 | Fe: 0.151 29 | Co: 0.66225646 30 | Ni: 1.156 31 | Cu: 1.235 32 | Zn: .nan 33 | Ga: 0.43 34 | Ge: 1.232712 35 | As: 0.804 36 | Se: 2.02067 37 | Br: 3.363588200000001 38 | Kr: .nan 39 | Rb: 0.48592 40 | Sr: 0.048 41 | Y: 0.307 42 | Zr: 0.426 43 | Nb: 0.917406 44 | Mo: 0.748 45 | Tc: 0.55 46 | Ru: 1.05 47 | Rh: 1.137 48 | Pd: 0.562 49 | Ag: 1.302 50 | Cd: .nan 51 | In: 0.3 52 | Sn: 1.112067 53 | Sb: 1.046 54 | Te: 1.970876 55 | I: 3.0590368 56 | Xe: -0.05599999999999999 57 | Cs: 0.471626 58 | Ba: 0.14462 59 | La: 0.47 60 | Ce: 0.65 61 | Pr: 0.9620000000000001 62 | Nd: 1.916 63 | Pm: .nan 64 | Sm: .nan 65 | Eu: 0.8640000000000001 66 | Gd: .nan 67 | Tb: 1.165 68 | Dy: 0.352 69 | Ho: .nan 70 | Er: .nan 71 | Tm: 1.029 72 | Yb: -0.02 73 | Lu: 0.34 74 | Hf: 0.014 75 | Ta: 0.322 76 | W: 0.81626 77 | Re: 0.15 78 | Os: 1.1 79 | Ir: 1.5638 80 | Pt: 2.128 81 | Au: 2.30863 82 | Hg: .nan 83 | Tl: 0.377 84 | Pb: 0.35674316 85 | Bi: 0.942362 86 | Po: 1.9 87 | At: 2.8 88 | Rn: .nan 89 | Fr: 0.486 90 | Ra: 0.1 91 | Ac: 0.35 92 | Th: .nan 93 | Pa: .nan 94 | U: .nan 95 | Np: .nan 96 | Pu: .nan 97 | Am: .nan 98 | Cm: .nan 99 | Bk: .nan 100 | Cf: .nan 101 | Es: .nan 102 | Fm: .nan 103 | Md: .nan 104 | 'No': .nan 105 | Lr: .nan 106 | Rf: .nan 107 | Db: .nan 108 | Sg: .nan 109 | Bh: .nan 110 | Hs: .nan 111 | Mt: .nan 112 | Ds: .nan 113 | Rg: .nan 114 | Cn: .nan 115 | Nh: .nan 116 | Fl: .nan 117 | Mc: .nan 118 | Lv: .nan 119 | Ts: .nan 120 | Og: 0.05599999999999999 -------------------------------------------------------------------------------- /molli/data/element.en_pauling.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/data/element.en_pauling.yml -------------------------------------------------------------------------------- /molli/data/element.group.yml: -------------------------------------------------------------------------------- 1 | whatis: Element group 2 | data: 3 | H: 1 4 | He: 18 5 | Li: 1 6 | Be: 2 7 | B: 13 8 | C: 14 9 | N: 15 10 | O: 16 11 | F: 17 12 | Ne: 18 13 | Na: 1 14 | Mg: 2 15 | Al: 13 16 | Si: 14 17 | P: 15 18 | S: 16 19 | Cl: 17 20 | Ar: 18 21 | K: 1 22 | Ca: 2 23 | Sc: 3 24 | Ti: 4 25 | V: 5 26 | Cr: 6 27 | Mn: 7 28 | Fe: 8 29 | Co: 9 30 | Ni: 10 31 | Cu: 11 32 | Zn: 12 33 | Ga: 13 34 | Ge: 14 35 | As: 15 36 | Se: 16 37 | Br: 17 38 | Kr: 18 39 | Rb: 1 40 | Sr: 2 41 | Y: 3 42 | Zr: 4 43 | Nb: 5 44 | Mo: 6 45 | Tc: 7 46 | Ru: 8 47 | Rh: 9 48 | Pd: 10 49 | Ag: 11 50 | Cd: 12 51 | In: 13 52 | Sn: 14 53 | Sb: 15 54 | Te: 16 55 | I: 17 56 | Xe: 18 57 | Cs: 1 58 | Ba: 2 59 | La: 3 60 | Ce: 3 61 | Pr: 3 62 | Nd: 3 63 | Pm: 3 64 | Sm: 3 65 | Eu: 3 66 | Gd: 3 67 | Tb: 3 68 | Dy: 3 69 | Ho: 3 70 | Er: 3 71 | Tm: 3 72 | Yb: 3 73 | Lu: 3 74 | Hf: 4 75 | Ta: 5 76 | W: 6 77 | Re: 7 78 | Os: 8 79 | Ir: 9 80 | Pt: 10 81 | Au: 11 82 | Hg: 12 83 | Tl: 13 84 | Pb: 14 85 | Bi: 15 86 | Po: 16 87 | At: 17 88 | Rn: 18 89 | Fr: 1 90 | Ra: 2 91 | Ac: 3 92 | Th: 3 93 | Pa: 3 94 | U: 3 95 | Np: 3 96 | Pu: 3 97 | Am: 3 98 | Cm: 3 99 | Bk: 3 100 | Cf: 3 101 | Es: 3 102 | Fm: 3 103 | Md: 3 104 | 'No': 3 105 | Lr: 3 106 | Rf: 4 107 | Db: 5 108 | Sg: 6 109 | Bh: 7 110 | Hs: 8 111 | Mt: 9 112 | Ds: 10 113 | Rg: 11 114 | Cn: 12 115 | Nh: 13 116 | Fl: 14 117 | Mc: 15 118 | Lv: 16 119 | Ts: 17 120 | Og: 18 -------------------------------------------------------------------------------- /molli/data/element.vdw_radius.yml: -------------------------------------------------------------------------------- 1 | whatis: 2 | description: | 3 | van der Waals radii collected from multiple sources 4 | 5 | units: distance/A 6 | 7 | reference_doi: 8 | - 10.1021/jp8111556 9 | - 10.1021/j100785a001 10 | 11 | data: 12 | H: 1.100 13 | He: 1.400 14 | Li: 1.820 15 | Be: 1.530 16 | B: 1.920 17 | C: 1.700 18 | N: 1.550 19 | O: 1.520 20 | F: 1.470 21 | Ne: 1.540 22 | Na: 2.270 23 | Mg: 1.730 24 | Al: 1.840 25 | Si: 2.100 26 | P: 1.800 27 | S: 1.800 28 | Cl: 1.750 29 | Ar: 1.880 30 | K: 2.750 31 | Ca: 2.310 32 | Sc: 2.150 33 | Ti: 2.110 34 | V: 2.070 35 | Cr: 2.060 36 | Mn: 2.050 37 | Fe: 2.040 38 | Co: 2.000 39 | Ni: 1.970 40 | Cu: 1.960 41 | Zn: 2.010 42 | Ga: 1.870 43 | Ge: 2.110 44 | As: 1.850 45 | Se: 1.900 46 | Br: 1.850 47 | Kr: 2.020 48 | Rb: 3.030 49 | Sr: 2.490 50 | Y: 2.320 51 | Zr: 2.230 52 | Nb: 2.180 53 | Mo: 2.170 54 | Tc: 2.160 55 | Ru: 2.130 56 | Rh: 2.100 57 | Pd: 2.100 58 | Ag: 2.110 59 | Cd: 2.180 60 | In: 1.930 61 | Sn: 2.170 62 | Sb: 2.060 63 | Te: 2.060 64 | I: 1.980 65 | Xe: 2.160 66 | Cs: 3.430 67 | Ba: 2.680 68 | La: 2.430 69 | Ce: 2.420 70 | Pr: 2.400 71 | Nd: 2.390 72 | Pm: 2.380 73 | Sm: 2.360 74 | Eu: 2.350 75 | Gd: 2.340 76 | Tb: 2.330 77 | Dy: 2.310 78 | Ho: 2.300 79 | Er: 2.290 80 | Tm: 2.270 81 | Yb: 2.260 82 | Lu: 2.240 83 | Hf: 2.230 84 | Ta: 2.220 85 | W: 2.180 86 | Re: 2.160 87 | Os: 2.160 88 | Ir: 2.130 89 | Pt: 2.130 90 | Au: 2.140 91 | Hg: 2.230 92 | Tl: 1.960 93 | Pb: 2.020 94 | Bi: 2.070 95 | Po: 1.970 96 | At: 2.020 97 | Rn: 2.200 98 | Fr: 3.480 99 | Ra: 2.830 100 | Ac: 2.470 101 | Th: 2.450 102 | Pa: 2.430 103 | U: 2.410 104 | Np: 2.390 105 | Pu: 2.430 106 | Am: 2.440 107 | Cm: 2.450 108 | Bk: 2.440 109 | Cf: 2.450 110 | Es: 2.450 111 | Fm: 2.450 112 | Md: 2.460 113 | 'No': 2.460 114 | Lr: 2.460 115 | Rf: .nan 116 | Db: .nan 117 | Sg: .nan 118 | Bh: .nan 119 | Hs: .nan 120 | Mt: .nan 121 | Ds: .nan 122 | Rg: .nan 123 | Cn: .nan 124 | Nh: .nan 125 | Fl: .nan 126 | Mc: .nan 127 | Lv: .nan 128 | Ts: .nan 129 | Og: .nan -------------------------------------------------------------------------------- /molli/data/isotope.exact_mass.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/data/isotope.exact_mass.yml -------------------------------------------------------------------------------- /molli/descriptor/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This submodule deals with the descriptor calculation. 23 | The ones provided here are primarily focused on grid-based descriptors. 24 | """ 25 | 26 | from .cov_cn import dftd_coordination_number 27 | from .gridbased import * 28 | -------------------------------------------------------------------------------- /molli/descriptor/aso.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | # `molli.descriptor.aso` 23 | This module defines the functions necessary to calculate ASO 24 | (Average Steric Occupancy Descriptor) 25 | 26 | See 27 | Zahrt AF, Henle JJ, Rose BT, Wang Y, Darrow WT, Denmark SE. Science 2019, 363 (6424), eaau5631. 28 | Henle JJ, Zahrt AF, Rose BT, Darrow WT, Wang Y, Denmark SE. Journal of the American Chemical Society 2020, 142 (26), 11578-11592. 29 | for definitions 30 | """ 31 | 32 | from ..chem import Molecule, ConformerEnsemble 33 | from concurrent.futures import ThreadPoolExecutor, Future 34 | import numpy as np 35 | from math import dist 36 | import molli_xt 37 | import deprecated 38 | 39 | 40 | def _where_distance(p, g: np.ndarray, r: float): 41 | """ 42 | Return a numpy array of where point is within radius from gridpoints 43 | """ 44 | 45 | diff = g - p 46 | dists = np.sum(diff**2, axis=-1) 47 | 48 | return dists <= r**2 49 | 50 | 51 | @deprecated.deprecated( 52 | "This function is left for compatibility and testing purposes only." 53 | "While it is more readable, due to pure Python for loops it is relatively slow." 54 | ) 55 | def aso1( 56 | ens: ConformerEnsemble, 57 | grid: np.ndarray, 58 | weighted: bool = False, 59 | ) -> np.ndarray: 60 | aso_full = np.empty((ens.n_conformers, grid.shape[0])) 61 | 62 | # Iterate over conformers in the ensemble 63 | # Complexity (O(n_confs * n_gpts)) 64 | for i, c in enumerate(ens): 65 | # Iterate over atoms 66 | for j, a in enumerate(c.atoms): 67 | aso_full[i][_where_distance(c.coords[j], grid, a.vdw_radius)] = 1 68 | 69 | return np.average( 70 | aso_full, 71 | axis=0, 72 | weights=ens.weights if weighted else None, 73 | ) 74 | 75 | 76 | def aso2( 77 | ens: ConformerEnsemble, 78 | grid: np.ndarray, 79 | weighted: bool = False, 80 | ) -> np.ndarray: 81 | """ 82 | Main workhorse function for ASO calculation that takes advantage of C++ backend code whenever possible. 83 | With large grids can be relatively memory intensive, so breaking up the grid into smaller pieces is recommended 84 | (see "chunky" calculation strategy) 85 | """ 86 | alldist = molli_xt.cdist32_eu2(ens._coords, grid) 87 | vdwr2s = np.array([a.vdw_radius for a in ens.atoms]) ** 2 88 | diff = alldist <= vdwr2s[:, None] 89 | 90 | return np.average( 91 | np.any(diff, axis=1), 92 | axis=0, 93 | weights=ens.weights if weighted else None, 94 | ) 95 | -------------------------------------------------------------------------------- /molli/descriptor/cov_cn.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Blake E. Ocampo 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | # `molli.descriptor.cov_cn` 23 | 24 | This defines the covalent coordination number calculator. 25 | """ 26 | 27 | from ..chem import Molecule, Atom, AtomLike, Substructure 28 | import numpy as np 29 | 30 | 31 | def dftd_coordination_number(mol: Molecule, a: AtomLike): 32 | """ 33 | This is the coordination number defined by Grimme in "https://doi.org/10.1063/1.3382344". 34 | All covalent radii for metals will be scaled down by 10%, and is built to error if the element used is not 1-94. 35 | 36 | This defines a coordination number for individual atoms based on the location of all atoms 37 | 38 | Could use some additional boundary cases, but is currently functioning the way it was implemented by Grimme. 39 | """ 40 | 41 | k1 = 16 42 | k2 = 4 / 3 43 | 44 | a1 = mol.get_atom(a) 45 | 46 | # assert 0 < max(elem_list := [a.element.z for a in mol.atoms]) < 94, f'There are elements for in this list that do not fall between 1 to 94! {elem_list}' 47 | assert all( 48 | 0 < a.element < 94 for a in mol.atoms 49 | ), f"There are elements for in this list that do not fall between 1 to 94!" 50 | 51 | ra1_cov = a1.element.cov_radius_grimme 52 | # This creates an "atom2" array where the atom is not equal to atom1 53 | a2_list: list[Atom] = [atom for atom in mol.atoms if atom != a1] 54 | 55 | # This creates an array matching grimme covalent radii to each atom in atom2 56 | ra2_cov_arr = np.array([atom.element.cov_radius_grimme for atom in a2_list]) 57 | # This is an array of all of the magnitudes of the vector a1 -> a2 multiplied by the constant k2 58 | # Coordinates of atom1 (shape = (1,3) ) and array of atom2 (shape = (n_atoms-1,3) ) 59 | a1_coords = mol.coord_subset([a1]) 60 | a2_coord_arr = mol.coord_subset(a2_list) 61 | 62 | # This line finds the magnitude of each row with shape of (n_atoms-1,1) (new radius vector) 63 | rab = np.linalg.norm( 64 | a2_coord_arr - a1_coords, axis=1 65 | ) # this can potentially be rewritten using molli_xt (~10x faster) 66 | inn = -k1 * (k2 * (ra1_cov + ra2_cov_arr) / rab - 1) 67 | 68 | e = 1 + np.exp(inn) 69 | cn = np.sum(1 / e) 70 | 71 | return cn 72 | -------------------------------------------------------------------------------- /molli/external/__init__.py: -------------------------------------------------------------------------------- 1 | # This file can be left empty. It serves to indicate a valid submodule. 2 | # The respective sub-submodules are meant to be loaded "lazily" so as not to invoke 3 | # unnecessary dependencies before they might become necessary. 4 | 5 | class RDKitException(Exception): 6 | "Raised when RDKit fails during Molecule Creation" 7 | pass 8 | 9 | class RDKitKekulizationException(RDKitException): 10 | "Raised when RDKit fails to kekulize during Molecule Creation" -------------------------------------------------------------------------------- /molli/files/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # Blake E. Ocampo 7 | # Casey L. Olen 8 | # Elena S. Burlova 9 | # 10 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 11 | # https://denmarkgroup.illinois.edu/ 12 | # 13 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 14 | # All Rights Reserved. 15 | # 16 | # Licensed under the terms MIT License 17 | # The License is included in the distribution as LICENSE file. 18 | # You may not use this file except in compliance with the License. 19 | # 20 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 21 | # ================================================================================ 22 | 23 | 24 | """ 25 | This module defines paths to sample files that can be used for testing or initial development of some code. 26 | """ 27 | 28 | 29 | from pathlib import Path 30 | 31 | ROOT = Path(__file__).parent.absolute() 32 | 33 | 34 | dendrobine_mol2 = ROOT / "dendrobine.mol2" 35 | nanotube_mol2 = ROOT / "nanotube.mol2" 36 | hadd_test_mol2 = ROOT / "hadd_test.mol2" 37 | pdb_4a05_mol2 = ROOT / "pdb_4a05.mol2" 38 | pentane_confs_mol2 = ROOT / "pentane_confs.mol2" 39 | zincdb_fda_mol2 = ROOT / "zincdb_fda.mol2" 40 | dummy_mol2 = ROOT / "dummy.mol2" 41 | fxyl_mol2 = ROOT / "fxyl.mol2" 42 | dmf_mol2 = ROOT / "dmf.mol2" 43 | bpa_backbone_mol2 = ROOT / "bpa_core.mol2" 44 | box_backbone_mol2 = ROOT / "box_alignment_core.mol2" 45 | isornitrate_mol2 = ROOT / "isornitrate.mol2" 46 | 47 | benzene_mol2 = ROOT / "benzene.mol2" 48 | dmf_mol2 = ROOT / "dmf.mol2" 49 | 50 | 51 | cinchonidine_query = ROOT / "cinchonidine_query.mol2" 52 | cinchonidine_mcs = ROOT / "cinchonidine_mcs.mol2" 53 | 54 | 55 | dendrobine_xyz = ROOT / "dendrobine.xyz" 56 | pentane_confs_xyz = ROOT / "pentane_confs.xyz" 57 | dummy_xyz = ROOT / "dummy.xyz" 58 | 59 | # SDF V3000 MOL molecules 60 | dendrobine_molv3 = ROOT / "dendrobine.mol" 61 | zincdb_fda_molv3 = ROOT / "zincdb_fda.mol" 62 | pentane_confs_molv3 = ROOT / "pentane_confs.mol" 63 | 64 | substituents_cdxml = ROOT / "substituents.cdxml" 65 | parser_demo_cdxml = ROOT / "parser_demo.cdxml" 66 | parser_demo2_cdxml = ROOT / "parser_demo2.cdxml" 67 | charges_mult_cdxml = ROOT / "charges_mult.cdxml" 68 | 69 | oldstyle_xml = ROOT / "oldstyle.xml" 70 | 71 | tiny_bpa_raw_conf = ROOT / "tiny_test_bpa_raw_conf.mlib" 72 | box_no_conf = ROOT / "box_ligands.mlib" 73 | cinchonidine_no_conf = ROOT / "cinchonidine.mlib" 74 | cinchonidine_rd_conf = ROOT / "cinchonidine_rdconfs.clib" 75 | fletcher_phosphoramidite = ROOT / "fletcher_phosphoramidite_cats.mlib" 76 | test_mol2_zip = ROOT / "test_mol2s.zip" 77 | test_mol2_ml02_zip = ROOT / "test_mol2s_ml02.zip" 78 | 79 | BOX_4_position = ROOT / "BOX_4position_fragments.cdxml" 80 | BOX_cores = ROOT / "BOX_cores.cdxml" 81 | BOX_bridge = ROOT / "BOX_bridging_fragments.cdxml" 82 | -------------------------------------------------------------------------------- /molli/files/benzene.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | benzene 3 | 12 12 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -2.4242 1.1348 -0.0000 C.ar 1 UNL1 -0.0618 9 | 2 C -3.6983 0.5672 -0.0000 C.ar 1 UNL1 -0.0618 10 | 3 C -3.8438 -0.8200 -0.0000 C.ar 1 UNL1 -0.0618 11 | 4 C -2.7152 -1.6396 -0.0000 C.ar 1 UNL1 -0.0618 12 | 5 C -1.4411 -1.0720 -0.0000 C.ar 1 UNL1 -0.0618 13 | 6 C -1.2956 0.3152 -0.0000 C.ar 1 UNL1 -0.0618 14 | 7 H -2.3108 2.2156 -0.0000 H 1 UNL1 0.0618 15 | 8 H -4.5776 1.2058 -0.0000 H 1 UNL1 0.0618 16 | 9 H -4.8365 -1.2622 -0.0000 H 1 UNL1 0.0618 17 | 10 H -2.8286 -2.7204 -0.0000 H 1 UNL1 0.0618 18 | 11 H -0.5618 -1.7106 0.0000 H 1 UNL1 0.0618 19 | 12 H -0.3029 0.7574 0.0000 H 1 UNL1 0.0618 20 | @BOND 21 | 1 1 2 ar 22 | 2 2 3 ar 23 | 3 3 4 ar 24 | 4 4 5 ar 25 | 5 5 6 ar 26 | 6 6 1 ar 27 | 7 1 7 1 28 | 8 2 8 1 29 | 9 3 9 1 30 | 10 4 10 1 31 | 11 5 11 1 32 | 12 6 12 1 33 | -------------------------------------------------------------------------------- /molli/files/box_alignment_core.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | ***** 3 | 19 20 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C 2.0885 -0.0209 0.1357 C.3 1 UNL111 0.0959 9 | 2 C 2.5312 -1.2553 0.8102 C.3 1 UNL111 0.1916 10 | 3 N 3.2330 -1.2637 1.8719 N.3 1 UNL111 -0.2009 11 | 4 C 3.5105 -2.6443 2.3180 C.3 1 UNL111 0.0406 12 | 5 C 2.8219 -3.4462 1.2282 C.3 1 UNL111 0.0644 13 | 6 O 2.2262 -2.4662 0.3609 O.3 1 UNL111 -0.3512 14 | 7 C 2.5437 1.2110 0.8065 C.3 1 UNL111 0.1916 15 | 8 N 3.2485 1.2155 1.8662 N.3 1 UNL111 -0.2009 16 | 9 C 3.5568 2.5946 2.2967 C.3 1 UNL111 0.0406 17 | 10 C 2.8242 3.4004 1.2390 C.3 1 UNL111 0.0644 18 | 11 O 2.2534 2.4235 0.3518 O.3 1 UNL111 -0.3512 19 | 12 H 3.0619 -2.8149 3.2997 H 1 UNL111 0.0464 20 | 13 H 4.5878 -2.8236 2.3447 H 1 UNL111 0.0464 21 | 14 H 2.0394 -4.0989 1.6277 H 1 UNL111 0.0574 22 | 15 H 3.5289 -4.0516 0.6520 H 1 UNL111 0.0574 23 | 16 H 4.6362 2.7613 2.2656 H 1 UNL111 0.0464 24 | 17 H 3.1629 2.7744 3.2998 H 1 UNL111 0.0464 25 | 18 H 3.4995 4.0508 0.6742 H 1 UNL111 0.0574 26 | 19 H 2.0208 4.0088 1.6664 H 1 UNL111 0.0574 27 | @BOND 28 | 1 1 2 1 29 | 2 1 7 1 30 | 3 2 3 1 31 | 4 2 6 1 32 | 5 3 4 1 33 | 6 4 5 1 34 | 7 4 12 1 35 | 8 4 13 1 36 | 9 5 6 1 37 | 10 5 14 1 38 | 11 5 15 1 39 | 12 7 8 1 40 | 13 7 11 1 41 | 14 8 9 1 42 | 15 9 10 1 43 | 16 9 16 1 44 | 17 9 17 1 45 | 18 10 11 1 46 | 19 10 18 1 47 | 20 10 19 1 48 | -------------------------------------------------------------------------------- /molli/files/box_ligands.mlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/box_ligands.mlib -------------------------------------------------------------------------------- /molli/files/bpa_core.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | ***** 3 | 25 27 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -3.7810 0.4129 -0.1319 C.ar 1 UNL1 0.0277 9 | 2 C -2.7729 1.2674 0.3431 C.ar 1 UNL1 0.1365 10 | 3 C -2.8999 2.6553 0.2954 C.ar 1 UNL1 -0.0189 11 | 4 C -4.0432 3.2252 -0.2578 C.ar 1 UNL1 -0.0583 12 | 5 C -5.0562 2.4044 -0.7501 C.ar 1 UNL1 -0.0610 13 | 6 C -4.9259 1.0123 -0.6868 C.ar 1 UNL1 -0.0504 14 | 7 C -3.6361 -1.0539 -0.0595 C.ar 1 UNL1 0.0277 15 | 8 C -2.4381 -1.6854 -0.4310 C.ar 1 UNL1 0.1365 16 | 9 C -2.2893 -3.0710 -0.3821 C.ar 1 UNL1 -0.0189 17 | 10 C -3.3419 -3.8629 0.0683 C.ar 1 UNL1 -0.0583 18 | 11 C -4.5396 -3.2655 0.4568 C.ar 1 UNL1 -0.0610 19 | 12 C -4.6847 -1.8749 0.3926 C.ar 1 UNL1 -0.0504 20 | 13 O -1.6559 0.7536 0.9446 O.3 1 UNL1 -0.4324 21 | 14 O -1.3954 -0.9533 -0.9315 O.3 1 UNL1 -0.4324 22 | 15 H -2.0933 3.2774 0.6730 H 1 UNL1 0.0654 23 | 16 H -4.1352 4.3056 -0.3125 H 1 UNL1 0.0619 24 | 17 H -5.9442 2.8452 -1.1935 H 1 UNL1 0.0618 25 | 18 H -5.7201 0.3923 -1.0950 H 1 UNL1 0.0625 26 | 19 H -1.3432 -3.5160 -0.6774 H 1 UNL1 0.0654 27 | 20 H -3.2209 -4.9403 0.1246 H 1 UNL1 0.0619 28 | 21 H -5.3589 -3.8789 0.8203 H 1 UNL1 0.0618 29 | 22 H -5.6210 -1.4298 0.7196 H 1 UNL1 0.0625 30 | 23 P -0.5094 0.0030 0.0541 P.3 1 UNL1 0.3264 31 | 24 O 0.1883 1.0409 -0.8001 O.2 1 UNL1 -0.4990 32 | 25 O 0.2997 -0.8826 0.9788 O.3 1 UNL1 -0.4172 33 | @BOND 34 | 1 1 2 ar 35 | 2 2 3 ar 36 | 3 3 4 ar 37 | 4 4 5 ar 38 | 5 5 6 ar 39 | 6 6 1 ar 40 | 7 1 7 1 41 | 8 7 8 ar 42 | 9 8 9 ar 43 | 10 9 10 ar 44 | 11 10 11 ar 45 | 12 11 12 ar 46 | 13 12 7 ar 47 | 14 2 13 1 48 | 15 8 14 1 49 | 16 3 15 1 50 | 17 4 16 1 51 | 18 5 17 1 52 | 19 6 18 1 53 | 20 9 19 1 54 | 21 10 20 1 55 | 22 11 21 1 56 | 23 12 22 1 57 | 24 23 13 1 58 | 25 14 23 1 59 | 26 23 24 2 60 | 27 23 25 1 61 | -------------------------------------------------------------------------------- /molli/files/cinchonidine.mlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/cinchonidine.mlib -------------------------------------------------------------------------------- /molli/files/cinchonidine_query.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | ***** 3 | 21 22 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -2.7499 0.7346 1.7243 C.3 1 UNL111 -0.0230 9 | 2 C -0.8304 0.1910 0.1464 C.3 1 UNL111 0.0127 10 | 3 C -3.0735 0.7681 -0.7801 C.3 1 UNL111 0.0016 11 | 4 N -2.0932 -0.3933 -0.5356 N.4 1 UNL111 0.3383 12 | 5 C -3.4912 1.4463 0.5493 C.3 1 UNL111 0.0119 13 | 6 C -1.2188 0.8023 1.5115 C.3 1 UNL111 -0.0044 14 | 7 C -2.7770 -1.4054 0.3991 C.3 1 UNL111 -0.0018 15 | 8 C -3.1693 -0.7538 1.7370 C.3 1 UNL111 -0.0075 16 | 9 C 0.3186 -0.8301 0.2808 C.3 1 UNL111 0.0204 17 | 10 H -3.0205 1.2211 2.6753 H 1 UNL111 0.0309 18 | 11 H -0.4843 0.9992 -0.5104 H 1 UNL111 0.0870 19 | 12 H -3.9397 0.3894 -1.3270 H 1 UNL111 0.0833 20 | 13 H -2.5936 1.4977 -1.4319 H 1 UNL111 0.0833 21 | 14 H -4.5701 1.2743 0.6971 H 1 UNL111 0.0360 22 | 15 H -0.8492 1.8291 1.6084 H 1 UNL111 0.0323 23 | 16 H -0.7242 0.2311 2.3028 H 1 UNL111 0.0323 24 | 17 H -2.0910 -2.2395 0.5579 H 1 UNL111 0.0830 25 | 18 H -3.6502 -1.8158 -0.1139 H 1 UNL111 0.0830 26 | 19 H -4.2483 -0.8421 1.9125 H 1 UNL111 0.0320 27 | 20 H -2.6852 -1.2722 2.5738 H 1 UNL111 0.0320 28 | 21 H 0.5288 -1.2626 -0.7055 H 1 UNL111 0.0365 29 | @BOND 30 | 1 1 5 1 31 | 2 1 6 1 32 | 3 2 4 1 33 | 4 2 6 1 34 | 5 3 5 1 35 | 6 3 4 1 36 | 7 4 7 1 37 | 8 1 8 1 38 | 9 8 7 1 39 | 10 2 9 1 40 | 11 1 10 1 41 | 12 2 11 1 42 | 13 3 12 1 43 | 14 3 13 1 44 | 15 5 14 1 45 | 16 6 15 1 46 | 17 6 16 1 47 | 18 7 17 1 48 | 19 7 18 1 49 | 20 8 19 1 50 | 21 8 20 1 51 | 22 9 21 1 52 | -------------------------------------------------------------------------------- /molli/files/cinchonidine_rdconfs.clib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/cinchonidine_rdconfs.clib -------------------------------------------------------------------------------- /molli/files/dendrobine.mol: -------------------------------------------------------------------------------- 1 | dendrobine 2 | OpenBabel02262423333D 3 | 4 | 0 0 0 0 0 999 V3000 5 | M V30 BEGIN CTAB 6 | M V30 COUNTS 44 47 0 0 1 7 | M V30 BEGIN ATOM 8 | M V30 1 N 1.296 -0.2319 1.267 0 9 | M V30 2 C 0.0573 -0.0226 2.1227 0 10 | M V30 3 C -1.0974 -0.4738 1.2059 0 11 | M V30 4 C -0.4284 -0.4113 -0.1687 0 12 | M V30 5 C 0.8683 0.3598 -0.0004 0 13 | M V30 6 C 2.4562 0.4417 1.8361 0 14 | M V30 7 C -2.4328 0.2659 0.9832 0 15 | M V30 8 C -2.6553 0.2472 -0.5801 0 16 | M V30 9 C -1.2428 0.5626 -1.0163 0 17 | M V30 10 C 1.5353 0.579 -1.4179 0 18 | M V30 11 O 1.341 2.0363 -1.6507 0 19 | M V30 12 C 0.0782 2.2291 -2.2166 0 20 | M V30 13 C -0.5977 0.8539 -2.402 0 21 | M V30 14 O -0.4135 3.318 -2.4552 0 22 | M V30 15 C 0.7602 0.1678 -2.7001 0 23 | M V30 16 C 0.7812 -1.2141 -3.3773 0 24 | M V30 17 H 1.2426 0.7684 -3.4982 0 25 | M V30 18 H -1.1794 1.558 -0.5377 0 26 | M V30 19 H 0.6516 1.3952 0.3174 0 27 | M V30 20 H -1.3722 -1.491 1.5134 0 28 | M V30 21 C -0.2828 -1.8835 -0.5957 0 29 | M V30 22 C 2.1775 -1.8412 -3.3215 0 30 | M V30 23 C 0.3485 -1.1006 -4.8514 0 31 | M V30 24 H 0.059 -1.9009 -2.9478 0 32 | M V30 25 H -0.0649 1.0264 2.4198 0 33 | M V30 26 H 0.1162 -0.6408 3.0244 0 34 | M V30 27 H 2.715 -0.0049 2.8019 0 35 | M V30 28 H 2.2927 1.5147 1.9874 0 36 | M V30 29 H 3.3255 0.3162 1.1818 0 37 | M V30 30 H -2.3716 1.2962 1.3534 0 38 | M V30 31 H -3.2639 -0.2261 1.4982 0 39 | M V30 32 H -3.381 1.0069 -0.8836 0 40 | M V30 33 H -2.9934 -0.7358 -0.9222 0 41 | M V30 34 H 2.6088 0.3798 -1.4394 0 42 | M V30 35 H -1.2929 0.8772 -3.2423 0 43 | M V30 36 H -0.3075 -2.5854 0.2475 0 44 | M V30 37 H 0.692 -2.089 -1.0319 0 45 | M V30 38 H -1.0943 -2.1904 -1.2614 0 46 | M V30 39 H 2.1795 -2.8241 -3.8049 0 47 | M V30 40 H 2.5176 -1.9822 -2.2914 0 48 | M V30 41 H 2.9143 -1.2135 -3.8343 0 49 | M V30 42 H 0.3522 -2.0859 -5.3307 0 50 | M V30 43 H 1.0232 -0.452 -5.421 0 51 | M V30 44 H -0.6652 -0.6967 -4.9346 0 52 | M V30 END ATOM 53 | M V30 BEGIN BOND 54 | M V30 1 1 5 1 55 | M V30 2 1 1 6 56 | M V30 3 1 1 2 57 | M V30 4 1 3 2 58 | M V30 5 1 2 25 59 | M V30 6 1 2 26 60 | M V30 7 1 4 3 61 | M V30 8 1 7 3 62 | M V30 9 1 3 20 63 | M V30 10 1 9 4 64 | M V30 11 1 21 4 65 | M V30 12 1 4 5 66 | M V30 13 1 10 5 67 | M V30 14 1 5 19 68 | M V30 15 1 29 6 69 | M V30 16 1 6 28 70 | M V30 17 1 6 27 71 | M V30 18 1 8 7 72 | M V30 19 1 7 30 73 | M V30 20 1 7 31 74 | M V30 21 1 9 8 75 | M V30 22 1 33 8 76 | M V30 23 1 32 8 77 | M V30 24 1 13 9 78 | M V30 25 1 9 18 79 | M V30 26 1 15 10 80 | M V30 27 1 11 10 81 | M V30 28 1 34 10 82 | M V30 29 1 12 11 83 | M V30 30 2 14 12 84 | M V30 31 1 13 12 85 | M V30 32 1 35 13 86 | M V30 33 1 15 13 87 | M V30 34 1 17 15 88 | M V30 35 1 16 15 89 | M V30 36 1 23 16 90 | M V30 37 1 16 22 91 | M V30 38 1 16 24 92 | M V30 39 1 38 21 93 | M V30 40 1 37 21 94 | M V30 41 1 21 36 95 | M V30 42 1 41 22 96 | M V30 43 1 39 22 97 | M V30 44 1 22 40 98 | M V30 45 1 43 23 99 | M V30 46 1 42 23 100 | M V30 47 1 44 23 101 | M V30 END BOND 102 | M V30 END CTAB 103 | M END 104 | -------------------------------------------------------------------------------- /molli/files/dendrobine.xyz: -------------------------------------------------------------------------------- 1 | 44 2 | dendrobine 3 | N 1.29605 -0.23189 1.26701 4 | C 0.05733 -0.02262 2.12271 5 | C -1.09739 -0.47380 1.20592 6 | C -0.42844 -0.41129 -0.16866 7 | C 0.86832 0.35976 -0.00040 8 | C 2.45618 0.44172 1.83608 9 | C -2.43280 0.26587 0.98323 10 | C -2.65526 0.24715 -0.58007 11 | C -1.24280 0.56261 -1.01626 12 | C 1.53533 0.57899 -1.41794 13 | O 1.34096 2.03626 -1.65068 14 | C 0.07819 2.22905 -2.21664 15 | C -0.59770 0.85394 -2.40197 16 | O -0.41347 3.31803 -2.45525 17 | C 0.76023 0.16780 -2.70006 18 | C 0.78122 -1.21410 -3.37735 19 | H 1.24261 0.76844 -3.49822 20 | H -1.17939 1.55800 -0.53766 21 | H 0.65158 1.39518 0.31742 22 | H -1.37221 -1.49100 1.51338 23 | C -0.28277 -1.88347 -0.59567 24 | C 2.17747 -1.84120 -3.32145 25 | C 0.34847 -1.10064 -4.85143 26 | H 0.05904 -1.90092 -2.94783 27 | H -0.06489 1.02643 2.41977 28 | H 0.11618 -0.64079 3.02439 29 | H 2.71496 -0.00486 2.80194 30 | H 2.29268 1.51467 1.98736 31 | H 3.32552 0.31624 1.18175 32 | H -2.37156 1.29616 1.35342 33 | H -3.26395 -0.22605 1.49817 34 | H -3.38096 1.00694 -0.88362 35 | H -2.99335 -0.73577 -0.92219 36 | H 2.60879 0.37977 -1.43942 37 | H -1.29291 0.87716 -3.24234 38 | H -0.30747 -2.58540 0.24751 39 | H 0.69200 -2.08905 -1.03186 40 | H -1.09433 -2.19042 -1.26138 41 | H 2.17948 -2.82409 -3.80492 42 | H 2.51758 -1.98217 -2.29137 43 | H 2.91433 -1.21347 -3.83434 44 | H 0.35220 -2.08590 -5.33068 45 | H 1.02315 -0.45197 -5.42096 46 | H -0.66521 -0.69675 -4.93459 47 | -------------------------------------------------------------------------------- /molli/files/dimethyl_sulfone.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | dimethyl_sulfone 3 | 11 10 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -3.8468 0.4459 -0.2037 C.3 1 UNL1 0.0541 9 | 2 S -2.3696 1.3617 -0.5684 S.O2 1 UNL1 -0.0366 10 | 3 H -3.8144 -0.5039 -0.7404 H 1 UNL1 0.0463 11 | 4 H -4.7036 1.0352 -0.5367 H 1 UNL1 0.0463 12 | 5 H -3.9024 0.2810 0.8738 H 1 UNL1 0.0463 13 | 6 C -1.0811 0.3002 0.0371 C.3 1 UNL1 0.0541 14 | 7 H -1.2242 0.1477 1.1084 H 1 UNL1 0.0463 15 | 8 H -0.1224 0.7896 -0.1463 H 1 UNL1 0.0463 16 | 9 H -1.1251 -0.6494 -0.4993 H 1 UNL1 0.0463 17 | 10 O -2.3774 2.5601 0.2475 O.2 1 UNL1 -0.1749 18 | 11 O -2.2401 1.4397 -2.0103 O.2 1 UNL1 -0.1749 19 | @BOND 20 | 1 1 2 1 21 | 2 1 3 1 22 | 3 1 4 1 23 | 4 1 5 1 24 | 5 2 6 1 25 | 6 6 7 1 26 | 7 6 8 1 27 | 8 6 9 1 28 | 9 2 10 2 29 | 10 2 11 2 30 | -------------------------------------------------------------------------------- /molli/files/dmf.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | dmf 3 | 12 11 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -4.9791 0.6157 0.0000 C.2 1 UNL1 0.2020 9 | 2 O -5.0618 1.8369 -0.0000 O.2 1 UNL1 -0.2793 10 | 3 N -3.8117 -0.1183 0.0000 N.am 1 UNL1 -0.3101 11 | 4 H -5.8824 -0.0166 0.0000 H 1 UNL1 0.1253 12 | 5 C -2.5234 0.5471 -0.0000 C.3 1 UNL1 0.0026 13 | 6 C -3.8274 -1.5666 0.0000 C.3 1 UNL1 0.0026 14 | 7 H -2.6298 1.6350 -0.0000 H 1 UNL1 0.0428 15 | 8 H -1.9701 0.2432 -0.8933 H 1 UNL1 0.0428 16 | 9 H -1.9701 0.2432 0.8933 H 1 UNL1 0.0428 17 | 10 H -4.8511 -1.9508 0.0000 H 1 UNL1 0.0428 18 | 11 H -3.3098 -1.9262 0.8938 H 1 UNL1 0.0428 19 | 12 H -3.3098 -1.9262 -0.8938 H 1 UNL1 0.0428 20 | @BOND 21 | 1 1 2 2 22 | 2 1 3 am 23 | 3 1 4 1 24 | 4 3 5 1 25 | 5 3 6 1 26 | 6 5 7 1 27 | 7 5 8 1 28 | 8 5 9 1 29 | 9 6 10 1 30 | 10 6 11 1 31 | 11 6 12 1 32 | -------------------------------------------------------------------------------- /molli/files/dummy.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | dummy_atom_test 3 | 2 1 0 0 0 4 | SMALL 5 | NO_CHARGES 6 | 7 | @ATOM 8 | 1 H1 0.0 0.0 0.0 Du.H 1 UNL1 9 | 2 Cl2 0.0 0.0 1.275 Du.Cl 1 UNL1 10 | @BOND 11 | 1 1 2 du 12 | -------------------------------------------------------------------------------- /molli/files/dummy.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | dummy_atom_test 3 | * 0.00000 0.00000 0.00000 4 | * 0.00000 0.00000 1.27500 5 | -------------------------------------------------------------------------------- /molli/files/fletcher_phosphoramidite_cats.mlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/fletcher_phosphoramidite_cats.mlib -------------------------------------------------------------------------------- /molli/files/fxyl.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | sample 3 | 18 18 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -1.4001 2.4298 0.0000 C.ar 1 UNL1 -0.0561 9 | 2 C -2.0947 1.2187 0.0000 C.ar 1 UNL1 -0.0611 10 | 3 C -1.3990 0.0083 0.0000 C.ar 1 UNL1 -0.0561 11 | 4 C 0.0000 0.0000 0.0000 C.ar 1 UNL1 -0.0150 12 | 5 C 0.6822 1.2219 0.0000 C.ar 1 UNL1 0.1292 13 | 6 C -0.0000 2.4425 0.0000 C.ar 1 UNL1 -0.0150 14 | 7 C 0.7385 3.7460 0.0000 C.3 1 UNL1 -0.0370 15 | 8 C 0.7698 -1.2852 0.0000 C.3 1 UNL1 -0.0370 16 | 9 H -1.9566 3.3645 0.0000 H 1 UNL1 0.0621 17 | 10 H -3.1822 1.2183 0.0000 H 1 UNL1 0.0618 18 | 11 H -1.9565 -0.9256 0.0000 H 1 UNL1 0.0621 19 | 12 H 1.8234 3.6011 -0.0000 H 1 UNL1 0.0278 20 | 13 H 0.4791 4.3253 0.8921 H 1 UNL1 0.0278 21 | 14 H 0.4791 4.3253 -0.8921 H 1 UNL1 0.0278 22 | 15 H 0.1021 -2.1531 -0.0000 H 1 UNL1 0.0278 23 | 16 H 1.4006 -1.3480 0.8926 H 1 UNL1 0.0278 24 | 17 H 1.4006 -1.3480 -0.8926 H 1 UNL1 0.0278 25 | 18 F 2.0246 1.2160 0.0000 F 1 UNL1 -0.2049 26 | @BOND 27 | 1 1 2 ar 28 | 2 2 3 ar 29 | 3 3 4 ar 30 | 4 4 5 ar 31 | 5 5 6 ar 32 | 6 6 1 ar 33 | 7 6 7 1 34 | 8 4 8 1 35 | 9 1 9 1 36 | 10 2 10 1 37 | 11 3 11 1 38 | 12 7 12 1 39 | 13 7 13 1 40 | 14 7 14 1 41 | 15 8 15 1 42 | 16 8 16 1 43 | 17 8 17 1 44 | 18 18 5 1 45 | -------------------------------------------------------------------------------- /molli/files/hadd_test.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | ***** 3 | 16 17 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -2.1687 1.5349 -0.3014 C.ar 1 UNL1 0.0165 9 | 2 C -1.9465 0.1575 -0.0483 C.ar 1 UNL1 0.0407 10 | 3 C -0.6381 -0.3475 0.0940 C.ar 1 UNL1 0.0035 11 | 4 C 0.4418 0.5084 -0.0196 C.ar 1 UNL1 -0.0255 12 | 5 C 0.2512 1.8614 -0.2828 C.ar 1 UNL1 -0.0266 13 | 6 C -1.0295 2.3720 -0.4343 C.ar 1 UNL1 -0.0058 14 | 7 C 1.5729 2.5634 -0.4315 C.3 1 UNL1 0.0224 15 | 8 C 1.6471 3.9462 0.1971 C.3 1 UNL1 0.0047 16 | 9 C 2.5139 1.5563 0.2623 C.3 1 UNL1 0.0090 17 | 10 C 1.8971 0.1682 0.0421 C.3 1 UNL1 0.0264 18 | 11 C -2.9907 -0.8197 0.0573 C.1 1 UNL1 -0.0515 19 | 12 C -3.8203 -1.6830 0.1636 C.1 1 UNL1 -0.0092 20 | 13 C -3.5193 2.1980 -0.5508 C.3 1 UNL1 0.1938 21 | 14 C -4.8204 1.5233 -0.0539 C.3 1 UNL1 0.1466 22 | 15 N -5.9698 2.4589 -0.0666 N.3 1 UNL1 -0.1282 23 | 16 O -3.5028 3.5238 0.0200 O.3 1 UNL1 -0.2167 24 | @BOND 25 | 1 1 2 ar 26 | 2 2 3 ar 27 | 3 3 4 ar 28 | 4 4 5 ar 29 | 5 5 6 ar 30 | 6 6 1 ar 31 | 7 5 7 1 32 | 8 7 8 1 33 | 9 7 9 1 34 | 10 9 10 1 35 | 11 4 10 1 36 | 12 2 11 1 37 | 13 11 12 3 38 | 14 1 13 1 39 | 15 13 14 1 40 | 16 14 15 1 41 | 17 13 16 1 42 | -------------------------------------------------------------------------------- /molli/files/isornitrate.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | ISOSORBIDE DINITRATE 3 | 24 25 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -0.0190 1.5484 0.0106 C.3 1 UNL1 0.1345 9 | 2 C 0.0021 -0.0041 0.0020 C.3 1 UNL1 0.1345 10 | 3 C 1.3601 -0.3347 -0.6473 C.3 1 UNL1 0.2283 11 | 4 C 2.2162 0.9144 -0.3811 C.3 1 UNL1 0.0947 12 | 5 O 1.3448 1.9786 -0.0002 O.3 1 UNL1 -0.3659 13 | 6 C -0.6362 1.8968 1.3852 C.3 1 UNL1 0.2283 14 | 7 C -0.8905 0.5241 2.0456 C.3 1 UNL1 0.0947 15 | 8 O 0.0327 -0.3761 1.3942 O.3 1 UNL1 -0.3659 16 | 9 H -0.8394 -0.4365 -0.5393 H 1 UNL1 0.0664 17 | 10 H -0.5877 1.9602 -0.8232 H 1 UNL1 0.0664 18 | 11 O -1.8654 2.6057 1.2161 O.2 1 UNL1 -0.2081 19 | 12 O 1.9443 -1.4829 -0.0290 O.2 1 UNL1 -0.2081 20 | 13 N -2.1046 3.3042 2.4244 N.pl3 1 UNL1 0.2847 21 | 14 N 2.8158 -2.0625 -0.9827 N.pl3 1 UNL1 0.2847 22 | 15 O 2.9362 -1.5567 -2.0842 O.2 1 UNL1 0.0934 23 | 16 O -1.3134 3.2150 3.3462 O.2 1 UNL1 0.0934 24 | 17 O -3.1014 3.9941 2.5420 O.co2 1 UNL1 -0.5338 25 | 18 O 3.4450 -3.0667 -0.7017 O.co2 1 UNL1 -0.5338 26 | 19 H 1.2420 -0.4954 -1.7189 H 1 UNL1 0.0858 27 | 20 H 2.9230 0.7116 0.4235 H 1 UNL1 0.0600 28 | 21 H 2.7583 1.1887 -1.2861 H 1 UNL1 0.0600 29 | 22 H 0.0642 2.4826 1.9804 H 1 UNL1 0.0858 30 | 23 H -0.6823 0.5730 3.1145 H 1 UNL1 0.0600 31 | 24 H -1.9181 0.2044 1.8727 H 1 UNL1 0.0600 32 | @UNITY_ATOM_ATTR 33 | 1 1 34 | charge 15 35 | 13 1 36 | charge 1 37 | 14 1 38 | charge 1 39 | 17 1 40 | charge -1 41 | 18 1 42 | charge -1 43 | @BOND 44 | 1 1 2 1 45 | 2 1 5 1 46 | 3 1 6 1 47 | 4 1 10 1 48 | 5 2 3 1 49 | 6 2 8 1 50 | 7 2 9 1 51 | 8 3 4 1 52 | 9 3 12 1 53 | 10 3 19 1 54 | 11 4 5 1 55 | 12 4 20 1 56 | 13 4 21 1 57 | 14 6 7 1 58 | 15 6 11 1 59 | 16 6 22 1 60 | 17 7 8 1 61 | 18 7 23 1 62 | 19 7 24 1 63 | 20 11 13 1 64 | 21 12 14 1 65 | 22 13 16 2 66 | 23 13 17 1 67 | 24 14 15 2 68 | 25 14 18 1 -------------------------------------------------------------------------------- /molli/files/propyne.mol2: -------------------------------------------------------------------------------- 1 | @MOLECULE 2 | propyne 3 | 7 6 0 0 0 4 | SMALL 5 | GASTEIGER 6 | 7 | @ATOM 8 | 1 C -2.4904 1.2499 0.0000 C.1 1 UNL1 -0.1089 9 | 2 C -0.4880 1.2883 -0.0000 C.1 1 UNL1 -0.1194 10 | 3 C -4.6255 1.2090 -0.0000 C.3 1 UNL1 -0.0028 11 | 4 H 0.5772 1.3087 -0.0000 H 1 UNL1 0.1228 12 | 5 H -4.7630 0.7746 -0.9903 H 1 UNL1 0.0361 13 | 6 H -4.7919 2.2795 0.1213 H 1 UNL1 0.0361 14 | 7 H -4.7590 0.5645 0.8690 H 1 UNL1 0.0361 15 | @BOND 16 | 1 1 2 3 17 | 2 1 3 1 18 | 3 2 4 1 19 | 4 3 5 1 20 | 5 3 6 1 21 | 6 3 7 1 22 | -------------------------------------------------------------------------------- /molli/files/test_mol2s.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/test_mol2s.zip -------------------------------------------------------------------------------- /molli/files/test_mol2s_ml02.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/test_mol2s_ml02.zip -------------------------------------------------------------------------------- /molli/files/tiny_test_bpa_raw_conf.mlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SEDenmarkLab/molli/e890a104b9e1a85107bf6762370914474a4d1d2d/molli/files/tiny_test_bpa_raw_conf.mlib -------------------------------------------------------------------------------- /molli/ftypes/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This submodule defines parsers and writers for chemical formats 23 | """ 24 | from .cdxml import CDXMLFile 25 | -------------------------------------------------------------------------------- /molli/math/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | `molli.math` module supplies mathematical functions 23 | """ 24 | 25 | from .rotation import ( 26 | rotation_matrix_from_vectors, 27 | rotation_matrix_from_axis, 28 | rotate_2dvec_outa_plane, 29 | ) 30 | from .distance import _optimize_rotation 31 | from .plane import mean_plane 32 | -------------------------------------------------------------------------------- /molli/math/distance.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This submodule defines an optimization function that applies a sequential rotation of 23 | one of the arrays against the other around an axis 24 | So as to minimize the "Steric interaction" loss function 25 | """ 26 | 27 | from .. import MOLLI_USING_EXTENSIONS 28 | import numpy as np 29 | from numpy.typing import ArrayLike 30 | from .rotation import rotation_matrix_from_axis 31 | 32 | 33 | def _optimize_rotation( 34 | c1: ArrayLike, c2: ArrayLike, ax: ArrayLike, resolution: int = 12 35 | ): 36 | if not MOLLI_USING_EXTENSIONS: 37 | raise NotImplementedError 38 | else: 39 | import molli_xt as xt 40 | 41 | angles = np.radians(np.arange(0, 360, step=360 // resolution)) 42 | aug_c2 = np.array([c2 @ rotation_matrix_from_axis(ax, ang) for ang in angles]) 43 | 44 | dist = ( 45 | xt.cdist32_eu2(aug_c2, c1) + 0.05 46 | ) # This latter part is damping to avoid singularities when and if present 47 | loss = np.sum(1 / dist, axis=(1, 2)) 48 | 49 | best_angle = angles[np.argmin(loss)] 50 | return rotation_matrix_from_axis(ax, best_angle) 51 | -------------------------------------------------------------------------------- /molli/math/plane.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # The only function is implemented according to the following publication 6 | # joriki (https://math.stackexchange.com/users/6622/joriki), 7 | # Best Fitting Plane given a Set of Points, URL (version: 2021-05-10): 8 | # https://math.stackexchange.com/q/99317 9 | # ================================================================================ 10 | 11 | 12 | """ 13 | This submodule deals with calculation of a mean plane 14 | """ 15 | 16 | import numpy as np 17 | from numpy.typing import ArrayLike 18 | 19 | 20 | def mean_plane(_vecs: ArrayLike): 21 | """ 22 | https://math.stackexchange.com/questions/99299/best-fitting-plane-given-a-set-of-points 23 | """ 24 | centered = np.array(_vecs) 25 | centered -= np.average(centered, axis=0) 26 | return np.linalg.svd(centered.T)[0][:, -1] 27 | -------------------------------------------------------------------------------- /molli/math/polyhedra.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This file defines the vertices of some useful polyhedra. 23 | """ 24 | 25 | import numpy as np 26 | 27 | TETRAHEDRON = np.array( 28 | [ 29 | [0.0, 0.0, 1.0], 30 | [0.94280904, 0.0, -0.33333333], 31 | [-0.47140452, 0.81649658, -0.33333333], 32 | [-0.47140452, -0.81649658, -0.33333333], 33 | ] 34 | ) 35 | 36 | OCTAHEDRON = np.array( 37 | [ 38 | [0.0, 0.0, 1.0], 39 | [0.0, 0.0, -1.0], 40 | [1.0, 0.0, 0.0], 41 | [-1.0, 0.0, 0.0], 42 | [0.0, 1.0, 0.0], 43 | [0.0, -1.0, 0.0], 44 | ] 45 | ) 46 | -------------------------------------------------------------------------------- /molli/parsing/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Parsing module is meant to provide tools to deserealize text files 3 | """ 4 | 5 | from .xyz import XYZAtom, XYZBlock, XYZSyntaxError, read_xyz 6 | from .mol2 import MOL2Header, MOL2Atom, MOL2Bond, MOL2Block, MOL2SyntaxError, read_mol2 7 | -------------------------------------------------------------------------------- /molli/parsing/_reader.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This function provides a convenience `LineReader` class that comes very handy in the mol2 file parsing 23 | """ 24 | 25 | from io import StringIO 26 | from typing import Callable 27 | from collections import deque 28 | 29 | 30 | class LineReader: 31 | def __init__( 32 | self, 33 | io: StringIO, 34 | post: Callable[[str], str] = None, 35 | ): 36 | self._io = io 37 | self._current_line = 0 38 | self._post = post 39 | self._extra_lines = deque() 40 | 41 | def __iter__(self): 42 | return self 43 | 44 | def __next__(self): 45 | if len(self._extra_lines): 46 | _line = self._extra_lines.popleft() 47 | else: 48 | _line = next(self._io) 49 | 50 | if self._post is None: 51 | line = _line 52 | else: 53 | line = self._post(_line) 54 | 55 | self._current_line += 1 56 | 57 | return line 58 | 59 | def next_noexcept(self) -> str | None: 60 | try: 61 | line = next(self) 62 | except StopIteration: 63 | return None 64 | except: 65 | raise 66 | else: 67 | return line 68 | 69 | def put_back(self, line: str): 70 | self._current_line -= 1 71 | self._extra_lines.append(line) 72 | 73 | @property 74 | def pos(self): 75 | return self._current_line 76 | -------------------------------------------------------------------------------- /molli/parsing/xyz.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This is a parser for .xyz files 23 | """ 24 | 25 | from dataclasses import dataclass 26 | from typing import List, Generator 27 | from io import StringIO 28 | from ._reader import LineReader 29 | 30 | 31 | @dataclass(slots=True, init=True) 32 | class XYZAtom: 33 | symbol: str 34 | x: float 35 | y: float 36 | z: float 37 | 38 | 39 | @dataclass(slots=True, init=True) 40 | class XYZBlock: 41 | n_atoms: int 42 | comment: str 43 | atoms: List[XYZAtom] 44 | 45 | @property 46 | def symbols(self): 47 | return [a.symbol for a in self.atoms] 48 | 49 | @property 50 | def coords(self): 51 | return [(a.x, a.y, a.z) for a in self.atoms] 52 | 53 | 54 | class XYZSyntaxError(SyntaxError): 55 | """Error is raised when a syntax error is detected within XYZ file""" 56 | 57 | ... 58 | 59 | 60 | def read_xyz(input: StringIO) -> Generator[XYZBlock, None, None]: 61 | """ 62 | Parse .xyz file with strict syntax 63 | """ 64 | reader = LineReader(input) 65 | 66 | while line := reader.next_noexcept(): 67 | try: 68 | n_atoms = int(line) 69 | except ValueError: 70 | raise XYZSyntaxError( 71 | f"Expected number of atoms at line {reader.pos - 1}, received: {line}" 72 | ) 73 | 74 | try: 75 | comment = str.strip(next(reader)) 76 | except StopIteration: 77 | raise XYZSyntaxError(f"Expected comment at line {reader.pos}, not EOF") 78 | 79 | atoms = [] 80 | 81 | try: 82 | for _ in range(n_atoms): 83 | atom_line = next(reader) 84 | a, x, y, z = atom_line.split() 85 | atoms.append(XYZAtom(a, float(x), float(y), float(z))) 86 | 87 | except StopIteration: 88 | raise XYZSyntaxError( 89 | f"Expected atom definitions at line {reader.pos}, not EOF" 90 | ) 91 | 92 | except: 93 | raise XYZSyntaxError(f"Unknown syntax at line {reader.pos}:\n\t{atom_line}") 94 | 95 | yield XYZBlock(n_atoms=n_atoms, comment=comment, atoms=atoms) 96 | -------------------------------------------------------------------------------- /molli/pipeline/__init__.py: -------------------------------------------------------------------------------- 1 | from .job import JobInput, JobOutput, Job, jobmap, jobmap_sge 2 | -------------------------------------------------------------------------------- /molli/pipeline/driver.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This describes the foundational class for all drivers. 23 | """ 24 | 25 | import shutil 26 | 27 | 28 | class DriverBase: 29 | def __init__( 30 | self, 31 | executable: str = None, 32 | nprocs: int = 1, 33 | memory: int = None, 34 | envars: dict = None, 35 | check_exe: bool = True, 36 | find: bool = True, 37 | ) -> None: 38 | self.executable = executable 39 | if hasattr(self, "default_executable"): 40 | self.executable = self.executable or self.default_executable 41 | self.nprocs = nprocs 42 | self.envars = envars 43 | self.memory = memory 44 | 45 | if check_exe and not (which_exe := self.which()): 46 | raise FileNotFoundError( 47 | f"Requested executable {self.executable!r} for {self.__class__.__name__!r} is not reachable." 48 | ) 49 | elif find: 50 | self.executable = which_exe 51 | 52 | def which(self): 53 | return shutil.which(self.executable) 54 | -------------------------------------------------------------------------------- /molli/scripts/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | This submodule contains all script files. 23 | """ 24 | 25 | __all__ = [ 26 | "info", 27 | "run", 28 | "compile", 29 | "stats", 30 | "recollect", 31 | "show", 32 | "grid", 33 | "gbca", 34 | "parse", 35 | "align", 36 | "ls", 37 | "combine", 38 | "test", 39 | ] 40 | 41 | __all__.sort() 42 | 43 | # from . import * 44 | -------------------------------------------------------------------------------- /molli/scripts/info.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Print information about current molli package 23 | """ 24 | import molli as ml 25 | from pprint import pprint 26 | from argparse import ArgumentParser 27 | 28 | MOLLI_VERSION = ml.__version__ 29 | 30 | arg_parser = ArgumentParser( 31 | "molli info", 32 | description=__doc__, 33 | ) 34 | 35 | 36 | def molli_main(args, **kwargs): 37 | arg_parser.parse_args(args) 38 | with ml.aux.ForeColor("yellow"): 39 | print(ml.config.SPLASH) 40 | print(ml.__doc__) 41 | print("HOME: ", ml.config.HOME) 42 | print("DATA_DIR: ", ml.config.DATA_DIR) 43 | -------------------------------------------------------------------------------- /molli/scripts/run.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Run a custom script that defines `molli_main(args, config, output, **)` 23 | """ 24 | 25 | raise NotImplementedError 26 | import molli as ml 27 | from pprint import pprint 28 | from argparse import ArgumentParser 29 | 30 | MOLLI_VERSION = ml.__version__ 31 | 32 | arg_parser = ArgumentParser( 33 | "molli run", 34 | description=__doc__, 35 | add_help=False, 36 | ) 37 | 38 | arg_parser.add_argument("script", action="store", type=str, metavar="") 39 | 40 | 41 | def molli_main(args, **kwargs): 42 | parsed, unknown = arg_parser.parse_known_args(args) 43 | 44 | with ml.aux.ForeColor("yellow"): 45 | print( 46 | "WARNING: this routine can execute arbitrary code. Do not feed untrusted .py files into it!" 47 | ) 48 | 49 | extm = ml.aux.load_external_module(parsed.script, "extm") 50 | extm.molli_main(unknown, config=config, output=output, **kwargs) 51 | -------------------------------------------------------------------------------- /molli/scripts/stats.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Inspect a collection file, such as .mlib, .clib, or .cdxml file. 23 | """ 24 | 25 | from argparse import ArgumentParser 26 | import molli as ml 27 | from pathlib import Path 28 | from sys import stderr, stdout 29 | import warnings 30 | from contextlib import nullcontext 31 | from tqdm import tqdm 32 | import math 33 | import pandas as pd 34 | 35 | arg_parser = ArgumentParser( 36 | "molli stats", 37 | description="Calculate statistics on the collection", 38 | ) 39 | 40 | arg_parser.add_argument( 41 | "expression", 42 | help=( 43 | "What to count. Expression is evaluated with the local variable `m` that corresponds to the object." 44 | ), 45 | ) 46 | 47 | arg_parser.add_argument( 48 | "input", 49 | help=( 50 | "Collection to inspect. If type is not specified, it will be deduced from file extensions" 51 | " or directory properties." 52 | ), 53 | ) 54 | 55 | arg_parser.add_argument( 56 | "-t", 57 | "--type", 58 | default=None, 59 | choices=["mlib", "clib"], 60 | help="Collection type", 61 | ) 62 | 63 | arg_parser.add_argument( 64 | "-o", 65 | "--output", 66 | type=Path, 67 | default=None, 68 | help="Output the results as a space-separated file", 69 | ) 70 | 71 | 72 | def molli_main(args, verbose=False, **kwargs): 73 | parsed = arg_parser.parse_args(args) 74 | 75 | input_type = parsed.type or Path(parsed.input).suffix[1:] 76 | 77 | match input_type: 78 | case "mlib": 79 | library = ml.MoleculeLibrary(parsed.input, readonly=True) 80 | 81 | case "clib": 82 | library = ml.ConformerLibrary(parsed.input, readonly=True) 83 | 84 | case _: 85 | print(f"Unrecognized input type: {input_type}") 86 | exit(1) 87 | 88 | # We are going to assume homogeneity of the collection 89 | with library.reading(), warnings.catch_warnings(): 90 | keys = sorted(library.keys()) 91 | data = [eval(parsed.expression, None, {"m": library[k]}) for k in keys] 92 | series = pd.Series(data=data, index=keys) 93 | 94 | print(series.describe()) 95 | 96 | if parsed.output is not None: 97 | series.to_csv(parsed.output, header=[parsed.expression]) 98 | -------------------------------------------------------------------------------- /molli/scripts/test.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | """ 21 | Test molli package. For most intents and purposes equivalent to `python -m unittest molli_test [args]` 22 | """ 23 | # Test molli installation by running molli test suite 24 | 25 | import molli as ml 26 | from pprint import pprint 27 | from argparse import ArgumentParser 28 | import unittest as ut 29 | import molli_test 30 | 31 | MOLLI_VERSION = ml.__version__ 32 | 33 | arg_parser = ArgumentParser("molli test", description=__doc__, add_help=False) 34 | 35 | 36 | def molli_main(args, verbosity=0, **kwargs): 37 | parsed, unknown = arg_parser.parse_known_args(args) 38 | if verbosity: 39 | v_arg = ("-" + "v" * verbosity,) 40 | else: 41 | v_arg = () 42 | ut.main(module=molli_test, argv=["molli test", *unknown, *v_arg]) 43 | -------------------------------------------------------------------------------- /molli/storage/__init__.py: -------------------------------------------------------------------------------- 1 | from .backends import ( 2 | CollectionBackendBase, 3 | DirCollectionBackend, 4 | ZipCollectionBackend, 5 | TarCollectionBackend, 6 | UkvCollectionBackend, 7 | MlibCollectionBackend, 8 | ) 9 | from .collection import Collection 10 | -------------------------------------------------------------------------------- /molli/visual/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import Literal 2 | import molli as ml 3 | 4 | 5 | def configure( 6 | backend: Literal["py3dmol", "pyvista"] = "py3dmol", 7 | theme: str = "dark", 8 | bgcolor: str = "black", 9 | width: int | str = None, 10 | height: int = None, 11 | style: Literal["ballnstick", "wireframe"] = "ballnstick", 12 | style_conf: Literal["ballnstick", "wireframe"] = "wireframe", 13 | **kwargs, 14 | ): 15 | """ 16 | This configures the *default* visualization protocol in Jupyter notebooks. 17 | Note that individual functions from the corresponding submodules can still be used. 18 | """ 19 | 20 | match backend: 21 | case "py3dmol": 22 | from . import _py3dmol 23 | 24 | _py3dmol.BGCOLOR = bgcolor 25 | 26 | if height is not None: 27 | _py3dmol.HEIGHT = height 28 | 29 | if width is not None: 30 | _py3dmol.WIDTH = width 31 | 32 | match style: 33 | case "ballnstick": 34 | _py3dmol.STYLE = _py3dmol.STYLE_BALLNSTICK 35 | case "wireframe": 36 | _py3dmol.STYLE = _py3dmol.STYLE_WIREFRAME 37 | 38 | if style and not style_conf: 39 | style_conf = style 40 | 41 | match style_conf: 42 | case "ballnstick": 43 | _py3dmol.STYLE_CONF = _py3dmol.STYLE_BALLNSTICK 44 | case "wireframe": 45 | _py3dmol.STYLE_CONF = _py3dmol.STYLE_WIREFRAME 46 | 47 | ml.Structure._repr_html_ = _py3dmol.view_structure 48 | ml.ConformerEnsemble._repr_html_ = _py3dmol.view_ensemble 49 | 50 | case "pyvista": 51 | import pyvista as pv 52 | from . import _pyvista 53 | 54 | _pyvista.BGCOLOR = bgcolor 55 | _pyvista.THEME = theme 56 | _pyvista.WIDTH = width 57 | _pyvista.HEIGHT = height 58 | 59 | pv.set_plot_theme(theme) 60 | 61 | ml.Structure._repr_html_ = _pyvista.draw_ballnstick 62 | ml.ConformerEnsemble._repr_html_ = _pyvista.draw_wireframe 63 | 64 | case _: 65 | raise NotImplementedError(f"Backend {backend!r} is not supported.") 66 | -------------------------------------------------------------------------------- /molli/visual/primitives.py: -------------------------------------------------------------------------------- 1 | import pyvista as pv 2 | import molli as ml 3 | import numpy as np 4 | from PIL import ImageColor 5 | 6 | 7 | def color_cpk(a: ml.Atom): 8 | 9 | if a.is_dummy: 10 | return [1, 0, 0] 11 | elif a.is_attachment_point: 12 | return [1, 1, 0] 13 | else: 14 | r, g, b = ImageColor.getrgb(a.color_cpk) 15 | return [r / 255, g / 255, b / 255] 16 | 17 | 18 | def colors_cpk(s: ml.StructureLike): 19 | colors = np.empty((s.n_atoms, 3)) 20 | for i, a in enumerate(s.atoms): 21 | colors[i] = color_cpk(a) 22 | return colors 23 | 24 | 25 | def wireframe(struct: ml.StructureLike) -> pv.PolyData: 26 | """ 27 | This creates a wireframe out of a structure-like object 28 | """ 29 | lines = [] 30 | for b in struct.bonds: 31 | i1, i2 = struct.get_atom_indices(b.a1, b.a2) 32 | lines.extend((2, i1, i2)) 33 | 34 | wire = pv.PolyData(struct.coords, n_lines=len(lines), lines=lines) 35 | wire.point_data["color_cpk"] = colors_cpk(struct) 36 | wire.point_data["radius_cov"] = [a.cov_radius_1 or 0.5 for a in struct.atoms] 37 | return wire 38 | 39 | 40 | def atoms(struct: ml.StructureLike) -> list[pv.PolyData]: 41 | mb_atoms = pv.MultiBlock() 42 | for i, a in enumerate(struct.atoms): 43 | if cov_rad := a.cov_radius_1: 44 | a_size = cov_rad * 0.4 45 | else: 46 | a_size = 0.2 47 | if a.is_dummy: 48 | mesh = pv.Cube(struct.coords[i], a_size, a_size, a_size) 49 | if a.is_attachment_point: 50 | a2 = next(struct.connected_atoms(a)) 51 | v = struct.vector(a2, a) 52 | o = struct.get_atom_coord(a2) 53 | mesh = pv.Arrow( 54 | o + v / 2, v / 2, shaft_radius=a_size / 2, tip_radius=a_size 55 | ) 56 | else: 57 | mesh = pv.Sphere( 58 | a_size, 59 | center=struct.coords[i], 60 | phi_resolution=32, 61 | theta_resolution=32, 62 | ) 63 | mesh.point_data["color_cpk"] = [color_cpk(a)] * mesh.n_points 64 | mb_atoms.append(mesh) 65 | 66 | return mb_atoms 67 | 68 | 69 | def test_ballnstick(s: ml.StructureLike): 70 | plt = pv.Plotter() 71 | w = wireframe(s) 72 | # w.point_data["color_cpk"] = colors_cpk(s) 73 | # w.point_data["radius_cov"] = [a.cov_radius_1 or 0.5 for a in s.atoms] 74 | # w.point_data["scalars"] = [glyph_type(a) for a in s.atoms] 75 | 76 | tubes = w.tube(radius=0.05) 77 | spheres = w.glyph(orient=False, scale="radius_cov", geom=pv.Sphere(radius=0.4)) 78 | 79 | # plt.add_mesh( 80 | # tubes, 81 | # rgb=True, 82 | # scalars="color_cpk", 83 | # smooth_shading=True, 84 | # interpolate_before_map=False, 85 | # culling=True, 86 | # ) 87 | 88 | plt.add_mesh( 89 | tubes + spheres, 90 | rgb=True, 91 | scalars="color_cpk", 92 | smooth_shading=True, 93 | interpolate_before_map=False, 94 | ) 95 | 96 | plt.add_point_labels( 97 | w, [a.label or a.element.symbol for a in s.atoms], always_visible=True 98 | ) 99 | plt.enable_ssao() 100 | plt.show() 101 | -------------------------------------------------------------------------------- /molli_test/__init__.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | # `molli_test` 23 | This package provides unit tests for the required molli functionality 24 | """ 25 | 26 | from .test_install import BasicInstallTC 27 | from .test_chem_promolecule import PromoleculeTC 28 | from .test_chem_connectivity import ConnectivityTC 29 | from .test_chem_geometry import GeometryTC 30 | from .test_chem_structure import StructureTC 31 | from .test_chem_molecule import MoleculeTC 32 | from .test_cdxml_parse import CDXMLParserTC 33 | from .test_conformer_ensemble import ConformerEnsembleTC 34 | from .test_descriptor import DescriptorTC 35 | from .test_external_openbabel import OpenbabelTC 36 | from .test_external_rdkit import RDKitTC 37 | from .test_collections import CollectionsTC 38 | from .test_molli_extensions import ExtensionTC 39 | from .test_read_write import ReadWriteTC 40 | -------------------------------------------------------------------------------- /molli_test/test_cdxml_parse.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Testing the descriptor calculation functionality 23 | """ 24 | 25 | import unittest as ut 26 | import molli as ml 27 | 28 | # formula, charge, multiplicity 29 | CHARGE_MULT_ANSWER = { 30 | "a1": ("C11 H18 N1", 1, 1), 31 | "a2": ("C9 H18 N1 O1", 0, 2), 32 | "a3": ("C6 H11 N1 O1", 0, 1), 33 | "a4": ("C6 H11 N1 O1", 0, 1), 34 | "a5": ("C6 H5 N1 O2", 0, 1), 35 | "a6": ("C8 H19 N1", 1, 2), 36 | "a7": ("C6 H8 O1", 0, 3), 37 | "a8": ("C1 Cl2", 0, 3), 38 | "a9": ("C2 H4 B1 O2", 1, 1), 39 | "a10": ("C4 H10 P1", 1, 1), 40 | "a11": ("C1 H6 B1", -1, 1), 41 | } 42 | 43 | 44 | class CDXMLParserTC(ut.TestCase): 45 | def setUp(self) -> None: 46 | super().setUp() 47 | self.charges_mult_cdxml = ml.CDXMLFile(ml.files.charges_mult_cdxml) 48 | 49 | def test_charge_mult_parsing(self): 50 | for mol_id in CHARGE_MULT_ANSWER: 51 | mol = self.charges_mult_cdxml[mol_id] 52 | mol.add_implicit_hydrogens() 53 | 54 | formula_correct, charge_correct, mult_correct = CHARGE_MULT_ANSWER[mol_id] 55 | formula_parsed, charge_parsed, mult_parsed = ( 56 | mol.formula, 57 | mol.charge, 58 | mol.mult, 59 | ) 60 | self.assertEqual( 61 | formula_correct, 62 | formula_parsed, 63 | f"Formula correct != parsed for molecule {mol.name!r}", 64 | ) 65 | self.assertEqual( 66 | charge_correct, 67 | charge_parsed, 68 | f"Charge correct != parsed for molecule {mol.name!r}", 69 | ) 70 | self.assertEqual( 71 | mult_correct, 72 | mult_parsed, 73 | f"Multiplicity correct != parsed for molecule {mol.name!r}", 74 | ) 75 | -------------------------------------------------------------------------------- /molli_test/test_descriptor.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Testing the descriptor calculation functionality 23 | """ 24 | 25 | import unittest as ut 26 | import molli as ml 27 | 28 | 29 | class DescriptorTC(ut.TestCase): 30 | def setUp(self) -> None: 31 | super().setUp() 32 | 33 | def test_rectangular_grid(self): 34 | g1 = ml.descriptor.rectangular_grid([-1, 0, 0], [1, 0, 0], spacing=0.5) 35 | g2 = ml.descriptor.rectangular_grid([-1, -1, 0], [1, 1, 0], spacing=0.5) 36 | g3 = ml.descriptor.rectangular_grid([-1, -1, -1], [1, 1, 1], spacing=0.5) 37 | 38 | self.assertTupleEqual(g1.shape, (5, 3)) 39 | self.assertTupleEqual(g2.shape, (25, 3)) 40 | self.assertTupleEqual(g3.shape, (125, 3)) 41 | 42 | g4 = ml.descriptor.rectangular_grid( 43 | [-1, -1, -1], [1, 1, 1], spacing=0.5, padding=0.1 44 | ) 45 | self.assertTupleEqual(g4.shape, (125, 3)) 46 | -------------------------------------------------------------------------------- /molli_test/test_external_openbabel.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Blake E. Ocampo 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Testing the external functionality related to `OpenBabel` 23 | """ 24 | 25 | import unittest as ut 26 | 27 | import molli as ml 28 | import numpy as np 29 | from copy import deepcopy 30 | import importlib.util 31 | 32 | 33 | def is_package_installed(pkg_name): 34 | return importlib.util.find_spec(pkg_name) is not None 35 | 36 | 37 | class OpenbabelTC(ut.TestCase): 38 | @ut.skipUnless(is_package_installed("openbabel"), "Openbabel is not installed") 39 | def test_ob_mol2(self): 40 | from molli.external import openbabel as mob 41 | 42 | with ml.files.dendrobine_mol2.open() as f: 43 | mlmol = ml.Molecule.load_mol2(f) 44 | 45 | mol2_block = mob.to_mol2_w_ob(mlmol) 46 | 47 | new_mlmol = next(ml.Structure.yield_from_mol2(mol2_block)) 48 | 49 | self.assertEqual(len(mlmol.atoms), len(new_mlmol.atoms)) 50 | self.assertEqual(len(mlmol.bonds), len(new_mlmol.bonds)) 51 | 52 | @ut.skipUnless(is_package_installed("openbabel"), "Openbabel is not installed") 53 | def test_ob_opt(self): 54 | from molli.external import openbabel as mob 55 | 56 | with ml.files.dendrobine_mol2.open() as f: 57 | mlmol = next(ml.Molecule.yield_from_mol2(f)) 58 | 59 | old_coords = deepcopy(mlmol.coords) 60 | 61 | opt_mlmol = mob.obabel_optimize(mlmol, ff="UFF") 62 | 63 | opt_coords = opt_mlmol.coords 64 | self.assertTupleEqual(old_coords.shape, opt_coords.shape) 65 | 66 | np.testing.assert_raises( 67 | AssertionError, np.testing.assert_array_equal, old_coords, opt_coords 68 | ) 69 | -------------------------------------------------------------------------------- /molli_test/test_install.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Testing the very basic molli install functionality 23 | """ 24 | 25 | import unittest as ut 26 | 27 | 28 | class BasicInstallTC(ut.TestCase): 29 | """This test suite is for the basic installation stuff""" 30 | 31 | def test_import_molli(self): 32 | """Tests""" 33 | import molli 34 | 35 | def test_import_molli_extensions(self): 36 | """Tests""" 37 | import molli_xt 38 | -------------------------------------------------------------------------------- /molli_test/test_molli_extensions.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # 5 | # Developed by Alexander S. Shved 6 | # 7 | # S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | # https://denmarkgroup.illinois.edu/ 9 | # 10 | # Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | # All Rights Reserved. 12 | # 13 | # Licensed under the terms MIT License 14 | # The License is included in the distribution as LICENSE file. 15 | # You may not use this file except in compliance with the License. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | # ================================================================================ 19 | 20 | 21 | """ 22 | Testing the functionality of molli extensions 23 | """ 24 | 25 | import unittest as ut 26 | import numpy as np 27 | import scipy.spatial.distance as spd 28 | import molli_xt 29 | 30 | 31 | class ExtensionTC(ut.TestCase): 32 | """This test suite is for the basic installation stuff""" 33 | 34 | def test_cdist3f(self): 35 | a1 = np.random.rand(5000, 3).astype(np.float32) 36 | a2 = np.random.rand(100, 3).astype(np.float32) 37 | 38 | d_molli = molli_xt.cdist22_eu2(a1, a2) 39 | d_spd = spd.cdist(a1, a2, metric="sqeuclidean") 40 | 41 | self.assertAlmostEqual(np.max(d_molli - d_spd), 0, places=6) 42 | -------------------------------------------------------------------------------- /molli_xt/_molli_xt.cpp: -------------------------------------------------------------------------------- 1 | // ================================================================================ 2 | // This file is part of `molli 1.0` 3 | // (https://github.com/SEDenmarkLab/molli) 4 | // 5 | // Developed by Alexander S. Shved 6 | // 7 | // S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | // https://denmarkgroup.illinois.edu/ 9 | // 10 | // Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | // All Rights Reserved. 12 | // 13 | // Licensed under the terms MIT License 14 | // The License is included in the distribution as LICENSE file. 15 | // You may not use this file except in compliance with the License. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | // ================================================================================ 19 | 20 | /* 21 | This defines the pybind11 module 22 | */ 23 | 24 | #include <_molli_xt.hpp> 25 | 26 | using namespace molli; 27 | 28 | PYBIND11_MODULE(molli_xt, m) 29 | { 30 | m.doc() = "molli_xt module (pybind11 c++ compiled extensions)"; 31 | _init_distance(m); 32 | } 33 | -------------------------------------------------------------------------------- /molli_xt/_molli_xt.hpp: -------------------------------------------------------------------------------- 1 | // ================================================================================ 2 | // This file is part of `molli 1.0` 3 | // (https://github.com/SEDenmarkLab/molli) 4 | // 5 | // Developed by Alexander S. Shved 6 | // 7 | // S. E. Denmark Laboratory, University of Illinois, Urbana-Champaign 8 | // https://denmarkgroup.illinois.edu/ 9 | // 10 | // Copyright 2022-2023 The Board of Trustees of the University of Illinois. 11 | // All Rights Reserved. 12 | // 13 | // Licensed under the terms MIT License 14 | // The License is included in the distribution as LICENSE file. 15 | // You may not use this file except in compliance with the License. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 18 | // ================================================================================ 19 | 20 | /* 21 | This is the header file that defines symbold in molli extensions 22 | */ 23 | 24 | #if !defined(MOLLI_EXTENSIONS) 25 | #define MOLLI_EXTENSIONS 26 | 27 | #include 28 | #include 29 | 30 | namespace molli 31 | { 32 | // shorter namespace alias 33 | namespace py = pybind11; 34 | 35 | // C-contiguous array with force cast. 36 | // Useful type alias 37 | template 38 | using carray = py::array_t; 39 | 40 | // short alias for signed size_t 41 | // python things 42 | using ssize_t = py::ssize_t; 43 | 44 | // My own little inline for square 45 | template 46 | inline T square(const T number) 47 | { 48 | return number * number; 49 | } 50 | 51 | // Squared euclidean distance between two points 52 | template 53 | inline T euclidean2(const T *vec1, const T *vec2); 54 | 55 | // Euclidean distance between two points 56 | template 57 | inline T euclidean(const T *vec1, const T *vec2); 58 | 59 | // Matrix-to-maxtrix distance matrix 60 | // arr1[N,3] arr2[M,3] --> dm[N,M] 61 | template 62 | carray cdist22(const carray &arr1, const carray &arr2); 63 | 64 | // Matrix-to-maxtrix MINIMAL distance matrix (over dimension X) 65 | // arr1[X,N,3] arr2[M,3] --> dm[N,M] 66 | template 67 | carray cdist32(const carray &arr1, const carray &arr2); 68 | 69 | // module init functions 70 | void _init_distance(py::module_ &m); 71 | 72 | } // namespace molli 73 | 74 | #endif // MOLLI_EXTENSIONS 75 | -------------------------------------------------------------------------------- /optional-deps.txt: -------------------------------------------------------------------------------- 1 | notebook 2 | py3dmol 3 | openbabel 4 | rdkit 5 | scikit-learn 6 | pandas 7 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of `molli 1.0` 3 | # (https://github.com/SEDenmarkLab/molli) 4 | # ================================================================================ 5 | 6 | [build-system] 7 | requires = [ 8 | "setuptools>=67", 9 | "wheel>=0.40", 10 | "pybind11>=2.10.4", 11 | "setuptools-scm>=8.0", 12 | ] 13 | build-backend = "setuptools.build_meta" 14 | 15 | [project] 16 | authors = [ 17 | { name = "Alexander S. Shved", email = "shvedalx@illinois.edu" }, 18 | { name = "Blake E. Ocampo" }, 19 | { name = "Elena S. Burlova" }, 20 | { name = "Casey L. Olen" }, 21 | { name = "N. Ian Rinehart" }, 22 | ] 23 | readme = "README.md" 24 | license = { file = "LICENSE" } 25 | requires-python = ">=3.10" 26 | name = "molli" 27 | description = "Molecular toolbox library" 28 | dependencies = [ 29 | "numpy>=1.24.0", 30 | "scipy>=1.9.1", 31 | "h5py>=3.8", 32 | "msgpack>=1.0.3", 33 | "msgpack-numpy>=0.4.8", 34 | "attrs>=22.1.0", 35 | "bidict>=0.21.2", 36 | "requests>=2.28", 37 | "PyYAML>=5.3", 38 | "colorama>=0.4.4", 39 | "networkx>=3.0", 40 | "tqdm>=4.64.0", 41 | "packaging>=23.1", 42 | "deprecated>=1.2.14", 43 | "fasteners>=0.19", 44 | "joblib>=1.3.2", 45 | ] 46 | dynamic = ["version"] 47 | 48 | 49 | [tool.setuptools.package-data] 50 | "molli.files" = ["*"] 51 | "molli.data" = ["*.yml"] 52 | 53 | [tool.setuptools.packages.find] 54 | include = ["molli", "molli.*", "molli_test"] 55 | 56 | [project.scripts] 57 | molli = "molli.__main__:main" 58 | _molli_run = "molli.pipeline.runner:run_local" 59 | _molli_run_sched = "molli.pipeline.runner:run_sched" 60 | 61 | [tool.setuptools_scm] 62 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # ================================================================================ 2 | # This file is part of 3 | # ----------- 4 | # MOLLI 1.0.0 5 | # ----------- 6 | # (C) 2021 Alexander S. Shved and the Denmark laboratory 7 | # University of Illinois at Urbana-Champaign, Department of Chemistry 8 | # ================================================================================ 9 | 10 | 11 | """ 12 | This configures proper installation of the molli package 13 | and enables pip install . 14 | """ 15 | 16 | from setuptools import setup, find_packages, Extension 17 | from glob import glob 18 | import os 19 | 20 | # Include directories for c++ source compilation 21 | import pybind11 as pb11 22 | from pybind11.setup_helpers import Pybind11Extension, build_ext 23 | 24 | ext_modules = [ 25 | Pybind11Extension( 26 | "molli_xt", 27 | sources=glob("molli_xt/*.cpp"), 28 | ), 29 | ] 30 | 31 | include_dirs = [ 32 | pb11.get_include(), 33 | "molli_xt", 34 | ] 35 | 36 | setup( 37 | ext_modules=ext_modules, 38 | cmdclass={"build_ext": build_ext}, 39 | include_dirs=include_dirs, 40 | ) 41 | --------------------------------------------------------------------------------