├── docs ├── source │ ├── _static │ │ └── .placeholder │ ├── changelog.rst │ ├── readme.rst │ ├── res │ │ ├── puffin_only.png │ │ └── puffin_header.png │ ├── utilities.rst │ ├── index.rst │ ├── configuration.rst │ ├── jobs.rst │ ├── api.rst │ └── programs.rst ├── Makefile └── make.bat ├── scine_puffin ├── tests │ ├── resources │ │ ├── h.xyz │ │ ├── water.xyz │ │ ├── water_distorted.xyz │ │ ├── water_distorted_2.xyz │ │ ├── h2o2_distorted.xyz │ │ ├── co.xyz │ │ ├── hf.xyz │ │ ├── h2.sfam.xyz │ │ ├── h2.xyz │ │ ├── h2.json │ │ ├── co2.xyz │ │ ├── hocl.xyz │ │ ├── good_water.xyz │ │ ├── co2.json │ │ ├── ch2o.xyz │ │ ├── FeO_H2.xyz │ │ ├── FeO_H2_lhs.xyz │ │ ├── OOCHH.xyz │ │ ├── h2o2.xyz │ │ ├── 3_reactant_ch2o.xyz │ │ ├── OOCHH.json │ │ ├── 3_reactant_ch2o.json │ │ ├── FeO_H2_lhs.json │ │ ├── hio3.xyz │ │ ├── FeO_H2.json │ │ ├── h2o2.json │ │ ├── meoh.xyz │ │ ├── CH3ClBr_ts.xyz │ │ ├── hio3.json │ │ ├── __init__.py │ │ ├── 5_reactant_struct.json │ │ ├── OHCCHHOH.xyz │ │ ├── 5_ts_struct.json │ │ ├── 5_ts_struct.xyz │ │ ├── 3_reactant_ch2choh.xyz │ │ ├── 5_reactant_struct.xyz │ │ ├── OHCCHHOH.json │ │ ├── 3_reactant_ch2choh.json │ │ ├── propanal.json │ │ ├── co.sfam │ │ ├── h2.sfam │ │ ├── hf.sfam │ │ ├── water.sfam │ │ ├── peroxide.xyz │ │ ├── propanal.xyz │ │ ├── butane.json │ │ ├── acetone_radical.xyz │ │ ├── hocl.sfam │ │ ├── ch2o.sfam │ │ ├── phenol.xyz │ │ ├── peroxide.json │ │ ├── qmmm_acetone_radical.xyz │ │ ├── proline_deprotonated.json │ │ ├── meoh.sfam │ │ ├── proline_deprotonated.xyz │ │ ├── proline_acid.json │ │ ├── proline_acid.xyz │ │ ├── c5of8.mol │ │ ├── imine.json │ │ ├── proline_propanal_complex.json │ │ ├── proline_acid_propanal_complex.json │ │ ├── imine.xyz │ │ ├── proline_acid_propanal_product.json │ │ ├── butane.mol │ │ ├── mn_catalyst.xyz │ │ ├── phenol.sfam │ │ ├── au.xyz │ │ ├── au.json │ │ ├── ts_proline_acid_propanal.xyz │ │ ├── proline_acid_propanal_complex.xyz │ │ ├── proline_acid_propanal_product.xyz │ │ ├── proline_propanal_complex.xyz │ │ ├── mn_catalyst.json │ │ ├── mn_result.json │ │ ├── mn_result_2.json │ │ ├── au_complex.xyz │ │ ├── methanol_enamine_complex.xyz │ │ ├── acetal_methanol_complex.xyz │ │ ├── spline.end.xyz │ │ ├── spline.start.xyz │ │ └── 8-gly-chain-opt.xyz │ ├── __init__.py │ ├── cp2k │ │ ├── __init__.py │ │ └── files │ │ │ └── system.xyz │ ├── jobs │ │ ├── __init__.py │ │ ├── test_sleep_job.py │ │ ├── test_gaussian_cm5_charges_job.py │ │ ├── test_orca_geometry_optimization_job.py │ │ ├── test_turbomole_geometry_optimization_job.py │ │ ├── test_turbomole_hessian.py │ │ ├── test_scine_react_ts_guess.py │ │ ├── test_scine_ts_optimization_job.py │ │ ├── test_turbomole_bond_orders.py │ │ ├── test_scine_afir.py │ │ └── test_turbomole_single_point_job.py │ ├── mrcc │ │ ├── __init__.py │ │ └── mrcc_test.py │ └── test_missing_dependency.py ├── jobs │ ├── deprecated │ │ └── README.rst │ ├── __init__.py │ ├── templates │ │ ├── __init__.py │ │ ├── sub_settings_job.py │ │ └── turbomole_job.py │ ├── sleep.py │ ├── graph.py │ ├── scine_hessian.py │ ├── scine_single_point.py │ └── scine_ts_optimization.py ├── programs │ ├── deprecated │ │ ├── README.rst │ │ └── rdkit.py.depr │ ├── __init__.py │ ├── core.py │ ├── gaussian.py │ ├── orca.py │ ├── kinetx.py │ ├── parrot.py │ ├── utils.py │ ├── database.py │ ├── cp2k.py │ ├── readuct.py │ ├── turbomole.py │ ├── swoose.py │ ├── molassembler.py │ ├── mrcc.py │ ├── sparrow.py │ ├── xtb.py │ ├── dftbplus.py │ ├── ams.py │ ├── serenity.py │ └── rms.py ├── _version.py ├── utilities │ ├── __init__.py │ ├── task_to_readuct_call.py │ ├── compound_and_flask_helpers.py │ ├── properties.py │ ├── transfer_helper.py │ └── surface_helper.py ├── __init__.py └── __main__.py ├── .gitmodules ├── pytest.ini ├── requirements-dev.txt ├── requirements.txt ├── .coveragerc ├── MANIFEST.in ├── container ├── docker │ ├── docker-compose.yaml │ └── Dockerfile └── apptainer │ ├── README.rst │ └── puffin.def ├── .gitignore ├── CONTRIBUTING.rst ├── setup.cfg ├── LICENSE.txt ├── scripts └── rms │ ├── build_rms.sh │ └── scine2rms.py └── setup.py /docs/source/_static/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/changelog.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../CHANGELOG.rst 2 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h.xyz: -------------------------------------------------------------------------------- 1 | 1 2 | 3 | H 0.0 0.0 0.0 4 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/water.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O 0.0 0.0 0.0 4 | H 1.0 0.0 0.0 5 | H 0.0 1.0 0.0 -------------------------------------------------------------------------------- /docs/source/readme.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README.rst 2 | :start-after: inclusion-marker-do-not-remove 3 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/water_distorted.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O 0.0 0.0 0.0 4 | H 1.0 0.0 0.0 5 | H 0.5 0.5 0.0 -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dev"] 2 | path = dev 3 | url = https://github.com/qcscine/development-utils.git 4 | -------------------------------------------------------------------------------- /docs/source/res/puffin_only.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcscine/puffin/HEAD/docs/source/res/puffin_only.png -------------------------------------------------------------------------------- /scine_puffin/tests/resources/water_distorted_2.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O 0.0 0.0 0.0 4 | H 1.0 0.0 0.0 5 | H -0.5 0.5 0.0 -------------------------------------------------------------------------------- /docs/source/res/puffin_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qcscine/puffin/HEAD/docs/source/res/puffin_header.png -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2o2_distorted.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 0 1 3 | O 0.0 0.0 -0.75 4 | O 0.0 0.0 0.75 5 | H 1.0 0.0 -0.25 6 | H 0.0 1.0 -0.75 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/co.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | 3 | C -0.0647836147 -0.7257678977 -0.9021345953 4 | O 0.8639172650 -0.4772407376 -0.2864022341 5 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hf.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | 3 | H -1.3602920504 0.0354407791 -0.8909809207 4 | F -1.0017551024 -0.4735572984 -0.0742597241 5 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2.sfam.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | 3 | H 1.1484282715 -0.0629737382 -0.5337174280 4 | H 0.5477815661 -0.2808144193 -0.1104762383 5 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | 0 1 3 | H -0.0000000000 0.0000000000 -0.3788952204 4 | H 0.0000000000 -0.0000000000 0.3788952204 5 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | filterwarnings = 3 | error 4 | ignore::ResourceWarning 5 | markers = 6 | slow: marks tests as slow (deselect with '-m "not slow"') 7 | serial 8 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "o2FjD2FnomFFgYMAAQBhWoIBAWF2gwECAQ==", 4 | "masm_idx_map" : "[(0, 0), (0, 1)]" 5 | } 6 | -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | matplotlib 3 | pytest 4 | coverage 5 | recommonmark 6 | numpydoc 7 | pylint 8 | pylint-exit 9 | autopep8 10 | flake8 11 | autoflake 12 | mypy 13 | types-PyYAML 14 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/co2.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O -1.1708043981 -0.0000000000 -0.0000000000 4 | C 0.0008999662 -0.0000000000 0.0000000000 5 | O 1.1699044319 -0.0000000000 0.0000000000 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hocl.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O -1.9869158780 -2.7755896369 -0.4134957467 4 | H -1.5915067033 -2.1093147062 -1.0093092671 5 | Cl -2.2848616573 -1.9720836055 1.0447579458 6 | -------------------------------------------------------------------------------- /scine_puffin/jobs/deprecated/README.rst: -------------------------------------------------------------------------------- 1 | These deprecated jobs are untested, unmaintained 2 | and may have never worked. They were deemed good 3 | enough to remain a starting point for future 4 | developments, nothing more. -------------------------------------------------------------------------------- /scine_puffin/tests/resources/good_water.xyz: -------------------------------------------------------------------------------- 1 | 3 2 | 3 | O -0.5215184966 0.2948564597 0.4753497884 4 | H -0.0458364245 -0.4825771890 0.0080973500 5 | H 0.1531491549 1.0319961072 0.6188413512 6 | -------------------------------------------------------------------------------- /scine_puffin/programs/deprecated/README.rst: -------------------------------------------------------------------------------- 1 | These deprecated programs are untested, unmaintained 2 | and may have never worked. They were deemed good 3 | enough to remain a starting point for future 4 | developments, nothing more. -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | gitpython 2 | numpy 3 | psutil 4 | pymatgen 5 | python-daemon 6 | pyyaml 7 | scipy 8 | setproctitle 9 | sphinx 10 | sphinx_rtd_theme 11 | sphinx_autodoc_typehints 12 | sphinx_copybutton 13 | salib 14 | typing-extensions -------------------------------------------------------------------------------- /docs/source/utilities.rst: -------------------------------------------------------------------------------- 1 | Utilities 2 | ========= 3 | 4 | A module that gathers various modules with helper functions for multiple jobs. 5 | 6 | .. autosummary:: 7 | :toctree: generated 8 | :recursive: 9 | 10 | scine_puffin.utilities 11 | -------------------------------------------------------------------------------- /scine_puffin/_version.py: -------------------------------------------------------------------------------- 1 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 2 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 3 | See LICENSE.txt for details. 4 | """ 5 | 6 | __version__ = '2.1.0' 7 | -------------------------------------------------------------------------------- /scine_puffin/jobs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/co2.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_cbor_graph" : "pGFhgaVhYQBhYwJhb4GCAAFhcqNhbIKBAIEBYmxygYIAAWFzgYIAAWFzAGFjD2FnomFFgoMAAgCDAQIAYVqDCAgGYXaDAgAB", 3 | "masm_decision_list" : "", 4 | "masm_idx_map" : "[(0, 0), (0, 2), (0, 1)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/programs/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/ch2o.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 3 | C 0.0039148348 0.0000003011 -0.0000006178 4 | O 1.2120609209 -0.0000034642 0.0000006303 5 | H -0.6079882961 0.0260250795 -0.9523445072 6 | H -0.6079874596 -0.0260219164 0.9523444947 7 | -------------------------------------------------------------------------------- /scine_puffin/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | -------------------------------------------------------------------------------- /scine_puffin/jobs/templates/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/FeO_H2.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 3 | Fe 0.6399150479 0.7133206784 0.7012062755 4 | O 0.1061174002 -0.3397098090 -0.5710346763 5 | H -0.5567387334 0.5413806809 1.1339136517 6 | H -0.1892937148 -0.9149915503 -1.2640852509 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/FeO_H2_lhs.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 3 | Fe 0.3329697985 -0.0620608456 -0.3959421243 4 | O 1.3622755765 -0.2536676437 -1.6201404547 5 | H -1.0599662461 -0.1485323268 0.8774437201 6 | H -0.6352791289 0.4642608161 1.1386388589 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/OOCHH.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 0 1 3 | O 1.2033590709 -2.7248956559 3.4075816355 4 | C 0.3863519170 -3.4361894935 2.8728117571 5 | H -0.0194801715 -4.3753887098 3.3585715964 6 | H -0.0363378164 -3.2174181407 1.8455730111 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2o2.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 0 1 3 | O -0.0501872324 -0.4574961186 -0.5423611208 4 | H -0.9293736701 -0.2599269352 -0.9006162977 5 | O 0.0501380410 0.4572277977 0.5424409929 6 | H 0.9294228616 0.2601952561 0.9005364255 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/3_reactant_ch2o.xyz: -------------------------------------------------------------------------------- 1 | 4 2 | 0 1 3 | O 1.1903585241 -2.7362135393 3.3990797487 4 | C 0.3841765051 -3.4381086892 2.8714317998 5 | H -0.0119609262 -4.3531254589 3.3433525691 6 | H -0.0286811030 -3.2264443126 1.8706738825 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = 3 | scine_puffin 4 | [report] 5 | omit = 6 | */python?.?/* 7 | */site-packages/nose/* 8 | # ignore _version.py 9 | .*version.* 10 | *_version.py 11 | */tests/* 12 | 13 | exclude_lines = 14 | if __name__ == '__main__': 15 | -------------------------------------------------------------------------------- /scine_puffin/tests/cp2k/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/mrcc/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/OOCHH.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "pGFhgaVhYQBhYwNhb4GDAAECYXKjYWyDgQCBAYECYmxygoIAAYECYXOCggABgQJhcwJhYw9hZ6JhRYODAAMAgwEDAIMCAwBhWoQBAQgGYXaDAgAB", 4 | "masm_idx_map" : "[(0, 2), (0, 3), (0, 0), (0, 1)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/3_reactant_ch2o.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "pGFhgaVhYQBhYwNhb4GDAAECYXKjYWyDgQCBAYECYmxygoIAAYECYXOCggABgQJhcwJhYw9hZ6JhRYODAAMAgwEDAIMCAwBhWoQBAQgGYXaDAgAB", 4 | "masm_idx_map" : "[(0, 2), (0, 3), (0, 0), (0, 1)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/FeO_H2_lhs.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "pGFhgaVhYQBhYwNhb4GCAAFhcqNhbIKBAIIBAmJscoKBAIEBYXOCggECgQBhcwBhYw9hZ6JhRYSDAAMAgwECAIMBAwaDAgMGYVqECAEBGBphdoMBAgE=", 4 | "masm_idx_map" : "[(0, 3), (0, 0), (0, 1), (0, 2)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hio3.xyz: -------------------------------------------------------------------------------- 1 | 5 2 | 0 1 3 | O 1.2039183970 -0.2141875471 -0.0296973503 4 | H 1.7484203023 0.0646907419 0.7233718756 5 | O -0.9945616081 0.4638335512 -1.6214092333 6 | I -0.5494980064 0.5014572548 0.0721937479 7 | O -1.4082790848 -0.8157940008 0.8555409601 8 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. scine_puffin master file 2 | 3 | Puffin 4 | ====== 5 | 6 | .. image:: res/puffin_header.png 7 | :width: 100 % 8 | :alt: Puffin 9 | 10 | .. toctree:: 11 | :maxdepth: 3 12 | 13 | readme 14 | configuration 15 | programs 16 | jobs 17 | api 18 | utilities 19 | changelog 20 | -------------------------------------------------------------------------------- /scine_puffin/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from ._version import __version__ # noqa: F401 9 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/FeO_H2.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "pGFhgqVhYQBhYwJhb4GCAAFhcqNhbIKBAYEDYmxygoEAgQFhc4KBAYEDYXMApWFhAGFjA2FvgYIAAWFyo2FsgoEAgQJibHKCgQCBAWFzgoEAgQJhcwFhYw9hZ6JhRYODAAMAgwECAIMCAwBhWoQBAQgYGmF2gwECAQ==", 4 | "masm_idx_map" : "[(0, 3), (0, 2), (0, 0), (0, 1)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2o2.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(175, -179, -174, 1)", 3 | "masm_cbor_graph" : "pGFhgqVhYQBhYwJhb4GCAAFhcqNhbIKBAYEDYmxygoEAgQFhc4KBAYEDYXMBpWFhAGFjA2FvgYIAAWFyo2FsgoEAgQJibHKCgQCBAWFzgoEAgQJhcwFhYw9hZ6JhRYODAAMAgwECAIMCAwBhWoQBAQgIYXaDAQIB", 4 | "masm_idx_map" : "[(0, 2), (0, 1), (0, 3), (0, 0)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/meoh.xyz: -------------------------------------------------------------------------------- 1 | 6 2 | 3 | C -0.3373026721 -0.0633526153 0.1185030185 4 | O 1.0684444551 -0.0771558976 0.1443216255 5 | H -0.7321066782 -0.6142716180 -0.7421086347 6 | H -0.7321069586 0.9582970716 0.0986151945 7 | H -0.6682253389 -0.5522145355 1.0329164870 8 | H 1.4012971926 0.3486975947 -0.6522476909 9 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/CH3ClBr_ts.xyz: -------------------------------------------------------------------------------- 1 | 6 2 | 3 | Cl 2.3799757761 0.0000456494 0.0437426074 4 | C -0.0318923961 -0.0000006118 -0.0005861673 5 | H 0.0550233224 1.0579224335 0.1538373495 6 | H 0.0424320266 -0.6612884666 0.8407083074 7 | H 0.0760992320 -0.3966306549 -0.9913558498 8 | Br -2.5216379610 -0.0000483496 -0.0463462471 9 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hio3.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(150, 156, 161, 1)", 3 | "masm_cbor_graph" : "pGFhgqVhYQBhYwNhb4GCAAFhcqNhbIKBAIEEYmxygoEAgQFhc4KBAIEEYXMBpWFhAGFjBGFvgYMAAQJhcqNhbIOBAYECgQNibHKCgQKCAAFhc4KBA4IBAmFzA2FjD2FnomFFhIMAAwCDAQQAgwIEAIMDBABhWoUBCAgIGT+1YXaDAQIB", 4 | "masm_idx_map" : "[(0, 3), (0, 0), (0, 1), (0, 4), (0, 2)]" 5 | } 6 | -------------------------------------------------------------------------------- /docs/source/configuration.rst: -------------------------------------------------------------------------------- 1 | Settings 2 | ======== 3 | 4 | All settings in Puffin are controlled via the ``Configuration``. The 5 | ``puffin.yml`` file represents the content of this class. All settings are 6 | explained defined in the documentation of the ``Configuration``, hence it is 7 | shown below. 8 | 9 | .. autoclass:: scine_puffin.config.Configuration 10 | :noindex: 11 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | include CHANGELOG.rst 4 | include requirements.txt 5 | 6 | recursive-exclude * __pycache__ 7 | recursive-exclude * *.py[co] 8 | 9 | recursive-include docs *.rst conf.py Makefile make.bat 10 | 11 | include scine_puffin/_version.py 12 | 13 | # If including data files in the package, add them like: 14 | include scine_puffin/tests/resources 15 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import pathlib 9 | 10 | 11 | def resource_path(): 12 | return pathlib.Path(__file__).parent.resolve() 13 | -------------------------------------------------------------------------------- /container/docker/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | puffin: 4 | image: puffin:1.0.0 5 | #build: .. # Enable this line in order to also build the image from scratch 6 | volumes: 7 | - /TO_BE_ADDED:/scratch 8 | network_mode: "host" 9 | environment: 10 | - PUFFIN_DATABASE_IP=127.0.0.1 11 | - PUFFIN_DATABASE_PORT=27017 12 | - PUFFIN_DATABASE_NAME=test_network 13 | 14 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/5_reactant_struct.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_cbor_graph" : "pGFhgqVhYQBhYwVhb4GDAAECYXKjYWyDgQCBBIEGYmxyg4EAgQKBAWFzg4EAgQaBBGFzAqVhYQBhYwZhb4GEAAECA2Fyo2FshIEBgQKBA4EFYmxygoMAAQKBA2FzgoMBAgOBBWFzBWFjD2FnomFFhoMABQCDAQYAgwIGAIMDBgCDBAUAgwUGAGFahwEBAQEIBgZhdoMCAAE=", 3 | "masm_decision_list" : "(54, 60, 65, 3)", 4 | "masm_idx_map" : "[(0, 6), (0, 5), (0, 4), (0, 1), (0, 2), (0, 0), (0, 3)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/OHCCHHOH.xyz: -------------------------------------------------------------------------------- 1 | 7 2 | 0 1 3 | H 0.4130396895 0.9286581227 -0.4128019725 4 | C 0.2327555605 1.1088327666 0.6573385460 5 | C 0.6458524288 0.2318287509 1.5892494854 6 | H -0.2930408009 2.0221714595 0.9642508996 7 | H 0.4631293210 0.4149652593 2.6651507961 8 | O 1.3049614653 -0.9221408857 1.2832739903 9 | H 1.5015353357 -1.3956414733 2.1091012550 10 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/5_ts_struct.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : ";(-28, -21, -17, 2)", 3 | "masm_cbor_graph" : "o2FjD2FnomFFgGFagQFhdoMCAAE=;pGFhgqVhYQBhYwRhb4GDAAECYXKjYWyDgQGBAoEFYmxygoIAAYECYXOCggECgQVhcwKlYWEAYWMFYW+BgwABAmFyo2Fsg4EAgQOBBGJscoOBAIECgQFhc4OBAIEEgQNhcwJhYw9hZ6JhRYWDAAUAgwEEAIMCBACDAwUAgwQFAGFahgEBAQgGBmF2gwIAAQ==", 4 | "masm_idx_map" : "[(1, 4), (1, 5), (1, 3), (0, 0), (1, 1), (1, 0), (1, 2)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/5_ts_struct.xyz: -------------------------------------------------------------------------------- 1 | 7 2 | 0 1 3 | C -0.6613818447 0.1194054559 0.3135283741 4 | C 0.5473135337 -0.4517824308 -0.1546408239 5 | O 1.1490007623 0.3319920185 -0.9818281829 6 | H -0.0340818430 0.8798530907 -0.8233016515 7 | H -1.5070824847 -0.4808722079 0.6901302320 8 | H 0.9929506225 -1.4475344518 0.0641279922 9 | H -0.4867187461 1.0489385254 0.8919840600 10 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/3_reactant_ch2choh.xyz: -------------------------------------------------------------------------------- 1 | 7 2 | 0 1 3 | H 0.4174081664 0.9157437059 -0.3700261295 4 | C 0.2354884531 1.1020890313 0.6725135644 5 | C 0.6362341672 0.2469232609 1.5966909983 6 | H -0.2804484016 2.0032385312 0.9419327655 7 | H 0.4573392807 0.4264010544 2.6511821886 8 | O 1.2936181996 -0.9058682984 1.2835626300 9 | H 1.5085931345 -1.3998532853 2.0797069827 10 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/5_reactant_struct.xyz: -------------------------------------------------------------------------------- 1 | 7 2 | 0 1 3 | C -0.6038002433 0.2035208741 0.1073514084 4 | C 0.8043518949 -0.2381920317 -0.1329927122 5 | O 1.7808566443 0.4428758048 -0.0057132276 6 | H -1.1801030273 0.0741987118 -0.8070351352 7 | H -1.0517882121 -0.4289991034 0.8716347015 8 | H 0.8849432931 -1.2967108468 -0.4544856251 9 | H -0.6344603495 1.2433065911 0.4212405901 10 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/OHCCHHOH.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-5, 0, 6, 1)", 3 | "masm_cbor_graph" : "pWFhg6VhYQBhYwRhb4GCAAFhcqNhbIKBA4EGYmxygoEAgQFhc4KBA4EGYXMBpWFhAGFjBWFvgYMAAQJhcqNhbIOBAYECgQZibHKCggABgQJhc4KCAQKBBmFzAqVhYQBhYwZhb4GDAAECYXKjYWyDgQCBBIEFYmxyg4EAgQKBAWFzg4EAgQWBBGFzAmFigaJhYQBhZYIFBmFjD2FnomFFhoMABgCDAQUAgwIFAIMDBACDBAYAgwUGAGFahwEBAQEIBgZhdoMCAAE=", 4 | "masm_idx_map" : "[(0, 1), (0, 5), (0, 6), (0, 2), (0, 0), (0, 4), (0, 3)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/3_reactant_ch2choh.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-6, 0, 5, 1)", 3 | "masm_cbor_graph" : "pWFhg6VhYQBhYwRhb4GCAAFhcqNhbIKBA4EGYmxygoEAgQFhc4KBA4EGYXMBpWFhAGFjBWFvgYMAAQJhcqNhbIOBAYECgQZibHKCggABgQJhc4KCAQKBBmFzAqVhYQBhYwZhb4GDAAECYXKjYWyDgQCBBIEFYmxyg4EAgQKBAWFzg4EAgQWBBGFzAmFigaJhYQBhZYIFBmFjD2FnomFFhoMABgCDAQUAgwIFAIMDBACDBAYAgwUGAGFahwEBAQEIBgZhdoMCAAE=", 4 | "masm_idx_map" : "[(0, 1), (0, 5), (0, 6), (0, 2), (0, 0), (0, 4), (0, 3)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/propanal.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-129, -122, -118, 1):(54, 60, 65, 3)", 3 | "masm_cbor_graph" : "pGFhg6RhYQBhYwdhcqNhbIOBBYEGgQlibHKDgQCBAoEBYXODgQWBCYEGYXMCpGFhAGFjCGFyo2FshIECgQOBBIEJYmxygoMAAQKBA2FzgoMCAwSBCWFzBaRhYQBhYwlhcqNhbISBAIEBgQeBCGJscoOCAAGBA4ECYXODggABgQiBB2FzBWFjD2FnomFFiYMACQCDAQkAgwIIAIMDCACDBAgAgwUHAIMGBwCDBwkAgwgJAGFaigEBAQEBAQgGBgZhdoMBAQA=", 4 | "masm_idx_map" : "[(0, 7), (0, 9), (0, 8), (0, 6), (0, 5), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/co.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svpd) 2 | 3 | ! bonds 4 | C1_O1 O1_C1 1.14179 1596.88 5 | 6 | ! angles 7 | * 8 | 9 | ! dihedrals 10 | * 11 | 12 | ! impropers 13 | * 14 | 15 | ! charges 16 | C1_O1 0.157448 17 | O1_C1 -0.157448 18 | 19 | ! non-covalent 20 | a1 0.2 21 | s8 5.5 22 | a2 6.2 23 | beta 7.3 24 | scaling_factor_for_atomic_charges 0.9 25 | 26 | ! c6 coefficients 27 | 43.0613 28 | 22.4688 12.8087 29 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/h2.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svpd) 2 | 3 | ! bonds 4 | H_H H_H_H 0.766379 381.637 5 | 6 | ! angles 7 | * 8 | 9 | ! dihedrals 10 | * 11 | 12 | ! impropers 13 | * 14 | 15 | ! charges 16 | H_H 0.00615727 17 | H_H_H -0.00615727 18 | 19 | ! non-covalent 20 | a1 0.2 21 | s8 5.5 22 | a2 6.2 23 | beta 7.3 24 | scaling_factor_for_atomic_charges 0.9 25 | 26 | ! c6 coefficients 27 | 3.15663 28 | 3.15664 3.15662 29 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hf.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svpd) 2 | 3 | ! bonds 4 | F1_H1 H_F1_H1 0.989128 236.861 5 | 6 | ! angles 7 | * 8 | 9 | ! dihedrals 10 | * 11 | 12 | ! impropers 13 | * 14 | 15 | ! charges 16 | F1_H1 -0.0970441 17 | H_F1_H1 0.0970441 18 | 19 | ! non-covalent 20 | a1 0.2 21 | s8 5.5 22 | a2 6.2 23 | beta 7.3 24 | scaling_factor_for_atomic_charges 0.9 25 | 26 | ! c6 coefficients 27 | 7.17497 28 | 4.32135 3.09095 29 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/water.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svp) 2 | 3 | ! bonds 4 | H_O2_H2 O2_H2 1.00545 780.264 5 | 6 | ! angles 7 | H_O2_H2 O2_H2 H_O2_H2 104.256 76.2399 8 | 9 | ! dihedrals 10 | * 11 | 12 | ! impropers 13 | * 14 | 15 | ! charges 16 | H_O2_H2 0.142231 17 | O2_H2 -0.284463 18 | 19 | ! non-covalent 20 | a1 0.2 21 | s8 5.5 22 | a2 6.2 23 | beta 7.3 24 | scaling_factor_for_atomic_charges 0.9 25 | 26 | ! c6 coefficients 27 | 3.08907 28 | 5.43187 10.406 29 | -------------------------------------------------------------------------------- /docs/source/jobs.rst: -------------------------------------------------------------------------------- 1 | Jobs 2 | ==== 3 | 4 | Basic Jobs 5 | ---------- 6 | 7 | All Jobs prepended with ``Scine`` indicate that they are making use of the C++ 8 | ``module`` interface defined in SCINE. Hence, adding a personal ``module`` with 9 | a custom ``Calculator`` will automatically enable the use of these tasks with 10 | the custom ``module``/``Calculator``. 11 | 12 | For more information about this interface please see the documentation of 13 | SCINE: Core and possibly also SCINE: Utils. 14 | 15 | .. autosummary:: 16 | :toctree: generated 17 | :recursive: 18 | 19 | scine_puffin.jobs 20 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/peroxide.xyz: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | C 0.6564298697 1.1596540408 -0.2620802273 4 | O -0.6801687991 1.1622761797 0.2886486810 5 | O -1.3436355647 0.0340145939 -0.2798102791 6 | C -0.6830223834 -1.1326872360 0.2607484053 7 | O 0.6535771712 -1.1353098584 -0.2899782528 8 | O 1.3170436088 -0.0070462737 0.2784776686 9 | H 1.1625132841 2.0200216111 0.2009400898 10 | H 0.6358666957 1.1340816815 -1.3594381839 11 | H -1.1891077689 -1.9930554787 -0.2022647061 12 | H -0.6624561134 -1.1070992602 1.3581068044 13 | -------------------------------------------------------------------------------- /docs/source/api.rst: -------------------------------------------------------------------------------- 1 | 2 | API 3 | === 4 | 5 | Module: bootstrap 6 | ----------------- 7 | 8 | .. automodule:: scine_puffin.bootstrap 9 | :members: 10 | 11 | Module: config 12 | -------------- 13 | 14 | .. automodule:: scine_puffin.config 15 | :members: 16 | 17 | Module: daemon 18 | -------------- 19 | 20 | .. automodule:: scine_puffin.daemon 21 | :members: 22 | 23 | Module: jobloop 24 | --------------- 25 | 26 | .. automodule:: scine_puffin.jobloop 27 | :members: 28 | 29 | Module: programs.program 30 | ------------------------ 31 | 32 | .. automodule:: scine_puffin.programs.program 33 | :members: 34 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/propanal.xyz: -------------------------------------------------------------------------------- 1 | 10 2 | dftb3 optimized 3 | C -0.0049753230 0.0056825497 1.0323108007 4 | C 0.0006423272 -1.2901746550 1.8365495365 5 | C -0.5797616718 -2.4717597899 1.0748009419 6 | O -0.4176856804 0.1162502803 -0.0918612112 7 | H 0.4252428055 0.8994999776 1.5887735686 8 | H 1.0324566405 -1.4972460612 2.1449496826 9 | H -0.5544162107 -1.1184683957 2.7666219215 10 | H -1.6109204922 -2.2758935128 0.7922537821 11 | H -0.0151981785 -2.6547497701 0.1641614146 12 | H -0.5557242167 -3.3748006229 1.6806695626 13 | -------------------------------------------------------------------------------- /scine_puffin/utilities/task_to_readuct_call.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from enum import Enum 8 | 9 | 10 | class SubTaskToReaductCall(Enum): 11 | OPT = "run_opt_task" 12 | RCOPT = "run_opt_task" 13 | IRCOPT = "run_opt_task" 14 | IRC = "run_irc_task" 15 | TSOPT = "run_tsopt_task" 16 | NT = "run_nt_task" 17 | NT2 = "run_nt2_task" 18 | AFIR = "run_afir_task" 19 | SP = "run_sp_task" 20 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/butane.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-64, -57, -53, 3):(53, 58, 64, 3):(175, -179, -174, 1)", 3 | "masm_cbor_graph" : "pGFhhKRhYQBhYwphcqNhbISBB4EIgQmBDWJscoKDAAECgQNhc4KDBwgJgQ1hcwWkYWEAYWMLYXKjYWyEgQSBBYEGgQxibHKCgwABAoEDYXOCgwQFBoEMYXMFpGFhAGFjDGFyo2FshIECgQOBC4ENYmxyg4IAAYECgQNhc4OCAgOBC4ENYXMFpGFhAGFjDWFyo2FshIEAgQGBCoEMYmxyg4IAAYECgQNhc4OCAAGBCoEMYXMFYWMPYWeiYUWNgwANAIMBDQCDAgwAgwMMAIMECwCDBQsAgwYLAIMHCgCDCAoAgwkKAIMKDQCDCwwAgwwNAGFajgEBAQEBAQEBAQEGBgYGYXaDAQIA", 4 | "masm_idx_map" : "[(0, 11), (0, 12), (0, 13), (0, 10), (0, 4), (0, 5), (0, 6), (0, 2), (0, 3), (0, 0), (0, 1), (0, 7), (0, 8), (0, 9)]" 5 | } 6 | 7 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/acetone_radical.xyz: -------------------------------------------------------------------------------- 1 | 11 2 | 3 | C 1.2420456000 0.4374053000 0.5859361000 4 | O 1.6822011000 1.7325487000 0.3928762000 5 | H 0.8995111000 2.3000944000 0.2647680000 6 | C -0.0627014000 0.0540340000 -0.0324719000 7 | H -0.4116707000 -0.9271026000 0.3470406000 8 | H -0.8615026000 0.7972463000 0.1904035000 9 | H -0.0066175000 -0.0293550000 -1.1510560000 10 | C 2.3615398000 -0.5381812000 0.7083719000 11 | H 3.1579744000 -0.1389006000 1.3693332000 12 | H 2.8456914000 -0.7629122000 -0.2782540000 13 | H 2.0065288000 -1.5016772000 1.1251123000 14 | 15 | -------------------------------------------------------------------------------- /scine_puffin/tests/cp2k/files/system.xyz: -------------------------------------------------------------------------------- 1 | 8 2 | cell : 5.4306975, 5.4306975, 5.4306975, 90, 90, 90, xyz 3 | Si 0.000000000000 0.000000000000 0.000000000000 4 | Si 0.000000000000 2.715348700000 2.715348700000 5 | Si 2.715348700000 2.715348700000 0.000000000000 6 | Si 2.715348700000 0.000000000000 2.715348700000 7 | Si 4.073023100000 1.357674400000 4.073023100000 8 | Si 1.357674400000 1.357674400000 1.357674400000 9 | Si 1.357674400000 4.073023100000 4.073023100000 10 | Si 4.073023100000 4.073023100000 1.357674400000 11 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/hocl.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svp) 2 | 3 | ! bonds 4 | Cl1_O1 O2_H1Cl1 1.73078 437.282 5 | H_O2_H1Cl1 O2_H1Cl1 0.981415 1065.75 6 | 7 | ! angles 8 | Cl1_O1 O2_H1Cl1 H_O2_H1Cl1 101.33 107.609 9 | 10 | ! dihedrals 11 | * 12 | 13 | ! impropers 14 | * 15 | 16 | ! charges 17 | Cl1_O1 0.112097 18 | H_O2_H1Cl1 0.189797 19 | O2_H1Cl1 -0.301893 20 | 21 | ! non-covalent 22 | a1 0.2 23 | s8 5.5 24 | a2 6.2 25 | beta 7.3 26 | scaling_factor_for_atomic_charges 0.9 27 | 28 | ! c6 coefficients 29 | 0 30 | 16.6647 0 31 | 29.7602 5.42518 0 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # Distribution / packaging 7 | build/ 8 | venv/ 9 | *.egg-info/ 10 | *.egg 11 | 12 | # Unit test / coverage reports 13 | .coverage 14 | .coverage.* 15 | .cache 16 | .hypothesis 17 | coverage.xml 18 | 19 | # Sphinx documentation 20 | docs/build/ 21 | docs/source/generated/ 22 | 23 | # pytest 24 | .pytest_cache/ 25 | 26 | # Editor files 27 | #mac 28 | .DS_Store 29 | *~ 30 | 31 | #vim 32 | *.swp 33 | *.swo 34 | 35 | #pycharm 36 | .idea/ 37 | 38 | #VSCode 39 | .vscode/ 40 | 41 | # unittests 42 | puffin_unittest_scratch/ 43 | 44 | # puffin instance 45 | puffin.yaml 46 | puffin.sh 47 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = "-W" # This flag turns warnings into errors. 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = PackagingScientificPython 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 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/ch2o.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svp) 2 | 3 | ! bonds 4 | C3_H2O1 H_C3_H2O1 1.13228 550.815 5 | C3_H2O1 O1_C1 1.20815 1777.56 6 | 7 | ! angles 8 | H_C3_H2O1 C3_H2O1 H_C3_H2O1 114.576 56.8462 9 | H_C3_H2O1 C3_H2O1 O1_C1 122.712 112.727 10 | 11 | ! dihedrals 12 | * 13 | 14 | ! impropers 15 | C3_H2O1 H_C3_H2O1 H_C3_H2O1 O1_C1 0 50 16 | 17 | ! charges 18 | C3_H2O1 -0.09184 19 | H_C3_H2O1 0.085615 20 | O1_C1 -0.07939 21 | 22 | ! non-covalent 23 | a1 0.2 24 | s8 5.5 25 | a2 6.2 26 | beta 7.3 27 | scaling_factor_for_atomic_charges 0.9 28 | 29 | ! c6 coefficients 30 | 0 31 | 8.90426 3.09354 32 | 17.746 6.11563 0 33 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/phenol.xyz: -------------------------------------------------------------------------------- 1 | 13 2 | 3 | H 0.8972651788 -1.7670325985 -0.5269435768 4 | O -0.9928946270 -0.4956357854 -1.7285604812 5 | H -1.6206217988 0.1651612319 -2.0452253705 6 | C -0.1846541447 0.0576700838 -0.7661037930 7 | C 0.7943034038 -0.7462324382 -0.1944984001 8 | C -0.3357972564 1.3732249259 -0.3544832224 9 | C 1.6126093875 -0.2274980655 0.7898792966 10 | C 0.4898839777 1.8821377728 0.6326691128 11 | C 1.4635789548 1.0850123567 1.2072243602 12 | H 2.3698778905 -0.8543538122 1.2352130795 13 | H 2.1042827308 1.4842386123 1.9782033921 14 | H 0.3655225831 2.9056727479 0.9533059586 15 | H -1.1000720416 1.9946229171 -0.8026332878 16 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/peroxide.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list": "", 3 | "masm_cbor_graph": "pGFhhqVhYQBhYwRhb4GCAAFhcqRhbIKBB4EJY2xua4GiYXCCAAFjc2VxhgQHCAYFCWJscoKBAYEAYXOCgQmBB2FzAaVhYQBhYwVhb4GCAAFhcqRhbIKBBoEJY2xua4GiYXCCAAFjc2VxhgUGCAcECWJscoKBAYEAYXOCgQmBBmFzAaVhYQBhYwZhb4GCAAFhcqRhbIKBBYEIY2xua4GiYXCCAAFjc2VxhgYFCQQHCGJscoKBAYEAYXOCgQiBBWFzAaVhYQBhYwdhb4GCAAFhcqRhbIKBBIEIY2xua4GiYXCCAAFjc2VxhgcECQUGCGJscoKBAYEAYXOCgQiBBGFzAaVhYQBhYwhhb4GEAAECA2FypGFshIECgQOBBoEHY2xua4GiYXCCAgNjc2VxhggGBQkEB2JscoKCAAGCAgNhc4KCAgOCBgdhcwWlYWEAYWMJYW+BhAABAgNhcqRhbISBAIEBgQSBBWNsbmuBomFwggIDY3NlcYYJBAcIBgVibHKCggABggIDYXOCggABggQFYXMFYWMPYWeiYUWKgwAJAIMBCQCDAggAgwMIAIMEBwCDBAkAgwUGAIMFCQCDBggAgwcIAGFaigEBAQEICAgIBgZhdoMCAAA=", 4 | "masm_idx_map": "[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 9)]" 5 | } -------------------------------------------------------------------------------- /scine_puffin/tests/resources/qmmm_acetone_radical.xyz: -------------------------------------------------------------------------------- 1 | 14 2 | 3 | C 1.2420456000 0.4374053000 0.5859361000 4 | O 1.6822011000 1.7325487000 0.3928762000 5 | H 0.8995111000 2.3000944000 0.2647680000 6 | C -0.0627014000 0.0540340000 -0.0324719000 7 | H -0.4116707000 -0.9271026000 0.3470406000 8 | H -0.8615026000 0.7972463000 0.1904035000 9 | H -0.0066175000 -0.0293550000 -1.1510560000 10 | C 2.3615398000 -0.5381812000 0.7083719000 11 | H 3.1579744000 -0.1389006000 1.3693332000 12 | H 2.8456914000 -0.7629122000 -0.2782540000 13 | H 2.0065288000 -1.5016772000 1.1251123000 14 | H -0.7503469086 10.0000000000 -0.1914644606 15 | H 0.7503469086 10.0000000000 -0.1914644606 16 | O 0.0000000000 10.0000000000 0.3829289211 17 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_deprotonated.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(80, 86, 91, 2)", 3 | "masm_cbor_graph" : "pGFhhqRhYQBhYwphcqNhbIOBCIEJgQ9ibHKCgQKCAAFhc4KBD4IICWFzAqRhYQBhYwthcqRhbIOBB4EOgQ9jbG5rgaJhcIIBAmNzZXGFCw4MDQ9ibHKDgQCBAYECYXODgQeBDoEPYXMDpGFhAGFjDGFypGFshIEEgQWBDYEOY2xua4GiYXCCAgNjc2VxhQwNDwsOYmxyg4IAAYECgQNhc4OCBAWBDYEOYXMFpGFhAGFjDWFypGFshIECgQOBDIEPY2xua4GiYXCCAgNjc2VxhQ0MDgsPYmxyg4IAAYECgQNhc4OCAgOBDIEPYXMFpGFhAGFjDmFypGFshIEAgQGBC4EMY2xua4GiYXCCAgNjc2VxhQ4LDw0MYmxyg4IAAYEDgQJhc4OCAAGBDIELYXMFpGFhAGFjD2FypGFshIEGgQqBC4ENY2xua4GiYXCCAgNjc2VxhQ8LDgwNYmxyhIEAgQOBAYECYXOEgQaBDYEKgQthcwVhYw9hZ6JhRZCDAA4AgwEOAIMCDQCDAw0AgwQMAIMFDACDBg8AgwcLAIMICgCDCQoAgwoPAIMLDgCDCw8AgwwNAIMMDgCDDQ8AYVqQAQEBAQEBAQEICAYHBgYGBmF2gwEBAA==", 4 | "masm_idx_map" : "[(0, 12), (0, 13), (0, 15), (0, 11), (0, 14), (0, 4), (0, 2), (0, 3), (0, 6), (0, 7), (0, 0), (0, 1), (0, 5), (0, 10), (0, 8), (0, 9)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/meoh.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svp) 2 | 3 | ! bonds 4 | C4_H3O1 H_C4_H3O1 1.11528 640.227 5 | C4_H3O1 O2_H1C1 1.41019 559.862 6 | H_O2_H1C1 O2_H1C1 0.973508 1089.45 7 | 8 | ! angles 9 | C4_H3O1 O2_H1C1 H_O2_H1C1 107.337 120.765 10 | H_C4_H3O1 C4_H3O1 H_C4_H3O1 107.166 70.1005 11 | H_C4_H3O1 C4_H3O1 O2_H1C1 111.65 115.542 12 | 13 | ! dihedrals 14 | X C4_H3O1 O2_H1C1 X 0.213082 180 3 15 | 16 | ! impropers 17 | * 18 | 19 | ! charges 20 | C4_H3O1 -0.237888 21 | H_C4_H3O1 0.0965483 22 | H_O2_H1C1 0.178962 23 | O2_H1C1 -0.230718 24 | 25 | ! non-covalent 26 | a1 0.2 27 | s8 5.5 28 | a2 6.2 29 | beta 7.3 30 | scaling_factor_for_atomic_charges 0.9 31 | 32 | ! c6 coefficients 33 | 0 34 | 7.472 3.0929 35 | 7.46552 3.09 0 36 | 13.627 5.4362 5.43177 0 37 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_deprotonated.xyz: -------------------------------------------------------------------------------- 1 | 16 2 | 3 | C 1.1089014976 -0.9319828430 -0.5716727016 4 | C 0.9665214269 0.5159912673 -0.0764364140 5 | C -0.3960113376 0.5589927907 0.6632572247 6 | N -1.1571577837 -0.5932046317 0.2094213559 7 | C -0.1711305593 -1.6285919132 -0.0628645957 8 | H 2.0039621573 -1.4083755694 -0.1749938908 9 | H 0.9353571513 1.2176233292 -0.9144871182 10 | H 1.7761330099 0.8209195759 0.5857905966 11 | H -0.2462524131 0.4926715744 1.7499151457 12 | H -1.6186658418 -0.3019709256 -0.6509581472 13 | H -0.5667519459 -2.3604489788 -0.7682393054 14 | H 0.0345014414 -2.1342438404 0.8874405858 15 | H 1.1538255713 -0.9617879443 -1.6604226967 16 | C -1.1144640353 1.9090387530 0.3440193834 17 | O -1.7645854996 1.9675834830 -0.7194521009 18 | O -0.9441828394 2.8377858727 1.1596826785 19 | -------------------------------------------------------------------------------- /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 | set SPHINXPROJ=PackagingScientificPython 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 20 | echo.installed, then set the SPHINXBUILD environment variable to point 21 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 22 | echo.may add the Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-8, -1, 3, 1):(-27, -20, -16, 1)", 3 | "masm_cbor_graph" : "pGFhh6RhYQBhYwphcqNhbIKBCIELYmxygoEAgQFhc4KBCIELYXMBpGFhAGFjC2Fyo2Fsg4EJgQqBEGJscoOBAoEBgQBhc4OBEIEKgQlhcwKkYWEAYWMMYXKkYWyDgQeBD4EQY2xua4GiYXCCAQJjc2VxhQwPDg0QYmxyg4EAgQGBAmFzg4EHgQ+BEGFzA6RhYQBhYw1hcqRhbISBA4EEgQ6BEGNsbmuBomFwggIDY3NlcYUNDg8MEGJscoOCAAGBAoEDYXODggMEgQ6BEGFzBaRhYQBhYw5hcqRhbISBAYECgQ2BD2NsbmuBomFwggIDY3NlcYUODRAMD2JscoOCAAGBAoEDYXODggECgQ2BD2FzBaRhYQBhYw9hcqRhbISBBYEGgQyBDmNsbmuBomFwggIDY3NlcYUPDBANDmJscoOCAAGBA4ECYXODggUGgQ6BDGFzBaRhYQBhYxBhcqRhbISBAIELgQyBDWNsbmuBomFwggIDY3NlcYUQDA8ODWJscoSBAIEDgQGBAmFzhIEAgQ2BC4EMYXMFYWMPYWeiYUWRgwAQAIMBDgCDAg4AgwMNAIMEDQCDBQ8AgwYPAIMHDACDCAoAgwkLAIMKCwCDCxAAgwwPAIMMEACDDQ4Agw0QAIMODwBhWpEBAQEBAQEBAQEICAYHBgYGBmF2gwEBAA==", 4 | "masm_idx_map" : "[(0, 14), (0, 13), (0, 16), (0, 12), (0, 15), (0, 1), (0, 3), (0, 4), (0, 0), (0, 7), (0, 5), (0, 6), (0, 2), (0, 11), (0, 9), (0, 10), (0, 8)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid.xyz: -------------------------------------------------------------------------------- 1 | 17 2 | dftb3 optimized 3 | C -3.5445628128 2.0215753918 -0.1440104929 4 | C -2.2489114608 2.8380823260 -0.2686179383 5 | C -1.4761384134 2.2007266416 -1.4567789740 6 | N -2.0914225555 0.8632818733 -1.6939956397 7 | C -3.5152962667 1.0256740969 -1.3226979537 8 | H -4.4342050957 2.6548875421 -0.1738824793 9 | H -1.6487009507 2.7882727424 0.6431280142 10 | H -2.4467842893 3.8950953117 -0.4584739029 11 | H -1.6392109266 2.8163058167 -2.3633046084 12 | H -1.6705004291 0.1967754313 -1.0356801525 13 | H -3.9476244848 0.0506427829 -1.0758186844 14 | H -4.0716174662 1.4285660115 -2.1815441649 15 | H -3.5720956576 1.4862249815 0.8091741985 16 | C 0.0384610247 2.0706603608 -1.2552557030 17 | O 0.6862520676 2.7270360738 -0.4628021311 18 | O 0.6251346889 1.1475137453 -2.0714418190 19 | H -0.0409569721 0.7037088706 -2.6208075683 20 | -------------------------------------------------------------------------------- /docs/source/programs.rst: -------------------------------------------------------------------------------- 1 | Programs 2 | ======== 3 | 4 | Default Programs 5 | ---------------- 6 | 7 | SCINE: Database 8 | ``````````````` 9 | .. autoclass:: scine_puffin.programs.database.Database 10 | 11 | SCINE: molassembler 12 | ``````````````````` 13 | .. autoclass:: scine_puffin.programs.molassembler.Molassembler 14 | 15 | SCINE: Readuct 16 | `````````````` 17 | .. autoclass:: scine_puffin.programs.readuct.Readuct 18 | 19 | SCINE: Utils 20 | ```````````` 21 | .. autoclass:: scine_puffin.programs.utils.Utils 22 | 23 | Optional Extensions 24 | ------------------- 25 | 26 | SCINE: Sparrow 27 | `````````````` 28 | .. autoclass:: scine_puffin.programs.sparrow.Sparrow 29 | 30 | SCINE: Parrot 31 | ````````````` 32 | .. autoclass:: scine_puffin.programs.parrot.Parrot 33 | 34 | Serenity 35 | ```````` 36 | .. autoclass:: scine_puffin.programs.serenity.Serenity 37 | 38 | Orca 39 | ```` 40 | .. autoclass:: scine_puffin.programs.orca.Orca 41 | 42 | Gaussian 43 | ```````` 44 | .. autoclass:: scine_puffin.programs.gaussian.Gaussian 45 | -------------------------------------------------------------------------------- /scine_puffin/tests/test_missing_dependency.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import pytest 9 | 10 | from ..utilities.imports import MissingDependency, MissingDependencyError, requires 11 | 12 | 13 | @requires("arbitrary_dependency") 14 | def _failing(_some_argument, _another_argument): 15 | pass 16 | 17 | 18 | @requires("pytest") 19 | def _working(_some_argument, _another_argument): 20 | pass 21 | 22 | 23 | def test_requires(): 24 | _working(1, 2) 25 | with pytest.raises(MissingDependencyError): 26 | _failing(1, 2) 27 | 28 | 29 | def test_missing_dependency(): 30 | missing_dependency = MissingDependency("arbitrary_dependency") 31 | with pytest.raises(NameError): 32 | _ = missing_dependency.arbitrary_attribute_name 33 | with pytest.raises(MissingDependencyError): 34 | _ = missing_dependency() 35 | with pytest.raises(NameError): 36 | _ = missing_dependency.some_method(42) 37 | -------------------------------------------------------------------------------- /scine_puffin/programs/core.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Core(Program): 14 | """ 15 | Scine: Core -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/gaussian.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Gaussian(Program): 15 | """ 16 | Setup of the Gaussian program 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | elif self.source: 23 | raise NotImplementedError 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | env_vars["GAUSSIAN_BINARY_PATH"] = os.path.join(self.root, "g09") 33 | elif self.source: 34 | pass 35 | else: 36 | raise RuntimeError 37 | 38 | def available_models(self) -> List[str]: 39 | return ["DFT", "HF"] 40 | -------------------------------------------------------------------------------- /scine_puffin/programs/orca.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Orca(Program): 15 | """ 16 | Setup of the Orca program 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | elif self.source: 23 | raise NotImplementedError 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | env_vars["ORCA_BINARY_PATH"] = os.path.join(self.root, "bin", "orca") 33 | elif self.source: 34 | pass 35 | else: 36 | raise RuntimeError 37 | 38 | def available_models(self) -> List[str]: 39 | return ["DFT", "HF", "PM3"] 40 | -------------------------------------------------------------------------------- /scine_puffin/programs/kinetx.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Kinetx(Program): 14 | """ 15 | KiNetX -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | pass 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/parrot.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Parrot(Program): 14 | """ 15 | Parrot -- Machine Learning Potentials for SCINE 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, _: int): 19 | if self.root: 20 | raise RuntimeError 21 | elif self.source: 22 | self.pip_module_source_install(repo_dir, install_dir) 23 | else: 24 | self.pip_package_install('scine_parrot', install_dir) 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, _: Configuration, __: dict, ___: dict): 30 | pass 31 | 32 | def available_models(self) -> List[str]: 33 | return ['lmlp', 'ani', 'm3gnet'] 34 | 35 | @staticmethod 36 | def initialize(): 37 | import scine_parrot # noqa: F401 , pylint: disable=unused-import 38 | -------------------------------------------------------------------------------- /scine_puffin/programs/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Utils(Program): 14 | """ 15 | Scine: Utils -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/database.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Database(Program): 14 | """ 15 | Scine: Database API -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/cp2k.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Cp2k(Program): 15 | """ 16 | Setup of the CP2K program 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | elif self.source: 23 | raise NotImplementedError 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | env_vars["CP2K_BINARY_PATH"] = os.path.join(self.root) # direct path to bin because of multiple bins 33 | elif self.source: 34 | pass 35 | else: 36 | raise RuntimeError 37 | 38 | def available_models(self) -> List[str]: 39 | return ["DFT"] 40 | -------------------------------------------------------------------------------- /scine_puffin/programs/readuct.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Readuct(Program): 14 | """ 15 | Scine: Readuct -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/turbomole.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Turbomole(Program): 14 | """ 15 | Setup of the Turbomole program 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | pass 21 | elif self.source: 22 | raise NotImplementedError 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | # $TURBODIR needs to be set in order for Turbomole to execute properly 32 | env_vars["TURBODIR"] = self.root 33 | elif self.source: 34 | pass 35 | else: 36 | raise RuntimeError 37 | 38 | def available_models(self) -> List[str]: 39 | return ["DFT"] 40 | -------------------------------------------------------------------------------- /scine_puffin/programs/swoose.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Swoose(Program): 14 | """ 15 | Scine: Swoose -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return ['SFAM', 'GAFF'] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/molassembler.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Molassembler(Program): 14 | """ 15 | Scine: Molassembler -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return [] 39 | -------------------------------------------------------------------------------- /scine_puffin/programs/mrcc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Mrcc(Program): 15 | """ 16 | Setup of the MRCC program 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | elif self.source: 23 | raise NotImplementedError 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | # MRCC_BINARY_PATH needs to be set in order for MRCC to execute. 33 | env_vars["MRCC_BINARY_PATH"] = self.root 34 | elif self.source: 35 | pass 36 | else: 37 | raise RuntimeError 38 | 39 | def available_models(self) -> List[str]: 40 | return ["DFT", "HF", "CC", "MP2"] 41 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/c5of8.mol: -------------------------------------------------------------------------------- 1 | c5of8.mol 2 | __Jmol-14_11292311103D 1 1.00000 0.00000 0 3 | Jmol version 14.32.3 2021-12-08 13:29 EXTRACT: ({0:13}) 4 | 14 13 0 0 0 0 999 V2000 5 | -1.9696 1.0028 0.1585 C 0 0 0 0 0 0 6 | -1.0663 -0.0070 -0.8149 C 0 0 0 0 0 0 7 | 0.5273 -0.3073 -0.5078 C 0 0 2 0 0 0 8 | 0.5951 -1.7320 0.3330 C 0 0 0 0 0 0 9 | 1.3093 0.9343 0.2285 C 0 0 2 0 0 0 10 | -1.7817 -0.6060 -1.9573 O 0 0 0 0 0 0 11 | -3.1009 1.8218 -0.3710 F 0 0 0 0 0 0 12 | -1.6424 1.1262 1.6075 F 0 0 0 0 0 0 13 | 1.2138 -0.5287 -1.8149 F 0 0 0 0 0 0 14 | -0.4392 -2.8089 0.1312 F 0 0 0 0 0 0 15 | 1.6604 -2.0461 1.3283 F 0 0 0 0 0 0 16 | 0.8918 2.2929 -0.2800 F 0 0 0 0 0 0 17 | 2.7570 0.8092 -0.1857 F 0 0 0 0 0 0 18 | 1.3207 0.8601 1.7174 F 0 0 0 0 0 0 19 | 1 2 1 0 0 0 20 | 1 8 1 0 0 0 21 | 2 3 1 0 0 0 22 | 3 9 1 0 0 0 23 | 3 4 1 0 0 0 24 | 3 5 1 0 0 0 25 | 4 11 1 0 0 0 26 | 5 14 1 0 0 0 27 | 5 13 1 0 0 0 28 | 6 2 1 0 0 0 29 | 7 1 1 0 0 0 30 | 10 4 1 0 0 0 31 | 12 5 1 0 0 0 32 | M END 33 | -------------------------------------------------------------------------------- /scine_puffin/programs/sparrow.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | 9 | from .program import Program 10 | from scine_puffin.config import Configuration 11 | 12 | 13 | class Sparrow(Program): 14 | """ 15 | Scine: Sparrow -- installation and verification class 16 | """ 17 | 18 | def install(self, repo_dir: str, install_dir: str, ncores: int): 19 | if self.root: 20 | raise NotImplementedError 21 | elif self.source: 22 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 23 | else: 24 | raise RuntimeError 25 | 26 | def check_install(self): 27 | raise NotImplementedError 28 | 29 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 30 | if self.root: 31 | raise NotImplementedError 32 | elif self.source: 33 | pass 34 | else: 35 | raise RuntimeError 36 | 37 | def available_models(self) -> List[str]: 38 | return ["NDDO", "RM1", "AM1", "PM3", "PM6", "DFTB2", "DFTB3"] 39 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/imine.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-9, -2, 2, 1):(12, 17, 23, 1):(-159, -152, -148, 1):(-57, -51, -46, 3)", 3 | "masm_cbor_graph" : "pWFhiqRhYQBhYw9hcqNhbIKBDYEQYmxygoEAgQFhc4KBDYEQYXMBpGFhAGFjEGFyo2Fsg4EOgQ+BGBhibHKDgQKBAYEAYXODgRgYgQ+BDmFzAqRhYQBhYxFhcqNhbIOBBYESgRRibHKDgQCBAoEBYXODgQWBFIESYXMCpGFhAGFjEmFypGFsg4ERgReBGBhjbG5rgaJhcIIBAmNzZXGFEhcWFRgYYmxyg4EBgQCBAmFzg4EXgRGBGBhhcwKkYWEAYWMTYXKjYWyEgQKBA4EEgRRibHKCgwABAoEDYXOCgwIDBIEUYXMFpGFhAGFjFGFyo2FshIEAgQGBEYETYmxyg4IAAYEDgQJhc4OCAAGBE4ERYXMFpGFhAGFjFWFypGFshIEGgQeBFoEYGGNsbmuBomFwggIDY3NlcYUVFhcSGBhibHKDggABgQKBA2Fzg4IGB4EWgRgYYXMFpGFhAGFjFmFypGFshIEIgQmBFYEXY2xua4GiYXCCAgNjc2VxhRYVGBgSF2JscoOCAAGBAoEDYXODgggJgRWBF2FzBaRhYQBhYxdhcqRhbISBC4EMgRKBFmNsbmuBomFwggIDY3NlcYUXEhgYFRZibHKDggABgQOBAmFzg4ILDIEWgRJhcwWkYWEAYWMYGGFypGFshIEKgRCBEoEVY2xua4GiYXCCAgNjc2VxhRgYEhcWFWJscoSBAIEDgQGBAmFzhIEKgRWBEIESYXMFYWKBomFhAWFlghESYWMPYWeiYUWYGYMAFACDARQAgwITAIMDEwCDBBMAgwURAIMGFQCDBxUAgwgWAIMJFgCDChgYAIMLFwCDDBcAgw0PAIMOEACDDxAAgxAYGACDERIAgxEUAIMSFwCDEhgYAIMTFACDFRYAgxUYGACDFhcAYVqYGQEBAQEBAQEBAQEBAQEBCAgGBgcGBgYGBgZhdoMBAQA=", 4 | "masm_idx_map" : "[(0, 22), (0, 21), (0, 24), (0, 18), (0, 23), (0, 8), (0, 6), (0, 7), (0, 10), (0, 11), (0, 12), (0, 9), (0, 16), (0, 15), (0, 14), (0, 13), (0, 17), (0, 20), (0, 19), (0, 5), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_propanal_complex.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(7, 12, 18):(53, 58, 64);(-1, 5, 10):(0, 5, 11)", 3 | "masm_cbor_graph" : "pGFhg6RhYQBhYwdhcqNhbIOBBYEGgQlibHKDgQCBAoEBYXODgQWBCYEGYXMCpGFhAGFjCGFyo2FshIECgQOBBIEJYmxygoMAAQKBA2FzgoMCAwSBCWFzBaRhYQBhYwlhcqNhbISBAIEBgQeBCGJscoOCAAGBA4ECYXODggABgQiBB2FzBWFjD2FnomFFiYMACQCDAQkAgwIIAIMDCACDBAgAgwUHAIMGBwCDBwkAgwgJAGFaigEBAQEBAQgGBgZhdoMBAQA=;pGFhh6RhYQBhYwphcqNhbIKBCIELYmxygoEAgQFhc4KBCIELYXMBpGFhAGFjC2Fyo2Fsg4EJgQqBEGJscoOBAoEBgQBhc4OBEIEKgQlhcwKkYWEAYWMMYXKkYWyDgQeBD4EQY2xua4GiYXCCAQJjc2VxhQwPDg0QYmxyg4EAgQGBAmFzg4EHgQ+BEGFzA6RhYQBhYw1hcqRhbISBA4EEgQ6BEGNsbmuBomFwggIDY3NlcYUNDg8MEGJscoOCAAGBAoEDYXODggMEgQ6BEGFzBaRhYQBhYw5hcqRhbISBAYECgQ2BD2NsbmuBomFwggIDY3NlcYUODRAMD2JscoOCAAGBAoEDYXODggECgQ2BD2FzBaRhYQBhYw9hcqRhbISBBYEGgQyBDmNsbmuBomFwggIDY3NlcYUPDBANDmJscoOCAAGBA4ECYXODggUGgQ6BDGFzBaRhYQBhYxBhcqRhbISBAIELgQyBDWNsbmuBomFwggIDY3NlcYUQDA8ODWJscoSBAIEDgQGBAmFzhIEAgQ2BC4EMYXMFYWMPYWeiYUWRgwAQAIMBDgCDAg4AgwMNAIMEDQCDBQ8AgwYPAIMHDACDCAoAgwkLAIMKCwCDCxAAgwwPAIMMEACDDQ4Agw0QAIMODwBhWpEBAQEBAQEBAQEICAYHBgYGBmF2gwEBAA==", 4 | "masm_idx_map" : "[(1, 14), (1, 13), (1, 16), (1, 12), (1, 15), (1, 1), (1, 3), (1, 4), (1, 0), (1, 7), (1, 5), (1, 6), (1, 2), (1, 11), (1, 9), (1, 10), (1, 8), (0, 7), (0, 9), (0, 8), (0, 6), (0, 5), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]" 5 | } 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contributing to SCINE Puffin 2 | ============================ 3 | 4 | Contribution Process 5 | -------------------- 6 | 7 | The development for this code is done in a private repository maintained by the 8 | Reiher Research Group. GitHub is only used for the official releases. 9 | 10 | If you would like to contribute a larger change, please write to scine@phys.chem.ethz.ch. 11 | For smaller changes, you can create a pull request on GitHub. If we agree with 12 | the changes, a member of the Reiher Research Group will include them in our 13 | development code. Of course, we will give proper acknowledgment for any external 14 | contribution (see below for a list of all contributors). As soon as these changes 15 | are available in an official release, we will close the corresponding pull requests 16 | and/or issues on GitHub. 17 | 18 | Please note that contributing a small change does in no way mean that you will 19 | be added to the author list of a future paper and/or Zenodo entry! 20 | 21 | Main Contributors 22 | ----------------- 23 | 24 | Almost all contributions to SCINE in general and this repository in specific come 25 | from members of the Reiher research group. 26 | 27 | Further Contributors 28 | -------------------- 29 | 30 | - Sebastian Ehlert (`@awvwgk `_), University of Bonn 31 | (https://github.com/qcscine/puffin/issues/2) 32 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid_propanal_complex.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(49, 54, 60, 1):(-65, -58, -54, 3);(-5, 0, 6, 1):(-68, -62, -57, 1)", 3 | "masm_cbor_graph" : "pGFhg6RhYQBhYwdhcqNhbIOBBYEGgQlibHKDgQCBAoEBYXODgQWBCYEGYXMCpGFhAGFjCGFyo2FshIECgQOBBIEJYmxygoMAAQKBA2FzgoMCAwSBCWFzBaRhYQBhYwlhcqNhbISBAIEBgQeBCGJscoOCAAGBA4ECYXODggABgQiBB2FzBWFjD2FnomFFiYMACQCDAQkAgwIIAIMDCACDBAgAgwUHAIMGBwCDBwkAgwgJAGFaigEBAQEBAQgGBgZhdoMBAgA=;pGFhh6RhYQBhYwphcqNhbIKBCIELYmxygoEAgQFhc4KBCIELYXMBpGFhAGFjC2Fyo2Fsg4EJgQqBEGJscoOBAoEBgQBhc4OBEIEKgQlhcwKkYWEAYWMMYXKkYWyDgQeBD4EQY2xua4GiYXCCAQJjc2VxhQwPDg0QYmxyg4EAgQGBAmFzg4EHgQ+BEGFzA6RhYQBhYw1hcqRhbISBA4EEgQ6BEGNsbmuBomFwggIDY3NlcYUNDg8MEGJscoOCAAGBAoEDYXODggMEgQ6BEGFzBaRhYQBhYw5hcqRhbISBAYECgQ2BD2NsbmuBomFwggIDY3NlcYUODRAMD2JscoOCAAGBAoEDYXODggECgQ2BD2FzBaRhYQBhYw9hcqRhbISBBYEGgQyBDmNsbmuBomFwggIDY3NlcYUPDBANDmJscoOCAAGBA4ECYXODggUGgQ6BDGFzBaRhYQBhYxBhcqRhbISBAIELgQyBDWNsbmuBomFwggIDY3NlcYUQDA8ODWJscoSBAIEDgQGBAmFzhIEAgQ2BC4EMYXMFYWMPYWeiYUWRgwAQAIMBDgCDAg4AgwMNAIMEDQCDBQ8AgwYPAIMHDACDCAoAgwkLAIMKCwCDCxAAgwwPAIMMEACDDQ4Agw0QAIMODwBhWpEBAQEBAQEBAQEICAYHBgYGBmF2gwECAA==", 4 | "masm_idx_map" : "[(1, 14), (1, 13), (1, 16), (1, 12), (1, 15), (1, 1), (1, 3), (1, 4), (1, 0), (1, 7), (1, 5), (1, 6), (1, 2), (1, 11), (1, 9), (1, 10), (1, 8), (0, 7), (0, 9), (0, 8), (0, 6), (0, 5), (0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/programs/xtb.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | import os 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Xtb(Program): 15 | """ 16 | Scine: Xtb wrapper -- installation and verification class 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | raise NotImplementedError 22 | elif self.source: 23 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | raise NotImplementedError 33 | elif self.source: 34 | env_vars["XTBPATH"] = os.path.join(config.daemon()["software_dir"], "install", "share", "xtb") 35 | else: 36 | raise RuntimeError 37 | 38 | def available_models(self) -> List[str]: 39 | return ["GFN0", "GFN1", "GFN2", "GFNFF"] 40 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [pycodestyle] 2 | max_line_length = 120 3 | 4 | [flake8] 5 | max_line_length = 120 6 | 7 | [mypy] 8 | ignore_missing_imports = True 9 | 10 | [pylint.MASTER] 11 | # allow to load these 12 | extension-pkg-whitelist=setproctitle 13 | 14 | [pylint.FORMAT] 15 | max-line-length=120 16 | 17 | [pylint.TYPECHECK] 18 | # types cannot be inferred leading to false negatives 19 | ignored-modules=scine_utilities,scine_database,scine_molassembler,scine_readuct,scine_sparrow,scine_swoose,scine_kinetx,scine_parrot 20 | 21 | # regex of default ignored + arg args kwargs 22 | ignored-argument-names=_.*|^ignored_|^unused_|arg|args|kwargs 23 | 24 | # general disable: 25 | # C: Conventions like naming variables 26 | # R: Code complexity like too many variables in function 27 | # W0511: show TODO 28 | # W0212: access to 'private' method, but can be useful for tests 29 | # W1514: open file without encoding 30 | # W0622: redefine builtin name such as 'id' or 'filter' 31 | # W0105: pointless string statement, e.g. """ highlighted comment """ 32 | # W1510: running subprocess, without return code check 33 | disable=C,R,W0511,W0212,W1514,W0622,W0105,W1510 34 | 35 | # multiprocessing generates some members, which can cause problems, add more here if needed 36 | generated-members=Lock 37 | 38 | # ignore file completely 39 | ignore=_version.py 40 | 41 | # accept BaseException 42 | overgeneral-exceptions=builtins.Exception 43 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/imine.xyz: -------------------------------------------------------------------------------- 1 | 25 2 | 3 | C 1.3590697925 -1.5096935574 1.5605652451 4 | C 1.5433193258 -1.5583278152 0.0436698019 5 | C 0.4681847122 -0.5946238919 -0.4962761807 6 | N 0.2021615574 0.3301874483 0.5991263418 7 | C 0.9536375128 -0.0591963404 1.7989750978 8 | H 2.2797337246 -1.7589884941 2.0831409526 9 | H 1.4325043342 -2.5615166011 -0.3636403230 10 | H 2.5321673067 -1.1913065089 -0.2306858047 11 | H 0.8212188524 -0.0636683400 -1.3834379826 12 | H 0.3623247743 0.0884533104 2.7040142013 13 | H 1.8450623337 0.5749146158 1.8567721924 14 | H 0.5922102204 -2.2088796484 1.8952791446 15 | C -0.7871967599 -1.3938363000 -0.9445998061 16 | O -1.5835480182 -1.8529817452 -0.0017684778 17 | O -0.9924156235 -1.5907992472 -2.1087342635 18 | H -1.3084923432 -1.7032293895 0.9184808036 19 | C -0.5694941449 1.3588062932 0.5892820487 20 | C -1.3615535190 1.9579524066 -0.4965220857 21 | C -0.8955880454 1.8335790511 -1.9482672376 22 | H -0.6629606889 1.8630617384 1.5486339799 23 | H -2.3747186856 1.5373263649 -0.4084821226 24 | H -1.4723855387 3.0195615665 -0.2532585106 25 | H 0.1369101727 2.1568846193 -2.0537969799 26 | H -1.0111174678 0.8319642073 -2.3524170922 27 | H -1.5090337848 2.4943562576 -2.5560529429 28 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid_propanal_product.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(-45, -38, -34, 1):(-40, -33, -29, 2):(46, 51, 57, 3):(42, 48, 53, 1):(174, 180, -175, 1)", 3 | "masm_cbor_graph" : "pGFhiqRhYQBhYxFhcqNhbIKBDoEYGmJscoKBAIEBYXOCgQ6BGBphcwGkYWEAYWMSYXKjYWyDgQ+BEIEWYmxygoECggABYXOCgRaCDxBhcwKkYWEAYWMTYXKkYWyEgQSBBYEUgRVjbG5rgaJhcIICA2NzZXGFExQWGBkVYmxyg4IAAYECgQNhc4OCBAWBFIEVYXMFpGFhAGFjFGFypGFshIECgQOBE4EWY2xua4GiYXCCAgNjc2VxhRQTFRgZFmJscoOCAAGBAoEDYXODggIDgROBFmFzBaRhYQBhYxVhcqRhbISBAIEBgROBGBljbG5rgaJhcIICA2NzZXGFFRMUFhgZYmxyg4IAAYECgQNhc4OCAAGBE4EYGWFzBaRhYQBhYxZhcqRhbISBBoESgRSBGBljbG5rgaJhcIICA2NzZXGFFhQTFRgZYmxyhIEAgQKBAYEDYXOEgQaBFIESgRgZYXMFpGFhAGFjF2Fyo2FshIEIgQmBCoEYGGJscoKDAAECgQNhc4KDCAkKgRgYYXMFpGFhAGFjGBhhcqNhbISBC4EMgReBGBpibHKDggABgQKBA2Fzg4ILDIEXgRgaYXMFpGFhAGFjGBlhcqRhbISBB4EVgRaBGBpjbG5rgaJhcIIBAmNzZXGFGBkVExQWYmxyhIEAgQGBAoEDYXOEgQeBFYEWgRgaYXMFpGFhAWFjGBphcqNhbISBDYERgRgYgRgZYmxyhIEAgQKBA4EBYXOEgQ2BGBiBGBmBEWFzBWFjD2FnomFFmBuDABUAgwEVAIMCFACDAxQAgwQTAIMFEwCDBhYAgwcYGQCDCBcAgwkXAIMKFwCDCxgYAIMMGBgAgw0YGgCDDhEAgw8SAIMQEgCDERgaAIMSFgCDExQAgxMVAIMUFgCDFRgZAIMWGBkAgxcYGACDGBgYGgCDGBkYGgBhWpgbAQEBAQEBAQEBAQEBAQEBCAgIBgYGBgYGBgcGYXaDAQIA", 4 | "masm_idx_map" : "[(0, 19), (0, 20), (0, 22), (0, 25), (0, 21), (0, 4), (0, 2), (0, 3), (0, 6), (0, 7), (0, 0), (0, 1), (0, 5), (0, 18), (0, 15), (0, 16), (0, 14), (0, 26), (0, 24), (0, 23), (0, 17), (0, 13), (0, 11), (0, 12), (0, 8), (0, 9), (0, 10)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/programs/dftbplus.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | import os 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Dftbplus(Program): 15 | """ 16 | SCINE: DFTB+ Wrapper -- installation and verification class 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | raise NotImplementedError 22 | elif self.source: 23 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | raise NotImplementedError 33 | elif self.source: 34 | env_vars["DFTBPLUS_PARAM_DIR"] = \ 35 | os.path.join(config.daemon()["software_dir"], "install", "share", "slakos", "origin") 36 | else: 37 | raise RuntimeError 38 | 39 | def available_models(self) -> List[str]: 40 | return ['GFN1', 'GFN2', 'IPEA1', 'DFTB0', 'DFTB2', 'DFTB3'] 41 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/butane.mol: -------------------------------------------------------------------------------- 1 | 2 | OpenBabel03081910223D 3 | 4 | 14 13 0 0 0 0 0 0 0 0999 V2000 5 | 0.9117 0.0131 0.0675 C 0 0 0 0 0 0 0 0 0 0 0 0 6 | 2.4320 0.0264 0.0706 C 0 0 0 0 0 0 0 0 0 0 0 0 7 | 2.9788 1.4024 0.4456 C 0 0 0 0 0 0 0 0 0 0 0 0 8 | 4.4991 1.4161 0.4477 C 0 0 0 0 0 0 0 0 0 0 0 0 9 | 0.5420 -0.9809 -0.2033 H 0 0 0 0 0 0 0 0 0 0 0 0 10 | 0.5146 0.7320 -0.6562 H 0 0 0 0 0 0 0 0 0 0 0 0 11 | 0.5151 0.2654 1.0561 H 0 0 0 0 0 0 0 0 0 0 0 0 12 | 2.7963 -0.2613 -0.9225 H 0 0 0 0 0 0 0 0 0 0 0 0 13 | 2.7969 -0.7254 0.7801 H 0 0 0 0 0 0 0 0 0 0 0 0 14 | 2.6151 1.6898 1.4390 H 0 0 0 0 0 0 0 0 0 0 0 0 15 | 2.6133 2.1544 -0.2634 H 0 0 0 0 0 0 0 0 0 0 0 0 16 | 4.8969 0.6968 1.1707 H 0 0 0 0 0 0 0 0 0 0 0 0 17 | 4.8688 2.4099 0.7186 H 0 0 0 0 0 0 0 0 0 0 0 0 18 | 4.8950 1.1643 -0.5413 H 0 0 0 0 0 0 0 0 0 0 0 0 19 | 1 2 1 0 0 0 0 20 | 1 5 1 0 0 0 0 21 | 1 6 1 0 0 0 0 22 | 1 7 1 0 0 0 0 23 | 2 3 1 0 0 0 0 24 | 2 8 1 0 0 0 0 25 | 2 9 1 0 0 0 0 26 | 3 4 1 0 0 0 0 27 | 3 10 1 0 0 0 0 28 | 3 11 1 0 0 0 0 29 | 4 12 1 0 0 0 0 30 | 4 13 1 0 0 0 0 31 | 4 14 1 0 0 0 0 32 | M END 33 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/mn_catalyst.xyz: -------------------------------------------------------------------------------- 1 | 26 2 | 3 | C -2.1519122497 0.2909357199 -1.0385422129 4 | C -2.1827442984 -0.8231511874 0.7727342905 5 | H -2.7955256569 -0.3205893130 -1.6912298189 6 | H -3.7809204265 1.6136069556 -0.4781877036 7 | H -2.6185495867 -1.7360205870 0.3593868926 8 | H -2.9015644855 -0.0690320289 1.1057520642 9 | C -2.7242148636 1.6567488834 -0.7920646410 10 | H -2.1564490362 2.2611823276 -0.0654137329 11 | H -2.7134541163 2.1885803862 -1.7614932607 12 | Mn -0.4268046372 -0.1149076996 -0.4926618222 13 | N 2.2212375135 -0.9452705195 0.9414819888 14 | C 1.5239146726 -0.0022248416 0.2605407054 15 | C 3.5058195068 -0.5398078736 1.2559687266 16 | C 3.6332425776 0.7208532815 0.7555276432 17 | N 2.4198896070 1.0142898738 0.1564154711 18 | H 2.2238177470 1.8858804605 -0.3253860744 19 | H 4.4664150837 1.4170220009 0.7721447770 20 | H 4.2060384478 -1.1687148421 1.7971251430 21 | C -0.2416938189 -1.6895862244 -1.2626708367 22 | O -0.1312486604 -2.7407118826 -1.7259673429 23 | C 0.2544620978 0.6965280335 -2.0032917829 24 | O 0.6365023368 1.1954470239 -2.9630013465 25 | H 1.8347890035 -1.8541669615 1.1729417472 26 | C -0.9262894537 -0.8974951179 1.4415696501 27 | H -0.4834489890 -1.8853716096 1.5974726753 28 | H -0.6913083150 -0.1540242581 2.2108488004 29 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/phenol.sfam: -------------------------------------------------------------------------------- 1 | # MM parameters of SFAM generated by SCINE (Reference calculations: TURBOMOLE / pbe-d3bj / def2-svp) 2 | 3 | ! bonds 4 | C3_C2O1 C3_H1C2 1.40949 711.532 5 | C3_C2O1 O2_H1C1 1.36205 716.42 6 | C3_H1C2 C3_H1C2 1.40298 776.218 7 | C3_H1C2 H_C3_H1C2 1.10091 729.306 8 | H_O2_H1C1 O2_H1C1 0.975126 1071.16 9 | 10 | ! angles 11 | C3_C2O1 C3_H1C2 C3_H1C2 119.916 169.533 12 | C3_C2O1 C3_H1C2 H_C3_H1C2 119.133 78.242 13 | C3_C2O1 O2_H1C1 H_O2_H1C1 108.315 124.83 14 | C3_H1C2 C3_C2O1 C3_H1C2 119.623 140.781 15 | C3_H1C2 C3_C2O1 O2_H1C1 120.189 171.553 16 | C3_H1C2 C3_H1C2 C3_H1C2 120.181 146.09 17 | C3_H1C2 C3_H1C2 H_C3_H1C2 120.17 81.4097 18 | 19 | ! dihedrals 20 | X C3_C2O1 C3_H1C2 X 3.04436 0 2 21 | X C3_C2O1 O2_H1C1 X 1.32907 0 2 22 | X C3_H1C2 C3_H1C2 X 2.87788 0 2 23 | 24 | ! impropers 25 | C3_C2O1 C3_H1C2 C3_H1C2 O2_H1C1 0 50 26 | C3_H1C2 C3_C2O1 C3_H1C2 H_C3_H1C2 0 50 27 | C3_H1C2 C3_H1C2 C3_H1C2 H_C3_H1C2 0 50 28 | 29 | ! charges 30 | C3_C2O1 0.0234 31 | C3_H1C2 -0.139638 32 | H_C3_H1C2 0.121284 33 | H_O2_H1C1 0.19407 34 | O2_H1C1 -0.1257 35 | 36 | ! non-covalent 37 | a1 0.2 38 | s8 5.5 39 | a2 6.2 40 | beta 7.3 41 | scaling_factor_for_atomic_charges 0.9 42 | 43 | ! c6 coefficients 44 | 0 45 | 25.2307 25.2447 46 | 8.81003 8.81879 3.08862 47 | 8.80617 8.81493 3.08729 0 48 | 15.6719 15.6853 5.42911 5.42697 0 49 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/au.xyz: -------------------------------------------------------------------------------- 1 | 27 2 | 0 1 3 | Au -0.9825436050 -1.7023669119 2.4126482175 4 | Au -2.4573208143 0.8520495702 2.4124273697 5 | Au -3.9321000052 3.4063796292 2.4124543101 6 | Au 1.9669776894 -1.7023763393 2.4119131997 7 | Au 0.4922004040 0.8520400222 2.4116923496 8 | Au -0.9825787838 3.4063700692 2.4117194234 9 | Au 4.9163992663 -1.7024432930 2.4115952980 10 | Au 3.4416220152 0.8519731292 2.4113744367 11 | Au 1.9668425096 3.4063030276 2.4114019974 12 | Au -2.4584358359 -2.5548600050 -2.4112937535 13 | Au -3.9332140897 -0.0005154442 -2.4114652059 14 | Au -5.4079913424 2.5539217869 -2.4115819624 15 | Au 0.4909856752 -2.5549268883 -2.4116114473 16 | Au -0.9837925039 -0.0005823846 -2.4117831202 17 | Au -2.4585697916 2.5538548183 -2.4118998121 18 | Au 3.4405068853 -2.5549364498 -2.4123464003 19 | Au 1.9657287233 -0.0005919165 -2.4125181268 20 | Au 0.4909515132 2.5538453811 -2.4126348683 21 | Au -0.9830259437 -3.4057723790 0.0004067113 22 | Au -2.4578046476 -0.8513758105 0.0004891085 23 | Au -3.9325819326 1.7030129134 0.0002680791 24 | Au 1.9663703880 -3.4058538179 0.0000088947 25 | Au 0.4915920944 -0.8514571021 0.0000907993 26 | Au -0.9831852032 1.7029316043 -0.0001302402 27 | Au 4.9157669913 -3.4059351240 -0.0003892412 28 | Au 3.4409888170 -0.8515384288 -0.0003075279 29 | Au 1.9662115268 1.7028503435 -0.0005284886 30 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/au.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "", 3 | "masm_cbor_graph" : "o2FjD2FnomFFmL2DAAEAgwACAIMAAwCDAAQAgwAFAIMABgCDABIAgwATAIMAFACDABUAgwAWAIMAFwCDAQIAgwEEAIMBBQCDAQ0AgwEOAIMBEwCDARQAgwEVAIMBFwCDARgYAIMBGBkAgwIDAIMCBgCDAg0AgwIOAIMCEwCDAhQAgwIVAIMCFgCDAhgYAIMCGBoAgwMEAIMDBQCDAw0AgwMOAIMDEgCDAxQAgwMVAIMDFgCDAxgZAIMDGBoAgwQGAIMEDQCDBA4AgwQSAIMEEwCDBBUAgwQXAIMEGBkAgwQYGgCDBQYAgwUNAIMFDgCDBRIAgwUUAIMFFgCDBRcAgwUYGACDBRgZAIMGDQCDBg4AgwYSAIMGEwCDBhYAgwYXAIMGGBgAgwYYGgCDBwgAgwcJAIMHCwCDBwwAgwcPAIMHEACDBxMAgwcUAIMHFQCDBxYAgwcXAIMHGBgAgwgJAIMICgCDCAwAgwgPAIMIEQCDCBIAgwgUAIMIFQCDCBYAgwgXAIMIGBkAgwkKAIMJCwCDCRAAgwkRAIMJEgCDCRMAgwkVAIMJFgCDCRcAgwkYGgCDCgsAgwoMAIMKDwCDChAAgwoSAIMKEwCDChQAgwoVAIMKGBkAgwoYGgCDCwwAgwsPAIMLEQCDCxIAgwsTAIMLFACDCxYAgwsYGACDCxgaAIMMEACDDBEAgwwSAIMMEwCDDBQAgwwXAIMMGBgAgwwYGQCDDRUAgw0WAIMNFwCDDRgYAIMNGBkAgw0YGgCDDhIAgw4TAIMOFACDDhgYAIMOGBkAgw4YGgCDDxAAgw8RAIMPFACDDxUAgw8WAIMPGBgAgw8YGQCDDxgaAIMQEQCDEBMAgxAVAIMQFwCDEBgYAIMQGBkAgxAYGgCDERIAgxEWAIMRFwCDERgYAIMRGBkAgxEYGgCDEhMAgxIUAIMSFgCDEhcAgxIYGQCDEhgaAIMTFACDExUAgxMXAIMTGBgAgxMYGgCDFBUAgxQWAIMUGBgAgxQYGQCDFRYAgxUXAIMVGBkAgxUYGgCDFhcAgxYYGACDFhgaAIMXGBgAgxcYGQCDGBgYGQCDGBgYGgCDGBkYGgBhWpgbGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPGWLPYXaDAQIB", 4 | "masm_idx_map" : "[(0, 0), (0, 2), (0, 3), (0, 5), (0, 1), (0, 13), (0, 6), (0, 14), (0, 4), (0, 12), (0, 16), (0, 17), (0, 11), (0, 10), (0, 9), (0, 7), (0, 15), (0, 8), (0, 18), (0, 19), (0, 26), (0, 22), (0, 20), (0, 21), (0, 23), (0, 24), (0, 25)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/ts_proline_acid_propanal.xyz: -------------------------------------------------------------------------------- 1 | 27 2 | 3 | C -1.7474459904 -1.5732232594 -1.3304186287 4 | C -2.3557630381 -0.2437396508 -0.8655375017 5 | C -1.4233991104 0.2778945193 0.2445858858 6 | N -0.2547746881 -0.6585178450 0.2759620282 7 | C -0.2628549553 -1.4688566166 -0.9594592156 8 | H -1.8861476598 -1.7516509187 -2.3980190776 9 | H -3.3677845115 -0.3693972450 -0.4701239922 10 | H -2.4154334399 0.4685275174 -1.6932177529 11 | H -1.0573017099 1.2934926499 0.0293314924 12 | H -0.3730140268 -1.2563156149 1.1112524421 13 | H 0.2233467634 -2.4335358318 -0.7800084235 14 | H 0.3002989301 -0.9464415011 -1.7439631937 15 | H -2.2040996452 -2.4122839848 -0.7986779068 16 | C -2.0577657454 0.2440430744 1.7513213081 17 | O -3.2756625572 0.2556024682 1.8778542972 18 | O -1.1228290817 0.1437291800 2.6479772594 19 | H 0.0413419265 0.7514095800 2.2449156446 20 | C 1.2837666541 0.2354359029 0.7751231407 21 | C 1.9564869184 0.7836641809 -0.4768624952 22 | C 3.2280193360 1.5417850979 -0.1031815933 23 | O 0.8438579021 1.1395161392 1.6218867493 24 | H 1.8238498690 -0.6398493485 1.2284855879 25 | H 2.1998063750 -0.0320790818 -1.1660831264 26 | H 1.2670182266 1.4561247654 -0.9959243146 27 | H 2.9957534160 2.3493540626 0.5852089355 28 | H 3.9465065301 0.8813298758 0.3778221827 29 | H 3.6942233123 1.9639818846 -0.9902497317 30 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid_propanal_complex.xyz: -------------------------------------------------------------------------------- 1 | 27 2 | 3 | C -2.9864819749 -1.0865162695 -3.0407490819 4 | C -3.7198596369 0.0911033534 -2.3802248629 5 | C -2.8025835816 0.5391588951 -1.2084834376 6 | N -1.8453219122 -0.5786554219 -0.9681792982 7 | C -1.6388596603 -1.1981292770 -2.2968158296 8 | H -2.8431619896 -0.9325195419 -4.1127492669 9 | H -4.7013117856 -0.2035535272 -2.0008262131 10 | H -3.8858007882 0.9144617208 -3.0780929941 11 | H -2.2187182855 1.4249865557 -1.5274344729 12 | H -2.3080390017 -1.2720041148 -0.3682242669 13 | H -1.2962672208 -2.2307921836 -2.1752392420 14 | H -0.8540151113 -0.6484713255 -2.8365631377 15 | H -3.5625256252 -2.0095055374 -2.9303692853 16 | C -3.5339399125 0.9121199287 0.0867224567 17 | O -4.7053666988 1.2321976528 0.1479965158 18 | O -2.7410466758 0.8749815357 1.1968965390 19 | H -1.8453219122 0.5786554219 0.9681792982 20 | C 1.8453219122 -0.2554202042 -0.5443711628 21 | C 1.9695623868 0.5004777375 -1.8631812338 22 | C 2.0964087439 2.0053411378 -1.6827115611 23 | O 1.8453219122 0.2554202042 0.5443711628 24 | H 1.7485860000 -1.3825208367 -0.6624151038 25 | H 2.8344878523 0.1012469100 -2.4064571121 26 | H 1.0971375487 0.2566001076 -2.4812477875 27 | H 1.2263963280 2.4037825374 -1.1671459919 28 | H 2.9738472370 2.2470044529 -1.0884202585 29 | H 2.1846335938 2.5062976624 -2.6441668472 30 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_acid_propanal_product.xyz: -------------------------------------------------------------------------------- 1 | 27 2 | 3 | C -1.6324883515 -1.6392612468 -1.2146109857 4 | C -2.1567298648 -0.2219571050 -0.9784273562 5 | C -1.3042471720 0.3269336757 0.1921456464 6 | N -0.1271412649 -0.5933918629 0.2966247921 7 | C -0.1593795296 -1.5628179606 -0.8188483797 8 | H -1.7702127462 -1.9695276900 -2.2463757670 9 | H -3.2252174754 -0.1979759386 -0.7521807203 10 | H -2.0040557642 0.3931072002 -1.8702061481 11 | H -0.9782431011 1.3603158203 -0.0157350662 12 | H -0.9703417710 -1.1092002682 1.9849582571 13 | H 0.2499088820 -2.5358480605 -0.5018159314 14 | H 0.4551797776 -1.2238973199 -1.6743724118 15 | H -2.1608650326 -2.3515444613 -0.5730264508 16 | C -2.0944377990 0.3405953998 1.5302322699 17 | O -3.0090919136 1.1068732558 1.7648343384 18 | O -1.6830603602 -0.6004963099 2.4214909449 19 | H 0.6621394052 0.3077813655 2.4769414374 20 | C 1.1867296016 0.0612016537 0.5843582723 21 | C 1.7196952592 0.9746212929 -0.5412291642 22 | C 3.0533625792 1.6079171745 -0.1681044329 23 | O 1.0363089382 0.8342638548 1.7607714860 24 | H 1.9228219696 -0.7663695646 0.7669455098 25 | H 1.8288052923 0.3901122374 -1.4607126386 26 | H 0.9883217670 1.7612512937 -0.7485897955 27 | H 2.9575620215 2.1768678397 0.7528097799 28 | H 3.8197059981 0.8495081537 -0.0159740601 29 | H 3.3949706544 2.2809375705 -0.9519034259 30 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/proline_propanal_complex.xyz: -------------------------------------------------------------------------------- 1 | 27 2 | dftb3 optimized 3 | C -1.7528656449 -1.6343850932 -1.4625929304 4 | C -2.5551297064 -0.5219909283 -0.7776578264 5 | C -1.6261440807 0.0620189203 0.3200326663 6 | N -0.3582813155 -0.7391404532 0.2896865312 7 | C -0.2973894778 -1.3883750788 -1.0365483817 8 | H -1.8715139528 -1.6256813565 -2.5485230796 9 | H -3.4739266894 -0.9027748471 -0.3236626704 10 | H -2.8435022495 0.2567899347 -1.4884444952 11 | H -1.3807911182 1.1172150881 0.0907998821 12 | H -0.4140929805 -1.4664089786 1.0109512372 13 | H 0.2994260128 -2.3051204030 -0.9745285646 14 | H 0.2066986424 -0.7185526005 -1.7537587880 15 | H -2.0859376809 -2.6157422592 -1.1131007538 16 | C -2.2392470475 0.0050028944 1.7392037438 17 | O -3.3031256213 -0.5401320260 1.9840648620 18 | O -1.4967472648 0.5901409171 2.7058270947 19 | H -0.6945317206 1.0429437181 2.3503576521 20 | C 1.5174674665 1.0260388197 1.0123424269 21 | C 2.1852024651 1.3197896847 -0.3193423693 22 | C 3.6914451367 1.0850050946 -0.2779469168 23 | O 0.6761353448 1.7492520135 1.5126056046 24 | H 1.8939008713 0.1145577916 1.5632184759 25 | H 1.7374599511 0.6661444895 -1.0782281045 26 | H 1.9604482921 2.3460418173 -0.6195625964 27 | H 4.1690110240 1.7425397191 0.4451294450 28 | H 3.9195755240 0.0577696316 0.0009070148 29 | H 4.1364558201 1.2770534900 -1.2512291594 30 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group 2 | 3 | Redistribution and use in source and binary forms, with or without modification, 4 | are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation and/or 11 | other materials provided with the distribution. 12 | 13 | 3. Neither the name of the copyright holder nor the names of its contributors 14 | may be used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 | OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_sleep_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class SleepJobTest(JobTestCase): 24 | 25 | @skip_without('database') 26 | def test_sleep(self): 27 | # import Job 28 | from scine_puffin.jobs.sleep import Sleep 29 | import scine_database as db 30 | from scine_utilities import ValueCollection 31 | 32 | # Setup DB for calculation 33 | water = os.path.join(resource_path(), "water.xyz") 34 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 35 | model = db.Model('dft', 'pbe', 'def2-SVP') 36 | job = db.Job('sleep') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | settings = {"time": 2} 39 | calculation.set_settings(ValueCollection(settings)) 40 | 41 | # Run calculation/job 42 | config = self.get_configuration() 43 | job = Sleep() 44 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 45 | self.run_job(job, calculation, config) 46 | 47 | # Check results 48 | assert calculation.get_status() == db.Status.COMPLETE 49 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/mn_catalyst.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_decision_list" : "(35, 41, 46, 2):(49, 54, 60, 3):(82, 88, 93, 1):(-11, -4, 0, 2)", 3 | "masm_cbor_graph" : "pWFhjKVhYQBhYw5hb4GCAAFhcqNhbIKBDYEYGWJscoKBAIEBYXOCgQ2BGBlhcwClYWEAYWMPYW+BggABYXKjYWyCgQyBGBlibHKCgQCBAWFzgoEMgRgZYXMApWFhAGFjEGFvgYMAAQJhcqRhbIOBAYERgRVjbG5rgaJhcIIBAmNzZXGFEBEUEhVibHKDgQCBAYECYXODgQGBEYEVYXMCpWFhAGFjEWFvgYMAAQJhcqRhbIOBAIEQgRRjbG5rgaJhcIIBAmNzZXGFERAVEhRibHKDgQCBAYECYXODgQCBEIEUYXMCpWFhAGFjEmFvgYMAAQJhcqRhbIOBFIEVgRgZY2xua4GiYXCCAAFjc2VxhRIUERAVYmxygoIAAYECYXOCghQVgRgZYXMCpWFhAGFjE2FvgYMAAQJhcqNhbIOBCIEYGIEYGWJscoOBAIEBgQJhc4OBCIEYGIEYGWFzAqVhYQBhYxRhb4GDAAECYXKkYWyDgQOBEYESY2xua4GiYXCCAQJjc2VxhRQREBUSYmxyg4EAgQGBAmFzg4EDgRGBEmFzAqVhYQBhYxVhb4GDAAECYXKkYWyDgQKBEIESY2xua4GiYXCCAQJjc2VxhRUQERQSYmxyg4EAgQGBAmFzg4ECgRCBEmFzAqVhYQBhYxZhb4GDAAECYXKjYWyDgQaBB4EXYmxygoIAAYECYXODggYHgReBGBlhcwKlYWEAYWMXYW+BgwABAmFyo2Fsg4EEgQWBFmJscoKCAAGBAmFzg4IEBYEWgRgZYXMCpWFhAGFjGBhhb4GEAAECA2Fyo2FshIEJgQqBC4ETYmxygoMAAQKBA2FzgoMJCguBE2FzBaVhYQxhYxgZYW+ChAACAwSBAWFyo2FshYEOgQ+BEoETghYXYmxyhIEDgQKCAAGBBGFzhIIWF4ETgRKCDg9hcwlhYoWiYWEAYWWCEBGiYWEAYWWCEBWiYWEAYWWCERSiYWEAYWWCEhSiYWEAYWWCEhVhYw9hZ6JhRZgbgwARAIMBEACDAhUAgwMUAIMEFwCDBRcAgwYWAIMHFgCDCBMAgwkYGACDChgYAIMLGBgAgwwPAIMNDgCDDhgZAIMPGBkAgxARAIMQFQCDERQAgxIUAIMSFQCDEhgZAIMTGBgAgxMYGQCDFhcAgxYYGQaDFxgZBmFamBoBAQEBAQEBAQEBAQEICAYGBgYGBgcHBgYGGRuZYXaDAgAB", 4 | "masm_idx_map" : "[(0, 19), (0, 22), (0, 8), (0, 9), (0, 6), (0, 7), (0, 24), (0, 10), (0, 11), (0, 25), (0, 21), (0, 18), (0, 16), (0, 17), (0, 20), (0, 3), (0, 0), (0, 1), (0, 15), (0, 12), (0, 14), (0, 13), (0, 2), (0, 23), (0, 4), (0, 5)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/mn_result.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_cbor_graph": "pWFhjKVhYQBhYw5hb4GCAAFhcqNhbIKBDYEYGWJscoKBAIEBYXOCgQ2BGBlhcwClYWEAYWMPYW+BggABYXKjYWyCgQyBGBlibHKCgQCBAWFzgoEMgRgZYXMApWFhAGFjEGFvgYMAAQJhcqRhbIOBAYERgRRjbG5rgaJhcIIBAmNzZXGFEBETEhRibHKDgQCBAYECYXODgQGBEYEUYXMCpWFhAGFjEWFvgYMAAQJhcqRhbIOBAIEQgRNjbG5rgaJhcIIBAmNzZXGFERAUEhNibHKDgQCBAYECYXODgQCBEIETYXMCpWFhAGFjEmFvgYMAAQJhcqRhbIOBE4EUgRgZY2xua4GiYXCCAAFjc2VxhRITERAUYmxygoIAAYECYXOCghMUgRgZYXMCpWFhAGFjE2FvgYMAAQJhcqRhbIOBA4ERgRJjbG5rgaJhcIIBAmNzZXGFExEQFBJibHKDgQCBAYECYXODgQOBEYESYXMCpWFhAGFjFGFvgYMAAQJhcqRhbIOBAoEQgRJjbG5rgaJhcIIBAmNzZXGFFBARExJibHKDgQCBAYECYXODgQKBEIESYXMCpWFhAGFjFWFvgYMAAQJhcqNhbIOBC4EXgRgYYmxyg4EAgQGBAmFzhIELgReBGBiBGBlhcwKlYWEAYWMWYW+BgwABAmFyo2Fsg4EEgQWBGBhibHKCggABgQJhc4OCBAWBGBiBGBlhcwOlYWEAYWMXYW+BhAABAgNhcqNhbISBBoEHgQiBFWJscoKDAAECgQNhc4KDBgcIgRVhcwWlYWEAYWMYGGFvgYQAAQIDYXKjYWyEgQmBCoEVgRZibHKDggABgQOBAmFzhIIJCoEWgRWBGBlhcwWlYWEAYWMYGWFvgYQAAQIDYXKjYWyEgQ6BD4ESgxUWGBhibHKDgQKCAAGBA2FzhYEWgRgYgRWBEoIOD2FzBWFihaJhYQBhZYIQEaJhYQBhZYIQFKJhYQBhZYIRE6JhYQBhZYISE6JhYQBhZYISFGFjD2FnomFFmByDABEAgwEQAIMCFACDAxMAgwQWAIMFFgCDBhcAgwcXAIMIFwCDCRgYAIMKGBgAgwsVAIMMDwCDDQ4Agw4YGQCDDxgZAIMQEQCDEBQAgxETAIMSEwCDEhQAgxIYGQCDFRcAgxUYGACDFRgZBoMWGBgAgxYYGQaDGBgYGQZhWpgaAQEBAQEBAQEBAQEBCAgGBgYGBgcHBgYGBhkbmWF2gwMAAA==", 3 | "masm_decision_list": "(-80, -73, -69, 2):(-51, -44, -40, 3):(5, 11, 16, 1):(-30, -23, -19, 1)", 4 | "masm_idx_map": "[(0, 21), (0, 24), (0, 11), (0, 6), (0, 9), (0, 10), (0, 23), (0, 7), (0, 8), (0, 25), (0, 20), (0, 18), (0, 16), (0, 17), (0, 19), (0, 3), (0, 0), (0, 1), (0, 15), (0, 12), (0, 14), (0, 13), (0, 2), (0, 22), (0, 4), (0, 5)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/mn_result_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "masm_cbor_graph": "pWFhjKVhYQBhYw5hb4GCAAFhcqNhbIKBDYEYGWJscoKBAIEBYXOCgQ2BGBlhcwClYWEAYWMPYW+BggABYXKjYWyCgQyBGBlibHKCgQCBAWFzgoEMgRgZYXMApWFhAGFjEGFvgYMAAQJhcqRhbIOBAYERgRRjbG5rgaJhcIIBAmNzZXGFEBETEhRibHKDgQCBAYECYXODgQGBEYEUYXMCpWFhAGFjEWFvgYMAAQJhcqRhbIOBAIEQgRNjbG5rgaJhcIIBAmNzZXGFERAUEhNibHKDgQCBAYECYXODgQCBEIETYXMCpWFhAGFjEmFvgYMAAQJhcqRhbIOBE4EUgRgZY2xua4GiYXCCAAFjc2VxhRITERAUYmxygoIAAYECYXOCghMUgRgZYXMCpWFhAGFjE2FvgYMAAQJhcqRhbIOBA4ERgRJjbG5rgaJhcIIBAmNzZXGFExEQFBJibHKDgQCBAYECYXODgQOBEYESYXMCpWFhAGFjFGFvgYMAAQJhcqRhbIOBAoEQgRJjbG5rgaJhcIIBAmNzZXGFFBARExJibHKDgQCBAYECYXODgQKBEIESYXMCpWFhAGFjFWFvgYMAAQJhcqNhbIOBC4EXgRgYYmxyg4EAgQGBAmFzhIELgReBGBiBGBlhcwKlYWEAYWMWYW+BgwABAmFyo2Fsg4EEgQWBGBhibHKCggABgQJhc4OCBAWBGBiBGBlhcwOlYWEAYWMXYW+BhAABAgNhcqNhbISBBoEHgQiBFWJscoKDAAECgQNhc4KDBgcIgRVhcwWlYWEAYWMYGGFvgYQAAQIDYXKjYWyEgQmBCoEVgRZibHKDggABgQOBAmFzhIIJCoEWgRWBGBlhcwWlYWEEYWMYGWFvgoIBAoIAA2Fyo2FshIEOgQ+BEoMVFhgYYmxyg4ECggABgQNhc4WBFoEYGIEVgRKCDg9hcwdhYoWiYWEAYWWCEBGiYWEAYWWCEBSiYWEAYWWCEROiYWEAYWWCEhOiYWEAYWWCEhRhYw9hZ6JhRZgcgwARAIMBEACDAhQAgwMTAIMEFgCDBRYAgwYXAIMHFwCDCBcAgwkYGACDChgYAIMLFQCDDA8Agw0OAIMOGBkAgw8YGQCDEBEAgxAUAIMREwCDEhMAgxIUAIMSGBkAgxUXAIMVGBgAgxUYGQaDFhgYAIMWGBkGgxgYGBkGYVqYGgEBAQEBAQEBAQEBAQgIBgYGBgYHBwYGBgYZG5lhdoMDAAA=", 3 | "masm_decision_list": "(-94, -87, -83, 2):(-64, -57, -53, 3):(-20, -13, -9, 1):(-6, 0, 5, 1)", 4 | "masm_idx_map": "[(0, 21), (0, 24), (0, 11), (0, 6), (0, 9), (0, 10), (0, 23), (0, 7), (0, 8), (0, 25), (0, 20), (0, 18), (0, 16), (0, 17), (0, 19), (0, 3), (0, 0), (0, 1), (0, 15), (0, 12), (0, 14), (0, 13), (0, 2), (0, 22), (0, 4), (0, 5)]" 5 | } 6 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/au_complex.xyz: -------------------------------------------------------------------------------- 1 | 29 2 | 3 | Au 1.2296159739 2.1292058733 13.2499723271 4 | Au -0.2451612354 4.6836223553 13.2497514793 5 | Au -1.7199404262 7.2379524144 13.2497784197 6 | Au 4.1791372683 2.1291964459 13.2492373093 7 | Au 2.7043599829 4.6836128074 13.2490164592 8 | Au 1.2295807951 7.2379428543 13.2490435330 9 | Au 7.1285588452 2.1291294921 13.2489194076 10 | Au 5.6537815941 4.6835459144 13.2486985463 11 | Au 4.1790020885 7.2378758128 13.2487261070 12 | Au -0.2462762570 1.2767127801 8.4260303561 13 | Au -1.7210545107 3.8310573410 8.4258589037 14 | Au -3.1958317634 6.3854945720 8.4257421472 15 | Au 2.7031452541 1.2766458968 8.4257126623 16 | Au 1.2283670750 3.8309904005 8.4255409894 17 | Au -0.2464102127 6.3854276035 8.4254242975 18 | Au 5.6526664643 1.2766363353 8.4249777093 19 | Au 4.1778883023 3.8309808686 8.4248059829 20 | Au 2.7031110921 6.3854181662 8.4246892413 21 | Au 1.2291336352 0.4258004062 10.8377308209 22 | Au -0.2456450687 2.9801969746 10.8378132181 23 | Au -1.7204223537 5.5345856986 10.8375921888 24 | Au 4.1785299670 0.4257189673 10.8373330043 25 | Au 2.7037516734 2.9801156831 10.8374149089 26 | Au 1.2289743757 5.5345043894 10.8371938694 27 | Au 7.1279265703 0.4256376612 10.8369348684 28 | Au 5.6531483960 2.9800343564 10.8370165817 29 | Au 4.1783711058 5.5344231287 10.8367956210 30 | H 1.5736804490 2.6532892261 16.4769422122 31 | H 1.5968851263 2.6764939033 17.2340217575 32 | -------------------------------------------------------------------------------- /scine_puffin/programs/ams.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Ams(Program): 15 | """ 16 | Setup of the AMS program via the Scine AMS_wrapper 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | if self.source: 23 | self.scine_module_install(repo_dir, install_dir, ncores) 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | env_vars["SCMLICENSE"] = os.getenv("SCMLICENSE") 33 | if all(os.getenv(var) is None for var in ["AMSHOME", "AMSBIN", "AMS_BINARY_PATH"]): 34 | if os.path.exists(os.path.join(self.root, "bin", "ams")): 35 | env_vars["AMSBIN"] = os.path.join(self.root, "bin") 36 | env_vars["AMSHOME"] = os.path.join(self.root) 37 | env_vars["AMS_BINARY_PATH"] = os.path.join(self.root, "bin") 38 | elif self.source: 39 | pass 40 | else: 41 | raise RuntimeError 42 | 43 | def available_models(self) -> List[str]: 44 | return ["DFT", "DFTB3", "DFTB2", "DFTB0", "GFN1", "GFN0", "REAXFF", "MLPOTENTIAL"] 45 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/methanol_enamine_complex.xyz: -------------------------------------------------------------------------------- 1 | 30 2 | 3 | O -1.051297586091 1.136639770894 1.277696965527 4 | H -0.459062349844 1.462993004481 0.505416411917 5 | C -1.932184900980 2.168305647080 1.617848968721 6 | H -2.488548351664 2.530637314817 0.744801868237 7 | H -1.403106779474 3.020005870054 2.067304749340 8 | H -2.641429723591 1.773548950994 2.349476015642 9 | C 1.651361129150 -0.529803996241 -0.362034285772 10 | C 0.496118786136 -1.379211251098 -0.546098870638 11 | H 2.371591867576 -0.620402165017 -1.167945370228 12 | H 2.131181259700 -0.620499249374 0.600601730710 13 | O 0.462549592971 1.915495593148 -0.656453530504 14 | H 1.246908635640 0.551546916436 -0.445096775995 15 | N -0.121520473688 -1.991376948889 0.442106568575 16 | C 0.263512969397 -1.788575355775 1.822444536389 17 | C 1.108140499055 3.086726972486 -0.384159018002 18 | C -1.365744769097 -2.704826496043 0.247400952177 19 | H -1.287219402709 -3.697467734259 0.691929121745 20 | H 0.039178010036 -0.760588576389 2.115523899454 21 | H 1.323054939274 -1.989749799538 1.969758378649 22 | H -0.306796194005 -2.470587159062 2.446770050896 23 | H -1.587017008703 -2.802783895008 -0.811062831735 24 | H -2.174837519804 -2.156472189144 0.732959231694 25 | O -0.037936062201 -1.556770246884 -1.746939740474 26 | C 0.416260883444 -0.756620715346 -2.829578451855 27 | H 0.416385275797 3.947777556555 -0.446712687341 28 | H 1.928448005708 3.275586121347 -1.102523026010 29 | H 1.552753833444 3.100041523535 0.629901768589 30 | H 1.415647962048 -1.055842025517 -3.150757577973 31 | H 0.410555268334 0.299200535847 -2.550073836638 32 | H -0.291386340507 -0.931870056174 -3.636489716575 33 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/acetal_methanol_complex.xyz: -------------------------------------------------------------------------------- 1 | 30 2 | 3 | O -1.818713591267 1.134530806303 1.944224098816 4 | H -1.230313831718 0.993116170077 1.182912854588 5 | C -1.601230319842 2.432652761433 2.444563678689 6 | H -1.810367820785 3.196058637216 1.688110254359 7 | H -0.573920930449 2.556787975109 2.803436106303 8 | H -2.287879344328 2.566878819458 3.279880245127 9 | C 2.152686054191 -0.402606974185 -0.426750213813 10 | C 0.633936307744 -0.471868639783 -0.662123127034 11 | H 2.603564638026 0.200022493161 -1.211592412825 12 | H 2.574595414409 -1.402047346449 -0.453975797511 13 | O -0.005962678610 0.724146902481 -0.232146146785 14 | H 2.355972834169 0.056663859908 0.536141316057 15 | N 0.047617939878 -1.595436749184 0.029783742816 16 | C 0.373089180199 -1.723438967649 1.440821988202 17 | C 0.393280946926 1.925939085901 -0.872128052344 18 | C -1.390793999880 -1.721031953392 -0.178194050492 19 | H -1.665741103037 -2.763826458193 -0.017783445749 20 | H 1.448885100829 -1.785978265972 1.576080430955 21 | H -0.071702762687 -2.653414689026 1.792207816109 22 | H -0.026749649488 -0.898428693627 2.042045080013 23 | H -1.627764852440 -1.440226764728 -1.201070480851 24 | H -1.965906128598 -1.088514725882 0.506210524805 25 | O 0.346729286921 -0.579102054948 -2.044175685445 26 | C 0.855967094510 -1.728248161242 -2.695171193672 27 | H 0.428895407406 1.791935102416 -1.953661741067 28 | H 1.367004017203 2.261672498947 -0.503348924391 29 | H -0.366074145312 2.664411314189 -0.621520435397 30 | H 0.668469122429 -2.625194289091 -2.102013618351 31 | H 1.928012697398 -1.629830983192 -2.889491163425 32 | H 0.320535981638 -1.789038216173 -3.641057516110 33 | -------------------------------------------------------------------------------- /scine_puffin/utilities/compound_and_flask_helpers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import Union, TYPE_CHECKING 9 | 10 | from scine_puffin.utilities.imports import module_exists, requires, MissingDependency 11 | if module_exists("scine_database") or TYPE_CHECKING: 12 | import scine_database as db 13 | else: 14 | db = MissingDependency("scine_database") 15 | 16 | 17 | @requires("database") 18 | def get_compound_or_flask(object_id: db.ID, object_type: db.CompoundOrFlask, compounds: db.Collection, 19 | flasks: db.Collection) -> Union[db.Compound, db.Flask]: 20 | """ 21 | Construct the compound or flask object depending on the type. Flask and Compound have a large set of functions 22 | in common. Through this function, we do not have to differentiate between them at every point. 23 | 24 | Parameters 25 | ---------- 26 | object_id : db.ID 27 | The ID of the object to construct. 28 | object_type : db.CompoundOrFlask 29 | The label for Compound or Flaks. 30 | compounds : db.Collection 31 | The compounds collection. 32 | flasks : db.Collection 33 | The flasks collection. 34 | 35 | Returns 36 | ------- 37 | Either the flask or compound object. 38 | 39 | Raises 40 | ------ 41 | RuntimeError 42 | If the object_type is unknown. 43 | """ 44 | if object_type == db.CompoundOrFlask.COMPOUND: 45 | return db.Compound(object_id, compounds) 46 | if object_type == db.CompoundOrFlask.FLASK: 47 | return db.Flask(object_id, flasks) 48 | raise RuntimeError("Requested aggregate type is not supported.") 49 | -------------------------------------------------------------------------------- /scine_puffin/utilities/properties.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import numpy as np 8 | import scine_utilities as utils 9 | 10 | 11 | def single_particle_energy_to_matrix(x: utils.SingleParticleEnergies) -> np.ndarray: 12 | """ 13 | Converts datatype `utils.SingleParticleEnergies` to `np.array`. 14 | In the restricted case, there is only one column, in the unrestricted case, 15 | there are two columns, denoted by `alpha` and `beta`. 16 | 17 | Parameters 18 | ---------- 19 | x : utils.SingleParticleEnergies 20 | The single particle energies to be converted to numpy matrices. It 21 | contains the energies and flags denoting the restricted or unrestricted 22 | case. 23 | """ 24 | if x.is_restricted: # restricted case 25 | return np.array([x.restricted_energies]) 26 | return np.array([x.alpha, x.beta]) 27 | 28 | 29 | def single_particle_energy_from_matrix(x: np.ndarray) -> utils.SingleParticleEnergies: 30 | """ 31 | Converts datatype `np.ndarray` to `SingleParticleEnergies`. 32 | If the first dimension of the numpy array is 1, there is only one column of 33 | energies, indicating the restricted case. 34 | Otherwise, for two columns, we're in the unrestricted case. 35 | 36 | Parameters 37 | ---------- 38 | x : np.ndarray 39 | The array of dimension $1 \times N$ for the restricted case or $2 40 | \times N$ for the unrestricted case, where $N$ is the number energies. 41 | """ 42 | if np.shape(x)[0] == 1: # restricted case 43 | a = utils.SingleParticleEnergies.make_restricted() 44 | a.set_restricted(x[0]) 45 | return a 46 | else: 47 | a = utils.SingleParticleEnergies.make_unrestricted() 48 | a.set_unrestricted(x[0], x[1]) 49 | return a 50 | -------------------------------------------------------------------------------- /scine_puffin/tests/mrcc/mrcc_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class MrccTests(JobTestCase): 24 | 25 | @skip_without('mrcc', 'database', 'readuct') 26 | def test_mrcc_single_point(self): 27 | from scine_puffin.jobs.scine_single_point import ScineSinglePoint 28 | import scine_database as db 29 | 30 | # Setup DB for calculation 31 | water = os.path.join(resource_path(), "water.xyz") 32 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 33 | model = db.Model('dft', 'pbe-d3bj', 'def2-svp') 34 | model.temperature = "" 35 | model.pressure = "" 36 | model.electronic_temperature = "" 37 | model.program = "mrcc" 38 | settings = { 39 | "require_charges": False 40 | } 41 | job = db.Job('scine_single_point') 42 | calculation = add_calculation(self.manager, model, job, [structure.id()], settings) 43 | 44 | # Run calculation/job 45 | config = self.get_configuration() 46 | job = ScineSinglePoint() 47 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 48 | self.run_job(job, calculation, config) 49 | 50 | # Check results 51 | assert calculation.get_status() == db.Status.COMPLETE 52 | assert structure.has_property("electronic_energy") 53 | energy_props = structure.get_properties("electronic_energy") 54 | assert len(energy_props) == 1 55 | results = calculation.get_results() 56 | assert energy_props[0] in results.property_ids 57 | -------------------------------------------------------------------------------- /scine_puffin/jobs/sleep.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from time import sleep 9 | from typing import TYPE_CHECKING, List 10 | 11 | from scine_puffin.config import Configuration 12 | from .templates.job import Job, job_configuration_wrapper 13 | from scine_puffin.utilities.imports import module_exists, MissingDependency 14 | 15 | if module_exists("scine_database") or TYPE_CHECKING: 16 | import scine_database as db 17 | else: 18 | db = MissingDependency("scine_database") 19 | 20 | 21 | class Sleep(Job): 22 | """ 23 | A dummy job used for debug purposes. The job sleeps for a given amount of 24 | time. 25 | 26 | **Order Name** 27 | ``sleep`` 28 | 29 | **Optional Settings** 30 | Optional settings are read from the ``settings`` field, which is part of 31 | any ``Calculation`` stored in a SCINE Database. 32 | Possible settings for this job are: 33 | 34 | time : int 35 | The time to sleep for in seconds. Default: 300. 36 | 37 | **Required Packages** 38 | - SCINE: Database (present by default) 39 | 40 | **Generated Data** 41 | This dummy job does not generate new data. 42 | """ 43 | 44 | def __init__(self) -> None: 45 | super().__init__() 46 | self.name = "Sleep Job" 47 | 48 | @job_configuration_wrapper 49 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 50 | 51 | # Get the requested sleep time 52 | sleeptime = int(calculation.get_settings().get("time", 300)) # type: ignore 53 | 54 | sleep(sleeptime) 55 | 56 | calculation.set_executor(config["daemon"]["uuid"]) 57 | calculation.set_status(db.Status.COMPLETE) 58 | return True 59 | 60 | @staticmethod 61 | def required_programs() -> List[str]: 62 | return ["database"] 63 | -------------------------------------------------------------------------------- /scine_puffin/programs/deprecated/rdkit.py.depr: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from typing import List 8 | import importlib 9 | 10 | from ..program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Rdkit(Program): 15 | """ 16 | Setup of RDKit. For a successful set-up rdkit is required to be present in the python path. 17 | """ 18 | 19 | def __init__(self, settings: dict): 20 | super().__init__(settings) 21 | 22 | def install(self, build_dir: str, install_dir: str, ncores: int): 23 | if self.root: 24 | raise NotImplementedError 25 | elif self.source: 26 | raise NotImplementedError 27 | else: 28 | # TODO If check_install is applied this is not necessary anymore 29 | chem = importlib.util.find_spec("rdkit", package="Chem") 30 | all_chem = importlib.util.find_spec("rdkit", package="Chem.AllChem") 31 | if chem is None or all_chem is None: 32 | raise ImportError("Miising RDKit package including 'rdkit.Chem.AllChem'.") 33 | 34 | def check_install(self) -> bool: 35 | """ 36 | Checks whether RDKit is installed and found by python. 37 | Returns false otherwise. 38 | """ 39 | chem = importlib.util.find_spec("rdkit", package="Chem") 40 | all_chem = importlib.util.find_spec("rdkit", package="Chem.AllChem") 41 | if chem is None or all_chem is None: 42 | return False 43 | return True 44 | 45 | def setup_environment(self, config: Configuration, env: dict, executables: dict): 46 | if self.root: 47 | # TODO One could append RDKits location to PYTHONPATH here 48 | pass 49 | elif self.source: 50 | pass 51 | else: 52 | pass 53 | 54 | def available_models(self) -> List[str]: 55 | return [] 56 | -------------------------------------------------------------------------------- /scine_puffin/programs/serenity.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Serenity(Program): 15 | """ 16 | Serenity -- installation and verification class 17 | """ 18 | 19 | def install(self, repo_dir: str, install_dir: str, ncores: int): 20 | if self.root: 21 | pass 22 | elif self.source: 23 | self.scine_module_install(repo_dir, install_dir, ncores, add_lib=True, add_bin=True) 24 | else: 25 | raise RuntimeError 26 | 27 | def check_install(self): 28 | raise NotImplementedError 29 | 30 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 31 | if self.root: 32 | env_paths["PATH"] = env_paths["PATH"] + ":" + os.path.join(self.root, "bin") 33 | env_paths["LD_LIBRARY_PATH"] = env_paths["LD_LIBRARY_PATH"] + ":" + os.path.join(self.root, "lib") 34 | env_vars["SERENITY_RESOURCES"] = os.path.join(self.root, "share", "serenity", "data", "") 35 | env_vars["SERENITY_MEMORY"] = str(float(config.resources()["memory"]) * 1024) 36 | env_vars["OMP_NUM_THREADS"] = str(config.resources()["cores"]) 37 | elif self.source: 38 | env_vars["SERENITY_RESOURCES"] = os.path.join( 39 | config.daemon()["software_dir"], 40 | "install", 41 | "share", 42 | "serenity", 43 | "data", 44 | "", 45 | ) 46 | env_vars["SERENITY_MEMORY"] = str(float(config.resources()["memory"]) * 1024) 47 | env_vars["OMP_NUM_THREADS"] = str(config.resources()["cores"]) 48 | else: 49 | raise RuntimeError 50 | 51 | def available_models(self) -> List[str]: 52 | return ["DFT", "HF", "CC"] 53 | -------------------------------------------------------------------------------- /container/apptainer/README.rst: -------------------------------------------------------------------------------- 1 | Basic Container Usage 2 | --------------------- 3 | 4 | In essence, these two commands should be enough to run a basic ``Puffin`` 5 | instance inside an Apptainer (formerly Singularity) image. 6 | One to build the container: 7 | 8 | .. code-block:: bash 9 | 10 | apptainer build puffin.sif puffin.def 11 | 12 | and one to run the generated image: 13 | 14 | .. code-block:: bash 15 | 16 | apptainer run puffin.sif 17 | 18 | The build command may require slight alterations to the ``.def`` file first, as 19 | the file may reference a user's SSH keys in order to allow the cloning of some 20 | ``SCINE`` repositories. 21 | For some users the ``--fakeroot`` option may be more comfortable than using a 22 | ``sudo`` preface, but keep in mind that this option is not guaranteed to work, 23 | depending on the subordinate UID mapping configured for you on the machine you're working on. 24 | Also, it may be required to make Apptainer build the image in 25 | a custom temporary directory if the default ``/tmp`` is not big enough. 26 | A slightly different build command may thus look like this: 27 | 28 | .. code-block:: bash 29 | 30 | APPTAINER_TMPDIR=/scratch/tmp apptainer build --fakeroot puffin.sif puffin.def 31 | 32 | The run command will have to be changed depending on the use case. 33 | It may be required to change some of the settings of the Puffin 34 | instance running inside the container. To this end, environment variables for 35 | Puffin can be set. These variables need to be present inside the container. 36 | It is possible to use the ``--env`` or ``--env-file`` argument to the run command. 37 | However, the more general way is setting ``APPTAINERENV_`` variables on the host 38 | machine. 39 | 40 | Furthermore it is required to mount two folders into the image, both are scratch 41 | direcories, one for ``.log`` and ``.pid`` files (``/socket``) and one for the 42 | actual job scratch (``/jobs``). 43 | 44 | A more complete run could thus look like this: 45 | 46 | .. code-block:: bash 47 | 48 | apptainer build puffin.sif puffin.def 49 | export APPTAINERENV_PUFFIN_DATABASE_NAME=ath_dft 50 | export APPTAINERENV_PUFFIN_DATABASE_PORT=27001 51 | export APPTAINERENV_PUFFIN_DATABASE_IP=129.132.118.83 52 | apptainer run --bind /scratch/puffin:/socket \ 53 | --bind /scratch/puffin/jobs:/jobs \ 54 | puffin.sif 55 | 56 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_gaussian_cm5_charges_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class ScineBondOrdersJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'gaussian') 26 | def test_water(self): 27 | # import Job 28 | from scine_puffin.jobs.gaussian_charge_model_5 import GaussianChargeModel5 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_OPTIMIZED) 34 | model = db.Model('dft', 'PBEPBE', '6-31G') 35 | model.program = "gaussian" 36 | job = db.Job('gaussian_charge_model_5') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = GaussianChargeModel5() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | assert structure.has_property("cm5_charges") 48 | charge_props = structure.get_properties("cm5_charges") 49 | assert len(charge_props) == 1 50 | results = calculation.get_results() 51 | assert len(results.property_ids) == 1 52 | assert charge_props[0] in results.property_ids 53 | 54 | # Check generated properties 55 | # Charges 56 | properties = self.manager.get_collection("properties") 57 | atomic_charges = db.VectorProperty(charge_props[0]) 58 | atomic_charges.link(properties) 59 | charges = atomic_charges.get_data() 60 | assert len(charges) == 3 61 | self.assertAlmostEqual(charges[0], -0.622577, delta=1e-1) 62 | self.assertAlmostEqual(charges[1], +0.311290, delta=1e-1) 63 | self.assertAlmostEqual(charges[2], +0.311290, delta=1e-1) 64 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/spline.end.xyz: -------------------------------------------------------------------------------- 1 | 44 2 | 3 | C -1.4398588330 0.8029726219 3.1714491304 4 | C -2.7517578806 0.9854485751 2.3963123232 5 | C -2.9980193776 -0.4419274052 1.8527350060 6 | N -2.5805074585 -1.3162962830 2.9448454300 7 | C -1.6043407244 -0.5931620651 3.8003981165 8 | H -1.2603426853 1.5983512074 3.9203969251 9 | H -2.7077459360 1.7422273173 1.5900320256 10 | H -3.5816595145 1.2591450233 3.0788980216 11 | H -4.0685741094 -0.5809611702 1.5776309701 12 | H -2.1645394828 -2.1713251972 2.5604090486 13 | H -0.6351801609 -1.1306291128 3.8609417653 14 | H -1.9951465010 -0.5073341900 4.8399014156 15 | H -0.5759617661 0.8086788129 2.4721887916 16 | C -2.1831588137 -0.6597388174 0.5770875027 17 | O -1.2325584057 -1.4550155764 0.5199714781 18 | O -2.5608080152 0.0861115031 -0.4421462331 19 | H -1.8428133378 0.0324109714 -1.1857713375 20 | H -0.5592863080 0.5620521293 -2.9030254252 21 | C 2.6641393886 -1.5160997248 -3.0285199745 22 | C 2.8177629350 -2.1601676035 -1.6472404142 23 | C 1.7861039541 -1.4023418898 -0.8039955208 24 | N 1.7787516142 -0.0372094385 -1.3790367017 25 | C 2.4703501798 -0.0344845551 -2.6849461478 26 | H 1.7544348774 -1.9072671691 -3.5301372822 27 | H 3.8258420856 -1.9632843836 -1.2273969777 28 | H 2.6436393607 -3.2531765269 -1.6375991393 29 | H 0.7799719833 -1.8703554412 -0.8960471618 30 | H 3.4490653084 0.4895550785 -2.6075997084 31 | H 1.8779422658 0.4992076897 -3.4568280348 32 | H 3.5292476593 -1.6955635235 -3.6960799602 33 | C 2.1854413298 -1.3087926151 0.6802621735 34 | O 3.3411805841 -1.1993062886 1.0569840560 35 | O 1.1809920763 -1.3103055195 1.5745361666 36 | H 0.2827935274 -1.4412444707 1.1456790368 37 | C 0.5718061407 0.6983288282 -1.2251244475 38 | C 0.7097732674 2.1975643602 -1.4840092978 39 | C -0.5404322740 2.9933607773 -1.1087721495 40 | O -0.5435427213 0.1380937170 -2.0214547268 41 | H 0.2279433622 0.5457784158 -0.1818347129 42 | H 1.5850587306 2.5480835684 -0.8998124436 43 | H 0.9680868043 2.3626471687 -2.5535404446 44 | H -1.4255399127 2.6580937855 -1.6849080324 45 | H -0.7799878077 2.8737421744 -0.0313252524 46 | H -0.3985654089 4.0741352417 -1.3035078565 47 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/spline.start.xyz: -------------------------------------------------------------------------------- 1 | 44 2 | 3 | C -1.3492243813 0.8598616131 3.1285355712 4 | C -2.6859166848 0.9456423889 2.3804532520 5 | C -2.8813574373 -0.5070171881 1.8785413625 6 | N -2.2819629143 -1.3567956719 2.9174719188 7 | C -1.4572257361 -0.5128659379 3.8131004959 8 | H -1.1891749873 1.6933716618 3.8409740458 9 | H -2.7046237826 1.6727772336 1.5455440846 10 | H -3.5034271891 1.2132174481 3.0818022479 11 | H -3.9657799390 -0.7173375955 1.7363820688 12 | H -1.6939050863 -2.0550509067 2.4476692663 13 | H -0.4675625601 -0.9788092205 3.9951913959 14 | H -1.9542773746 -0.3997007038 4.8050273007 15 | H -0.4993670064 0.8634519686 2.4119372627 16 | C -2.2405300813 -0.6836660172 0.4843648647 17 | O -1.1961682336 -1.4197586536 0.3720024882 18 | O -2.7841582923 -0.0809646956 -0.4808549970 19 | H -1.7460611892 -0.0654651264 -1.6998663071 20 | H -1.3041400035 0.7602421377 -2.9670889184 21 | C 2.7871577958 -1.4137304353 -2.9337128125 22 | C 2.7007749171 -2.2160778590 -1.6280131187 23 | C 1.6503438074 -1.4751521854 -0.7914437171 24 | N 1.6509060237 -0.0919398750 -1.3613470081 25 | C 2.6341345312 0.0292887820 -2.4540950730 26 | H 1.9456772720 -1.6695121286 -3.6095153741 27 | H 3.6664078501 -2.1805198940 -1.0848579325 28 | H 2.4230379340 -3.2755049694 -1.7801995149 29 | H 0.6232897412 -1.8710769204 -0.9208136937 30 | H 3.5817386859 0.4309588369 -2.0368169683 31 | H 2.2643630213 0.7320384782 -3.2229524844 32 | H 3.7348136121 -1.5733927305 -3.4812641294 33 | C 2.0119832407 -1.4033762434 0.7179199734 34 | O 3.1769557745 -1.3782577956 1.0882707635 35 | O 0.9986435949 -1.3411090935 1.5682326305 36 | H 0.0541602348 -1.4036835454 1.1123761054 37 | C 0.7200152460 0.7791136524 -1.0724418506 38 | C 0.7160365963 2.1949446070 -1.5419673005 39 | C -0.5043372139 2.9725673267 -1.0502303004 40 | O -0.9951188531 0.0366198681 -2.3880412331 41 | H 0.0635513419 0.4920910473 -0.2374010010 42 | H 1.6564819025 2.6636512674 -1.1726694358 43 | H 0.8020656604 2.2220329260 -2.6491189992 44 | H -1.4380531926 2.4664600763 -1.3626920754 45 | H -0.5136220035 3.0405766093 0.0563234615 46 | H -0.5065446415 4.0018574633 -1.4547163151 47 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_orca_geometry_optimization_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class OrcaGeometryOptimizationJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'orca') 26 | def test_energy(self): 27 | # import Job 28 | from scine_puffin.jobs.orca_geometry_optimization import OrcaGeometryOptimization 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 34 | model = db.Model('dft', 'pbe', 'def2-SVP') 35 | model.program = "orca" 36 | job = db.Job('orca_geometry_optimization') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = OrcaGeometryOptimization() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | results = calculation.get_results() 48 | assert len(results.structure_ids) == 1 49 | structure = db.Structure(results.structure_ids[0]) 50 | structures = self.manager.get_collection("structures") 51 | assert structures.count("{}") == 2 52 | structure.link(structures) 53 | assert db.Label.USER_OPTIMIZED == structure.get_label() 54 | assert structure.has_property("electronic_energy") 55 | energy_props = structure.get_properties("electronic_energy") 56 | assert len(energy_props) == 1 57 | assert len(results.property_ids) == 1 58 | assert energy_props[0] == results.property_ids[0] 59 | energy = db.NumberProperty(energy_props[0]) 60 | properties = self.manager.get_collection("properties") 61 | energy.link(properties) 62 | self.assertAlmostEqual(energy.get_data(), -76.272650836328, delta=1e-1) 63 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_turbomole_geometry_optimization_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class TurbomoleGeometryOptimizationJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'turbomole') 26 | def test_energy(self): 27 | # import Job 28 | from scine_puffin.jobs.turbomole_geometry_optimization import TurbomoleGeometryOptimization 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 34 | model = db.Model('dft', 'pbe', 'def2-SVP') 35 | model.program = "turbomole" 36 | job = db.Job('turbomole_geometry_optimization') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = TurbomoleGeometryOptimization() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | results = calculation.get_results() 48 | assert len(results.structure_ids) == 1 49 | structure = db.Structure(results.structure_ids[0]) 50 | structures = self.manager.get_collection("structures") 51 | assert structures.count("{}") == 2 52 | structure.link(structures) 53 | assert db.Label.USER_OPTIMIZED == structure.get_label() 54 | assert structure.has_property("electronic_energy") 55 | energy_props = structure.get_properties("electronic_energy") 56 | assert len(energy_props) == 1 57 | assert len(results.property_ids) == 1 58 | assert energy_props[0] == results.property_ids[0] 59 | energy = db.NumberProperty(energy_props[0]) 60 | properties = self.manager.get_collection("properties") 61 | energy.link(properties) 62 | self.assertAlmostEqual(energy.get_data(), -76.27266683034, delta=1e-1) 63 | -------------------------------------------------------------------------------- /scine_puffin/jobs/templates/sub_settings_job.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from abc import ABC 9 | from typing import Any, Dict 10 | 11 | from .job import is_configured 12 | from .scine_connectivity_job import ConnectivityJob 13 | 14 | 15 | class SubSettingsJob(ConnectivityJob, ABC): 16 | """ 17 | """ 18 | 19 | def __init__(self) -> None: 20 | super().__init__() 21 | self.name = "SubSettingsJob" # to be overwritten by child 22 | self.job_key = "job" 23 | # to be extended by child: 24 | self.settings: Dict[str, Dict[str, Any]] = { 25 | self.job_key: {} 26 | } 27 | 28 | @is_configured 29 | def sort_settings(self, task_settings: Dict[str, Any]) -> None: 30 | """ 31 | Take settings of configured calculation and save them in class member. Throw exception for unknown settings. 32 | 33 | Notes 34 | ----- 35 | * Requires run configuration 36 | * May throw exception 37 | 38 | Parameters 39 | ---------- 40 | task_settings : dict 41 | A dictionary from which the settings are taken 42 | """ 43 | self.extract_connectivity_settings_from_dict(task_settings) 44 | # Dissect settings into individual user task_settings 45 | for key, value in task_settings.items(): 46 | for task in self.settings.keys(): 47 | if task == self.job_key: 48 | if key in self.settings[task].keys(): 49 | self.settings[task][key] = value 50 | break # found right task, leave inner loop 51 | else: 52 | indicator_length = len(task) + 1 # underscore to avoid ambiguities 53 | if key[:indicator_length] == task + "_": 54 | self.settings[task][key[indicator_length:]] = value 55 | break # found right task, leave inner loop 56 | else: 57 | self.raise_named_exception( 58 | f"The key '{key}' was not recognized." 59 | ) 60 | 61 | if "ircopt" in self.settings.keys() and "output" in self.settings["ircopt"]: 62 | self.raise_named_exception( 63 | "Cannot specify a separate output system for the optimization of the IRC end points" 64 | ) 65 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_turbomole_hessian.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class TurbomoleHessianJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'turbomole') 26 | def test_hessian(self): 27 | # import Job 28 | from scine_puffin.jobs.turbomole_hessian import TurbomoleHessian 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 34 | model = db.Model('dft', 'pbe', 'def2-SVP') 35 | model.program = "turbomole" 36 | job = db.Job('turbomole_hessian') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = TurbomoleHessian() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | assert structure.has_property("electronic_energy") 48 | assert structure.has_property("hessian") 49 | energy_props = structure.get_properties("electronic_energy") 50 | hessian_props = structure.get_properties("hessian") 51 | assert len(energy_props) == 1 52 | assert len(hessian_props) == 1 53 | results = calculation.get_results() 54 | assert len(results.property_ids) == 2 55 | assert energy_props[0] in results.property_ids 56 | assert hessian_props[0] in results.property_ids 57 | 58 | # Check generated properties 59 | # Energy 60 | properties = self.manager.get_collection("properties") 61 | energy = db.NumberProperty(energy_props[0]) 62 | energy.link(properties) 63 | self.assertAlmostEqual(energy.get_data(), -76.26848572171, delta=1e-1) 64 | # Hessian 65 | hessian = db.DenseMatrixProperty(hessian_props[0]) 66 | hessian.link(properties) 67 | h = hessian.get_data() 68 | self.assertAlmostEqual(h[0][0], +0.4298600028, delta=1e-1) 69 | -------------------------------------------------------------------------------- /scripts/rms/build_rms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This code is licensed under the 3-clause BSD license. 4 | # Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | # See LICENSE.txt for details. 6 | 7 | # This script creates a new Python environment (python-3.7) and installs julia and 8 | # the reaction mechanism simulator. Note that the script requires an existing conda 9 | # installation and the path to this installation in the variable conda_home (vide infra). 10 | 11 | # Assumes that conda exists at the following path 12 | export conda_home=The-path-to-the-anaconda-installation 13 | export rms_path=$PWD/ReactionMechanismSimulator 14 | export rms_so_path=$rms_path/rms.so 15 | export path_to_conda_env=$PWD/rms_conda_env 16 | 17 | # Download RMS development version 18 | git clone https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl.git $rms_path 19 | cd $rms_path 20 | # This script was tested with the following commit (Aug. 8. 2023, 19:32). The source code has likely changed since then and may include additional bug 21 | # fixes and improvements. 22 | git checkout 8fa7f60e2ef62050ba365503ddb95c16933752c3 23 | cd .. 24 | # export conda commands + create environment 25 | . $conda_home/etc/profile.d/conda.sh 26 | conda env create --file $rms_path/environment.yml --prefix $path_to_conda_env 27 | conda activate $path_to_conda_env 28 | 29 | # install julia and RMS 30 | conda install -c rmg "julia>=1.8.5,!=1.9.0" "pyjulia>=0.6" 31 | 32 | export JULIA_NUM_THREADS=8 33 | export path_to_python=`which python` 34 | echo 'import Pkg' > install_rms.jl 35 | echo 'Pkg.add("PyCall")' >> install_rms.jl 36 | echo 'ENV["CONDA_JL_HOME"] = "'$conda_home'"' >> install_rms.jl 37 | echo 'Pkg.build("Conda")' >> install_rms.jl 38 | echo 'ENV["PYTHON"] = "'$path_to_python'"' >> install_rms.jl 39 | echo 'Pkg.build("PyCall")' >> install_rms.jl 40 | echo 'Pkg.add("DiffEqBase")' >> install_rms.jl 41 | echo 'Pkg.build("DiffEqBase")' >> install_rms.jl 42 | echo 'Pkg.add("DifferentialEquations")' >> install_rms.jl 43 | echo 'Pkg.build("DifferentialEquations")' >> install_rms.jl 44 | echo 'Pkg.develop(Pkg.PackageSpec(path="'$rms_path'"))' >> install_rms.jl 45 | echo 'Pkg.build("ReactionMechanismSimulator")' >> install_rms.jl 46 | echo "Julia install script" 47 | julia ./install_rms.jl 48 | 49 | # create system image 50 | python -m julia.sysimage $rms_so_path 51 | # We need diffeqpy for the python bindings of SciML. 52 | pip install diffeqpy==1.2.0 53 | 54 | # Check installation 55 | python -c 'from julia import Julia; jl = Julia(sysimage="'$rms_so_path'"); from diffeqpy import de;' 56 | python -c 'from julia import Julia; jl = Julia(sysimage="'$rms_so_path'"); from julia import ReactionMechanismSimulator' 57 | 58 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_scine_react_ts_guess.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class ScineReactTsGuessJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'readuct') 26 | def test_job_sn2(self): 27 | # import Job 28 | from scine_puffin.jobs.scine_react_ts_guess import ScineReactTsGuess 29 | import scine_database as db 30 | import scine_utilities as su 31 | 32 | # Setup DB for calculation 33 | ts_opt = os.path.join(resource_path(), "CH3ClBr_ts.xyz") 34 | structure = add_structure(self.manager, ts_opt, db.Label.TS_OPTIMIZED, charge=-1, multiplicity=1) 35 | model = db.Model('dftb3', 'dftb3', '') 36 | job = db.Job('scine_react_ts_guess') 37 | # Settings 38 | # Enhanced SD Optimizer to reduce number of steps 39 | settings = { 40 | "irc_irc_initial_step_size": 0.3, 41 | "irc_convergence_max_iterations": 250, 42 | "irc_sd_use_trust_radius": True, 43 | "irc_sd_trust_radius": 0.05, 44 | "irc_sd_dynamic_multiplier": 1.2, 45 | 'spin_propensity_check': 0 46 | } 47 | calculation = add_calculation(self.manager, model, job, [structure.id()], settings) 48 | 49 | # Run calculation/job 50 | config = self.get_configuration() 51 | job = ScineReactTsGuess() 52 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 53 | self.run_job(job, calculation, config) 54 | 55 | # Check results 56 | assert calculation.get_status() == db.Status.COMPLETE 57 | results = calculation.get_results() 58 | assert len(results.structure_ids) == 7 59 | assert len(results.property_ids) >= 10 60 | assert len(results.elementary_step_ids) == 3 61 | found_ts = False 62 | for sid in results.elementary_step_ids: 63 | step = db.ElementaryStep(sid, self.manager.get_collection('elementary_steps')) 64 | if not step.has_transition_state(): 65 | continue 66 | found_ts = True 67 | ts = db.Structure(step.get_transition_state(), self.manager.get_collection("structures")) 68 | fit = su.QuaternionFit(ts.get_atoms().positions, structure.get_atoms().positions) 69 | assert fit.get_rmsd() < 0.1 70 | assert step.has_spline() 71 | assert found_ts 72 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_scine_ts_optimization_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class ScineGeometryOptimizationJobTest(JobTestCase): 24 | 25 | def run_by_label(self, input_label, expected_label): 26 | # import Job 27 | from scine_puffin.jobs.scine_ts_optimization import ScineTsOptimization 28 | import scine_database as db 29 | 30 | # Setup DB for calculation 31 | water = os.path.join(resource_path(), "ts_proline_acid_propanal.xyz") 32 | structure = add_structure(self.manager, water, input_label) 33 | model = db.Model('dftb3', 'dftb3', '') 34 | job = db.Job('scine_geometry_optimization') 35 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 36 | 37 | # Run calculation/job 38 | config = self.get_configuration() 39 | job = ScineTsOptimization() 40 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 41 | self.run_job(job, calculation, config) 42 | 43 | # Check results 44 | assert calculation.get_status() == db.Status.COMPLETE 45 | results = calculation.get_results() 46 | assert len(results.structure_ids) == 1 47 | structure = db.Structure(results.structure_ids[0]) 48 | structures = self.manager.get_collection("structures") 49 | assert structures.count("{}") == 2 50 | structure.link(structures) 51 | assert expected_label == structure.get_label() 52 | assert structure.has_property("electronic_energy") 53 | energy_props = structure.get_properties("electronic_energy") 54 | assert len(energy_props) == 1 55 | assert len(results.property_ids) == 1 56 | assert energy_props[0] == results.property_ids[0] 57 | energy = db.NumberProperty(energy_props[0]) 58 | properties = self.manager.get_collection("properties") 59 | energy.link(properties) 60 | self.assertAlmostEqual(energy.get_data(), -31.659571862, delta=1e-1) 61 | 62 | @skip_without('database', 'readuct') 63 | def test_user_guess(self): 64 | import scine_database as db 65 | self.run_by_label(db.Label.USER_GUESS, db.Label.TS_OPTIMIZED) 66 | 67 | @skip_without('database', 'readuct') 68 | def test_minimum_guess(self): 69 | import scine_database as db 70 | self.run_by_label(db.Label.MINIMUM_GUESS, db.Label.TS_OPTIMIZED) 71 | 72 | @skip_without('database', 'readuct') 73 | def test_surface_guess(self): 74 | import scine_database as db 75 | self.run_by_label(db.Label.SURFACE_GUESS, db.Label.TS_OPTIMIZED) 76 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_turbomole_bond_orders.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class TurbomoleBondOrdersJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'turbomole') 26 | def test_energy(self): 27 | # import Job 28 | from scine_puffin.jobs.turbomole_bond_orders import TurbomoleBondOrders 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 34 | model = db.Model('dft', 'pbe', 'def2-SVP') 35 | model.program = "turbomole" 36 | job = db.Job('turbomole_bond_orders') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = TurbomoleBondOrders() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | assert structure.has_property("electronic_energy") 48 | energy_props = structure.get_properties("electronic_energy") 49 | bo_props = structure.get_properties("bond_orders") 50 | assert len(energy_props) == 1 51 | results = calculation.get_results() 52 | assert len(results.property_ids) == 2 53 | assert energy_props[0] in results.property_ids 54 | assert bo_props[0] in results.property_ids 55 | 56 | # Check generated properties 57 | # Energy 58 | properties = self.manager.get_collection("properties") 59 | energy = db.NumberProperty(energy_props[0]) 60 | energy.link(properties) 61 | self.assertAlmostEqual(energy.get_data(), -76.26848572171) 62 | # Bond orders 63 | bond_orders = db.SparseMatrixProperty(bo_props[0]) 64 | bond_orders.link(properties) 65 | bos = bond_orders.get_data() 66 | self.assertAlmostEqual(bos[0, 1], +1.004910000, delta=1e-1) 67 | self.assertAlmostEqual(bos[0, 2], +1.004910000, delta=1e-1) 68 | self.assertAlmostEqual(bos[1, 0], +1.004910000, delta=1e-1) 69 | self.assertAlmostEqual(bos[2, 0], +1.004910000, delta=1e-1) 70 | self.assertAlmostEqual(bos[0, 0], +0.000000000) 71 | self.assertAlmostEqual(bos[1, 1], +0.000000000) 72 | self.assertAlmostEqual(bos[2, 2], +0.000000000) 73 | self.assertAlmostEqual(bos[2, 1], +0.000000000) 74 | self.assertAlmostEqual(bos[1, 2], +0.000000000) 75 | -------------------------------------------------------------------------------- /container/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | RUN apt-get update && apt-get install -y \ 5 | wget \ 6 | make \ 7 | cmake \ 8 | gcc \ 9 | git \ 10 | vim \ 11 | libeigen3-dev \ 12 | python3-pip \ 13 | libboost-all-dev \ 14 | libhdf5-dev \ 15 | libssl-dev \ 16 | libxml2-dev \ 17 | libpciaccess-dev \ 18 | libopenblas-dev \ 19 | liblapack-dev \ 20 | python3-pybind11 21 | RUN pip3 install --upgrade pip 22 | 23 | # Install MKL 24 | RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O - | apt-key add - 25 | RUN echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list 26 | RUN apt-get update && apt-get -y install intel-oneapi-mkl intel-oneapi-mkl-devel 27 | RUN ln -r -s /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_avx2.so.2 /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_avx2.so 28 | RUN ln -r -s /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_vml_avx2.so.2 /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_vml_avx2.so 29 | ENV LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/latest/lib/intel64:$LD_LIBRARY_PATH 30 | ENV MKLROOT=/opt/intel/oneapi/mkl/latest 31 | 32 | # Install Cython 33 | RUN pip3 install Cython==0.29.36 pythran 34 | 35 | # Install numpy 36 | WORKDIR / 37 | RUN git clone https://github.com/numpy/numpy.git numpy 38 | WORKDIR /numpy 39 | RUN git checkout v1.24.2 40 | RUN git submodule update --init 41 | RUN cp site.cfg.example site.cfg ; \ 42 | echo "\n[mkl]" >> site.cfg ; \ 43 | echo "include_dirs = /opt/intel/oneapi/mkl/latest/lib/intel64/" >> site.cfg ; \ 44 | echo "library_dirs = /opt/intel/oneapi/mkl/latest/lib/intel64/" >> site.cfg ; \ 45 | echo "mkl_libs = mkl_rt" >> site.cfg ; \ 46 | echo "lapack_libs =" >> site.cfg 47 | RUN python3 setup.py build --fcompiler=gnu95 48 | RUN python3 setup.py install 49 | 50 | # Install scipy 51 | WORKDIR / 52 | RUN git clone https://github.com/scipy/scipy.git scipy 53 | WORKDIR /scipy 54 | RUN git checkout v1.10.1 55 | RUN git submodule update --init 56 | RUN python3 setup.py build 57 | RUN python3 setup.py install 58 | 59 | # Install MongoDB C++ bindings 60 | RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz 61 | RUN tar -xzf mongo-c-driver-1.17.3.tar.gz 62 | RUN mkdir -p mongo-c-driver-1.17.3/cmake-build 63 | RUN cd mongo-c-driver-1.17.3/cmake-build ; cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr .. 64 | RUN cd mongo-c-driver-1.17.3/cmake-build ;make install 65 | 66 | RUN wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.2.tar.gz 67 | RUN tar -xzf r3.6.2.tar.gz 68 | RUN mkdir -p mongo-cxx-driver-r3.6.2/build 69 | RUN cd mongo-cxx-driver-r3.6.2/build ; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION=3.6.2 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr .. 70 | RUN cd mongo-cxx-driver-r3.6.2/build ; make install 71 | 72 | # Install Puffin 73 | RUN git clone https://github.com/qcscine/puffin.git 74 | RUN cd puffin ; pip3 install . 75 | 76 | # Bootstrap Puffin 77 | ENV PUFFIN_PROGRAMS_XTB_AVAILABLE=true 78 | RUN python3 -m scine_puffin bootstrap 79 | RUN mv puffin.sh /scratch/puffin.sh 80 | RUN chmod u+x /scratch/puffin.sh 81 | 82 | #ENV PATH="/opt/gtk/bin:${PATH}" 83 | 84 | ENTRYPOINT source ./puffin.sh ; python3 -m scine_puffin container 85 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | from os import path 8 | from setuptools import setup, find_packages 9 | import sys 10 | 11 | 12 | min_version = (3, 6) 13 | if sys.version_info < min_version: 14 | error = """ 15 | SCINE Puffin does not support Python {0}.{1}. 16 | Python {2}.{3} and above is required. Check your Python version like so: 17 | 18 | python3 --version 19 | 20 | This may be due to an out-of-date pip. Make sure you have pip >= 9.0.1. 21 | Upgrade pip like so: 22 | 23 | pip install --upgrade pip 24 | """.format( 25 | *(sys.version_info[:2] + min_version) 26 | ) 27 | sys.exit(error) 28 | 29 | here = path.abspath(path.dirname(__file__)) 30 | 31 | with open(path.join(here, "requirements.txt")) as requirements_file: 32 | # Parse requirements.txt, ignoring any commented-out lines. 33 | requirements = [line for line in requirements_file.read().splitlines() if not line.startswith("#")] 34 | 35 | with open(path.join(here, "README.rst"), encoding="utf-8") as readme_file: 36 | readme = readme_file.read() 37 | 38 | with open(path.join(here, 'scine_puffin', '_version.py'), encoding='utf-8') as f: 39 | exec(f.read()) # This will set the __version__ variable 40 | 41 | 42 | # Define the setup 43 | setup( 44 | name="scine_puffin", 45 | version=__version__, 46 | author="ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group", 47 | author_email="scine@phys.chem.ethz.ch", 48 | description="Calculation handler for SCINE Chemoton", 49 | long_description=readme, 50 | url="https://www.scine.ethz.ch", 51 | python_requires=">={}".format(".".join(str(n) for n in min_version)), 52 | packages=find_packages(include=["scine_puffin", "scine_puffin.*"], 53 | exclude=["scine_puffin.tests*"]), 54 | include_package_data=True, 55 | package_data={ 56 | "scine_puffin": [ 57 | # When adding files here, remember to update MANIFEST.in as well, 58 | # or else they will not be included in the distribution on PyPI! 59 | # 'path/to/data_file', 60 | ] 61 | }, 62 | license="BSD (3-clause)", 63 | classifiers=[ 64 | "Programming Language :: Python", 65 | "Programming Language :: C++", 66 | "Development Status :: 5 - Production/Stable", 67 | "Intended Audience :: Science/Research", 68 | "License :: OSI Approved :: BSD License", 69 | "Natural Language :: English", 70 | "Topic :: Scientific/Engineering :: Chemistry", 71 | ], 72 | entry_points={ 73 | 'console_scripts': [ 74 | 'scine_puffin = scine_puffin.__main__:main', 75 | 'scine_puffin_bootstrap = scine_puffin.__main__:main_bootstrap', 76 | 'scine_puffin_configure = scine_puffin.__main__:configure', 77 | 'scine_puffin_container = scine_puffin.__main__:container', 78 | 'scine_puffin_kill = scine_puffin.__main__:kill', 79 | 'scine_puffin_start = scine_puffin.__main__:start', 80 | 'scine_puffin_stop = scine_puffin.__main__:stop', 81 | ], 82 | }, 83 | install_requires=requirements, 84 | zip_safe=False, 85 | test_suite="pytest", 86 | tests_require=["pytest"], 87 | ) 88 | -------------------------------------------------------------------------------- /scine_puffin/jobs/graph.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import TYPE_CHECKING, List 9 | 10 | from scine_puffin.config import Configuration 11 | from .templates.job import calculation_context, job_configuration_wrapper 12 | from .templates.scine_connectivity_job import ConnectivityJob 13 | from scine_puffin.utilities.imports import module_exists, MissingDependency 14 | 15 | if module_exists("scine_database") or TYPE_CHECKING: 16 | import scine_database as db 17 | else: 18 | db = MissingDependency("scine_database") 19 | 20 | 21 | class Graph(ConnectivityJob): 22 | __doc__ = (""" 23 | A job generating the molassembler graph and decision lists of a structure. 24 | 25 | **Order Name** 26 | ``graph`` 27 | 28 | **Optional Settings** 29 | Optional settings are read from the ``settings`` field, which is part of 30 | any ``Calculation`` stored in a SCINE Database. 31 | Possible settings for this job are: 32 | """ + "\n" 33 | + ConnectivityJob.optional_settings_doc() + "\n" 34 | + ConnectivityJob.general_calculator_settings_docstring() + "\n" 35 | + ConnectivityJob.generated_data_docstring() + "\n" 36 | + """ 37 | If successful the following data will be generated and added to the 38 | database: 39 | 40 | Properties 41 | - None 42 | 43 | Other 44 | Graph representations of the structure will be added to the structures 45 | ``graphs`` field. The added representations are: A representation of the 46 | graph ``masm_cbor_graph``, and the decision representations of the existing 47 | stereopermutators using a nearest neighbor fit ``masm_decision_list`` 48 | Any previous graph representations of the structure will be overwritten. 49 | """ 50 | + ConnectivityJob.required_packages_docstring() 51 | ) 52 | 53 | def __init__(self) -> None: 54 | super().__init__() 55 | self.name = "Scine Graph Job" 56 | 57 | @job_configuration_wrapper 58 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 59 | 60 | # preprocessing of structure 61 | structure = db.Structure(calculation.get_structures()[0], self._structures) 62 | 63 | with calculation_context(self): 64 | # Get settings and check for incorrect settings 65 | self.connectivity_settings_from_only_connectivity_settings() 66 | # Query bond orders of the specified model 67 | db_bond_orders = self.query_bond_orders(structure) 68 | # construct bond orders from db property 69 | bond_orders = self.bond_orders_from_db_bond_orders(structure, db_bond_orders) 70 | # construct graph from bond orders 71 | self.add_graph(structure, bond_orders) 72 | 73 | # After the calculation, verify that the connection to the database still exists 74 | self.verify_connection() 75 | 76 | calculation.set_model( 77 | db_bond_orders.get_model() 78 | ) # updates model based on model of bond order job 79 | return self.postprocess_calculation_context() 80 | 81 | @staticmethod 82 | def required_programs() -> List[str]: 83 | return ["database", "molassembler", "utils"] 84 | -------------------------------------------------------------------------------- /scine_puffin/jobs/templates/turbomole_job.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | import subprocess 10 | from typing import List, TYPE_CHECKING 11 | 12 | from scine_puffin.config import Configuration 13 | from scine_puffin.jobs.templates.job import Job 14 | from scine_puffin.utilities.imports import module_exists, requires, MissingDependency 15 | 16 | if module_exists("scine_database") or TYPE_CHECKING: 17 | import scine_database as db 18 | else: 19 | db = MissingDependency("scine_database") 20 | if module_exists("scine_utilities") or TYPE_CHECKING: 21 | import scine_utilities as utils 22 | else: 23 | utils = MissingDependency("scine_utilities") 24 | 25 | 26 | class TurbomoleJob(Job): 27 | """ 28 | A common interface for all jobs in Puffin that use Turbomole. 29 | """ 30 | 31 | def __init__(self) -> None: 32 | super().__init__() 33 | self.input_structure = "system.xyz" 34 | 35 | env = os.environ.copy() 36 | 37 | self.turboexe = "" 38 | self.turboscripts = "" 39 | self.smp_turboexe = "" 40 | 41 | if "TURBODIR" in env.keys(): 42 | if env["TURBODIR"]: 43 | if os.environ.get("PARA_ARCH") is not None: 44 | del os.environ["PARA_ARCH"] 45 | if os.path.exists(os.path.join(env["TURBODIR"], "scripts", "sysname")): 46 | self.sysname = ( 47 | subprocess.check_output(os.path.join(env["TURBODIR"], "scripts", "sysname")) 48 | .decode("utf-8", errors='replace') 49 | .rstrip() 50 | ) 51 | self.sysname_parallel = self.sysname + "_smp" 52 | self.turboexe = os.path.join(env["TURBODIR"], "bin", self.sysname) 53 | self.smp_turboexe = os.path.join(env["TURBODIR"], "bin", self.sysname_parallel) 54 | self.turboscripts = os.path.join(env["TURBODIR"], "scripts") 55 | else: 56 | raise RuntimeError("TURBODIR not assigned correctly. Check spelling or empty the env variable.") 57 | 58 | @requires("utilities") 59 | def prepare_calculation(self, structure: db.Structure, calculation_settings: utils.ValueCollection, 60 | model: db.Model, job: db.Job) -> None: 61 | from scine_puffin.utilities.turbomole_helper import TurbomoleHelper 62 | 63 | tm_helper = TurbomoleHelper() 64 | # Write xyz file 65 | utils.io.write(self.input_structure, structure.get_atoms()) 66 | # Write coord file 67 | tm_helper.write_coord_file(calculation_settings) 68 | # Check if settings are available 69 | tm_helper.check_settings_availability(job, calculation_settings) 70 | # Generate input file for preprocessing tool 'define' 71 | tm_helper.prepare_define_session(structure, model, calculation_settings, job) 72 | # Initialize via define 73 | tm_helper.initialize(model, calculation_settings) 74 | 75 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 76 | """See Job.run()""" 77 | raise NotImplementedError 78 | 79 | @staticmethod 80 | def required_programs() -> List[str]: 81 | """See Job.required_programs()""" 82 | raise NotImplementedError 83 | -------------------------------------------------------------------------------- /scripts/rms/scine2rms.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | """ 8 | This script creates a RMS input file from a SCINE database. 9 | Requires scine_chemoton. 10 | """ 11 | 12 | import scine_utilities as utils 13 | import scine_database as db 14 | 15 | from scine_puffin.utilities.rms_input_file_creator import create_rms_yml_file 16 | from scine_chemoton.gears.kinetic_modeling.rms_network_extractor import ReactionNetworkData 17 | from scine_chemoton.gears.kinetic_modeling.kinetic_modeling import KineticModeling 18 | from scine_chemoton.utilities.model_combinations import ModelCombination 19 | from scine_chemoton.gears.kinetic_modeling.atomization import ZeroEnergyReference 20 | from scine_chemoton.utilities.db_object_wrappers.thermodynamic_properties import ReferenceState 21 | 22 | 23 | def get_options() -> KineticModeling.Options: 24 | """ 25 | Define the electronic structure models and options for the rate calculations here. 26 | """ 27 | T = 150 + 273.15 # 150 degree Celsius 28 | p = utils.MOLAR_GAS_CONSTANT * T / 1e-3 # 1 mol/L 29 | 30 | model = db.Model("gfn2", "gfn2", "") 31 | model.solvation = "gbsa" 32 | model.solvent = "toluene" 33 | model.program = "xtb" 34 | model.pressure = p 35 | model.temperature = T 36 | 37 | dft_struc_model = db.Model("dft", "pbe-d3bj", "def2-sv(p)") 38 | dft_struc_model.solvation = "cosmo" 39 | dft_struc_model.solvent = "toluene" 40 | dft_struc_model.program = "turbomole" 41 | dft_struc_model.pressure = model.pressure 42 | dft_struc_model.temperature = model.temperature 43 | 44 | model_single_points = db.Model("dft", "pbe0-d3bj", "def2-tzvp") 45 | model_single_points.solvation = "cosmo" 46 | model_single_points.solvent = "toluene" 47 | model_single_points.program = "turbomole" 48 | model_single_points.pressure = model.pressure 49 | model_single_points.temperature = model.temperature 50 | 51 | options = KineticModeling.Options 52 | options.model_combinations = [ModelCombination(model_single_points, dft_struc_model), 53 | ModelCombination(model_single_points, model)] 54 | options.model_combinations_reactions = [ModelCombination(model_single_points, dft_struc_model), 55 | ModelCombination(model_single_points, model)] 56 | options.reference_state = ReferenceState(T, p) 57 | options.max_barrier = 300.0 # kJ/mol 58 | options.only_electronic = False 59 | options.min_flux_truncation = 1e-9 60 | return options 61 | 62 | 63 | if __name__ == "__main__": 64 | manager = db.Manager() 65 | db_name = "my-database" 66 | db_ip = "my-database-ip" 67 | db_port = 27017 68 | credentials = db.Credentials(db_ip, db_port, db_name) 69 | manager.set_credentials(credentials) 70 | manager.connect(False, 60, 120) 71 | reactions = manager.get_collection("reactions") 72 | 73 | kinetic_modeling_options = get_options() 74 | refs = [ZeroEnergyReference(c.electronic_model) for c in kinetic_modeling_options.model_combinations] 75 | network_data = ReactionNetworkData(manager, kinetic_modeling_options, refs) 76 | 77 | rms_file_name = "chem.rms" 78 | solvent = "toluene" 79 | solvent_viscosity = None 80 | solvent_aggregate_index = None 81 | create_rms_yml_file(network_data.aggregate_ids, network_data.enthalpies, network_data.entropies, 82 | network_data.prefactors, network_data.exponents, network_data.ea, 83 | [db.ID(str_id) for str_id in network_data.reaction_ids], reactions, rms_file_name, solvent, 84 | solvent_viscosity, solvent_aggregate_index) 85 | -------------------------------------------------------------------------------- /scine_puffin/utilities/transfer_helper.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from abc import ABC, abstractmethod 9 | from typing import List, TYPE_CHECKING 10 | 11 | from scine_puffin.utilities.imports import module_exists, MissingDependency 12 | 13 | if module_exists("scine_database") or TYPE_CHECKING: 14 | import scine_database as db 15 | else: 16 | db = MissingDependency("scine_database") 17 | 18 | 19 | class TransferHelper(ABC): 20 | """ 21 | An abstract base class to transfer properties from one or more structures 22 | to one or more other structures. 23 | """ 24 | 25 | @abstractmethod 26 | def transfer_properties(self, old_structure: db.Structure, new_structure: db.Structure, 27 | properties_to_transfer: List[str]) \ 28 | -> None: 29 | """ 30 | Transfer properties between individual structures based on given property names 31 | 32 | Parameters 33 | ---------- 34 | old_structure : db.Structure 35 | The structure holding the properties 36 | new_structure : db.Structure 37 | The structure receiving the properties 38 | properties_to_transfer : List[str] 39 | The names of the properties to transfer 40 | """ 41 | raise NotImplementedError 42 | 43 | @abstractmethod 44 | def transfer_properties_between_multiple(self, 45 | old_structures: List[db.Structure], 46 | new_structures: List[db.Structure], 47 | properties_to_transfer: List[str]) -> None: 48 | """ 49 | Transfer properties between multiple structures based on given property names 50 | 51 | Parameters 52 | ---------- 53 | old_structures : List[db.Structure] 54 | The structures holding the properties 55 | new_structures : List[db.Structure] 56 | The structures receiving the properties 57 | properties_to_transfer: List[str] 58 | The names of the properties to transfer 59 | """ 60 | raise NotImplementedError 61 | 62 | @staticmethod 63 | def simple_transfer_all(old_structure: db.Structure, new_structure: db.Structure, properties: List[str]) \ 64 | -> None: 65 | """ 66 | Simply set the id of the given properties from one structure to another one 67 | 68 | Parameters 69 | ---------- 70 | old_structure : db.Structure 71 | The structure holding the properties 72 | new_structure : db.Structure 73 | The structure receiving the properties 74 | properties : List[str] 75 | The names of the properties to transfer 76 | """ 77 | for prop in properties: 78 | TransferHelper.simple_transfer(old_structure, new_structure, prop) 79 | 80 | @staticmethod 81 | def simple_transfer(old_structure: db.Structure, new_structure: db.Structure, property_to_transfer: str) \ 82 | -> None: 83 | """ 84 | Transfer a single property from one structure to another. 85 | 86 | Parameters 87 | ---------- 88 | old_structure : db.Structure 89 | The structure holding the properties 90 | new_structure : db.Structure 91 | The structure receiving the properties 92 | property_to_transfer : str 93 | The name of the property to transfer 94 | """ 95 | if old_structure.has_property(property_to_transfer): 96 | prop_id = old_structure.get_property(property_to_transfer) 97 | new_structure.set_property(property_to_transfer, prop_id) 98 | -------------------------------------------------------------------------------- /scine_puffin/jobs/scine_hessian.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import TYPE_CHECKING 9 | 10 | from scine_puffin.config import Configuration 11 | from .templates.job import calculation_context, job_configuration_wrapper 12 | from .templates.scine_hessian_job import HessianJob 13 | from scine_puffin.utilities.imports import module_exists, MissingDependency 14 | 15 | if module_exists("scine_database") or TYPE_CHECKING: 16 | import scine_database as db 17 | else: 18 | db = MissingDependency("scine_database") 19 | 20 | 21 | class ScineHessian(HessianJob): 22 | """ 23 | A job generating a Hessian and derived data for a single structure. 24 | Derived data means the eigenvalues (frequencies) and eigenvectors 25 | (normalmodes) as well as thermochemical data (Gibbs free energy). 26 | 27 | **Order Name** 28 | ``scine_hessian`` 29 | 30 | **Optional Settings** 31 | Optional settings are read from the ``settings`` field, which is part of 32 | any ``Calculation`` stored in a SCINE Database. 33 | Possible settings for this job are: 34 | 35 | All settings recognized by ReaDuct's Hessian task. For a complete list see 36 | the 37 | `ReaDuct manual `_ 38 | 39 | All settings that are recognized by the SCF program chosen. 40 | 41 | Common examples are: 42 | 43 | max_scf_iterations : int 44 | The number of allowed SCF cycles until convergence. 45 | 46 | **Required Packages** 47 | - SCINE: Database (present by default) 48 | - SCINE: Readuct (present by default) 49 | - SCINE: Utils (present by default) 50 | - A program implementing the SCINE Calculator interface, e.g. Sparrow 51 | 52 | **Generated Data** 53 | If successful the following data will be generated and added to the 54 | database: 55 | 56 | Properties 57 | The ``hessian`` (``DenseMatrixProperty``), ``frequencies`` 58 | (``VectorProperty``), ``normal_modes`` (``DenseMatrixProperty``), 59 | ``gibbs_energy_correction`` (``NumberProperty``) and 60 | ``gibbs_free_energy` (``NumberProperty``) will be provided. 61 | Optionally the ``electronic_energy`` associated with the structure if it 62 | is present in the results of provided by the calculator interface. 63 | """ 64 | 65 | def __init__(self) -> None: 66 | super().__init__() 67 | self.name = "Scine Hessian Job" 68 | 69 | @job_configuration_wrapper 70 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 71 | import scine_readuct as readuct 72 | 73 | # preprocessing of structure 74 | structure = db.Structure(calculation.get_structures()[0], self._structures) 75 | settings_manager, program_helper = self.create_helpers(structure) 76 | 77 | if len(structure.get_atoms()) < 2: 78 | calculation.set_comment("No Hessian generated for a single atom.\n") 79 | calculation.set_status(db.Status.FAILED) 80 | return False 81 | 82 | # actual calculation 83 | with calculation_context(self): 84 | systems, keys = settings_manager.prepare_readuct_task( 85 | structure, calculation, calculation.get_settings(), config["resources"] 86 | ) 87 | if program_helper is not None: 88 | program_helper.calculation_preprocessing(self.get_calc(keys[0], systems), calculation.get_settings()) 89 | systems, success = readuct.run_hessian_task(systems, keys, **settings_manager.task_settings) 90 | 91 | self.sp_postprocessing(success, systems, keys, structure, program_helper) 92 | 93 | self.store_hessian_data(systems[keys[0]], structure) 94 | 95 | return self.postprocess_calculation_context() 96 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_scine_afir.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class ScineAfirOptimizationJobTest(JobTestCase): 24 | 25 | def run_by_label(self, input_label, expected_label): 26 | # import Job 27 | from scine_puffin.jobs.scine_afir import ScineAfir 28 | from scine_puffin.utilities.masm_helper import get_molecules_result 29 | import scine_database as db 30 | import scine_utilities as utils 31 | 32 | # Setup DB for calculation 33 | rc = os.path.join(resource_path(), "proline_acid_propanal_complex.xyz") 34 | structure = add_structure(self.manager, rc, input_label) 35 | model = db.Model('dftb3', 'dftb3', '') 36 | if input_label == db.Label.SURFACE_GUESS: 37 | p = db.VectorProperty.make("surface_atom_indices", model, [], self.manager.get_collection('properties')) 38 | structure.set_property("surface_atom_indices", p.id()) 39 | job = db.Job('scine_afir') 40 | settings = { 41 | "afir_afir_lhs_list": [3, 16], 42 | "afir_afir_rhs_list": [17, 20], 43 | "afir_convergence_max_iterations": 800, 44 | "spin_propensity_check": 0, 45 | } 46 | calculation = add_calculation(self.manager, model, job, [structure.id()], settings) 47 | 48 | # Run calculation/job 49 | config = self.get_configuration() 50 | job = ScineAfir() 51 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 52 | self.run_job(job, calculation, config) 53 | 54 | # Check results 55 | assert calculation.get_status() == db.Status.COMPLETE 56 | results = calculation.get_results() 57 | assert len(results.structure_ids) == 1 58 | structures = self.manager.get_collection("structures") 59 | product = db.Structure(results.structure_ids[0], structures) 60 | assert structures.count("{}") == 2 61 | assert expected_label == product.get_label() 62 | assert product.has_property("electronic_energy") 63 | energy_props = product.get_properties("electronic_energy") 64 | assert len(energy_props) == 1 65 | assert len(results.property_ids) == 2 66 | assert energy_props[0] == results.property_ids[0] 67 | energy = db.NumberProperty(energy_props[0]) 68 | properties = self.manager.get_collection("properties") 69 | energy.link(properties) 70 | self.assertAlmostEqual(energy.get_data(), -31.633858301419195, delta=1e-1) 71 | assert product.has_property('bond_orders') 72 | assert product.has_graph('masm_cbor_graph') 73 | bonds = utils.BondOrderCollection() 74 | bonds.matrix = db.SparseMatrixProperty(product.get_property('bond_orders'), properties).get_data() 75 | job.connectivity_settings['sub_based_on_distance_connectivity'] = False 76 | assert len(get_molecules_result(product.get_atoms(), bonds, job.connectivity_settings).molecules) == 1 77 | 78 | @skip_without('database', 'readuct', 'molassembler') 79 | def test_user_guess(self): 80 | import scine_database as db 81 | self.run_by_label(db.Label.USER_GUESS, db.Label.USER_OPTIMIZED) 82 | 83 | @skip_without('database', 'readuct', 'molassembler') 84 | def test_minimum_guess(self): 85 | import scine_database as db 86 | self.run_by_label(db.Label.MINIMUM_GUESS, db.Label.MINIMUM_OPTIMIZED) 87 | 88 | @skip_without('database', 'molassembler', 'readuct') 89 | def test_surface_guess(self): 90 | import scine_database as db 91 | self.run_by_label(db.Label.SURFACE_GUESS, db.Label.SURFACE_OPTIMIZED) 92 | -------------------------------------------------------------------------------- /scine_puffin/tests/resources/8-gly-chain-opt.xyz: -------------------------------------------------------------------------------- 1 | 73 2 | optimized with gfn2/gbsa(water) 3 | C -9.1595144272 4.6848201752 -0.8650802970 4 | C -8.3268938065 3.4010460377 -0.8202669621 5 | N -10.3994550705 4.5835866928 -0.1055065915 6 | O -8.6749172211 2.4117383957 -0.1929113865 7 | H -9.4104986191 4.9036049843 -1.9105601311 8 | H -8.5269489288 5.4976859093 -0.4949254990 9 | H -10.4535350800 3.6558165550 0.3083664179 10 | C -6.1676840782 2.4219241142 -1.5506534576 11 | C -4.9104256630 3.0593540668 -2.1470673084 12 | N -7.1613955498 3.4846005440 -1.4855599403 13 | O -4.9633421898 3.5770325661 -3.2552559376 14 | H -6.0194573402 2.0077784061 -0.5520618558 15 | H -6.5163106918 1.6208312511 -2.2154092789 16 | H -6.9916310310 4.2664666176 -2.1023349762 17 | C -2.6565029621 3.8815040588 -1.8256149292 18 | C -1.6924971342 4.1638274193 -0.6671522856 19 | N -3.8015847206 3.0984392166 -1.3959696293 20 | O -1.8275794983 3.6344318390 0.4248850048 21 | H -2.1121926308 3.3509414196 -2.6153519154 22 | H -3.0325703621 4.8167910576 -2.2520260811 23 | H -3.7302973270 2.6635463238 -0.4849408865 24 | C 0.3780808151 5.3932375908 -0.0697760060 25 | C 1.3709466457 6.3027267456 -0.8096673489 26 | N -0.6869525313 4.9979267120 -0.9808021188 27 | O 0.9772907495 7.0078601837 -1.7286738157 28 | H -0.0479640402 5.9810371399 0.7552043200 29 | H 0.8505551815 4.5058879852 0.3547314703 30 | H -0.6828391552 5.4951367378 -1.8637034893 31 | H 10.8946123123 13.0760993958 -1.3322688341 32 | C 3.5987129211 7.2600550652 -0.9661633372 33 | C 5.0701255798 6.9577441216 -0.6475380659 34 | N 2.6476628780 6.3204603195 -0.3864783943 35 | O 5.4166164398 6.0328521729 0.0662100613 36 | H 3.4470429420 7.2703533173 -2.0497319698 37 | H 3.3825180531 8.2658376694 -0.5864674449 38 | H 2.9993774891 5.7014250755 0.3314624727 39 | C 7.3725528717 7.8049116135 -1.0237170458 40 | C 8.0727624893 9.0564985275 -1.5896153450 41 | N 5.9225201607 7.8563389778 -1.1874067783 42 | O 8.0825366974 9.2650108337 -2.7942357063 43 | H 7.6042203903 7.6423673630 0.0299255569 44 | H 7.7729682922 6.9569296837 -1.5977802277 45 | H 5.5834918022 8.5062551498 -1.8813923597 46 | H 11.5526790619 13.9536180496 1.2142589092 47 | C 9.5525121689 10.9628763199 -1.1344981194 48 | C 9.7082557678 12.0355529785 -0.0435910672 49 | N 8.7182674408 9.8465957642 -0.7131417990 50 | O 9.1657791138 11.9383478165 1.0436633825 51 | H 10.5511503220 10.5890989304 -1.3923562765 52 | H 9.1131210327 11.4052810669 -2.0335333347 53 | H 8.6134538651 9.7321224213 0.2858773470 54 | C 10.8166484833 14.2085371017 0.4467360377 55 | C 11.2261056900 15.4468488693 -0.3709571362 56 | N 10.5283384323 13.0489244461 -0.3935002387 57 | O 10.4212884903 15.9613714218 -1.1341047287 58 | H 9.8839187622 14.4905891418 0.9531626701 59 | C 12.7378778458 17.3180046082 -0.6683366895 60 | C 14.2190465927 17.6392669678 -0.8701280355 61 | N 12.4468984604 15.9826564789 -0.1653366834 62 | O 15.1255846024 16.8895244598 -0.5527139902 63 | H 12.1996307373 17.4464588165 -1.6113750935 64 | H 12.3493804932 18.0547847748 0.0465964042 65 | H 13.1805305481 15.5225667953 0.3559043705 66 | C 15.7333946228 19.4057788849 -1.6553828716 67 | C 15.6851034164 20.7534999847 -2.3352193832 68 | N 14.4208478928 18.8615360260 -1.4013431072 69 | O 14.6830844879 21.3607692719 -2.6068284512 70 | H 16.3232021332 19.5049571991 -0.7379171848 71 | H 16.3041763306 18.7514591217 -2.3274137974 72 | H 13.6517944336 19.4616889954 -1.6695697308 73 | O 16.9361629486 21.1544437408 -2.6001026630 74 | H -10.4089860916 5.2540292740 0.6528951526 75 | H 17.1167392731 21.3788852692 -3.5246484280 76 | -------------------------------------------------------------------------------- /scine_puffin/jobs/scine_single_point.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import TYPE_CHECKING, List, Dict 9 | 10 | from scine_puffin.config import Configuration 11 | from scine_puffin.jobs.templates.job import calculation_context, job_configuration_wrapper, is_configured 12 | from scine_puffin.jobs.templates.scine_job import ScineJob 13 | from scine_puffin.utilities.qm_mm_settings import prepare_optional_settings 14 | from scine_puffin.utilities.imports import module_exists, MissingDependency 15 | from scine_puffin.utilities.scine_helper import SettingsManager 16 | 17 | if module_exists("scine_database") or TYPE_CHECKING: 18 | import scine_database as db 19 | else: 20 | db = MissingDependency("scine_database") 21 | 22 | 23 | class ScineSinglePoint(ScineJob): 24 | """ 25 | A job calculating the electronic energy for a given structure with a given 26 | model. 27 | 28 | QM/MM and MM calculations expect the presence of bond orders ('bond_orders'), (optionally) atomic 29 | charges ('atomic_charges'), and the QM-atom selection ('qm_atoms') as properties of the structure. 30 | 31 | **Order Name** 32 | ``scine_single_point`` 33 | 34 | **Optional Settings** 35 | Optional settings are read from the ``settings`` field, which is part of 36 | any ``Calculation`` stored in a SCINE Database. 37 | Possible settings for this job are: 38 | 39 | All settings that are recognized by the program chosen. 40 | Furthermore, all settings that are commonly understood by any program 41 | interface via the SCINE Calculator interface. 42 | 43 | Common examples are: 44 | 45 | max_scf_iterations : int 46 | The number of allowed SCF cycles until convergence. 47 | 48 | **Required Packages** 49 | - SCINE: Database (present by default) 50 | - SCINE: Readuct (present by default) 51 | - SCINE: Utils (present by default) 52 | - A program implementing the SCINE Calculator interface, i.e. Sparrow 53 | 54 | **Generated Data** 55 | If successful the following data will be generated and added to the 56 | database: 57 | 58 | Properties 59 | The ``electronic_energy`` associated with the given structure. 60 | The ``atomic_charges`` associated with the given structure (if available). 61 | """ 62 | 63 | def __init__(self) -> None: 64 | super().__init__() 65 | self.name = "Scine Single Point Calculation Job" 66 | 67 | @job_configuration_wrapper 68 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 69 | 70 | import scine_readuct as readuct 71 | 72 | # preprocessing of structure 73 | structure = db.Structure(calculation.get_structures()[0], self._structures) 74 | settings_manager, program_helper = self.create_helpers(structure) 75 | 76 | # actual calculation 77 | with calculation_context(self): 78 | prepare_optional_settings(structure, calculation, settings_manager, self._properties) 79 | self.sp_preprocessing(settings_manager, structure, config["resources"]) 80 | systems, keys = settings_manager.prepare_readuct_task( 81 | structure, calculation, calculation.get_settings(), config["resources"] 82 | ) 83 | if program_helper is not None: 84 | program_helper.calculation_preprocessing(self.get_calc(keys[0], systems), calculation.get_settings()) 85 | systems, success = readuct.run_sp_task(systems, keys, **settings_manager.task_settings) 86 | self.sp_postprocessing(success, systems, keys, structure, program_helper) 87 | 88 | return self.postprocess_calculation_context() 89 | 90 | @staticmethod 91 | def required_programs() -> List[str]: 92 | return ["database", "readuct", "utils"] 93 | 94 | @is_configured 95 | def sp_preprocessing(self, _: SettingsManager, __: db.Structure, ___: Dict) -> None: 96 | pass 97 | -------------------------------------------------------------------------------- /container/apptainer/puffin.def: -------------------------------------------------------------------------------- 1 | Bootstrap: docker 2 | From: ubuntu:focal 3 | 4 | %setup 5 | mkdir -p /root/.ssh/ 6 | 7 | %files 8 | /home/$USER/.ssh/id_rsa /root/.ssh/id_rsa 9 | /home/$USER/.ssh/known_hosts /root/.ssh/known_hosts 10 | 11 | %environment 12 | export LC_ALL=C 13 | export TMPDIR=/jobs 14 | export PUFFIN_DAEMON_JOB_DIR=/jobs 15 | export PUFFIN_DAEMON_LOG=/socket/puffin.log 16 | export PUFFIN_DAEMON_PID=/socket/puffin.pid 17 | export PUFFIN_DAEMON_STOP=/socket/puffin.stop 18 | export PUFFIN_PROGRAMS_XTB_AVAILABLE=true 19 | 20 | %post 21 | cd /root 22 | chmod 600 .ssh/id_rsa 23 | 24 | export DEBIAN_FRONTEND=noninteractive 25 | apt-get -y update 26 | apt-get -y install wget libssl-dev make cmake gcc git vim libeigen3-dev python3-pip libboost-all-dev libhdf5-dev libxml2-dev libpciaccess-dev libopenblas-dev liblapack-dev python3-pybind11 27 | pip3 install --upgrade pip 28 | 29 | ######### 30 | # MKL # 31 | ######### 32 | 33 | wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O - | apt-key add - 34 | echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list 35 | apt-get -y update 36 | apt-get -y install intel-oneapi-mkl intel-oneapi-mkl-devel 37 | ln -r -s /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_avx2.so.2 /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_avx2.so 38 | ln -r -s /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_vml_avx2.so.2 /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_vml_avx2.so 39 | export LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/latest/lib/intel64:$LD_LIBRARY_PATH 40 | export MKLROOT=/opt/intel/oneapi/mkl/latest 41 | echo 'export LD_LIBRARY_PATH=/opt/intel/oneapi/mkl/latest/lib/intel64:$LD_LIBRARY_PATH' >>$SINGULARITY_ENVIRONMENT 42 | echo 'export MKLROOT=/opt/intel/oneapi/mkl/latest' >>$SINGULARITY_ENVIRONMENT 43 | 44 | # Install Cython 45 | pip3 install Cython==0.29.36 pythran 46 | 47 | # Install numpy 48 | git clone https://github.com/numpy/numpy.git numpy 49 | cd numpy 50 | git checkout v1.24.2 51 | git submodule update --init 52 | cp site.cfg.example site.cfg 53 | echo "\n[mkl]" >> site.cfg 54 | echo "include_dirs = /opt/intel/oneapi/mkl/latest/lib/intel64/" >> site.cfg 55 | echo "library_dirs = /opt/intel/oneapi/mkl/latest/lib/intel64/" >> site.cfg 56 | echo "mkl_libs = mkl_rt" >> site.cfg 57 | echo "lapack_libs =" >> site.cfg 58 | python3 setup.py build --fcompiler=gnu95 59 | python3 setup.py install 60 | cd .. 61 | rm -rf numpy 62 | 63 | # Install scipy 64 | git clone https://github.com/scipy/scipy.git scipy 65 | cd scipy 66 | git checkout v1.10.1 67 | git submodule update --init 68 | python3 setup.py build 69 | python3 setup.py install 70 | cd .. 71 | rm -rf scipy 72 | 73 | ############ 74 | # Mongodb # 75 | ############ 76 | 77 | wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.3/mongo-c-driver-1.17.3.tar.gz 78 | tar -xzf mongo-c-driver-1.17.3.tar.gz 79 | cd mongo-c-driver-1.17.3 80 | mkdir cmake-build 81 | cd cmake-build 82 | cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr .. 83 | make install 84 | cd ../.. 85 | 86 | wget https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.2.tar.gz 87 | tar -xzf r3.6.2.tar.gz 88 | cd mongo-cxx-driver-r3.6.2/build 89 | cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VERSION=3.6.2 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr .. 90 | make install 91 | cd ../.. 92 | 93 | ############ 94 | # Puffin # 95 | ############ 96 | 97 | git clone https://github.com/qcscine/puffin.git 98 | cd puffin 99 | pip3 install . 100 | cd .. 101 | 102 | export PUFFIN_PROGRAMS_XTB_AVAILABLE=true 103 | python3 -m scine_puffin bootstrap 104 | mv puffin.sh /scratch/puffin.sh 105 | chmod u+x /scratch/puffin.sh 106 | cat /scratch/puffin.sh >>$SINGULARITY_ENVIRONMENT 107 | 108 | rm /root/.ssh/id_rsa 109 | rm /root/.ssh/known_hosts 110 | 111 | %runscript 112 | /bin/bash -c "python3 -m scine_puffin container" 113 | -------------------------------------------------------------------------------- /scine_puffin/programs/rms.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 3 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 4 | See LICENSE.txt for details. 5 | """ 6 | 7 | import os 8 | from typing import List 9 | 10 | from .program import Program 11 | from scine_puffin.config import Configuration 12 | 13 | 14 | class Rms(Program): 15 | """ 16 | The reaction mechanism simulator. See https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl 17 | 18 | See the install scripts in the "scripts" directory for details. Note that the installation requires Conda. 19 | """ 20 | 21 | def install(self, repo_dir: str, install_dir: str, ncores: int): 22 | if self.root: 23 | pass 24 | elif self.source: 25 | raise NotImplementedError("RMS must be installed manually. See rms.py for details.") 26 | else: 27 | raise NotImplementedError("RMS must be installed manually. See rms.py for details.") 28 | 29 | def check_install(self): 30 | self.assert_install() 31 | 32 | @staticmethod 33 | def assert_install(): 34 | if not Rms.is_installed(): 35 | raise ModuleNotFoundError('RMS was not installed correctly. It must be preinstalled in a conda' 36 | ' environment. An installation script is provided in scripts/rms/build_rms.sh.' 37 | ' More information on the RMS installation process is provided on' 38 | ' http://reactionmechanismgenerator.github.io/RMG-Py/users/rmg/installation/' 39 | 'anacondaDeveloper.html') 40 | 41 | @staticmethod 42 | def is_installed(): 43 | try: 44 | # pylint: disable=unused-import 45 | import julia # noqa: F401 46 | from julia import ReactionMechanismSimulator # noqa: F401 47 | import diffeqpy # noqa: F401 48 | # pylint: enable=unused-import 49 | except ImportError as e: 50 | print("Julia, pyrms or diffeqpy could not be imported. The error message was:\n" + str(e)) 51 | return False 52 | return True 53 | 54 | def setup_environment(self, config: Configuration, env_paths: dict, env_vars: dict): 55 | if self.root: 56 | raise NotImplementedError 57 | elif self.source: 58 | raise NotImplementedError 59 | else: 60 | raise RuntimeError 61 | 62 | def available_models(self) -> List[str]: 63 | return [] 64 | 65 | 66 | class JuliaPrecompiler(object): 67 | def __new__(cls): 68 | if not hasattr(cls, 'instance'): 69 | cls.instance = super(JuliaPrecompiler, cls).__new__(cls) 70 | cls.instance.julia_is_precompiled = False 71 | cls.instance.root = "" 72 | return cls.instance 73 | 74 | def set_root(self, root: str): 75 | # pylint: disable=attribute-defined-outside-init 76 | self.root = root 77 | # pylint: enable=attribute-defined-outside-init 78 | 79 | def compile_julia(self): 80 | # Try to load the system image if the file already exists. 81 | if self.root: 82 | if ".so" not in self.root or not os.path.exists(self.root): 83 | raise RuntimeError("The shared library file for RMS was not found. Install RMS through the installation" 84 | "scripts in the scripts directory and activate the conda environment after" 85 | " installation.") 86 | # pylint: disable=import-error 87 | from julia import Julia # noqa: F401 88 | _ = Julia(sysimage=self.root) 89 | # pylint: enable=import-error 90 | else: 91 | print("Compiling Julia on the fly. This may take a while!") 92 | # If the system image is not available we resort to compiling it on the fly. This is potentially very slow. 93 | # pylint: disable=import-error 94 | from julia.api import Julia 95 | _ = Julia(compiled_modules=False) 96 | # pylint: enable=import-error 97 | 98 | # pylint: disable=attribute-defined-outside-init 99 | self.julia_is_precompiled = True 100 | # pylint: enable=attribute-defined-outside-init 101 | 102 | def ensure_is_compiled(self): 103 | if not self.julia_is_precompiled: 104 | self.compile_julia() 105 | -------------------------------------------------------------------------------- /scine_puffin/jobs/scine_ts_optimization.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from typing import TYPE_CHECKING 9 | 10 | from scine_puffin.config import Configuration 11 | from .templates.job import calculation_context, job_configuration_wrapper 12 | from .templates.scine_optimization_job import OptimizationJob 13 | from scine_puffin.utilities.imports import module_exists, MissingDependency 14 | 15 | if module_exists("scine_database") or TYPE_CHECKING: 16 | import scine_database as db 17 | else: 18 | db = MissingDependency("scine_database") 19 | 20 | 21 | class ScineTsOptimization(OptimizationJob): 22 | """ 23 | A job searching the nearest saddlepoint on the potential energy surface. 24 | Optimizing a given structure's geometry, generating a new transition state 25 | structure, if successful. 26 | 27 | **Order Name** 28 | ``scine_ts_optimization`` 29 | 30 | **Optional Settings** 31 | Optional settings are read from the ``settings`` field, which is part of 32 | any ``Calculation`` stored in a SCINE Database. 33 | Possible settings for this job are: 34 | 35 | All settings recognized by ReaDuct's transition state search 36 | 37 | Common examples are: 38 | 39 | optimizer : str 40 | The name of the optimizer to be used, e.g. 'bofill' or 'evf' or 'dimer'. 41 | convergence_max_iterations : int 42 | The maximum number of geometry optimization cycles. 43 | convergence_delta_value : float 44 | The convergence criterion for the electronic energy difference between 45 | two steps. 46 | convergence_gradient_max_coefficient : float 47 | The convergence criterion for the maximum absolute gradient. 48 | contribution. 49 | convergence_step_rms : float 50 | The convergence criterion for root mean square of the geometric 51 | gradient. 52 | convergence_step_max_coefficient : float 53 | The convergence criterion for the maximum absolute coefficient in the 54 | last step taken in the geometry optimization. 55 | convergence_gradient_rms : float 56 | The convergence criterion for root mean square of the last step taken 57 | in the geometry optimization. 58 | 59 | For a complete list see the 60 | `ReaDuct manual `_ 61 | 62 | All settings that are recognized by the SCF program chosen. 63 | 64 | Common examples are: 65 | 66 | max_scf_iterations : int 67 | The number of allowed SCF cycles until convergence. 68 | 69 | **Required Packages** 70 | - SCINE: Database (present by default) 71 | - SCINE: Readuct (present by default) 72 | - SCINE: Utils (present by default) 73 | - A program implementing the SCINE Calculator interface, e.g. Sparrow 74 | 75 | **Generated Data** 76 | If successful the following data will be generated and added to the 77 | database: 78 | 79 | Structures 80 | A new transition state structure. 81 | Properties 82 | The ``electronic_energy`` associated with the new structure. 83 | """ 84 | 85 | def __init__(self) -> None: 86 | super().__init__() 87 | self.name = "Scine Transition State Optimization" 88 | 89 | @job_configuration_wrapper 90 | def run(self, manager: db.Manager, calculation: db.Calculation, config: Configuration) -> bool: 91 | import scine_readuct as readuct 92 | 93 | # preprocessing of structure 94 | structure = db.Structure(calculation.get_structures()[0], self._structures) 95 | settings_manager, program_helper = self.create_helpers(structure) 96 | 97 | # actual calculation 98 | with calculation_context(self): 99 | systems, keys = settings_manager.prepare_readuct_task( 100 | structure, calculation, calculation.get_settings(), config["resources"] 101 | ) 102 | if program_helper is not None: 103 | program_helper.calculation_preprocessing(self.get_calc(keys[0], systems), calculation.get_settings()) 104 | systems, success = readuct.run_tsopt_task(systems, keys, **settings_manager.task_settings) 105 | 106 | self.optimization_postprocessing( 107 | success, systems, keys, structure, db.Label.TS_OPTIMIZED, program_helper 108 | ) 109 | 110 | return self.postprocess_calculation_context() 111 | -------------------------------------------------------------------------------- /scine_puffin/tests/jobs/test_turbomole_single_point_job.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import os 9 | 10 | from ..testcases import ( 11 | JobTestCase, 12 | skip_without 13 | ) 14 | 15 | from ..db_setup import ( 16 | add_calculation, 17 | add_structure 18 | ) 19 | 20 | from ..resources import resource_path 21 | 22 | 23 | class TurbomoleSinglePointJobTest(JobTestCase): 24 | 25 | @skip_without('database', 'turbomole') 26 | def test_energy(self): 27 | # import Job 28 | from scine_puffin.jobs.turbomole_single_point import TurbomoleSinglePoint 29 | import scine_database as db 30 | 31 | # Setup DB for calculation 32 | water = os.path.join(resource_path(), "water.xyz") 33 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 34 | model = db.Model('dft', 'pbe', 'def2-SVP') 35 | model.program = "turbomole" 36 | job = db.Job('turbomole_single_point') 37 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 38 | 39 | # Run calculation/job 40 | config = self.get_configuration() 41 | job = TurbomoleSinglePoint() 42 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 43 | self.run_job(job, calculation, config) 44 | 45 | # Check results 46 | assert calculation.get_status() == db.Status.COMPLETE 47 | assert structure.has_property("electronic_energy") 48 | energy_props = structure.get_properties("electronic_energy") 49 | assert len(energy_props) == 1 50 | results = calculation.get_results() 51 | assert len(results.property_ids) == 1 52 | assert energy_props[0] in results.property_ids 53 | 54 | # Check generated properties 55 | # Energy 56 | properties = self.manager.get_collection("properties") 57 | energy = db.NumberProperty(energy_props[0]) 58 | energy.link(properties) 59 | self.assertAlmostEqual(energy.get_data(), -76.26848572171, delta=1e-1) 60 | 61 | @skip_without('database', 'turbomole') 62 | def test_charges(self): 63 | # import Job 64 | from scine_puffin.jobs.turbomole_single_point import TurbomoleSinglePoint 65 | import scine_database as db 66 | import scine_utilities as utils 67 | 68 | # Setup DB for calculation 69 | water = os.path.join(resource_path(), "water.xyz") 70 | structure = add_structure(self.manager, water, db.Label.USER_GUESS) 71 | model = db.Model('dft', 'pbe', 'def2-SVP') 72 | job = db.Job('turbomole_single_point') 73 | calculation = add_calculation(self.manager, model, job, [structure.id()]) 74 | settings = utils.ValueCollection({ 75 | "calculate_loewdin_charges": True 76 | }) 77 | calculation.set_settings(settings) 78 | 79 | # Run calculation/job 80 | config = self.get_configuration() 81 | job = TurbomoleSinglePoint() 82 | job.prepare(config["daemon"]["job_dir"], calculation.id()) 83 | self.run_job(job, calculation, config) 84 | 85 | # Check results 86 | assert calculation.get_status() == db.Status.COMPLETE 87 | assert structure.has_property("electronic_energy") 88 | energy_props = structure.get_properties("electronic_energy") 89 | assert len(energy_props) == 1 90 | results = calculation.get_results() 91 | assert len(results.property_ids) == 2 92 | assert energy_props[0] in results.property_ids 93 | 94 | assert structure.has_property("loewdin_charges") 95 | charge_props = structure.get_properties("loewdin_charges") 96 | assert len(charge_props) == 1 97 | assert charge_props[0] in results.property_ids 98 | 99 | # Check generated properties 100 | # Energy 101 | properties = self.manager.get_collection("properties") 102 | energy = db.NumberProperty(energy_props[0]) 103 | energy.link(properties) 104 | self.assertAlmostEqual(energy.get_data(), -76.26848572171, delta=1e-1) 105 | 106 | # Charges 107 | properties = self.manager.get_collection("properties") 108 | charges = db.VectorProperty(charge_props[0]) 109 | charges.link(properties) 110 | self.assertAlmostEqual(charges.get_data()[0], -0.35773, delta=1e-1) 111 | self.assertAlmostEqual(charges.get_data()[1], +0.17886, delta=1e-1) 112 | self.assertAlmostEqual(charges.get_data()[2], +0.17886, delta=1e-1) 113 | -------------------------------------------------------------------------------- /scine_puffin/__main__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | import argparse 9 | import sys 10 | from typing import Union 11 | from .bootstrap import bootstrap 12 | from .config import Configuration 13 | from .daemon import start_daemon, stop_daemon, check_environment 14 | from .jobloop import kill_daemon 15 | 16 | 17 | def setup_config(args: argparse.Namespace) -> Configuration: 18 | config = Configuration() 19 | if args.config: 20 | config.load(args.config) 21 | print("Loading configuration: " + args.config) 22 | print("Applying environment variables afterwards.") 23 | else: 24 | print("No configuration loaded, using default configuration with environment variables.") 25 | config.load() 26 | return config 27 | 28 | 29 | def parse_arguments(include_action: bool = False) -> argparse.Namespace: 30 | parser = argparse.ArgumentParser(description="SCINE Puffin") 31 | parser.add_argument( 32 | "-c", 33 | "--config", 34 | default=None, 35 | metavar="path", 36 | help="The path to the configuration file.", 37 | ) 38 | if include_action: 39 | parser.add_argument( 40 | "action", 41 | choices=["configure", "bootstrap", "start", "stop", "kill", "container"], 42 | help="The main action to be taken.", 43 | ) 44 | return parser.parse_args() 45 | 46 | 47 | def configure(args: Union[None, argparse.Namespace] = None): 48 | if args is None: 49 | args = parse_arguments() 50 | print("") 51 | print("+--------------------+") 52 | print("| Configure Puffin |") 53 | print("+--------------------+") 54 | config = Configuration() 55 | print("Applying environment variables to default configuration, then dumping into a .yaml file.") 56 | if not args.config: 57 | args.config = "puffin.yaml" 58 | config.dump(args.config) 59 | print("") 60 | print("Please edit the generated '" + args.config + "' to your liking.") 61 | 62 | 63 | def main_bootstrap(config: Union[None, Configuration] = None): 64 | print("") 65 | print("+-----------------+") 66 | print("| Bootstrapping |") 67 | print("+-----------------+") 68 | print("") 69 | print("Getting Puffin ready for use.") 70 | print("") 71 | if config is None: 72 | config = setup_config(parse_arguments()) 73 | bootstrap(config) 74 | 75 | 76 | def stop(config: Union[None, Configuration] = None): 77 | print("") 78 | print("+-------------------+") 79 | print("| Stopping Puffin |") 80 | print("+-------------------+") 81 | print("") 82 | print("Puffin will stop after the current job has concluded.") 83 | if config is None: 84 | config = setup_config(parse_arguments()) 85 | stop_daemon(config) 86 | print("") 87 | print("Goodbye!") 88 | 89 | 90 | def kill(config: Union[None, Configuration] = None): 91 | print("") 92 | print("+------------------+") 93 | print("| Killing Puffin |") 94 | print("+------------------+") 95 | if config is None: 96 | config = setup_config(parse_arguments()) 97 | kill_daemon(config) 98 | print("") 99 | print("Goodbye!") 100 | 101 | 102 | def start(config: Union[None, Configuration] = None): 103 | print("") 104 | print("+-------------------+") 105 | print("| Starting Puffin |") 106 | print("+-------------------+") 107 | if config is None: 108 | config = setup_config(parse_arguments()) 109 | print("") 110 | print("Running with UUID: " + config["daemon"]["uuid"]) 111 | start_daemon(config) 112 | 113 | 114 | def container(config: Union[None, Configuration] = None): 115 | print("") 116 | print("+----------------------------------+") 117 | print("| Starting Puffin in Docker Mode |") 118 | print("+----------------------------------+") 119 | if config is None: 120 | config = setup_config(parse_arguments()) 121 | print("") 122 | print("Running with UUID: " + config["daemon"]["uuid"]) 123 | check_environment(config) 124 | start_daemon(config, detach=False) 125 | 126 | 127 | def main(): 128 | args = parse_arguments(include_action=True) 129 | if args.action == "configure": 130 | configure(args) 131 | sys.exit() 132 | config = setup_config(args) 133 | if args.action == "bootstrap": 134 | main_bootstrap(config) 135 | elif args.action == "stop": 136 | stop(config) 137 | elif args.action == "kill": 138 | kill(config) 139 | elif args.action == "start": 140 | start(config) 141 | elif args.action == "container": 142 | container(config) 143 | else: 144 | raise NotImplementedError("Action " + str(args.action) + " has not been implemented properly") 145 | 146 | 147 | if __name__ == "__main__": 148 | main() 149 | -------------------------------------------------------------------------------- /scine_puffin/utilities/surface_helper.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import annotations 3 | __copyright__ = """ This code is licensed under the 3-clause BSD license. 4 | Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group. 5 | See LICENSE.txt for details. 6 | """ 7 | 8 | from ast import literal_eval 9 | from typing import TYPE_CHECKING 10 | from platform import python_version 11 | 12 | from pymatgen.core import Lattice 13 | from pymatgen.core.surface import Slab 14 | import pymatgen 15 | 16 | from scine_puffin.utilities.imports import module_exists, MissingDependency 17 | 18 | if module_exists("scine_database") or TYPE_CHECKING: 19 | import scine_database as db 20 | else: 21 | db = MissingDependency("scine_database") 22 | if module_exists("scine_utilities") or TYPE_CHECKING: 23 | import scine_utilities as utils 24 | else: 25 | utils = MissingDependency("scine_utilities") 26 | 27 | 28 | def get_slab_dict(structure: db.Structure, properties: db.Collection) -> dict: 29 | """ 30 | Generate the dictionary defining a pymatgen Slab object from a database Structure, 31 | which must hold the required information as a property. 32 | 33 | Notes 34 | ----- 35 | This code is taken from scine.chemoton.utilities.surfaces.pymatgen_interface 36 | 37 | 38 | Parameters 39 | ---------- 40 | structure : db.Structure 41 | The periodic Structure 42 | properties : db.Collection 43 | The properties collection to link the structure's properties 44 | 45 | Returns 46 | ------- 47 | dict 48 | A dictionary that can be used as a constructor for the pymatgen.core.surface.Slab 49 | 50 | Raises 51 | ------ 52 | RuntimeError 53 | The property 'slab_dict' not present 54 | """ 55 | if not structure.has_property("slab_dict"): 56 | raise RuntimeError(f"Slab information is missing for structure '{str(structure)}'") 57 | dict_info = db.StringProperty(structure.get_property('slab_dict'), properties) 58 | dict_info_string = dict_info.get_data() 59 | # remove some specific extra strings from representation to be able to make dict out of string 60 | dict_info_string = dict_info_string.replace("]])", "]]") 61 | dict_info_string = dict_info_string.replace("array(", "") 62 | # transform into dict 63 | return literal_eval(dict_info_string) 64 | 65 | 66 | def update_slab_dict(structure: db.Structure, properties: db.Collection, replace_property: bool = False) -> None: 67 | """ 68 | Update the slab dict property of the given structure with its current 69 | positions and periodic boundary conditions 70 | 71 | Notes 72 | ----- 73 | This code is taken from scine.chemoton.utilities.surfaces.pymatgen_interface 74 | 75 | Parameters 76 | ---------- 77 | structure : db.Structure 78 | The structure holding the property 79 | properties : db.Collection 80 | The properties collection to link the structure's properties 81 | replace_property : bool, optional 82 | If the old property should be replaced with the new one 83 | 84 | Raises 85 | ------ 86 | RuntimeError 87 | The structure is not periodic 88 | """ 89 | slab_dict_name = "slab_dict" 90 | slab = Slab.from_dict(get_slab_dict(structure, properties)) 91 | pbc_string = structure.get_model().periodic_boundaries 92 | if not pbc_string or pbc_string.lower() == "none": 93 | raise RuntimeError("Structure is missing periodic boundary conditions") 94 | pbc = utils.PeriodicBoundaries(pbc_string) 95 | atoms = structure.get_atoms() 96 | ele = [utils.ElementInfo.symbol(e) for e in atoms.elements] 97 | coords = pbc.transform(atoms.positions, False) 98 | lattice = _construct_pmg_lattice(pbc) 99 | new_slab = Slab(lattice, ele, coords, slab.miller_index, slab.oriented_unit_cell, slab.shift, 100 | slab.scale_factor, coords_are_cartesian=False) 101 | if not replace_property: 102 | dict_property = db.StringProperty(structure.get_property(slab_dict_name), properties) 103 | dict_property.set_data(str(new_slab.as_dict())) 104 | return 105 | structure.clear_properties(slab_dict_name) 106 | new_property = db.StringProperty.make(slab_dict_name, structure.get_model(), 107 | str(new_slab.as_dict()), properties) 108 | structure.set_property(slab_dict_name, new_property.id()) 109 | 110 | 111 | def _construct_pmg_lattice(pbc: utils.PeriodicBoundaries) -> Lattice: 112 | matrix = pbc.matrix * utils.ANGSTROM_PER_BOHR 113 | if python_version() >= "3.8": 114 | from importlib.metadata import version 115 | pymatgen_version = version(pymatgen.__name__) 116 | elif hasattr(pymatgen, "__version__"): 117 | pymatgen_version = getattr(pymatgen, "__version__") 118 | else: 119 | pymatgen_version = "0" 120 | if pymatgen_version >= "2022": 121 | return Lattice(matrix, pbc.periodicity) # type: ignore # pylint: disable=too-many-function-args 122 | return Lattice(matrix) 123 | --------------------------------------------------------------------------------