├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── help-request.md └── workflows │ ├── build.yml │ └── stale.yml ├── .gitignore ├── .gitmodules ├── CITATION.cff ├── CMakeLists.txt ├── COPYING ├── COPYING.LESSER ├── README.md ├── assets ├── crest.png ├── newtoc.png ├── tblite │ ├── gfn1-si.toml │ ├── gfn1.toml │ ├── gfn2.toml │ └── ipea1.toml └── template │ └── metadata.f90 ├── config ├── CMakeLists.txt ├── config.cmake.in ├── meson.build └── modules │ ├── Findgfn0.cmake │ ├── Findgfnff.cmake │ ├── Findlibpvol.cmake │ ├── Findlwoniom.cmake │ ├── Findmctc-lib.cmake │ ├── Findtblite.cmake │ ├── Findtest-drive.cmake │ ├── Findtoml-f.cmake │ └── crest-utils.cmake ├── docs ├── man │ ├── crest.adoc │ └── meson.build └── meson.build ├── examples ├── README.md ├── expl-0 │ ├── run.sh │ └── struc.xyz ├── expl-1 │ ├── run.sh │ └── struc.xyz ├── expl-2.5 │ ├── run.sh │ └── struc.xyz ├── expl-2 │ ├── run.sh │ └── struc.xyz ├── expl-3 │ ├── run.sh │ ├── struc.xyz │ └── xtb.trj ├── expl-4 │ ├── run.sh │ └── struc.xyz ├── expl-5 │ ├── run.sh │ └── xtb.trj ├── expl-6 │ ├── run.sh │ └── struc.xyz ├── expl-7 │ ├── run.sh │ └── struc.xyz ├── expl-8 │ ├── run.sh │ └── struc.xyz └── expl-9 │ ├── run.sh │ └── struc.xyz ├── include └── .gitignore ├── meson.build ├── meson_options.txt ├── src ├── .gitignore ├── CMakeLists.txt ├── algos │ ├── CMakeLists.txt │ ├── ConfSolv.F90 │ ├── crossing.f90 │ ├── dynamics.f90 │ ├── hessian_tools.f90 │ ├── meson.build │ ├── numhess.f90 │ ├── optimization.f90 │ ├── parallel.f90 │ ├── playground.f90 │ ├── protonate.f90 │ ├── refine.f90 │ ├── scan.f90 │ ├── search_1.f90 │ ├── search_conformers.f90 │ ├── search_entropy.f90 │ ├── search_mecp.f90 │ ├── search_newnci.f90 │ ├── setuptest.f90 │ └── singlepoint.f90 ├── atmasses.f90 ├── axis_module.f90 ├── biasmerge.f90 ├── bondconstraint.f90 ├── calculator │ ├── CMakeLists.txt │ ├── api_engrad.f90 │ ├── api_helpers.F90 │ ├── calc_type.f90 │ ├── calculator.F90 │ ├── constraints.f90 │ ├── generic_sc.f90 │ ├── gfn0_api.F90 │ ├── gfnff_api.F90 │ ├── gradreader.f90 │ ├── libpvol.F90 │ ├── lj.f90 │ ├── lwoniom.F90 │ ├── meson.build │ ├── nonadiabatic.f90 │ ├── oniom_hessian.F90 │ ├── orca_sc.f90 │ ├── printouts.F90 │ ├── subprocess_engrad.f90 │ ├── subprocess_types.f90 │ ├── tblite_api.F90 │ ├── turbom_sc.f90 │ └── xtb_sc.f90 ├── canonical.f90 ├── ccegen.f90 ├── choose_settings.f90 ├── classes.f90 ├── cleanup.f90 ├── cn.f90 ├── compress.f90 ├── confparse.f90 ├── cregen.f90 ├── crest_main.f90 ├── crest_pars.f90 ├── deprecated │ ├── Makefile │ ├── confcross.f90 │ ├── confscript1.f90 │ ├── data.f90 │ ├── dft_propcalc.f90 │ ├── intmodes.f │ ├── io.f │ ├── neighbor.f │ ├── setdg.f90 │ ├── utilities.f │ └── xtbmodef.f90 ├── discretize │ ├── CMakeLists.txt │ ├── bessel.f90 │ ├── discretize.f90 │ ├── discretize_module.f90 │ ├── meson.build │ └── probability.f90 ├── dynamics │ ├── CMakeLists.txt │ ├── dynamics_module.f90 │ ├── meson.build │ ├── metadynamics_module.f90 │ └── shake_module.f90 ├── ensemblecomp.f90 ├── entropy │ ├── CMakeLists.txt │ ├── entropic.f90 │ ├── entropy.f90 │ ├── meson.build │ ├── mie.f90 │ ├── thermo.f90 │ └── thermocalc.f90 ├── eval_timer.f90 ├── filemod.f90 ├── flexi.F90 ├── freqmasses.f90 ├── geo.f90 ├── graphs │ ├── CMakeLists.txt │ ├── adjacency.f90 │ ├── dijkstra.f90 │ ├── floydwarshall.f90 │ ├── meson.build │ └── shortpath.f90 ├── identifiers.f90 ├── internals.f90 ├── internals2.f90 ├── iomod.F90 ├── legacy_algos │ ├── CMakeLists.txt │ ├── acidbase.f90 │ ├── confopt.f90 │ ├── confscript2_main.f90 │ ├── confscript2_misc.f90 │ ├── confscript3.f90 │ ├── cregen_old.f90 │ ├── deprotonate.f90 │ ├── flexi.f90 │ ├── ligands.f90 │ ├── meson.build │ ├── normmd.f90 │ ├── pka.f90 │ ├── protonate.f90 │ ├── reactor.f90 │ ├── relaxensemble.f90 │ ├── stereoisomers.f90 │ ├── tautomerize.f90 │ ├── trialmd_legacy.f90 │ └── zsort.f90 ├── legacy_wrappers.f90 ├── ls_rmsd.f90 ├── marqfit.f90 ├── meson.build ├── minitools.f90 ├── miscdata.f90 ├── msreact │ ├── CMakeLists.txt │ ├── meson.build │ ├── msmod.f90 │ └── msreact.f90 ├── ncigeo.f90 ├── ompmklset.F90 ├── optimize │ ├── CMakeLists.txt │ ├── ancopt.f90 │ ├── gd.f90 │ ├── hessupdate.f90 │ ├── meson.build │ ├── modelhessian.f90 │ ├── optimize_maths.f90 │ ├── optimize_module.f90 │ ├── optimize_type.f90 │ ├── optutils.f90 │ └── rfo.f90 ├── parsing │ ├── CMakeLists.txt │ ├── confparse2.f90 │ ├── constraining.f90 │ ├── meson.build │ ├── parse_block.f90 │ ├── parse_calcdata.f90 │ ├── parse_csv.f90 │ ├── parse_datastruct.f90 │ ├── parse_inputfile.F90 │ ├── parse_keyvalue.f90 │ ├── parse_maindata.f90 │ ├── parse_toml.F90 │ └── parse_xtbinput.f90 ├── printouts.f90 ├── prmat.f90 ├── propcalc.f90 ├── qcg │ ├── CMakeLists.txt │ ├── meson.build │ ├── solvtool.f90 │ ├── solvtool_misc.f90 │ └── volume.f90 ├── qmhelpers │ ├── CMakeLists.txt │ ├── intpack.f90 │ ├── local.f90 │ ├── lopt.f90 │ ├── meson.build │ └── wiberg_mayer.f90 ├── quicksort.f90 ├── readl.f90 ├── restartlog.f90 ├── rigidconf │ ├── CMakeLists.txt │ ├── analyze.f90 │ ├── meson.build │ ├── reconstruct.f90 │ ├── rigidconf.f90 │ └── tree.f90 ├── rotcompare.f90 ├── scratch.f90 ├── sdfio.f90 ├── select.f90 ├── signal.c ├── sigterm.f90 ├── sortens.f90 ├── strucreader.f90 ├── symmetry2.f90 ├── symmetry_i.c ├── timer.f90 ├── trackorigin.f90 ├── utilmod.f90 ├── wallsetup.f90 ├── zdata.f90 └── ztopology.f90 ├── subprojects ├── .gitignore ├── README.md ├── gfn0.wrap ├── gfnff.wrap ├── libpvol.wrap ├── lwoniom.wrap ├── packagefiles │ └── tblite │ │ └── tblite_patch.patch ├── tblite.wrap └── toml-f.wrap └── test ├── CMakeLists.txt ├── helpers.f90 ├── main.f90 ├── test_CN.F90 ├── test_gfn0.F90 ├── test_gfn0occ.F90 ├── test_gfnff.F90 ├── test_optimization.F90 ├── test_tblite.F90 └── testmol.f90 /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is and what causes the program to crash. 12 | 13 | 16 | 17 | 18 | **To Reproduce** 19 | Steps to reproduce the behavior, program version, etc. 20 | 21 | **Expected behavior** 22 | A clear and concise description of what you expected to happen. 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: pprcht 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe workarounds you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/help-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Help request 3 | about: Request help with executing the program or explainig its behavior 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the issue** 11 | A clear and concise description of what you are trying to do. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior, program version, etc. 15 | 16 | **Additional context** 17 | Add any other context about the problem here. 18 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: "Close stale issues and PRs" 2 | 3 | on: 4 | schedule: 5 | # Every day at 00:00 6 | - cron: "0 0 * * *" 7 | workflow_dispatch: 8 | 9 | jobs: 10 | stale: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/stale@v9.0.0 15 | with: 16 | stale-issue-message: 'This issue had no activity for **6 months**. It will be closed in **1 week** unless there is some new activity.' 17 | stale-issue-label: 'stale' 18 | exempt-issue-labels: 'bug,enhancement' 19 | stale-pr-message: 'This pull request had no activity for **6 months**. It will be closed in **1 week** unless there is some new activity.' 20 | stale-pr-label: 'stale' 21 | days-before-stale: 180 22 | days-before-close: 7 23 | operations-per-run: 20 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.mod 3 | *.tgz 4 | *.i90 5 | *__genmod.f90 6 | github_bin/ 7 | build_majestix 8 | build_commands 9 | _build* 10 | _dist* 11 | src/crest 12 | bin/ 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "subprojects/gfn0"] 2 | path = subprojects/gfn0 3 | url = https://github.com/pprcht/gfn0.git 4 | branch = main 5 | [submodule "subprojects/toml-f"] 6 | path = subprojects/toml-f 7 | url = https://github.com/toml-f/toml-f.git 8 | branch = main 9 | [submodule "subprojects/gfnff"] 10 | path = subprojects/gfnff 11 | url = https://github.com/pprcht/gfnff.git 12 | branch = master 13 | [submodule "subprojects/lwoniom"] 14 | path = subprojects/lwoniom 15 | url = https://github.com/crest-lab/lwoniom 16 | branch = main 17 | [submodule "subprojects/test-drive"] 18 | path = subprojects/test-drive 19 | url = https://github.com/fortran-lang/test-drive.git 20 | [submodule "subprojects/tblite"] 21 | path = subprojects/tblite 22 | url = https://github.com/tblite/tblite.git 23 | branch = main 24 | [submodule "subprojects/pvol"] 25 | path = subprojects/pvol 26 | url = https://github.com/neudecker-group/libpvol.git 27 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: "Pracht" 5 | given-names: "Philipp" 6 | orcid: "https://orcid.org/0000-0002-8495-9504" 7 | - family-names: "Grimme" 8 | given-names: "Stefan" 9 | orcid: "https://orcid.org/0000-0002-5844-4371" 10 | - family-names: "Bannwarth" 11 | given-names: "Christoph" 12 | orcid: "https://orcid.org/0000-0003-3242-496X" 13 | - family-names: "Bohle" 14 | given-names: "Fabian" 15 | orcid: "https://orcid.org/0000-0003-2621-6339" 16 | - family-names: "Ehlert" 17 | given-names: "Sebastian" 18 | orcid: "https://orcid.org/0000-0001-7809-771X" 19 | - family-names: "Feldmann" 20 | given-names: "Gereon" 21 | orcid: "https://orcid.org/0009-0009-1466-4610" 22 | - family-names: "Gorges" 23 | given-names: "Johannes" 24 | orcid: "https://orcid.org/0000-0002-9309-0193" 25 | - family-names: "Müller" 26 | given-names: "Marcel" 27 | orcid: "https://orcid.org/0000-0002-5398-4192" 28 | - family-names: "Neudecker" 29 | given-names: "Tim" 30 | orcid: "https://orcid.org/0000-0001-7599-3578" 31 | - family-names: "Plett" 32 | given-names: "Christoph" 33 | orcid: "https://orcid.org/0000-0002-3911-2478" 34 | - family-names: "Spicher" 35 | given-names: "Sebastian" 36 | orcid: "https://orcid.org/0000-0001-6541-3680" 37 | - family-names: "Steinbach" 38 | given-names: "Pit" 39 | orcid: "https://orcid.org/0000-0001-7437-242X" 40 | - family-names: "Wesołowski" 41 | given-names: "Patryk Adam" 42 | orcid: "https://orcid.org/0000-0002-7751-980X" 43 | - family-names: "Zeller" 44 | given-names: "Felix" 45 | orcid: "https://orcid.org/0000-0001-9140-8359" 46 | title: "CREST - Conformer-Rotamer Sampling Tool" 47 | version: 3.0 48 | doi: 10.1063/5.0197592 49 | date-released: 2024-03-21 50 | url: "https://github.com/crest-lab/crest" 51 | preferred-citation: 52 | type: article 53 | authors: 54 | - family-names: "Pracht" 55 | given-names: "Philipp" 56 | orcid: "https://orcid.org/0000-0002-8495-9504" 57 | - family-names: "Grimme" 58 | given-names: "Stefan" 59 | orcid: "https://orcid.org/0000-0002-5844-4371" 60 | - family-names: "Bannwarth" 61 | given-names: "Christoph" 62 | orcid: "https://orcid.org/0000-0003-3242-496X" 63 | - family-names: "Bohle" 64 | given-names: "Fabian" 65 | orcid: "https://orcid.org/0000-0003-2621-6339" 66 | - family-names: "Ehlert" 67 | given-names: "Sebastian" 68 | orcid: "https://orcid.org/0000-0001-7809-771X" 69 | - family-names: "Feldmann" 70 | given-names: "Gereon" 71 | orcid: "https://orcid.org/0009-0009-1466-4610" 72 | - family-names: "Gorges" 73 | given-names: "Johannes" 74 | orcid: "https://orcid.org/0000-0002-9309-0193" 75 | - family-names: "Müller" 76 | given-names: "Marcel" 77 | orcid: "https://orcid.org/0000-0002-5398-4192" 78 | - family-names: "Neudecker" 79 | given-names: "Tim" 80 | orcid: "https://orcid.org/0000-0001-7599-3578" 81 | - family-names: "Plett" 82 | given-names: "Christoph" 83 | orcid: "https://orcid.org/0000-0002-3911-2478" 84 | - family-names: "Spicher" 85 | given-names: "Sebastian" 86 | orcid: "https://orcid.org/0000-0001-6541-3680" 87 | - family-names: "Steinbach" 88 | given-names: "Pit" 89 | orcid: "https://orcid.org/0000-0001-7437-242X" 90 | - family-names: "Wesołowski" 91 | given-names: "Patryk Adam" 92 | orcid: "https://orcid.org/0000-0002-7751-980X" 93 | - family-names: "Zeller" 94 | given-names: "Felix" 95 | orcid: "https://orcid.org/0000-0001-9140-8359" 96 | doi: "10.1063/5.0197592" 97 | journal: "J. Chem. Phys" 98 | month: 03 99 | start: 114110 100 | title: "CREST - A program for the exploration of low-energy molecular chemical space" 101 | issue: 160 102 | volume: 11 103 | year: 2024 104 | -------------------------------------------------------------------------------- /assets/crest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grimme-lab/crest/ccce4d27fd90cf2a021bd5ac5763320edc8af85c/assets/crest.png -------------------------------------------------------------------------------- /assets/newtoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grimme-lab/crest/ccce4d27fd90cf2a021bd5ac5763320edc8af85c/assets/newtoc.png -------------------------------------------------------------------------------- /assets/template/metadata.f90: -------------------------------------------------------------------------------- 1 | character(len=*),parameter :: version = "@version@" 2 | character(len=*),parameter :: commit = "@commit@" 3 | character(len=*),parameter :: date = "@date@" 4 | character(len=*),parameter :: author = "'@author@@@origin@'" 5 | character(len=*),parameter :: fcompiler = "@fcid@ @fcver@" 6 | character(len=*),parameter :: ccompiler = "@ccid@ @ccver@" 7 | character(len=*),parameter :: bsystem = "@bsystem@" 8 | character(len=*),parameter :: tomlfvar = "@tomlfvar@" 9 | character(len=*),parameter :: gfn0var = "@gfn0var@" 10 | character(len=*),parameter :: gfnffvar = "@gfnffvar@" 11 | character(len=*),parameter :: tblitevar = "@tblitevar@" 12 | character(len=*),parameter :: libpvolvar = "@libpvolvar@" 13 | character(len=*),parameter :: lwoniomvar = "@lwoniomvar@" 14 | -------------------------------------------------------------------------------- /config/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | # Set the module path for CMake includes 17 | 18 | ######################################################################################### 19 | ######################################################################################### 20 | # Add modules to the CMake build 21 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules") 22 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE) 23 | 24 | # specify module installation directory 25 | install( 26 | DIRECTORY 27 | "${CMAKE_CURRENT_SOURCE_DIR}/modules/" 28 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" 29 | ) 30 | 31 | # Options for enabling or disabling features 32 | option(WITH_OpenMP "Enable OpenMP support" TRUE) 33 | option(WITH_TBLITE "Enable support for tblite" TRUE) 34 | option(WITH_TOMLF "Enable support for toml-f" TRUE) 35 | option(WITH_GFN0 "Enable support for GFN0-xTB" TRUE) 36 | option(WITH_GFNFF "Enable support for GFN-FF" TRUE) 37 | option(WITH_LIBPVOL "Enable support for LIBPVOL" TRUE) 38 | option(WITH_LWONIOM "Enable support for lwONIOM" TRUE) 39 | option(WITH_TESTS "Enable unit tests" TRUE) 40 | 41 | option(STATICBUILD "Attempt to link everything statically" FALSE) 42 | set(PYTHON_BINDINGS OFF CACHE BOOL "Disable python bindings for submodules that have them" FORCE) 43 | 44 | ######################################################################################### 45 | ######################################################################################### 46 | 47 | # Set build type as CMake does not provide defaults 48 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 49 | set( 50 | CMAKE_BUILD_TYPE "RelWithDebInfo" 51 | CACHE STRING "Build type to be used." 52 | FORCE 53 | ) 54 | message( 55 | STATUS 56 | "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified." 57 | ) 58 | endif() 59 | 60 | ######################################################################################### 61 | ######################################################################################### 62 | 63 | # Compiler settings for GNU and Intel Fortran compilers 64 | if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") 65 | set(dialect "-g -O0 -fbacktrace -ffree-line-length-none -fbacktrace") 66 | set(bounds "-fbounds-check -ffpe-trap=invalid,zero,overflow") 67 | elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") 68 | set(dialect "-g -O2 -r8 -align array64byte -traceback") 69 | set(bounds "-check all -fpe0") 70 | else() 71 | message(FATAL_ERROR "Please use an Intel or GNU compiler!") 72 | endif() 73 | 74 | # Apply the compiler flags 75 | set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${bounds}" PARENT_SCOPE) 76 | set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}" PARENT_SCOPE) 77 | 78 | ######################################################################################### 79 | ######################################################################################### 80 | 81 | # Populate crest_metadata.fh 82 | set(version ${PROJECT_VERSION}${SOVERSION}) 83 | execute_process(COMMAND git show -s --format=%h 84 | RESULT_VARIABLE git_return 85 | OUTPUT_VARIABLE commit 86 | OUTPUT_STRIP_TRAILING_WHITESPACE 87 | ) 88 | if(git_return) 89 | set(commit "unknown-commit") 90 | endif() 91 | string(TIMESTAMP date "%a, %d %B %H:%M:%S, %m/%d/%Y") 92 | set(author $ENV{USERNAME}) 93 | execute_process(COMMAND hostname OUTPUT_VARIABLE HOSTNAME OUTPUT_STRIP_TRAILING_WHITESPACE) 94 | set(origin ${HOSTNAME}) 95 | set(fcid ${CMAKE_Fortran_COMPILER_ID}) 96 | set(fcver ${CMAKE_Fortran_COMPILER_VERSION}) 97 | set(ccid ${CMAKE_C_COMPILER_ID}) 98 | set(ccver ${CMAKE_C_COMPILER_VERSION}) 99 | set(bsystem "cmake ${CMAKE_VERSION}") 100 | set(tomlfvar "${WITH_TOMLF}") 101 | set(gfn0var "${WITH_GFN0}") 102 | set(gfnffvar "${WITH_GFNFF}") 103 | set(tblitevar "${WITH_TBLITE}") 104 | set(libpvolvar "${WITH_LIBPVOL}") 105 | set(lwoniomvar "${WITH_LWONIOM}") 106 | 107 | configure_file( 108 | "${PROJECT_SOURCE_DIR}/assets/template/metadata.f90" 109 | "${PROJECT_BINARY_DIR}/crest_metadata.fh" 110 | @ONLY 111 | ) 112 | # just to be safe, create it also in include/ 113 | configure_file( 114 | "${PROJECT_SOURCE_DIR}/assets/template/metadata.f90" 115 | "${PROJECT_BINARY_DIR}/include/crest_metadata.fh" 116 | @ONLY 117 | ) 118 | 119 | ######################################################################################### 120 | ######################################################################################### 121 | -------------------------------------------------------------------------------- /config/config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | set("@PROJECT_NAME@_WITH_OpenMP" @WITH_OpenMP@) 4 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") 5 | 6 | if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@") 7 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") 8 | 9 | include(CMakeFindDependencyMacro) 10 | 11 | if(NOT TARGET "OpenMP::OpenMP_Fortran" AND "@PROJECT_NAME@_WITH_OpenMP") 12 | find_dependency("OpenMP" REQUIRED) 13 | endif() 14 | 15 | # if(NOT TARGET "mctc-lib::mctc-lib") 16 | # find_dependency("mctc-lib" REQUIRED) 17 | # endif() 18 | 19 | if(NOT ${LAPACK_FOUND}) 20 | find_dependency("LAPACK" REQUIRED) 21 | endif() 22 | if(NOT ${BLAS_FOUND}) 23 | find_dependency("BLAS" REQUIRED) 24 | endif() 25 | 26 | endif() 27 | -------------------------------------------------------------------------------- /config/modules/Findgfn0.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "gfn0") 18 | set(_pkg "GFN0") 19 | set(_url "https://github.com/pprcht/gfn0") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | set (found FALSE) 30 | if(TARGET "gfn0::gfn0") 31 | set (found TRUE) 32 | endif() 33 | message(STATUS "Found GFN0-xTB: ${found}") 34 | 35 | unset(_lib) 36 | unset(_pkg) 37 | unset(_url) 38 | -------------------------------------------------------------------------------- /config/modules/Findgfnff.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "gfnff") 18 | set(_pkg "GFNFF") 19 | set(_url "https://github.com/pprcht/gfnff") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | set(found FALSE) 30 | if(TARGET "gfnff::gfnff") 31 | set (found TRUE) 32 | endif() 33 | message(STATUS "Found GFN-FF: ${found}") 34 | 35 | unset(_lib) 36 | unset(_pkg) 37 | unset(_url) 38 | -------------------------------------------------------------------------------- /config/modules/Findlibpvol.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "pvol") 18 | set(_pkg "PVOL") 19 | set(_url "https://github.com/neudecker-group/libpvol.git") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf" ) 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | set(found FALSE) 30 | if(TARGET "pvol::pvol") 31 | set (found TRUE) 32 | endif() 33 | message(STATUS "Found libpvol: ${found}") 34 | 35 | unset(_lib) 36 | unset(_pkg) 37 | unset(_url) 38 | -------------------------------------------------------------------------------- /config/modules/Findlwoniom.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "lwoniom") 18 | set(_pkg "LWONIOM") 19 | set(_url "https://github.com/crest-lab/lwoniom") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | set(found FALSE) 30 | if(TARGET "lwoniom::lwoniom") 31 | set (found TRUE) 32 | endif() 33 | message(STATUS "Found lwONIOM: ${found}") 34 | 35 | unset(_lib) 36 | unset(_pkg) 37 | unset(_url) 38 | -------------------------------------------------------------------------------- /config/modules/Findmctc-lib.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "mctc-lib") 18 | set(_pkg "MCTCLIB") 19 | set(_url "https://github.com/grimme-lab/mctc-lib") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | if(DEFINED "${PROJECT_NAME}-dependency-method") 23 | set("${_pkg}_FIND_METHOD" "${${PROJECT_NAME}-dependency-method}") 24 | else() 25 | set("${_pkg}_FIND_METHOD" "cmake" "pkgconf" "subproject" "fetch") 26 | endif() 27 | set("_${_pkg}_FIND_METHOD") 28 | endif() 29 | 30 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 31 | 32 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 33 | 34 | if(TARGET "mctc-lib::mctc-lib") 35 | set (found TRUE) 36 | else() 37 | set (found FALSE) 38 | endif() 39 | message("-- Found mctc-lib: ${found}") 40 | 41 | if(DEFINED "_${_pkg}_FIND_METHOD") 42 | unset("${_pkg}_FIND_METHOD") 43 | unset("_${_pkg}_FIND_METHOD") 44 | endif() 45 | unset(_lib) 46 | unset(_pkg) 47 | unset(_url) 48 | -------------------------------------------------------------------------------- /config/modules/Findtblite.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "tblite") 18 | set(_pkg "TBLITE") 19 | set(_url "https://github.com/tblite/tblite") 20 | set(_branch "xtb_solvation") 21 | 22 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 23 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 24 | endif() 25 | 26 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 27 | 28 | set(temp_with_tests ${WITH_TESTS}) # Save the current value of WITH_TESTS 29 | set(WITH_TESTS FALSE CACHE BOOL "Temporarily disable tests for the tblite subproject" FORCE) 30 | set(WITH_API FALSE) 31 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}" "${_branch}") 32 | 33 | set(found FALSE) 34 | if(TARGET "tblite::tblite") 35 | set (found TRUE) 36 | endif() 37 | message(STATUS "Found tblite: ${found}") 38 | 39 | set(WITH_TESTS ${temp_with_tests} CACHE BOOL "Enable tests for the main project" FORCE) 40 | 41 | unset(_lib) 42 | unset(_pkg) 43 | unset(_url) 44 | -------------------------------------------------------------------------------- /config/modules/Findtest-drive.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "test-drive") 18 | set(_pkg "TEST-DRIVE") 19 | set(_url "https://github.com/fortran-lang/test-drive") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | if(TARGET "${_lib}::${_lib}") 30 | set (found TRUE) 31 | else() 32 | set (found FALSE) 33 | endif() 34 | message(STATUS "Found test-drive: ${found}") 35 | 36 | unset(_lib) 37 | unset(_pkg) 38 | unset(_url) 39 | -------------------------------------------------------------------------------- /config/modules/Findtoml-f.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(_lib "toml-f") 18 | set(_pkg "TOML-F") 19 | set(_url "https://github.com/toml-f/toml-f") 20 | 21 | if(NOT DEFINED "${_pkg}_FIND_METHOD") 22 | set("${_pkg}_FIND_METHOD" "subproject" "cmake" "fetch" "pkgconf") 23 | endif() 24 | 25 | include("${CMAKE_CURRENT_LIST_DIR}/crest-utils.cmake") 26 | 27 | crest_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}") 28 | 29 | if(TARGET "toml-f::toml-f") 30 | set (found TRUE) 31 | else() 32 | set (found FALSE) 33 | endif() 34 | message(STATUS "Found toml-f: ${found}") 35 | 36 | unset(_lib) 37 | unset(_pkg) 38 | unset(_url) 39 | -------------------------------------------------------------------------------- /docs/man/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | asciidoctor = find_program('asciidoctor', required: false) 18 | if asciidoctor.found() 19 | foreach man_name : ['crest.adoc'] 20 | install_man( 21 | configure_file( 22 | input: files(man_name), 23 | output: '@BASENAME@.1', 24 | command: [ 25 | asciidoctor, 26 | '--attribute=release-version=@0@'.format(meson.project_version()), 27 | '--backend=manpage', 28 | '--out-file=@OUTPUT@', 29 | '@INPUT@', 30 | ], 31 | ) 32 | ) 33 | endforeach 34 | endif 35 | -------------------------------------------------------------------------------- /docs/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | subdir('man') 18 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Example applications of the CREST program 2 | 3 | This directory contains several examples for 4 | standard applications of the `crest` program. 5 | 6 | Each example directory contains a input structure 7 | (typically called `struc.xyz`) and a bash script 8 | called `run.sh` that includes some information about 9 | the example and will execute the calculation upon 10 | execution. 11 | 12 | To run the example scripts simply go to the respective 13 | directory and execute it from the command line: 14 | ```bash 15 | ./run.sh 16 | ``` 17 | 18 | It is assumed that the `xtb` and `crest` binaries 19 | are present in the *PATH* variable as such. 20 | The `run.sh` scripts will check for this, however. 21 | 22 | 23 | ## Examples 24 | 25 | 0. *dry run* of the `crest` program 26 | 1. default conformational search (iMTD-GC) 27 | 2. example for different CMD settings 28 | 3. sorting an ensemble file (CREGEN) 29 | 4. constrained conformational sampling 30 | 5. standalone optimization along a trajectory 31 | 6. NCI sampling mode (iMTD-NCI) 32 | 7. protonation site sampling 33 | 8. modified protonation site sampling 34 | 9. tautomer sampling 35 | -------------------------------------------------------------------------------- /examples/expl-0/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -dry 12 | else 13 | $crst struc.xyz -dry -xnam $xtbin 14 | fi 15 | 16 | # Before starting any calculation, settings 17 | # can be checked with the '-dry' flag. 18 | # This will only print a summary about the 19 | # selected settings and thresholds to the 20 | # consol and check for the xtb binary. 21 | # 22 | # Every time the input file (struc.xyz) is 23 | # something else than 'coord', a file called 24 | # 'coord' will be (over-)written, containing 25 | # the atomic coordinates in Bohr. CREST will 26 | # then continue to use and overwrite this 27 | # coord file for all further calculations. 28 | -------------------------------------------------------------------------------- /examples/expl-0/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | 3 | C 1.00510 -0.04436 0.07729 4 | C 2.52196 -0.10014 0.05638 5 | C 3.03386 -1.52959 -0.04885 6 | O 4.45512 -1.53382 -0.04957 7 | H 0.66450 0.99293 0.15400 8 | H 0.60392 -0.59767 0.93240 9 | H 0.58435 -0.47325 -0.83778 10 | H 2.92490 0.36854 0.96213 11 | H 2.90338 0.49174 -0.78421 12 | H 2.68484 -2.01184 -0.96764 13 | H 2.69552 -2.12845 0.80244 14 | H 4.74911 -1.01511 -0.81774 15 | -------------------------------------------------------------------------------- /examples/expl-1/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -ewin 2.0 12 | else 13 | $crst struc.xyz -ewin 2.0 -xnam $xtbin 14 | fi 15 | 16 | 17 | # This will execute a conformational search with default settings 18 | # for the 1-propanol molecule. 19 | # The energy window is set to 2.0 kcal/mol with the '-ewin' flag 20 | # (instead of the default 6.0 kcal/mol window) 21 | # Within this window there should be 4 conformers for 1-propanol 22 | # in the gas phase. 23 | # The 4 unique conformers can be found in the file 'crest_conformers.xyz'. 24 | # All degenerate conformers (rotamers, pseudo-enantiomers) of the 4 structures 25 | # can be found in the file 'crest_rotamers.xyz' 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/expl-1/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | 3 | C 1.00510 -0.04436 0.07729 4 | C 2.52196 -0.10014 0.05638 5 | C 3.03386 -1.52959 -0.04885 6 | O 4.45512 -1.53382 -0.04957 7 | H 0.66450 0.99293 0.15400 8 | H 0.60392 -0.59767 0.93240 9 | H 0.58435 -0.47325 -0.83778 10 | H 2.92490 0.36854 0.96213 11 | H 2.90338 0.49174 -0.78421 12 | H 2.68484 -2.01184 -0.96764 13 | H 2.69552 -2.12845 0.80244 14 | H 4.74911 -1.01511 -0.81774 15 | -------------------------------------------------------------------------------- /examples/expl-2.5/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -ewin 2.0 -quick -prop ohess 12 | else 13 | $crst struc.xyz -ewin 2.0 -quick -prop ohess -xnam $xtbin 14 | fi 15 | 16 | # Some further calculations can be added automatically 17 | # after the conformer search with the '-prop' command. 18 | # In the above example, after searching for the 19 | # conformers of 1-propanol, each conformer is optimized 20 | # again and frequencies are calculated (ohess). 21 | # The conformer ensemble is then re-ranked with free 22 | # energies from RRHO contributions. 23 | # 24 | # There are also some different 'quick'-modes to run 25 | # the conformational search with reduced settings. 26 | # With these modes the conformational space will be 27 | # explored less extensively, but it will speed up 28 | # the calculation. ('-quick','-squick','-mquick') 29 | 30 | -------------------------------------------------------------------------------- /examples/expl-2.5/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | 3 | C 1.00510 -0.04436 0.07729 4 | C 2.52196 -0.10014 0.05638 5 | C 3.03386 -1.52959 -0.04885 6 | O 4.45512 -1.53382 -0.04957 7 | H 0.66450 0.99293 0.15400 8 | H 0.60392 -0.59767 0.93240 9 | H 0.58435 -0.47325 -0.83778 10 | H 2.92490 0.36854 0.96213 11 | H 2.90338 0.49174 -0.78421 12 | H 2.68484 -2.01184 -0.96764 13 | H 2.69552 -2.12845 0.80244 14 | H 4.74911 -1.01511 -0.81774 15 | -------------------------------------------------------------------------------- /examples/expl-2/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -ewin 2.0 -g h2o -gfn2 -T 4 12 | else 13 | $crst struc.xyz -ewin 2.0 -g h2o -gfn2 -T 4 -xnam $xtbin 14 | fi 15 | 16 | 17 | # This will execute a conformational search with some manually changed 18 | # settings for the 1-propanol molecule. 19 | # The GBSA implicit solvation model for H2O is employed with the 20 | # '-g' flag. 21 | # Furthermore, the use of GFN2-xTB is requested explicitly ('-gfn2') 22 | # and the program is ordered to use 4 CPU threads ('-T'). 23 | # For a 1-propanol the conformers in implicit solvation are the 24 | # same as in the gas phase, but the relative energies should 25 | # differ significantly. 26 | # Unique conformers can be found in the file 'crest_conformers.xyz'. 27 | # All degenerate conformers (rotamers, pseudo-enantiomers) 28 | # can be found in the file 'crest_rotamers.xyz' 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/expl-2/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | 3 | C 1.00510 -0.04436 0.07729 4 | C 2.52196 -0.10014 0.05638 5 | C 3.03386 -1.52959 -0.04885 6 | O 4.45512 -1.53382 -0.04957 7 | H 0.66450 0.99293 0.15400 8 | H 0.60392 -0.59767 0.93240 9 | H 0.58435 -0.47325 -0.83778 10 | H 2.92490 0.36854 0.96213 11 | H 2.90338 0.49174 -0.78421 12 | H 2.68484 -2.01184 -0.96764 13 | H 2.69552 -2.12845 0.80244 14 | H 4.74911 -1.01511 -0.81774 15 | -------------------------------------------------------------------------------- /examples/expl-3/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | $crst struc.xyz -cregen xtb.trj -ewin 100.0 10 | 11 | 12 | # The sorting routine from the CREST conformational search can be 13 | # used as a standalone to sort any .xyz or .trj ensemble file. 14 | # The above command will sort the file xtb.trj according to 15 | # its energy and determine duplicate structures. 16 | # Two files are written analogous to 'crest_conformers.xyz' 17 | # and 'crest_rotamers.xyz'. 18 | # The new file 'crest_ensemble.xyz' will contain only unique 19 | # structures from xtb.trj, while the new file 'xtb.trj.sorted' 20 | # is just a sorted version of the original file (without the 21 | # -ewin flag the default 6.0 kcal/mol window will be used) 22 | # The routine requires a reference structure which is given 23 | # by 'struc.xyz'. 24 | 25 | -------------------------------------------------------------------------------- /examples/expl-3/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | FINAL HEAT OF FORMATION = -1.651323 3 | C 1.625257 -0.262628 -0.323273 4 | C 0.518221 0.706221 -0.335177 5 | C -0.859313 -0.005477 -0.327969 6 | H -1.683026 0.654493 -0.607965 7 | H -0.974493 -0.754480 -1.061658 8 | O -1.171503 -0.423846 1.012985 9 | H -0.837975 0.254126 1.683603 10 | H 0.615912 1.428650 0.457852 11 | H 0.597843 1.325129 -1.321583 12 | H 1.504113 -0.866659 0.564875 13 | H 2.639815 0.049302 -0.353007 14 | H 1.502315 -1.001480 -1.109649 15 | -------------------------------------------------------------------------------- /examples/expl-4/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -constrain 1-4 12 | $crst struc.xyz -cinp .xcontrol.sample 13 | else 14 | $crst struc.xyz -constrain 1-4 15 | $crst struc.xyz -cinp .xcontorl.sample -xnam $xtbin 16 | fi 17 | 18 | 19 | # Constraint conformational sampling is possible by 20 | # providing the constrainment info as a file 21 | # via the '-cinp' flag. 22 | # For detailed information about the constraining 23 | # options see the online documentation of 24 | # CREST and xTB. 25 | # However, a dummy constraining file '.xcontrol.sample' 26 | # can be written by CREST with a seperate call using 27 | # The '-constrain ' flag. 28 | # In the above example the carbon atoms and the oxygen 29 | # atom of 1-propanol (atoms 1-4) will be constrained. 30 | # In the resulting "ensemble" only conformers resulting 31 | # from different OH dihedral angles will be present 32 | # (2 conformers total) 33 | -------------------------------------------------------------------------------- /examples/expl-4/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | 3 | C 1.00510 -0.04436 0.07729 4 | C 2.52196 -0.10014 0.05638 5 | C 3.03386 -1.52959 -0.04885 6 | O 4.45512 -1.53382 -0.04957 7 | H 0.66450 0.99293 0.15400 8 | H 0.60392 -0.59767 0.93240 9 | H 0.58435 -0.47325 -0.83778 10 | H 2.92490 0.36854 0.96213 11 | H 2.90338 0.49174 -0.78421 12 | H 2.68484 -2.01184 -0.96764 13 | H 2.69552 -2.12845 0.80244 14 | H 4.74911 -1.01511 -0.81774 15 | -------------------------------------------------------------------------------- /examples/expl-5/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst -mdopt xtb.trj 12 | else 13 | $crst -mdopt xtb.trj -xnam $xtbin 14 | fi 15 | 16 | 17 | # A ensemble file (or MD trajectory) can also 18 | # be optimized in a standalone application 19 | # of CREST using the '-mdopt' flag. 20 | # The optimized structures are written to a 21 | # file called 'crest_ensemble.xyz', but will 22 | # not be sorted in any way. 23 | -------------------------------------------------------------------------------- /examples/expl-6/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -nci 12 | else 13 | $crst struc.xyz -nci -xnam $xtbin 14 | fi 15 | 16 | 17 | # This will execute the NCI sampling mode of CREST of the 18 | # water trimer with default settings. 19 | # A wall-potential is automatically generated and added to 20 | # the calculation to prevent dissociation. 21 | # The NCI mode is a special case of the constrained sampling. 22 | # Just like the regular conformational search unique conformers 23 | # can be found in the file 'crest_conformers.xyz'. 24 | # All degenerate conformers (rotamers, pseudo-enantiomers) 25 | # can be found in the file 'crest_rotamers.xyz' 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/expl-6/struc.xyz: -------------------------------------------------------------------------------- 1 | 9 2 | FINAL HEAT OF FORMATION = 0.000000 3 | H -1.091354 2.083948 0.561412 4 | O -0.873213 1.360333 -0.037725 5 | H -1.126153 -0.540943 0.037240 6 | H 0.094609 1.245770 0.037306 7 | O 1.614744 0.076014 -0.037729 8 | O -0.741528 -1.436357 -0.037711 9 | H -1.259101 -1.987119 0.561339 10 | H 2.350402 -0.096756 0.561513 11 | H 1.031565 -0.704748 0.037192 12 | -------------------------------------------------------------------------------- /examples/expl-7/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -protonate 12 | else 13 | $crst struc.xyz -protonate -xnam $xtbin 14 | fi 15 | 16 | 17 | # This command will create protomers of the uracil molecule. 18 | # The default energy window for this application is 30 kcal/mol 19 | # Only 3 structures should remain in the gas phase at the 20 | # default GFN2-xTB level. 21 | # The structures can be found in the file 'protonated.xyz' 22 | -------------------------------------------------------------------------------- /examples/expl-7/struc.xyz: -------------------------------------------------------------------------------- 1 | 12 2 | energy: -24.614946947602 gnorm: 0.000456827525 xtb: 6.2.2 (89a525f) 3 | O 1.01382029544030 0.03880681993718 0.26260657568622 4 | C 2.21194959420030 0.00777551853774 0.13894624850894 5 | N 2.97633014247497 1.15928881874167 0.06760158128732 6 | C 4.33128423994495 1.14641376546424 -0.07421492522129 7 | C 5.02090106234646 -0.00303350704424 -0.15435476958224 8 | C 4.32754207903802 -1.27903972647711 -0.09166688984675 9 | O 4.83244816077160 -2.37420082989590 -0.15422059425404 10 | N 2.94450163810970 -1.14763022456257 0.05629094590508 11 | H 2.46829084494664 2.03038084438831 0.12488082938105 12 | H 4.81038312241915 2.11362921965719 -0.11757996835012 13 | H 6.09011013882395 -0.02137897779485 -0.26646726330202 14 | H 2.41547828301905 -2.01176145142300 0.10488837035251 15 | -------------------------------------------------------------------------------- /examples/expl-8/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -protonate -swel Cs+ 12 | else 13 | $crst struc.xyz -protonate -swel Cs+ -xnam $xtbin 14 | fi 15 | 16 | # In a modified version of the protonation tool 17 | # other ionization adducts can be created 18 | # (only mono nuclear ions) 19 | # To do this, the flag '-swel' (short for switch element) 20 | # is used to indicate the new ion and its charge, 21 | # e.g., Na+, Ca2+, Li+, etc. 22 | # 23 | # As a example the alpha-D-glucose-Cs+ adducts 24 | # will be created at the GFN2-xTB level with the above command. 25 | # The adducts can be found in the file 'protonated.xyz' 26 | 27 | -------------------------------------------------------------------------------- /examples/expl-8/struc.xyz: -------------------------------------------------------------------------------- 1 | 24 2 | FINAL HEAT OF FORMATION = 0.000000 3 | O -1.240000 0.500286 0.389534 4 | O -3.422179 -1.988021 -1.200876 5 | O -1.030343 -2.500198 1.371244 6 | O -0.269585 -1.376682 -2.050459 7 | O 0.714096 0.825174 -0.948699 8 | O -4.564244 0.596025 -1.237038 9 | C -2.604750 -1.434635 -0.186435 10 | C -1.275745 -2.232516 0.002738 11 | C -2.309462 0.069148 -0.458819 12 | C -0.090913 -1.462394 -0.648941 13 | C 0.038626 -0.020969 -0.037264 14 | C -3.562580 0.927621 -0.299600 15 | H -3.175049 -1.514611 0.751562 16 | H -1.394054 -3.206789 -0.495459 17 | H -1.941229 0.164323 -1.490086 18 | H 0.840456 -2.024192 -0.479114 19 | H 0.639496 -0.057270 0.885117 20 | H -3.985456 0.780616 0.699514 21 | H -3.317920 1.993716 -0.382206 22 | H -4.113958 -1.329897 -1.403262 23 | H -1.021769 -1.655987 1.868817 24 | H 0.187245 -0.582574 -2.396515 25 | H 1.659435 0.569359 -1.034662 26 | H -4.311180 0.903728 -2.134995 27 | -------------------------------------------------------------------------------- /examples/expl-9/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | xtbin='xtb' 4 | crst='crest' 5 | 6 | command -v $xtbin >/dev/null 2>&1 || { echo >&2 "Cannot find xtb binary. Exit."; exit 1; } 7 | command -v $crst >/dev/null 2>&1 || { echo >&2 "Cannot find crest binary. Exit."; exit 1; } 8 | 9 | if [ $xtbin == 'xtb' ] 10 | then 11 | $crst struc.xyz -tautomerize -ewin 10.0 12 | else 13 | $crst struc.xyz -tautomerize -ewin 10.0 -xnam $xtbin 14 | fi 15 | 16 | # The -tautomerize flag can be used to request 17 | # a screening of prototropic tautomers. 18 | # The structures are build from a sequence of 19 | # protonating and deprotonating steps of the 20 | # (neutral) input structure. 21 | # In the above example this procedure is 22 | # performed on the guanine molecule to get 23 | # the gas phase tautomers at GFN2-xTB level. 24 | # Within the 10 kcal/mol window 5 tautomers 25 | # should remain at this level. 26 | # The structures can be found in 'tautomers.xyz'. 27 | 28 | -------------------------------------------------------------------------------- /examples/expl-9/struc.xyz: -------------------------------------------------------------------------------- 1 | 16 2 | energy: -31.983681788270 gnorm: 0.000372144832 xtb: 6.2.2 (89a525f) 3 | N 1.46226284012671 0.18335744247169 -0.07855270314916 4 | C 1.31781205014203 -1.15293393777405 0.05955064599303 5 | C 1.54055132778996 -2.13428714261960 -0.91007075980005 6 | C 1.98029754954570 -1.74761862944617 -2.21865239727883 7 | N 2.10914370306048 -0.33402358897783 -2.27674973147307 8 | C 1.86775867472018 0.54390043382692 -1.26343764079100 9 | N 1.27680953207984 -3.36757233307534 -0.37748854905490 10 | C 0.91461226786592 -3.14740906594264 0.84460715972356 11 | N 0.91768716624572 -1.81594469141732 1.17440471889163 12 | O 2.23471850070944 -2.39670706107528 -3.20454497820690 13 | N 2.11460025487082 1.85836120568312 -1.49845077783225 14 | H 0.67952040591559 -1.39514835256529 2.05664466916869 15 | H 0.63659476510547 -3.91144927326480 1.54245387480526 16 | H 2.43918920019300 0.01672894983906 -3.16809193535854 17 | H 1.78950116764777 2.49655065642122 -0.79277065540295 18 | H 2.15173216814906 2.19392916334893 -2.44513710915798 19 | -------------------------------------------------------------------------------- /include/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grimme-lab/crest/ccce4d27fd90cf2a021bd5ac5763320edc8af85c/include/.gitignore -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | project( 18 | 'crest', 19 | 'fortran', 'c', 20 | version: '3.0.2', 21 | license: 'LGPL-3.0-or-later', 22 | meson_version: '>=0.63', 23 | default_options: [ 24 | 'buildtype=debugoptimized', 25 | 'default_library=static', 26 | 'c_link_args=-static', 27 | 'fortran_link_args=-static', 28 | ], 29 | ) 30 | install = not (meson.is_subproject() and get_option('default_library') == 'static') 31 | 32 | 33 | # =================================== # 34 | ## General configuration information ## 35 | # =================================== # 36 | exe_deps = [] 37 | subdir('config') 38 | 39 | # create the metadata file with the configured data 40 | configure_file( 41 | input: files('assets/template/metadata.f90'), 42 | output: 'crest_metadata.fh', 43 | configuration : config, 44 | ) 45 | 46 | 47 | # Documentation 48 | #subdir('docs') 49 | 50 | # Collect source of the project 51 | prog = [] 52 | srcs = [] 53 | subdir('src') 54 | 55 | 56 | # Create library target 57 | crest_lib = library( 58 | meson.project_name(), 59 | sources: srcs, 60 | dependencies: exe_deps, 61 | # include_directories: include_directories('include'), 62 | ) 63 | 64 | # Export as dependency 65 | crest_inc = crest_lib.private_dir_include() 66 | crest_dep = declare_dependency( 67 | link_with: crest_lib, 68 | include_directories: crest_inc, 69 | dependencies: exe_deps, 70 | ) 71 | 72 | 73 | # Create executable target 74 | crest_exe = executable( 75 | meson.project_name(), 76 | sources: prog, 77 | dependencies: crest_dep, 78 | install: install, 79 | link_language: 'fortran', 80 | ) 81 | 82 | 83 | 84 | # add the testsuite separate meson.build 85 | #subdir('testsuite') #has to be filled with tests, not availabel yet 86 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | option( 18 | 'la_backend', 19 | type: 'combo', 20 | value: 'mkl-static', 21 | yield: true, 22 | choices: ['mkl', 'mkl-rt', 'mkl-static', 'openblas', 'netlib', 'custom','none'], 23 | description: 'Linear algebra backend for program.', 24 | ) 25 | option( 26 | 'custom_libraries', 27 | type: 'array', 28 | value: [], 29 | description: 'libraries to load for custom linear algebra backend', 30 | ) 31 | option( 32 | 'openmp', 33 | type: 'boolean', 34 | value: true, 35 | yield: true, 36 | description: 'use OpenMP parallelisation', 37 | ) 38 | option( 39 | 'WITH_TBLITE', 40 | type: 'boolean', 41 | value: true, 42 | description: 'build with tblite integration', 43 | ) 44 | option( 45 | 'WITH_GFN0', 46 | type: 'boolean', 47 | value: true, 48 | description: 'build with GFN0-xTB integration', 49 | ) 50 | option( 51 | 'WITH_GFNFF', 52 | type: 'boolean', 53 | value: true, 54 | description: 'build with GFN-FF integration', 55 | ) 56 | option( 57 | 'WITH_TOMLF', 58 | type: 'boolean', 59 | value: true, 60 | description: 'build with toml-f integration', 61 | ) 62 | option( 63 | 'WITH_LIBPVOL', 64 | type: 'boolean', 65 | value: true, 66 | description: 'build with libpvol integration', 67 | ) 68 | 69 | option( 70 | 'WITH_LWONIOM', 71 | type: 'boolean', 72 | value: true, 73 | description: 'build with lwONIOM integration', 74 | ) 75 | 76 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | deprecated 2 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | 18 | add_subdirectory("parsing") 19 | add_subdirectory("optimize") 20 | add_subdirectory("calculator") 21 | add_subdirectory("algos") 22 | add_subdirectory("dynamics") 23 | add_subdirectory("qcg") 24 | add_subdirectory("qmhelpers") 25 | add_subdirectory("graphs") 26 | add_subdirectory("rigidconf") 27 | add_subdirectory("discretize") 28 | add_subdirectory("entropy") 29 | add_subdirectory("legacy_algos") 30 | add_subdirectory("msreact") 31 | 32 | 33 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 34 | 35 | list(APPEND srcs 36 | "${dir}/atmasses.f90" 37 | "${dir}/axis_module.f90" 38 | "${dir}/biasmerge.f90" 39 | "${dir}/bondconstraint.f90" 40 | "${dir}/canonical.f90" 41 | "${dir}/ccegen.f90" 42 | "${dir}/choose_settings.f90" 43 | "${dir}/classes.f90" 44 | "${dir}/cleanup.f90" 45 | "${dir}/cn.f90" 46 | "${dir}/compress.f90" 47 | "${dir}/confparse.f90" 48 | "${dir}/cregen.f90" 49 | "${dir}/crest_pars.f90" 50 | "${dir}/ensemblecomp.f90" 51 | "${dir}/eval_timer.f90" 52 | "${dir}/filemod.f90" 53 | "${dir}/flexi.F90" 54 | "${dir}/freqmasses.f90" 55 | "${dir}/geo.f90" 56 | "${dir}/identifiers.f90" 57 | "${dir}/internals.f90" 58 | "${dir}/internals2.f90" 59 | "${dir}/iomod.F90" 60 | "${dir}/legacy_wrappers.f90" 61 | "${dir}/ls_rmsd.f90" 62 | "${dir}/marqfit.f90" 63 | "${dir}/minitools.f90" 64 | "${dir}/miscdata.f90" 65 | "${dir}/ncigeo.f90" 66 | "${dir}/ompmklset.F90" 67 | "${dir}/printouts.f90" 68 | "${dir}/prmat.f90" 69 | "${dir}/propcalc.f90" 70 | "${dir}/quicksort.f90" 71 | "${dir}/readl.f90" 72 | "${dir}/restartlog.f90" 73 | "${dir}/rotcompare.f90" 74 | "${dir}/scratch.f90" 75 | "${dir}/sdfio.f90" 76 | "${dir}/select.f90" 77 | "${dir}/signal.c" 78 | "${dir}/sigterm.f90" 79 | "${dir}/sortens.f90" 80 | "${dir}/strucreader.f90" 81 | "${dir}/symmetry2.f90" 82 | "${dir}/symmetry_i.c" 83 | "${dir}/timer.f90" 84 | "${dir}/trackorigin.f90" 85 | "${dir}/utilmod.f90" 86 | "${dir}/wallsetup.f90" 87 | "${dir}/zdata.f90" 88 | "${dir}/ztopology.f90" 89 | ) 90 | 91 | list(APPEND prog 92 | "${dir}/crest_main.f90" 93 | ) 94 | 95 | set(srcs ${srcs} PARENT_SCOPE) 96 | set(prog ${prog} PARENT_SCOPE) 97 | -------------------------------------------------------------------------------- /src/algos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/singlepoint.f90" 21 | "${dir}/dynamics.f90" 22 | "${dir}/numhess.f90" 23 | "${dir}/optimization.f90" 24 | "${dir}/playground.f90" 25 | "${dir}/crossing.f90" 26 | "${dir}/refine.f90" 27 | "${dir}/scan.f90" 28 | "${dir}/search_1.f90" 29 | "${dir}/search_mecp.f90" 30 | "${dir}/setuptest.f90" 31 | "${dir}/protonate.f90" 32 | "${dir}/hessian_tools.f90" 33 | "${dir}/ConfSolv.F90" 34 | "${dir}/search_conformers.f90" 35 | "${dir}/search_entropy.f90" 36 | "${dir}/parallel.f90" 37 | ) 38 | 39 | set(srcs ${srcs} PARENT_SCOPE) 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/algos/dynamics.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2022 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | subroutine crest_moleculardynamics(env,tim) 21 | use crest_parameters 22 | use crest_data 23 | use crest_calculator 24 | use strucrd 25 | use dynamics_module 26 | use shake_module 27 | implicit none 28 | type(systemdata),intent(inout) :: env 29 | type(timer),intent(inout) :: tim 30 | type(coord) :: mol,molnew 31 | integer :: i,j,k,l,io,ich,T,Tn 32 | logical :: pr,wr 33 | !========================================================================================! 34 | type(calcdata) :: calc 35 | type(mddata) :: mddat 36 | type(shakedata) :: shk 37 | 38 | real(wp) :: energy,gnorm 39 | real(wp),allocatable :: grad(:,:) 40 | 41 | character(len=80) :: atmp 42 | character(len=*),parameter :: trjf='crest_dynamics.trj' 43 | !========================================================================================! 44 | write(stdout,*) 45 | !call system('figlet dynamics') 46 | write(stdout,*) " _ _ " 47 | write(stdout,*) " __| |_ _ _ __ __ _ _ __ ___ (_) ___ ___ " 48 | write(stdout,*) " / _` | | | | '_ \ / _` | '_ ` _ \| |/ __/ __| " 49 | write(stdout,*) " | (_| | |_| | | | | (_| | | | | | | | (__\__ \ " 50 | write(stdout,*) " \__,_|\__, |_| |_|\__,_|_| |_| |_|_|\___|___/ " 51 | write(stdout,*) " |___/ " 52 | write(stdout,*) 53 | !========================================================================================! 54 | call new_ompautoset(env,'max',0,T,Tn) 55 | call ompprint_intern() 56 | call tim%start(14,'Molecular dynamics (MD)') 57 | call env%ref%to(mol) 58 | write (stdout,*) 59 | write (stdout,*) 'Input structure:' 60 | call mol%append(stdout) 61 | write (stdout,*) 62 | !========================================================================================! 63 | 64 | pr = .true. 65 | !>--- default settings from env 66 | call env_to_mddat(env) 67 | mddat = env%mddat 68 | calc = env%calc 69 | !>--- check if we have any MD & calculation settings allocated 70 | if (.not. mddat%requested) then 71 | write (stdout,*) 'MD requested, but no MD settings present.' 72 | env%iostatus_meta = status_config 73 | return 74 | else if (calc%ncalculations < 0) then 75 | write (stdout,*) 'MD requested, but no calculation settings present.' 76 | env%iostatus_meta = status_config 77 | return 78 | end if 79 | 80 | !>--- print calculation info 81 | call calc%info( stdout ) 82 | 83 | !>--- init SHAKE? --> we need connectivity info 84 | if (mddat%shake) then 85 | calc%calcs(1)%rdwbo = .true. 86 | if(.not.calc%calcs(1)%active) calc%calcs(1)%active=.true. 87 | allocate (grad(3,mol%nat),source=0.0_wp) 88 | call engrad(mol,calc,energy,grad,io) 89 | deallocate (grad) 90 | calc%calcs(1)%rdwbo = .false. 91 | call move_alloc(calc%calcs(1)%wbo,mddat%shk%wbo) 92 | end if 93 | 94 | !>--- complete real-time settings to steps 95 | mddat%trajectoryfile = trjf 96 | 97 | !>--- run the MD 98 | call dynamics(mol,mddat,calc,pr,io) 99 | 100 | if (io == 0) then 101 | write (stdout,*) 'MD run completed successfully' 102 | write (stdout,*) 'Trajectory written to ',trjf 103 | else 104 | write (stdout,*) 'WARNING: MD run terminated ABNORMALLY' 105 | env%iostatus_meta = status_failed 106 | end if 107 | !========================================================================================! 108 | call tim%stop(14) 109 | return 110 | end subroutine crest_moleculardynamics 111 | -------------------------------------------------------------------------------- /src/algos/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'singlepoint.f90', 19 | 'dynamics.f90', 20 | 'numhess.f90', 21 | 'optimization.f90', 22 | 'playground.f90', 23 | 'crossing.f90', 24 | 'refine.f90', 25 | 'scan.f90', 26 | 'search_1.f90', 27 | 'search_mecp.f90', 28 | 'setuptest.f90', 29 | 'protonate.f90', 30 | 'hessian_tools.f90', 31 | 'ConfSolv.F90', 32 | 'search_conformers.f90', 33 | 'search_entropy.f90', 34 | 'parallel.f90', 35 | ) 36 | -------------------------------------------------------------------------------- /src/algos/playground.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2022 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !========================================================================================! 21 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>! 22 | !> Implementation of whatever, for testing implementations 23 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>! 24 | !========================================================================================! 25 | !> Input/Output: 26 | !> env - crest's systemdata object 27 | !> tim - timer object 28 | !>----------------------------------------------- 29 | subroutine crest_playground(env,tim) 30 | use crest_parameters 31 | use crest_data 32 | use crest_calculator 33 | use strucrd 34 | use canonical_mod 35 | implicit none 36 | type(systemdata),intent(inout) :: env 37 | type(timer),intent(inout) :: tim 38 | type(coord) :: mol,molnew 39 | integer :: i,j,k,l,io,ich 40 | logical :: pr,wr 41 | !========================================================================================! 42 | type(calcdata) :: calc 43 | real(wp) :: accuracy,etemp 44 | 45 | integer :: V,maxgen 46 | integer,allocatable :: A(:,:) 47 | logical,allocatable :: rings(:,:) 48 | integer,allocatable :: tmp(:) 49 | logical :: connected,fail 50 | 51 | real(wp) :: energy 52 | real(wp),allocatable :: grad(:,:),geo(:,:),csv(:,:) 53 | 54 | type(canonical_sorter) :: can 55 | !========================================================================================! 56 | call tim%start(14,'Test implementation') 57 | !========================================================================================! 58 | !call system('figlet welcome') 59 | write(*,*) " _ " 60 | write(*,*) "__ _____| | ___ ___ _ __ ___ ___ " 61 | write(*,*) "\ \ /\ / / _ \ |/ __/ _ \| '_ ` _ \ / _ \" 62 | write(*,*) " \ V V / __/ | (_| (_) | | | | | | __/" 63 | write(*,*) " \_/\_/ \___|_|\___\___/|_| |_| |_|\___|" 64 | write(*,*) 65 | !========================================================================================! 66 | call env%ref%to(mol) 67 | write(*,*) 68 | write(*,*) 'Input structure:' 69 | call mol%append(stdout) 70 | write(*,*) 71 | !========================================================================================! 72 | 73 | allocate(grad(3,mol%nat), source=0.0_wp) 74 | call env2calc(env,calc,mol) 75 | calc%calcs(1)%rdwbo=.true. 76 | call calc%info(stdout) 77 | 78 | call engrad(mol,calc,energy,grad,io) 79 | call calculation_summary(calc,mol,energy,grad) 80 | 81 | 82 | write(stdout,*) 83 | write(stdout,*) 'CANGEN algorithm' 84 | call can%init(mol,calc%calcs(1)%wbo,'apsp+') 85 | call can%stereo(mol) 86 | call can%rankprint(mol) 87 | 88 | !========================================================================================! 89 | call tim%stop(14) 90 | return 91 | end subroutine crest_playground 92 | -------------------------------------------------------------------------------- /src/algos/refine.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | subroutine crest_refine(env,input,output) 21 | !******************************************************************* 22 | !* subroutine crest_refine 23 | !* This subroutine will process the ensemble specified by "input" 24 | !* and either overwrite it or write a new file "output". 25 | !* The routine is intended to be called after geometry optimization 26 | !* to re-rank structures by singlepoint energies, or add other 27 | !* contributions to the energy. 28 | !******************************************************************* 29 | use crest_parameters 30 | use crest_data 31 | use crest_calculator 32 | use strucrd 33 | use cregen_interface 34 | use parallel_interface 35 | implicit none 36 | type(systemdata),intent(inout) :: env 37 | character(len=*),intent(in) :: input 38 | character(len=*),intent(in),optional :: output 39 | !===========================================================! 40 | integer :: i,j,k,l,io,ich,m,t1,t2 41 | logical :: pr,wr,ex 42 | !===========================================================! 43 | character(len=:),allocatable :: outname 44 | real(wp) :: energy,gnorm 45 | real(wp),allocatable :: grad(:,:) 46 | character(len=:),allocatable :: ensnam 47 | integer :: nat,nall 48 | real(wp),allocatable :: eread(:),etmp(:) 49 | real(wp),allocatable :: xyz(:,:,:) 50 | integer,allocatable :: at(:) 51 | integer :: nrefine,refine_stage 52 | !===========================================================! 53 | !>--- setup 54 | if (present(output)) then 55 | outname = output !> new file 56 | else 57 | outname = input !> overwrite 58 | end if 59 | 60 | !>--- presorting step, if necessary 61 | if(env%refine_presort)then 62 | call newcregen(env,0,input) 63 | call rename('crest_ensemble.xyz',input) 64 | endif 65 | 66 | !>--- read in 67 | call rdensemble(input,nat,nall,at,xyz,eread) 68 | allocate (etmp(nall),source=0.0_wp) 69 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- Important: crest_sploop requires coordinates in Bohrs 71 | xyz = xyz / bohr 72 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<< set the calculator to the correct stage 85 | env%calc%refine_stage = refine_stage 86 | 87 | select case (refine_stage) 88 | case (refine%singlepoint) 89 | write (stdout,'("> Singlepoint re-ranking for ",i0," structures")') nall 90 | call crest_sploop(env,nat,nall,at,xyz,eread) 91 | 92 | case (refine%correction) 93 | write (stdout,'("> Additive correction for ",i0," structures")') nall 94 | call crest_sploop(env,nat,nall,at,xyz,etmp) 95 | eread(:) = eread(:)+etmp(:) 96 | 97 | case (refine%geoopt) 98 | write (stdout,'("> Geometry optimization of ",i0," structures")') nall 99 | call crest_oloop(env,nat,nall,at,xyz,eread,.false.) 100 | 101 | case(refine%confsolv) 102 | call new_ompautoset(env,'subprocess',1,t1,t2) 103 | write (stdout,'("> ConfSolv: ΔΔGsoln estimation from 3D directed message passing neural networks (D-MPNN)")') 104 | call confsolv_request( input, nall, t2, etmp, io) 105 | if(io == 0)then 106 | eread(:) = etmp(:)*kcaltoau !> since CREGEN deals with Eh energies 107 | endif 108 | end select 109 | write(stdout,*) 110 | end do 111 | 112 | !> reset the refinement stage of the calculator 113 | env%calc%refine_stage = 0 114 | 115 | !===========================================================! 116 | end if DO_REFINE 117 | !===========================================================! 118 | 119 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- Important: ensemble file must be written in AA 121 | xyz = xyz / angstrom 122 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- write output ensemble 124 | call wrensemble(outname,nat,nall,at,xyz,eread) 125 | 126 | !===========================================================! 127 | deallocate (etmp,eread,xyz,at) 128 | return 129 | end subroutine crest_refine 130 | !========================================================================================! 131 | !========================================================================================! 132 | -------------------------------------------------------------------------------- /src/algos/search_1.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2022 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !> This is an implementation of a generic sampling workflow 21 | !> consisting of one batch of metadynamics with snapshot optimization. 22 | 23 | subroutine crest_search_1(env,tim) 24 | use crest_parameters 25 | use crest_data 26 | use crest_calculator 27 | use strucrd 28 | use dynamics_module 29 | use shake_module 30 | use parallel_interface 31 | implicit none 32 | type(systemdata),intent(inout) :: env 33 | type(timer),intent(inout) :: tim 34 | type(coord) :: mol 35 | !===========================================================! 36 | type(mddata) :: mddat 37 | 38 | type(mddata),allocatable :: mddats(:) 39 | integer :: nsim 40 | 41 | character(len=:),allocatable :: ensnam 42 | integer :: nat,nall,T,Tn 43 | real(wp),allocatable :: eread(:) 44 | real(wp),allocatable :: xyz(:,:,:) 45 | integer,allocatable :: at(:) 46 | logical :: dump 47 | 48 | !===========================================================! 49 | !>--- printout header 50 | write (stdout,*) 51 | write (stdout,'(10x,"┍",49("━"),"┑")') 52 | write (stdout,'(10x,"│",13x,a,12x,"│")') "CREST SAMPLING ALGORITHM" 53 | write (stdout,'(10x,"┕",49("━"),"┙")') 54 | write (stdout,*) 55 | 56 | !===========================================================! 57 | !>--- setup 58 | call env%ref%to(mol) 59 | write (stdout,*) 'Input structure:' 60 | call mol%append(stdout) 61 | write (stdout,*) 62 | 63 | !>--- saftey termination 64 | if(mol%nat .le. 2)then 65 | call catchdiatomic(env) 66 | return 67 | endif 68 | 69 | !===========================================================! 70 | !>--- Dynamics 71 | 72 | write(stdout,*) 73 | write(stdout,'(1x,a)') '------------------------------' 74 | write(stdout,'(1x,a)') 'Molecular Dynamics Simulations' 75 | write(stdout,'(1x,a)') '------------------------------' 76 | 77 | nsim = -1 !>--- enambles automatic MTD setup in init routines 78 | call crest_search_multimd_init(env,mol,mddat,nsim) 79 | allocate (mddats(nsim), source=mddat) 80 | call crest_search_multimd_init2(env,mddats,nsim) 81 | 82 | call tim%start(2,'Molecular dynamics (MD)') 83 | call crest_search_multimd(env,mol,mddats,nsim) 84 | call tim%stop(2) 85 | !>--- a file called crest_dynamics.trj should have been written 86 | ensnam = 'crest_dynamics.trj' 87 | 88 | !==========================================================! 89 | !>--- Reoptimization of trajectories 90 | 91 | write(stdout,*) 92 | write(stdout,'(1x,a)') '---------------------' 93 | write(stdout,'(1x,a)') 'Ensemble Optimization' 94 | write(stdout,'(1x,a)') '---------------------' 95 | 96 | !>--- read ensemble 97 | call rdensembleparam(ensnam,nat,nall) 98 | if (nall .lt. 1) then 99 | write(stdout,*) '**ERROR** empty ensemble file' 100 | env%iostatus_meta = status_failed 101 | return 102 | endif 103 | allocate (xyz(3,nat,nall),at(nat),eread(nall)) 104 | call rdensemble(ensnam,nat,nall,at,xyz,eread) 105 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- Important: crest_oloop requires coordinates in Bohrs 107 | xyz = xyz / bohr 108 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- set threads 114 | call new_ompautoset(env,'auto',nall,T,Tn) 115 | 116 | !>--- optimize 117 | call tim%start(3,'Geometry optimization') 118 | dump = .true. 119 | call crest_oloop(env,nat,nall,at,xyz,eread,dump) 120 | call tim%stop(3) 121 | 122 | !==========================================================! 123 | return 124 | end subroutine crest_search_1 125 | 126 | -------------------------------------------------------------------------------- /src/algos/search_mecp.f90: -------------------------------------------------------------------------------- 1 | 2 | subroutine crest_search_mecp(env,tim) 3 | use crest_parameters 4 | use crest_data 5 | use crest_calculator 6 | use strucrd 7 | use dynamics_module 8 | use shake_module 9 | use cregen_interface 10 | use parallel_interface 11 | implicit none 12 | type(systemdata),intent(inout) :: env 13 | type(timer),intent(inout) :: tim 14 | type(coord) :: mol,molnew 15 | integer :: i,j,k,l,io,ich,m,T,Tn 16 | logical :: pr,wr 17 | !===========================================================! 18 | type(calcdata) :: calc 19 | type(mddata) :: mddat 20 | type(shakedata) :: shk 21 | 22 | type(mddata),allocatable :: mddats(:) 23 | integer :: nsim 24 | 25 | real(wp) :: energy,gnorm 26 | real(wp),allocatable :: grad(:,:) 27 | character(len=:),allocatable :: ensnam 28 | integer :: nat,nall 29 | real(wp),allocatable :: eread(:) 30 | real(wp),allocatable :: xyz(:,:,:) 31 | integer,allocatable :: at(:) 32 | logical :: dump,ex 33 | character(len=80) :: atmp 34 | 35 | !===========================================================! 36 | !>--- printout header 37 | write (stdout,*) 38 | write (stdout,'(10x,"┍",49("━"),"┑")') 39 | write (stdout,'(10x,"│",10x,a,10x,"│")') "CREST MECP SAMPLING ALGORITHM" 40 | write (stdout,'(10x,"┕",49("━"),"┙")') 41 | write (stdout,*) 42 | 43 | !===========================================================! 44 | !>--- setup 45 | call env%ref%to(mol) 46 | write (stdout,*) 'Input structure:' 47 | call mol%append(stdout) 48 | write (stdout,*) 49 | 50 | !>--- check calculation setup 51 | ex = env%calc%ncalculations > 1 52 | if (.not.ex) then 53 | write (stdout,*) '**ERROR** Not enough calculation levels specified for MECP search.' 54 | env%iostatus_meta = status_config 55 | return 56 | end if 57 | call print_gapcons(env%calc) 58 | 59 | !===========================================================! 60 | !>--- Dynamics 61 | 62 | write (stdout,*) 63 | write (stdout,'(1x,a)') '------------------------------' 64 | write (stdout,'(1x,a)') 'Molecular Dynamics Simulations' 65 | write (stdout,'(1x,a)') '------------------------------' 66 | 67 | nsim = -1 !>--- enambles automatic MTD setup in init routines 68 | call crest_search_multimd_init(env,mol,mddat,nsim) 69 | allocate (mddats(nsim),source=mddat) 70 | call crest_search_multimd_init2(env,mddats,nsim) 71 | 72 | call tim%start(2,'Molecular dynamics (MD)') 73 | call crest_search_multimd(env,mol,mddats,nsim) 74 | call tim%stop(2) 75 | !>--- a file called crest_dynamics.trj should have been written 76 | ensnam = 'crest_dynamics.trj' 77 | 78 | !==========================================================! 79 | !>--- Reoptimization of trajectories 80 | 81 | write (stdout,*) 82 | write (stdout,'(1x,a)') '---------------------' 83 | write (stdout,'(1x,a)') 'Ensemble Optimization' 84 | write (stdout,'(1x,a)') '---------------------' 85 | 86 | !>--- read ensemble 87 | call rdensembleparam(ensnam,nat,nall) 88 | if (nall .lt. 1) then 89 | write (stdout,*) 'empty ensemble file' 90 | return 91 | end if 92 | allocate (xyz(3,nat,nall),at(nat),eread(nall)) 93 | call rdensemble(ensnam,nat,nall,at,xyz,eread) 94 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- Important: crest_oloop requires coordinates in Bohrs 96 | xyz = xyz/bohr 97 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<--- set threads 102 | call new_ompautoset(env,'auto',nall,T,Tn) 103 | 104 | !>--- optimize 105 | call tim%start(3,'Geometry optimization') 106 | dump = .true. 107 | call crest_oloop(env,nat,nall,at,xyz,eread,dump) 108 | call tim%stop(3) 109 | 110 | !==========================================================! 111 | !>--- rename ensemble and sort 112 | call rename(ensemblefile,mecpensemble) 113 | call newcregen(env,12) 114 | 115 | !==========================================================! 116 | return 117 | end subroutine crest_search_mecp 118 | 119 | !========================================================================================! 120 | !========================================================================================! 121 | 122 | subroutine print_gapcons(calc) 123 | use crest_parameters 124 | use crest_data 125 | use crest_calculator 126 | implicit none 127 | 128 | type(calcdata) :: calc 129 | integer :: i,t 130 | logical :: ex 131 | 132 | if (calc%nconstraints < 1) then 133 | write (stdout,*) 'no gap constraint provided' 134 | end if 135 | 136 | ex = .false. 137 | do i = 1,calc%nconstraints 138 | t = calc%cons(i)%type 139 | select case (t) 140 | case (-1) 141 | ex = .true. 142 | write (stdout,'(1x,a1x,"[",a,"]")') 'nonadiabatic gap constraint','σ*ΔE²/(ΔE+α)' 143 | write (stdout,'(" σ=",f8.5," α=",f8.5)') calc%cons(i)%fc(1:2) 144 | case (-2) 145 | ex = .true. 146 | write (stdout,'(1x,a)') 'nonadiabatic gap constraint' 147 | write (stdout,'(1x,"Vgap = [",a,"] with")') & 148 | & 'σ*(exp(-β|ΔE|)+C) * ΔE²/(|ΔE|+α)' 149 | write (stdout,'(" σ = ",f8.5,/," α = ",f8.5,/," C = ",f8.5,/," β = ",f8.5)') & 150 | & calc%cons(i)%fc(1:3),27.2114_wp 151 | case default 152 | continue 153 | end select 154 | end do 155 | 156 | if (.not.ex) then 157 | write (stdout,*) '**ERROR** no gap constraint provided' 158 | call creststop(status_config) 159 | else 160 | write (stdout,*) 161 | end if 162 | 163 | end subroutine print_gapcons 164 | 165 | !========================================================================================! 166 | !========================================================================================! 167 | 168 | -------------------------------------------------------------------------------- /src/atmasses.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | module atmasses 21 | use iso_fortran_env, only : wp => real64 22 | implicit none 23 | private :: wp 24 | public 25 | 26 | real(wp) :: ams(118) 27 | data ams /1.00794075_wp, 4.00260193_wp, 6.94003660_wp, 9.01218307_wp,& 28 | & 10.81102805_wp, 12.01073590_wp, 14.00670321_wp, 15.99940492_wp,& 29 | & 18.99840316_wp, 20.18004638_wp, 22.98976928_wp, 24.30505162_wp,& 30 | & 26.98153853_wp, 28.08549871_wp, 30.97376200_wp, 32.06478741_wp,& 31 | & 35.45293758_wp, 39.94779856_wp, 39.09830091_wp, 40.07802251_wp,& 32 | & 44.95590828_wp, 47.86674496_wp, 50.94146504_wp, 51.99613176_wp,& 33 | & 54.93804391_wp, 55.84514443_wp, 58.93319429_wp, 58.69334711_wp,& 34 | & 63.54603995_wp, 65.37778253_wp, 69.72306607_wp, 72.62755016_wp,& 35 | & 74.92159457_wp, 78.95938856_wp, 79.90352778_wp, 83.79800000_wp,& 36 | & 85.46766360_wp, 87.61664447_wp, 88.90584030_wp, 91.22364160_wp,& 37 | & 92.90637300_wp, 95.95978854_wp, 97.90721240_wp,101.06494014_wp,& 38 | &102.90549800_wp,106.41532751_wp,107.86814963_wp,112.41155782_wp,& 39 | &114.81808663_wp,118.71011259_wp,121.75978367_wp,127.60312648_wp,& 40 | &126.90447190_wp,131.29276145_wp,132.90545196_wp,137.32689163_wp,& 41 | &138.90546887_wp,140.11573074_wp,140.90765760_wp,144.24159603_wp,& 42 | &144.91275590_wp,150.36635571_wp,151.96437813_wp,157.25213065_wp,& 43 | &158.92535470_wp,162.49947282_wp,164.93032880_wp,167.25908265_wp,& 44 | &168.93421790_wp,173.05415017_wp,174.96681496_wp,178.48497872_wp,& 45 | &180.94787564_wp,183.84177755_wp,186.20670455_wp,190.22485963_wp,& 46 | &192.21605165_wp,195.08445686_wp,196.96656879_wp,200.59916703_wp,& 47 | &204.38341284_wp,207.21690806_wp,208.98039910_wp,208.98243080_wp,& 48 | &209.98714790_wp,222.01757820_wp,223.01973600_wp,226.02541030_wp,& 49 | &227.02775230_wp,232.03805580_wp,231.03588420_wp,238.02891046_wp,& 50 | &237.04817360_wp,244.06420530_wp,243.06138130_wp,247.07035410_wp,& 51 | &247.07030730_wp,251.07958860_wp,252.08298000_wp,257.09510610_wp,& 52 | &258.09843150_wp,259.10103000_wp,262.10961000_wp,267.12179000_wp,& 53 | &269.12791000_wp,271.13393000_wp,270.13336000_wp,276.14846000_wp,& 54 | &276.15159000_wp,280.16131000_wp,282.16912000_wp,284.17416000_wp,& 55 | &284.17873000_wp,289.19042000_wp,288.19274000_wp,293.20449000_wp,& 56 | &292.20746000_wp,294.21392000_wp/ 57 | 58 | contains 59 | 60 | !------------------------------------------------------------ 61 | ! This is a subroutine that replaces masses with fitted or scaled 62 | ! masses to increase the quality of frequencies in IR spectra calculations 63 | ! 64 | subroutine freqmass(amss,param) 65 | implicit none 66 | real(wp),intent(inout) :: amss(118) 67 | character(len=*) :: param 68 | 69 | select case( param ) 70 | case( 'gfn2' ) 71 | amss=amss*1.016_wp 72 | 73 | ! open(newunit=ich,file='~/.mscal') 74 | ! read(ich,*) scal 75 | ! close(ich) 76 | 77 | amss( 1)= 1.032_wp 78 | amss( 6)= 11.79_wp 79 | amss( 7)= 14.82_wp 80 | amss( 8)= 17.11_wp 81 | amss( 9)= 16.17_wp 82 | !amss(14)= ams(14)*scal 83 | !amss(14)= ams(14)*1.163_wp 84 | amss(14)= 32.6634_wp 85 | !amss(15)= ams(15)*scal 86 | !amss(15)= ams(15)*0.847_wp 87 | amss(15)= 26.2348_wp 88 | amss(16)= 22.39_wp 89 | amss(17)= 30.23_wp 90 | amss(35)= 55.34_wp 91 | case( 'b3lyp-3c' ) 92 | amss=amss*1.07_wp 93 | 94 | amss( 1)= 1.072_wp 95 | amss( 6)= 12.60_wp 96 | amss( 7)= 15.48_wp 97 | amss( 8)= 17.75_wp 98 | amss( 9)= 16.92_wp 99 | amss(16)= 24.99_wp 100 | amss(17)= 30.55_wp 101 | amss(35)= 55.83_wp 102 | case default 103 | continue 104 | end select 105 | 106 | return 107 | end subroutine freqmass 108 | 109 | 110 | !========================================= 111 | ! calculate total weight of molecule 112 | !========================================= 113 | function molweight(nat,at) 114 | implicit none 115 | real(wp) :: molweight 116 | integer :: nat 117 | integer :: at(nat) 118 | integer :: i 119 | molweight = 0.0_wp 120 | do i=1,nat 121 | molweight = molweight + ams(at(i)) 122 | enddo 123 | return 124 | end function molweight 125 | 126 | 127 | end module atmasses 128 | -------------------------------------------------------------------------------- /src/calculator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/calculator.F90" 21 | "${dir}/calc_type.f90" 22 | "${dir}/printouts.F90" 23 | "${dir}/constraints.f90" 24 | "${dir}/gfn0_api.F90" 25 | "${dir}/gfnff_api.F90" 26 | "${dir}/lj.f90" 27 | "${dir}/lwoniom.F90" 28 | "${dir}/oniom_hessian.F90" 29 | "${dir}/nonadiabatic.f90" 30 | "${dir}/tblite_api.F90" 31 | "${dir}/api_helpers.F90" 32 | "${dir}/api_engrad.f90" 33 | "${dir}/gradreader.f90" 34 | "${dir}/libpvol.F90" 35 | "${dir}/subprocess_types.f90" 36 | "${dir}/xtb_sc.f90" 37 | "${dir}/orca_sc.f90" 38 | "${dir}/generic_sc.f90" 39 | "${dir}/turbom_sc.f90" 40 | "${dir}/subprocess_engrad.f90" 41 | ) 42 | 43 | set(srcs ${srcs} PARENT_SCOPE) 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/calculator/lj.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2021 - 2022 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !> a small module containing the Lennard-Jones potential 21 | !> (mainly for testing other implementations) 22 | 23 | module lj 24 | 25 | use iso_fortran_env,only:wp => real64 26 | 27 | implicit none 28 | private 29 | 30 | public :: lj_engrad 31 | 32 | !========================================================================================! 33 | !========================================================================================! 34 | contains !> MODULE PROCEDURES START HERE 35 | !========================================================================================! 36 | !========================================================================================! 37 | 38 | subroutine lj_engrad(n,xyz,epsi,sigma,energy,grad) 39 | !> Compute the total energy and corresponding forces for 40 | !> a system of nPart interacting LJ particles. 41 | !> The total energy is given by: 42 | !> 43 | !> U(rⁿ) = ∑_i∑_j U( r_ij ) for i≠j 44 | !> 45 | !> Lennard-Jones potential U(r) = 4*ε*[ (σ/r)^12 - (σ/r)^6] 46 | !> Here, we set σ=1 and ε=1 for reduced LJ units: 47 | !> 48 | !> U(r) = 4*[ (1/r)^12 - (1/r)^6] 49 | !> 50 | !> dU(r) = 4*(x/r)*[ 12*(1/r)^13 - 6*(1/r)^7] 51 | !> = 48 * x * (1/r)^8 *[(1/r)^6 - 0.5] 52 | !> 53 | implicit none 54 | integer,intent(in) :: n 55 | real(wp),intent(in) :: xyz(3,n) 56 | real(wp),intent(in) :: sigma 57 | real(wp),intent(in) :: epsi 58 | 59 | real(wp),intent(inout) :: energy 60 | real(wp),intent(inout) :: grad(3,n) 61 | 62 | integer :: i,j,k,l,ich,och,io 63 | logical :: ex 64 | 65 | real(wp) :: rij,rij2,dr(3) 66 | real(wp) :: invR2,invR6,sig2 67 | real(wp) :: U,dU,dx,dy,dz 68 | 69 | energy = 0.0_wp 70 | grad = 0.0_wp 71 | 72 | !>--- standard implementation 73 | do i = 1,n 74 | do j = 1,i-1 75 | rij = (xyz(1,i)-xyz(1,j))**2 & 76 | & +(xyz(2,i)-xyz(2,j))**2 & 77 | & +(xyz(3,i)-xyz(3,j))**2 78 | rij = sqrt(rij) 79 | !>--- energy 80 | U = 4.0_wp*epsi*((sigma/rij)**12-(sigma/rij)**6) 81 | energy = energy+U 82 | !>--- Cartesian derivative 83 | dU = 4.0_wp*epsi*(6.0_wp*(sigma**6)* & 84 | & (rij**-7)-12.0_wp*(sigma**12)*(rij**(-13))) 85 | dU = dU/rij 86 | dx = dU*(xyz(1,i)-xyz(1,j)) 87 | dy = dU*(xyz(2,i)-xyz(2,j)) 88 | dz = dU*(xyz(3,i)-xyz(3,j)) 89 | grad(1,i) = grad(1,i)+dx 90 | grad(1,j) = grad(1,j)-dx 91 | grad(2,i) = grad(2,i)+dy 92 | grad(2,j) = grad(2,j)-dy 93 | grad(3,i) = grad(3,i)+dz 94 | grad(3,j) = grad(3,j)-dz 95 | end do 96 | end do 97 | 98 | !>--- efficient implementation (needs debugging) 99 | ! sig2 = sigma**2 100 | ! !$omp parallel & 101 | ! !$omp shared(xyz,energy,grad) & 102 | ! !$omp private(i,j,dr,invR2,invR6,U,dU,dz,dx,dy) 103 | ! do i = 1,n 104 | ! do j = 1,i-1 105 | ! dr(:) = xyz(:,i)-xyz(:,j) 106 | ! rij2 = dot_product(dr,dr) 107 | ! invR2 = sig2/rij2 108 | ! invR6 = invR2**3 109 | ! !>--- energy 110 | ! U = invR6*(invR6-1.0_wp) 111 | ! !>--- Cartesian derivative 112 | ! dU = (invR2**4)*(invR6-0.5d0) 113 | ! dx = dU*dr(1) 114 | ! dy = dU*dr(2) 115 | ! dz = dU*dr(3) 116 | ! !$omp critical 117 | ! energy = energy + U 118 | ! grad(1,i) = grad(1,i)+dx 119 | ! grad(1,j) = grad(1,j)-dx 120 | ! grad(2,i) = grad(2,i)+dy 121 | ! grad(2,j) = grad(2,j)-dy 122 | ! grad(3,i) = grad(3,i)+dz 123 | ! grad(3,j) = grad(3,j)-dz 124 | ! !$omp end critical 125 | ! end do 126 | ! end do 127 | ! !$omp end parallel 128 | ! energy = energy*(4.0_wp*epsi) 129 | ! grad(:,:) = grad(:,:)*(48.0_wp*epsi) 130 | 131 | return 132 | end subroutine lj_engrad 133 | 134 | !========================================================================================! 135 | !========================================================================================! 136 | end module lj 137 | -------------------------------------------------------------------------------- /src/calculator/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'calculator.F90', 19 | 'calc_type.f90', 20 | 'printouts.F90', 21 | 'constraints.f90', 22 | 'gfn0_api.F90', 23 | 'gfnff_api.F90', 24 | 'lj.f90', 25 | 'lwoniom.F90', 26 | 'oniom_hessian.F90', 27 | 'nonadiabatic.f90', 28 | 'tblite_api.F90', 29 | 'api_helpers.F90', 30 | 'api_engrad.f90', 31 | 'gradreader.f90', 32 | 'libpvol.F90', 33 | 'xtb_sc.f90', 34 | 'subprocess_types.f90', 35 | 'orca_sc.f90', 36 | 'generic_sc.f90', 37 | 'turbom_sc.f90', 38 | 'subprocess_engrad.f90', 39 | ) 40 | -------------------------------------------------------------------------------- /src/calculator/subprocess_engrad.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !> module subprocess_engrad 21 | !> RE-EXPORTS of subprocess engrad routines 22 | 23 | !=========================================================================================! 24 | 25 | module subprocess_engrad 26 | use generic_sc 27 | use xtb_sc 28 | use turbom_sc 29 | use orca_sc 30 | implicit none 31 | !>--- private module variables and parameters 32 | private 33 | 34 | !>--- generic subrpocess (run.sh) 35 | public :: generic_engrad 36 | 37 | !>--- xtb subprocess 38 | public :: xtb_engrad 39 | 40 | !>--- Turbomole-style subprocesses 41 | public :: turbom_engrad 42 | 43 | !>--- ORCA subprocesses 44 | public :: ORCA_engrad 45 | 46 | !=========================================================================================! 47 | !=========================================================================================! 48 | contains !> MODULE PROCEDURES START HERE 49 | !=========================================================================================! 50 | !=========================================================================================! 51 | 52 | end module subprocess_engrad 53 | -------------------------------------------------------------------------------- /src/compress.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | !======================================================! 20 | ! metadynamics based sampling with logfermi potential 21 | !======================================================! 22 | subroutine compress(env, tim) 23 | use iso_fortran_env, wp => real64 24 | use crest_data 25 | use iomod 26 | use zdata 27 | use strucrd, only: rdensembleparam,rdensemble 28 | implicit none 29 | 30 | type(systemdata) :: env 31 | type(timer) :: tim 32 | 33 | 34 | !--- start timer 35 | call tim%start(1, 'Setup') 36 | 37 | !--- 1. set up reactor metadynamics 38 | ! wall-potential, mass density, simulation length 39 | call md_length_setup(env) !set the MD length according to a flexibility measure 40 | env%preactormtd=.false. !MTD settings already obtained 41 | env%preactorpot=.true. !Generate logfermi potential 42 | call reactor_setup(env) 43 | call tim%stop(1) 44 | 45 | call rdrcontrol('rcontrol',env) 46 | 47 | call tim%start(2,'test MD') 48 | call trialmd(env) !calculate a short 1ps test MTD to check settings 49 | call tim%stop(2) 50 | 51 | 52 | 53 | !--- 2. run the metadynamics 54 | write(*,*) 55 | write(*,'(''========================================'')') 56 | write(*,'('' MTD Simulations '',15x)') 57 | write(*,'(''========================================'')') 58 | call tim%start(3,'MTD') 59 | call MetaMD_para_OMP(env) 60 | call tim%stop(3) 61 | 62 | !--- 3. loose threshold optimization 63 | call tim%start(4,'geometry opt.') 64 | call append_INPUT_to('coord','input') !include the input structure into the last optimization 65 | call multilevel_opt(env,2) 66 | call tim%stop(4) 67 | 68 | write(*,*) 69 | write(*,'(3x,''================================================'')') 70 | write(*,'(3x,''| Final Geometry Optimization |'')') 71 | write(*,'(3x,''================================================'')') 72 | if(env%doNMR) env%cgf(3)=.true. !--- if NMR equivalencies are requested, turn them on here 73 | call tim%start(4,'geometry opt.') 74 | call multilevel_opt(env,99) !--- the last CREGEN is done within this subroutine 75 | call tim%stop(4) 76 | 77 | !--- 4. read the final ensemble and analyze 78 | 79 | 80 | 81 | !---- print CREGEN results and clean up Directory a bit 82 | call V2terminating() 83 | 84 | return 85 | end subroutine compress 86 | 87 | -------------------------------------------------------------------------------- /src/crest_pars.f90: -------------------------------------------------------------------------------- 1 | module crest_parameters 2 | use iso_fortran_env, only: wp => real64, sp => real32 3 | use iso_fortran_env, only: ap => real64 4 | use iso_fortran_env, only: dp => int64 5 | use iso_fortran_env, only: int8,int16,int32,int64,real64,real32 6 | use iso_fortran_env, only: stdout => output_unit 7 | use iso_fortran_env, only: stderr => error_unit 8 | 9 | public :: wp,sp,ap,dp,stdout,stderr 10 | public :: int8,int16,int32,int64,real64,real32 11 | 12 | real(wp),parameter,public :: bohr = 0.52917726_wp 13 | real(wp),parameter,public :: angstrom = 1.0_wp / bohr 14 | real(wp),parameter,public :: autoaa = bohr 15 | real(wp),parameter,public :: aatoau = angstrom 16 | 17 | real(wp),parameter,public :: pi = acos(0.0_wp)*2.0_wp 18 | real(wp),parameter,public :: radtodeg = 180.0_wp / pi 19 | real(wp),parameter,public :: degtorad = 1.0_wp / radtodeg 20 | 21 | real(wp),parameter,public :: amutokg = 1.660539040e-27_wp 22 | real(wp),parameter,public :: autokj = 2625.49964038_wp 23 | real(wp),parameter,public :: autokcal = 627.50947428_wp 24 | real(wp),parameter,public :: autoeV = 27.211324570273_wp 25 | real(wp),parameter,public :: kcaltoau = 1.0_wp/autokcal 26 | real(wp),parameter,public :: kcaltokj = autokj/autokcal 27 | real(wp),parameter,public :: autorcm = 219474.63067_wp 28 | real(wp),parameter,public :: rcmtoau = 1.0_wp/autorcm 29 | real(wp),parameter,public :: metokg = 9.10938356e-31_wp 30 | real(wp),parameter,public :: kgtome = 1.0_wp/metokg 31 | 32 | real(wp),parameter,public :: Rcal = 8.31446261815324_wp/kcaltokj 33 | real(wp),parameter,public :: kB = 3.166808578545117e-06_wp 34 | real(wp),parameter,public :: avogadro = 6.0221413e23_wp ! 1/mol 35 | real(wp),parameter,public :: planck = 6.62606957e-34_wp ! J*s 36 | real(wp),parameter,public :: hbar = planck/(2.0_wp*pi) 37 | 38 | real(wp),public,parameter :: lightspeed = 137.0359990740_wp 39 | !> femtosectons to atomic time units 40 | real(wp), public, parameter :: fstoau = 41.3413733365614_wp 41 | !> Coulomb to atomic charge units (electrons) 42 | real(wp), public, parameter :: autoc = 1.6021766208e-19_wp 43 | !> Debye to atomic units 44 | real(wp), public, parameter :: autod = autoc * lightspeed * autoaa**2 * fstoau * 1.0e+16_wp 45 | real(wp), public, parameter :: dtoau = 1.0_wp / autod 46 | 47 | character(len=1),public,parameter :: sep = '/' 48 | character(len=12),public,parameter :: dev0 = ' 2>/dev/null' 49 | 50 | end module crest_parameters 51 | -------------------------------------------------------------------------------- /src/discretize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/bessel.f90" 21 | "${dir}/probability.f90" 22 | "${dir}/discretize_module.f90" 23 | "${dir}/discretize.f90" 24 | ) 25 | 26 | set(srcs ${srcs} PARENT_SCOPE) 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/discretize/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'bessel.f90', 19 | 'probability.f90', 20 | 'discretize_module.f90', 21 | 'discretize.f90', 22 | ) 23 | -------------------------------------------------------------------------------- /src/dynamics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/dynamics_module.f90" 21 | "${dir}/metadynamics_module.f90" 22 | "${dir}/shake_module.f90" 23 | ) 24 | 25 | set(srcs ${srcs} PARENT_SCOPE) 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/dynamics/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'dynamics_module.f90', 19 | 'metadynamics_module.f90', 20 | 'shake_module.f90', 21 | ) 22 | -------------------------------------------------------------------------------- /src/entropy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/thermocalc.f90" 21 | "${dir}/thermo.f90" 22 | "${dir}/mie.f90" 23 | "${dir}/entropic.f90" 24 | "${dir}/entropy.f90" 25 | ) 26 | 27 | set(srcs ${srcs} PARENT_SCOPE) 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/entropy/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'thermocalc.f90', 19 | 'thermo.f90', 20 | 'mie.f90', 21 | 'entropic.f90', 22 | 'entropy.f90', 23 | ) 24 | -------------------------------------------------------------------------------- /src/entropy/mie.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | module mutual_information_module 21 | use crest_parameters 22 | use discretize_module 23 | implicit none 24 | private 25 | 26 | integer,parameter :: hugeint = huge(hugeint) 27 | real(wp),parameter :: hugeint_as_real = float(hugeint) 28 | 29 | !========================================================================================! 30 | !========================================================================================! 31 | contains !> MODULE PROCEDURES START HERE 32 | !========================================================================================! 33 | !========================================================================================! 34 | 35 | subroutine mie_entropy( dataset, N, entropy) 36 | !********************************************************************** 37 | !* This subroutine calculates the Mutual Information Expansion (MIE) 38 | !* entropy up to a given order N for a data set A={A_1, A_2, ..., A_M} 39 | !* with M discrete variables. 40 | !* 41 | !* 42 | !********************************************************************** 43 | implicit none 44 | !> INPUT 45 | integer,intent(in) :: dataset(:,:) !> discrete data 46 | integer,intent(in) :: N !> max order of MIE 47 | !> OUTPUT 48 | real(wp),intent(out) :: entropy !> MIE entropy 49 | !> LOCAL 50 | integer :: ndata,M 51 | integer :: maxorder !> "true" maxorder because N <= M 52 | integer :: k 53 | real(wp) :: marginal_entropy, factor 54 | 55 | !> initialize 56 | entropy = 0.0_wp 57 | M = size(dataset,1) 58 | ndata = size(dataset,2) 59 | maxorder = min(N,M) 60 | 61 | do k=1,maxorder 62 | marginal_entropy = 0.0_wp 63 | factor = 1.0_wp 64 | 65 | ! call mie_factor( 66 | ! call n_order_entropy( 67 | 68 | entropy = entropy + factor*marginal_entropy 69 | enddo 70 | 71 | end subroutine mie_entropy 72 | 73 | !========================================================================================! 74 | subroutine n_order_entropy 75 | 76 | 77 | !>-- loops over all n_order subsets (probably needs to be done recursively) 78 | 79 | !... 80 | ! call n_order_subset_entropy 81 | 82 | 83 | end subroutine n_order_entropy 84 | 85 | !========================================================================================! 86 | subroutine n_order_subset_entropy(M,N,dataset,weights,mask,work,p,entropy) 87 | implicit none 88 | !> INPUT 89 | integer,intent(in) :: M,N 90 | integer,intent(in) :: dataset(M,N) 91 | logical,intent(in) :: mask(M) 92 | integer,intent(inout) :: work(N,2) !> a work arry to avoid allocating one in the subroutine 93 | real(wp),intent(inout) :: p(N) !> p is also a work array 94 | real(wp),intent(in) :: weights(N) 95 | !> OUTPUT 96 | real(wp),intent(out) :: entropy 97 | !> LOCAL 98 | integer :: i,j,k,l,ref 99 | logical :: check 100 | real(wp) :: sumweights 101 | 102 | !> reset 103 | entropy = 0.0_wp 104 | work(:,:) = 0 105 | p(:) = 0.0_wp 106 | k = 0 107 | sumweights = sum(weights(:)) 108 | !> the first is always the first wrt the subset 109 | work(1,2) = 1 110 | work(1,1) = 1 111 | p(1) = p(1) + weights(1) 112 | k = k + 1 113 | !> loop over the data 114 | do i=2,N 115 | !TODO 116 | do j=1,i-1 !> better only over the k mappings? 117 | do l=1,M 118 | if(mask(l))then 119 | 120 | endif 121 | enddo 122 | enddo 123 | enddo 124 | 125 | !> calculate probabilities 126 | p = p / sumweights 127 | 128 | !> calculate Shannon entropy 129 | do i=1,k 130 | entropy = entropy - Rcal * p(i) * log( p(i) ) 131 | enddo 132 | 133 | end subroutine n_order_subset_entropy 134 | 135 | !========================================================================================! 136 | !========================================================================================! 137 | end module mutual_information_module 138 | -------------------------------------------------------------------------------- /src/eval_timer.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2021-2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | subroutine eval_timer(tim) 20 | !******************************** 21 | !* The final timer evaluation to 22 | !* be called at the end of CREST 23 | !******************************** 24 | use crest_parameters 25 | use crest_data 26 | use crest_calculator,only: engrad_total 27 | use crest_restartlog 28 | implicit none 29 | type(timer) :: tim 30 | real(wp) :: time_total,time_avg 31 | character(len=40) :: atmp 32 | write (stdout,*) 33 | call smallhead('Wall Time Summary') 34 | call tim%write(stdout,'CREST runtime',verbose=.true.) 35 | time_total = tim%get() 36 | call tim%clear 37 | if(engrad_total > 0)then 38 | write(atmp,'(f30.3)') time_total/real(engrad_total,wp) 39 | write(stdout,'(" * Total number of energy+grad calls: ",i0)') & !,a,1x,a,a)') & 40 | & engrad_total!,' (avg. wall-time',trim(adjustl(atmp)),' sec)' 41 | write(stdout,*) 42 | call dump_restart() 43 | endif 44 | end subroutine eval_timer 45 | 46 | subroutine propquit(tim) 47 | use crest_parameters, only: stdout 48 | use crest_data 49 | implicit none 50 | type(timer) :: tim 51 | call eval_timer(tim) 52 | write (stdout,*) 'CREST terminated normally.' 53 | stop 54 | end subroutine propquit 55 | -------------------------------------------------------------------------------- /src/graphs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/adjacency.f90" 21 | "${dir}/dijkstra.f90" 22 | "${dir}/floydwarshall.f90" 23 | "${dir}/shortpath.f90" 24 | ) 25 | 26 | set(srcs ${srcs} PARENT_SCOPE) 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/graphs/floydwarshall.f90: -------------------------------------------------------------------------------- 1 | !=======================================================================! 2 | ! Taken from github.com/pprcht/shortestpaths 3 | ! under the MIT license and slightly modified 4 | !=======================================================================! 5 | 6 | module floydwarshall_mod 7 | use iso_fortran_env,wp => real64 8 | implicit none 9 | 10 | public :: FloydWarshall,getPathFW 11 | interface FloydWarshall 12 | module procedure :: FloydWarshall_classic 13 | module procedure :: FloydWarshall_simple 14 | end interface FloydWarshall 15 | 16 | 17 | !========================================================================================! 18 | !========================================================================================! 19 | contains !> MODULE PROCEDURES START HERE 20 | !========================================================================================! 21 | !========================================================================================! 22 | 23 | !> To run the Floyd-Warshall algorithm call the FloydWarshall() routine providing 24 | !> an adjacency matrix, distance matrix, and starting point, 25 | !> and then run getPathFW() to reconstruct the shortest path between two points. 26 | !> Compared to Dijkstra's algorithm this one provides the shortest paths between 27 | !> all vertices in one go. Though, for repeated executions it is more expensive. 28 | 29 | !========================================================================================! 30 | 31 | !>-- implementation of the algorithm including setup of "dist" and "prev" 32 | subroutine FloydWarshall_classic(V,A,E,dist,prev) 33 | implicit none 34 | !> INPUT 35 | integer,intent(in) :: V !> number of vertices (atoms) 36 | integer,intent(in) :: A(V,V) !> adjacency matrix 37 | real(wp),intent(in) :: E(V,V) !> edge length/distance matrix 38 | !> OUTPUT 39 | real(wp),intent(inout) :: dist(V,V) 40 | integer,intent(inout) :: prev(V,V) 41 | !> LOCAL 42 | real(wp) :: inf 43 | real(wp) :: kdist 44 | integer :: i,j,k 45 | 46 | inf = 2 * sum(E) 47 | !>-- set distances and previously visited nodes 48 | dist = inf 49 | prev = -1 50 | do i = 1,V 51 | do j = 1,V 52 | if (A(i,j) == 1) then 53 | dist(i,j) = E(i,j) 54 | prev(i,j) = j 55 | end if 56 | end do 57 | end do 58 | 59 | !>-- The algorithm is based on the following assumption: 60 | !> If a shortest path from vertex u to vertex v runns through a thrid 61 | !> vertex w, then the paths u-to-w and w-to-v are already minimal. 62 | !> Hence, the shorest paths are constructed by searching all path 63 | !> that run over an additional intermediate point k 64 | !> The following loop is the actual algorithm 65 | do k = 1,V 66 | do i = 1,V 67 | do j = 1,V 68 | kdist = dist(i,k) + dist(k,j) 69 | !>-- if the path ij runs over k, update 70 | if (dist(i,j) > kdist) then 71 | dist(i,j) = kdist 72 | prev(i,j) = prev(i,k) 73 | end if 74 | end do 75 | end do 76 | end do 77 | 78 | return 79 | end subroutine FloydWarshall_classic 80 | 81 | !>-- implementation of the algorithm without edge length matrix 82 | subroutine FloydWarshall_simple(V,A,dist,prev) 83 | implicit none 84 | !> INPUT 85 | integer,intent(in) :: V !> number of vertices (atoms) 86 | integer,intent(in) :: A(V,V) !> adjacency matrix 87 | !> OUTPUT 88 | real(wp),intent(inout) :: dist(V,V) 89 | integer,intent(inout) :: prev(V,V) 90 | !> LOCAL 91 | real(wp) :: inf 92 | real(wp) :: kdist 93 | integer :: i,j,k 94 | 95 | inf = 2 * float(sum(A)) 96 | !>-- set distances and previously visited nodes 97 | dist = inf 98 | prev = -1 99 | do i = 1,V 100 | do j = 1,V 101 | if (A(i,j) == 1) then 102 | dist(i,j) = float(A(i,j)) 103 | prev(i,j) = j 104 | end if 105 | end do 106 | end do 107 | 108 | !>-- The algorithm is based on the following assumption: 109 | !> If a shortest path from vertex u to vertex v runns through a thrid 110 | !> vertex w, then the paths u-to-w and w-to-v are already minimal. 111 | !> Hence, the shorest paths are constructed by searching all path 112 | !> that run over an additional intermediate point k 113 | !> The following loop is the actual algorithm 114 | do k = 1,V 115 | do i = 1,V 116 | do j = 1,V 117 | kdist = dist(i,k) + dist(k,j) 118 | !>-- if the path ij runs over k, update 119 | if (dist(i,j) > kdist) then 120 | dist(i,j) = kdist 121 | prev(i,j) = prev(i,k) 122 | end if 123 | end do 124 | end do 125 | end do 126 | 127 | return 128 | end subroutine FloydWarshall_simple 129 | 130 | 131 | !========================================================================================! 132 | 133 | !>-- reconstruct the path start to end for the Floyd-Warshall algorithm 134 | subroutine getPathFW(V,prev,start,end,path,lpath) 135 | implicit none 136 | integer :: V 137 | integer :: start 138 | integer :: end 139 | integer :: prev(V,V) 140 | integer :: path(V) 141 | integer :: lpath 142 | integer :: i,k 143 | if (prev(start,end) == -1) then 144 | path(1) = -1 145 | lpath = 0 146 | return 147 | end if 148 | k = 1 149 | path(k) = start 150 | i = start 151 | do while (i .ne. end) 152 | i = prev(i,end) 153 | k = k + 1 154 | path(k) = i 155 | end do 156 | lpath = k 157 | return 158 | end subroutine getPathFW 159 | 160 | !========================================================================================! 161 | 162 | end module floydwarshall_mod 163 | -------------------------------------------------------------------------------- /src/graphs/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'adjacency.f90', 19 | 'dijkstra.f90', 20 | 'floydwarshall.f90', 21 | 'shortpath.f90', 22 | ) 23 | -------------------------------------------------------------------------------- /src/legacy_algos/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/acidbase.f90" 21 | "${dir}/confscript2_main.f90" 22 | "${dir}/confscript2_misc.f90" 23 | "${dir}/confscript3.f90" 24 | "${dir}/confopt.f90" 25 | "${dir}/cregen_old.f90" 26 | "${dir}/deprotonate.f90" 27 | "${dir}/flexi.f90" 28 | "${dir}/ligands.f90" 29 | "${dir}/normmd.f90" 30 | "${dir}/pka.f90" 31 | "${dir}/protonate.f90" 32 | "${dir}/reactor.f90" 33 | "${dir}/relaxensemble.f90" 34 | "${dir}/stereoisomers.f90" 35 | "${dir}/tautomerize.f90" 36 | "${dir}/trialmd_legacy.f90" 37 | "${dir}/zsort.f90" 38 | ) 39 | 40 | set(srcs ${srcs} PARENT_SCOPE) 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/legacy_algos/flexi.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2023 Philipp Pracht, Stefan Grimme 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | subroutine nciflexi_legacy(env,flexval) 20 | use crest_parameters 21 | use crest_data 22 | use iomod 23 | use strucrd 24 | implicit none 25 | type(systemdata) :: env 26 | character(len=80) :: fname 27 | character(len=512) :: jobcall 28 | integer :: io,T,Tn 29 | logical :: ex 30 | real(wp) :: ehb,edisp 31 | real(wp) :: flexval 32 | type(coord) :: mol 33 | character(len=25) :: chrgflag 34 | character(len=*),parameter :: pipe = ' > xtb.out 2>/dev/null' 35 | 36 | !>--- get coordinates 37 | call env%ref%to( mol ) 38 | 39 | !>--- some options 40 | call remove('energy') 41 | call remove('charges') 42 | call remove('xtbrestart') 43 | 44 | !>--- setting threads 45 | call new_ompautoset(env,'auto',1,T,Tn) 46 | 47 | !>--- new plain coord file 48 | fname = 'tmp.coord' 49 | call mol%write(fname) 50 | write(chrgflag,'(a,i0)') '--chrg ',mol%chrg 51 | 52 | !>--- jobcall 53 | write (stdout,'(1x,a)',advance='no') 'Calculating NCI flexibility...' 54 | flush(stdout) 55 | jobcall = "" 56 | jobcall = trim(jobcall)//trim(env%ProgName) 57 | jobcall = trim(jobcall)//" "//trim(fname)//" --sp --gfnff" 58 | jobcall = trim(jobcall)//" "//trim(chrgflag) 59 | jobcall = trim(jobcall)//" "//trim(env%solv) 60 | jobcall = trim(jobcall)//pipe 61 | call command(trim(jobcall), io) 62 | 63 | !>--- read E(disp) and E(HB) from output 64 | call grepval('xtb.out','HB energy',ex,ehb) 65 | call grepval('xtb.out','dispersion energy',ex,edisp) 66 | 67 | write (stdout,'(a)') ' done.' 68 | 69 | !>--- normalize by number of atoms 70 | ehb = ehb/env%nat 71 | edisp = edisp/env%nat 72 | 73 | !>--- NCI flexi is determined RELATIVE to a reference molecule (Crambin) 74 | flexval = 0.5_wp*(1.0_wp-(ehb/(-0.00043374_wp))) 75 | flexval = flexval+0.5_wp*(1.0_wp-(edisp/(-0.00163029_wp))) 76 | 77 | !>--- cleanup 78 | call remove('xtb.out') 79 | call remove('energy') 80 | call remove('charges') 81 | if (env%chargesfile) then 82 | call env%wrtCHRG('') 83 | end if 84 | call remove('xtbrestart') 85 | call remove('xtbtopo.mol') 86 | 87 | return 88 | end subroutine nciflexi_legacy 89 | 90 | -------------------------------------------------------------------------------- /src/legacy_algos/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'acidbase.f90', 19 | 'confscript2_main.f90', 20 | 'confscript2_misc.f90', 21 | 'confscript3.f90', 22 | 'confopt.f90', 23 | 'cregen_old.f90', 24 | 'deprotonate.f90', 25 | 'flexi.f90', 26 | 'ligands.f90', 27 | 'normmd.f90', 28 | 'pka.f90', 29 | 'protonate.f90', 30 | 'reactor.f90', 31 | 'relaxensemble.f90', 32 | 'stereoisomers.f90', 33 | 'tautomerize.f90', 34 | 'trialmd_legacy.f90', 35 | 'zsort.f90', 36 | ) 37 | -------------------------------------------------------------------------------- /src/legacy_algos/relaxensemble.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !==================================================================! 21 | ! A function to be used in conjunction with the 22 | ! protonation/deprotonation/tautomerization tools 23 | ! --> relax a each generated structure by performing a (reduced) 24 | ! conformational search 25 | !==================================================================! 26 | subroutine relaxensemble(fname,env,tim) 27 | use crest_parameters 28 | use crest_data 29 | use strucrd 30 | use iomod 31 | use cregen_interface 32 | implicit none 33 | 34 | character(len=*) :: fname 35 | type(systemdata) :: env 36 | type(timer) :: tim 37 | 38 | integer :: nall 39 | integer :: nat 40 | real(wp),allocatable :: xyz(:,:,:) 41 | real(wp),allocatable :: c0(:,:) 42 | real(wp) :: energy 43 | real(wp),allocatable :: eread(:) 44 | integer,allocatable :: at(:) 45 | character(len=40),allocatable :: origin(:) 46 | 47 | integer :: i,r,ich 48 | 49 | character(len=:),allocatable :: relaxdir 50 | character(len=:),allocatable :: oname 51 | character(len=512) :: thisdir 52 | character(len=128) :: atmp 53 | 54 | !--- deactivate possible constraints of the strict modi 55 | if(env%protb%strictPDT .or. env%protb%fixPDT)then 56 | env%cts%used=.false. 57 | endif 58 | 59 | call getcwd(thisdir) 60 | relaxdir='RELAX' 61 | 62 | !--- read the ensemble 63 | call rdensembleparam(fname,nat,nall) 64 | if(nall.lt.1) return 65 | allocate(xyz(3,nat,nall),at(nat),eread(nall)) 66 | if(.not.env%trackorigin)then 67 | call rdensemble(fname,nat,nall,at,xyz,eread) 68 | else 69 | allocate(origin(nall)) 70 | call rdensemble_origin(fname,nat,nall,at,xyz,eread,origin) 71 | endif 72 | 73 | write(*,'(/)') 74 | call largehead('Relaxation of generated structures') 75 | !--- make the new subdir and change to it 76 | r = makedir(relaxdir) 77 | call chdir(relaxdir) 78 | 79 | !--- write .CHRG and .UHR files 80 | if(env%chrg.ne.0)then 81 | open(newunit=ich,file='.CHRG') 82 | write(ich,*)env%chrg 83 | close(ich) 84 | endif 85 | if(env%uhf.ne.0)then 86 | open(newunit=ich,file='.UHF') 87 | write(ich,*)env%uhf 88 | close(ich) 89 | endif 90 | 91 | allocate(c0(3,nat), source=0.0d0) 92 | 93 | !--- do the reduced conf. search for all the structures 94 | do i=1,nall 95 | !--- NOTE: all conformational searches are done in series and the Dir is cleared in between 96 | call V2cleanup(.false.) 97 | write(atmp,'(a,i0)') 'Structure ',i 98 | call largehead(trim(atmp)) 99 | call wrc0('coord',nat,at,xyz(:,:,i)/bohr) 100 | call confscript2i(env,tim) !MTD-GC algo 101 | !--- read the new best conformer 102 | call rdcoord('crest_best.xyz',nat,at,c0,energy) 103 | c0=c0*bohr 104 | xyz(:,:,i) = c0(:,:) 105 | eread(i) = energy 106 | !stop 107 | enddo 108 | 109 | call chdir(thisdir) 110 | 111 | !--- write the new ensemble file 112 | oname='relax.'//trim(fname) 113 | call wrensemble(oname,nat,nall,at,xyz,eread) 114 | 115 | deallocate(c0) 116 | if(allocated(origin))deallocate(origin) 117 | deallocate(eread,at,xyz) 118 | call rmrf(relaxdir) 119 | 120 | !energy sorting 121 | call largehead('Sorting relaxed ensemble') 122 | env%ensemblename=trim(oname) 123 | env%confgo = .true. 124 | call newcregen(env,6) 125 | env%confgo = .false. 126 | env%ensemblename='none selected' !RESET, IMPORTANT! 127 | call rename(trim(oname)//'.sorted',trim(oname)) 128 | 129 | 130 | return 131 | end subroutine relaxensemble 132 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | subdir('qcg') 18 | subdir('dynamics') 19 | subdir('calculator') 20 | subdir('optimize') 21 | subdir('algos') 22 | subdir('parsing') 23 | subdir('qmhelpers') 24 | subdir('graphs') 25 | subdir('rigidconf') 26 | subdir('discretize') 27 | subdir('entropy') 28 | subdir('legacy_algos') 29 | subdir('msreact') 30 | 31 | 32 | srcs += files( 33 | 'atmasses.f90', 34 | 'axis_module.f90', 35 | 'biasmerge.f90', 36 | 'bondconstraint.f90', 37 | 'canonical.f90', 38 | 'ccegen.f90', 39 | 'choose_settings.f90', 40 | 'classes.f90', 41 | 'cleanup.f90', 42 | 'cn.f90', 43 | 'compress.f90', 44 | 'confparse.f90', 45 | 'cregen.f90', 46 | 'crest_pars.f90', 47 | 'ensemblecomp.f90', 48 | 'eval_timer.f90', 49 | 'filemod.f90', 50 | 'flexi.F90', 51 | 'freqmasses.f90', 52 | 'geo.f90', 53 | 'identifiers.f90', 54 | 'internals.f90', 55 | 'internals2.f90', 56 | 'iomod.F90', 57 | 'legacy_wrappers.f90', 58 | 'ls_rmsd.f90', 59 | 'marqfit.f90', 60 | 'minitools.f90', 61 | 'miscdata.f90', 62 | 'ncigeo.f90', 63 | 'ompmklset.F90', 64 | 'printouts.f90', 65 | 'prmat.f90', 66 | 'propcalc.f90', 67 | 'quicksort.f90', 68 | 'readl.f90', 69 | 'restartlog.f90', 70 | 'rotcompare.f90', 71 | 'scratch.f90', 72 | 'sdfio.f90', 73 | 'select.f90', 74 | 'signal.c', 75 | 'sigterm.f90', 76 | 'sortens.f90', 77 | 'strucreader.f90', 78 | 'symmetry2.f90', 79 | 'symmetry_i.c', 80 | 'timer.f90', 81 | 'trackorigin.f90', 82 | 'utilmod.f90', 83 | 'wallsetup.f90', 84 | 'zdata.f90', 85 | 'ztopology.f90', 86 | ) 87 | 88 | prog += files( 89 | 'crest_main.f90', 90 | ) 91 | -------------------------------------------------------------------------------- /src/msreact/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/msreact.f90" 21 | "${dir}/msmod.f90" 22 | ) 23 | 24 | set(srcs ${srcs} PARENT_SCOPE) 25 | -------------------------------------------------------------------------------- /src/msreact/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'msreact.f90', 19 | 'msmod.f90', 20 | ) 21 | -------------------------------------------------------------------------------- /src/ncigeo.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !========================================================================================! 21 | ! calculate settings for an elipsoid wall potential 22 | !========================================================================================! 23 | subroutine wallpot(env) 24 | use crest_parameters 25 | use crest_data 26 | use strucrd,only:coord,get_atlist 27 | use axis_module 28 | use crest_calculator 29 | use wall_setup 30 | implicit none 31 | type(systemdata) :: env 32 | real(wp) :: rabc(3) 33 | logical :: pr = .false. 34 | type(coord) :: mol 35 | type(constraint) :: constr 36 | logical,allocatable :: atms(:) 37 | real(wp),parameter :: pi43 = pi*(4.0_wp/3.0_wp) 38 | real(wp),parameter :: third = 1.0_wp/3.0_wp 39 | real(wp),parameter :: kdefault = 298.15_wp !> xtb version doesn't use k 40 | real(wp),parameter :: betadefault = 50.0_wp !> polynomial default in xtb 41 | !=========================================================! 42 | 43 | !>--- read in coord 44 | call env%ref%to(mol) 45 | 46 | !>--- calculate the surrounding ellipsoid 47 | call boxpot_core(mol,rabc,potscal=env%potscal,potpad=env%potpad) 48 | 49 | !>--- write CMA transformed coord file and into memory 50 | env%ref%xyz = mol%xyz 51 | call mol%write('coord') 52 | 53 | if (.not.env%legacy) then 54 | !>--- add constraint in calculator framwork 55 | allocate (atms(mol%nat),source=.false.) 56 | if(allocated(env%potatlist))then 57 | call get_atlist(mol%nat,atms,env%potatlist,mol%at) !> selected atoms 58 | else 59 | atms(:) = .true. !> all atoms 60 | endif 61 | call constr%ellipsoid(mol%nat,atms,rabc,kdefault,betadefault,.true.) 62 | deallocate (atms) 63 | call constr%print(stdout) 64 | call env%calc%add(constr) 65 | else 66 | !>--- constraint in legacy framework 67 | 68 | allocate (env%cts%pots(10)) 69 | env%cts%pots = '' 70 | env%cts%NCI = .true. 71 | write (env%cts%pots(1),'("$wall")') 72 | write (env%cts%pots(2),'(2x,"potential=logfermi")') 73 | write (env%cts%pots(3),'(2x,"ellipsoid:",1x,3(g0,",",1x),"all")') rabc 74 | end if 75 | return 76 | end subroutine wallpot 77 | -------------------------------------------------------------------------------- /src/optimize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/ancopt.f90" 21 | "${dir}/gd.f90" 22 | "${dir}/rfo.f90" 23 | "${dir}/hessupdate.f90" 24 | "${dir}/modelhessian.f90" 25 | "${dir}/optimize_maths.f90" 26 | "${dir}/optimize_module.f90" 27 | "${dir}/optimize_type.f90" 28 | "${dir}/optutils.f90" 29 | ) 30 | 31 | set(srcs ${srcs} PARENT_SCOPE) 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/optimize/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'ancopt.f90', 19 | 'gd.f90', 20 | 'rfo.f90', 21 | 'hessupdate.f90', 22 | 'modelhessian.f90', 23 | 'optimize_maths.f90', 24 | 'optimize_module.f90', 25 | 'optimize_type.f90', 26 | 'optutils.f90', 27 | ) 28 | -------------------------------------------------------------------------------- /src/optimize/optimize_module.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2021 - 2022 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | ! 19 | ! Routines were adapted from the xtb code (github.com/grimme-lab/xtb) 20 | ! under the Open-source software LGPL-3.0 Licencse. 21 | !================================================================================! 22 | 23 | !> This module wrapps the different optimization algorithms, 24 | !> i.e., this is what can be called for geometry opt. 25 | 26 | module optimize_module 27 | use iso_fortran_env,only:wp => real64 28 | use crest_parameters 29 | use crest_calculator 30 | use strucrd 31 | use ancopt_module 32 | use gradientdescent_module 33 | use rfo_module 34 | use optimize_utils 35 | implicit none 36 | private 37 | 38 | public :: optimize_geometry 39 | public :: print_opt_data 40 | 41 | !========================================================================================! 42 | !========================================================================================! 43 | contains !> MODULE PROCEDURES START HERE 44 | !========================================================================================! 45 | !========================================================================================! 46 | 47 | subroutine optimize_geometry(mol,molnew,calc,etot,grd,pr,wr,iostatus) 48 | implicit none 49 | !> Input 50 | type(coord) :: mol 51 | type(calcdata) :: calc 52 | logical,intent(in) :: pr 53 | logical,intent(in) :: wr 54 | !> Output 55 | type(coord) :: molnew 56 | integer,intent(out) :: iostatus 57 | real(wp),intent(inout) :: etot 58 | real(wp),intent(inout) :: grd(3,mol%nat) 59 | 60 | iostatus = -1 61 | !> do NOT overwrite original geometry 62 | !$omp critical 63 | molnew%at = mol%at 64 | molnew%xyz = mol%xyz 65 | molnew%nat = mol%nat 66 | !$omp end critical 67 | 68 | !> Check for optimization-individual calculation setup 69 | if(calc%optnewinit)then 70 | !$omp critical 71 | call calc%dealloc_params() 72 | !$omp end critical 73 | endif 74 | 75 | !> initial singlepoint 76 | call engrad(molnew,calc,etot,grd,iostatus) 77 | 78 | !> optimization 79 | select case (calc%opt_engine) 80 | case ( 0) 81 | call ancopt(molnew,calc,etot,grd,pr,wr,iostatus) 82 | case ( 1) 83 | !> l-bfgs goes here 84 | write(stdout,'(a)') 'L-BFGS currently not implemented' 85 | stop 86 | case ( 2) 87 | !> rfo goes here 88 | call rfopt(molnew,calc,etot,grd,pr,wr,iostatus) 89 | case (-1) 90 | call gradientdescent(molnew,calc,etot,grd,pr,wr,iostatus) 91 | case default 92 | write(stdout,'(a)') 'Unknown optimization engine!' 93 | stop 94 | end select 95 | molnew%energy = etot 96 | return 97 | end subroutine optimize_geometry 98 | 99 | !========================================================================================! 100 | 101 | subroutine print_opt_data(calc,ich) 102 | implicit none 103 | type(calcdata) :: calc 104 | integer,intent(in) :: ich 105 | integer :: tight 106 | real(wp) :: ethr,gthr 107 | 108 | write (ich,'(1x,a)',advance='no') 'Optimization engine: ' 109 | select case (calc%opt_engine) 110 | case ( 0) 111 | write (ich,'(a)') 'ANCOPT' 112 | case ( 1) 113 | write (ich,'(a)') 'L-BFGS' 114 | case ( 2) 115 | write (ich,'(a)') 'RFO' 116 | case (-1) 117 | write (ich,'(a)') 'Gradient Descent' 118 | case default 119 | write(ich,'(a)') 'Unknown' 120 | end select 121 | if (calc%opt_engine >= 0) then 122 | write (ich,'(1x,a)',advance='no') 'Hessian update type: ' 123 | select case (calc%iupdat) 124 | case (0) 125 | write (ich,'(a)') 'BFGS' 126 | case (1) 127 | write (ich,'(a)') 'Powell' 128 | case (2) 129 | write (ich,'(a)') 'SR1' 130 | case (3) 131 | write (ich,'(a)') 'Bofill' 132 | case (4) 133 | write (ich,'(a)') 'Farkas-Schlegel' 134 | end select 135 | end if 136 | 137 | tight = calc%optlev 138 | call get_optthr(0,tight,calc,ethr,gthr) 139 | write (ich,'(1x,a,e10.3,a,e10.3,a)') 'E/G convergence criteria: ',& 140 | & ethr,' Eh,',gthr,' Eh/a0' 141 | 142 | write (ich,'(1x,a,i0)') 'maximum optimization steps: ',calc%maxcycle 143 | 144 | end subroutine print_opt_data 145 | 146 | !========================================================================================! 147 | !========================================================================================! 148 | end module optimize_module 149 | -------------------------------------------------------------------------------- /src/parsing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/confparse2.f90" 21 | "${dir}/constraining.f90" 22 | "${dir}/parse_block.f90" 23 | "${dir}/parse_calcdata.f90" 24 | "${dir}/parse_maindata.f90" 25 | "${dir}/parse_datastruct.f90" 26 | "${dir}/parse_xtbinput.f90" 27 | "${dir}/parse_csv.f90" 28 | "${dir}/parse_toml.F90" 29 | "${dir}/parse_inputfile.F90" 30 | "${dir}/parse_keyvalue.f90" 31 | ) 32 | 33 | set(srcs ${srcs} PARENT_SCOPE) 34 | 35 | -------------------------------------------------------------------------------- /src/parsing/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'confparse2.f90', 19 | 'constraining.f90', 20 | 'parse_block.f90', 21 | 'parse_calcdata.f90', 22 | 'parse_datastruct.f90', 23 | 'parse_maindata.f90', 24 | 'parse_xtbinput.f90', 25 | 'parse_csv.f90', 26 | 'parse_toml.F90', 27 | 'parse_inputfile.F90', 28 | 'parse_keyvalue.f90', 29 | ) 30 | -------------------------------------------------------------------------------- /src/parsing/parse_datastruct.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2022-2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | module parse_datastruct 21 | use crest_parameters 22 | use parse_keyvalue 23 | use parse_block 24 | use iomod,only:lowercase 25 | implicit none 26 | 27 | public :: root_object 28 | type :: root_object 29 | !> filename (if any) 30 | character(len=:),allocatable :: filename 31 | 32 | !> number & list of root key-value objects 33 | integer :: nkv = 0 34 | type(keyvalue),allocatable :: kv_list(:) 35 | 36 | !> number & list of blocks 37 | integer :: nblk = 0 38 | type(datablock),allocatable :: blk_list(:) 39 | 40 | contains 41 | procedure :: new => root_deallocate 42 | procedure :: deallocate => root_deallocate 43 | procedure :: addkv => root_addkv 44 | procedure :: addblk => root_addblk 45 | procedure :: lowercase_keys => root_lowercase_keys 46 | procedure :: print => root_print 47 | procedure :: print2 => root_print2 48 | end type root_object 49 | 50 | !========================================================================================! 51 | !========================================================================================! 52 | contains !> MODULE PROCEDURES START HERE 53 | !========================================================================================! 54 | !========================================================================================! 55 | subroutine root_deallocate(self) 56 | implicit none 57 | class(root_object) :: self 58 | self%nkv = 0 59 | if (allocated(self%kv_list)) deallocate (self%kv_list) 60 | self%nblk = 0 61 | if (allocated(self%blk_list)) deallocate (self%blk_list) 62 | return 63 | end subroutine root_deallocate 64 | 65 | subroutine root_addkv(self,kv) 66 | implicit none 67 | class(root_object) :: self 68 | type(keyvalue) :: kv 69 | type(keyvalue),allocatable :: newlist(:) 70 | integer :: i,j,ii 71 | i = self%nkv 72 | j = i+1 73 | allocate (newlist(j)) 74 | do ii=1,i 75 | newlist(ii) = self%kv_list(ii)%copy() 76 | enddo 77 | newlist(j) = kv%copy() 78 | call move_alloc(newlist,self%kv_list) 79 | self%nkv = j 80 | end subroutine root_addkv 81 | 82 | subroutine root_addblk(self,blk) 83 | implicit none 84 | class(root_object) :: self 85 | type(datablock) :: blk 86 | type(datablock),allocatable :: newlist(:) 87 | integer :: i,j 88 | i = self%nblk 89 | j = i+1 90 | allocate (newlist(j)) 91 | if(allocated(self%blk_list))then 92 | newlist(1:i) = self%blk_list(1:i) 93 | deallocate(self%blk_list) 94 | endif 95 | newlist(j) = blk 96 | !call move_alloc(newlist,self%blk_list) 97 | self%nblk = j 98 | allocate(self%blk_list, source=newlist) 99 | end subroutine root_addblk 100 | 101 | subroutine root_lowercase_keys(self) 102 | implicit none 103 | class(root_object) :: self 104 | integer :: i,j 105 | do i = 1,self%nkv 106 | self%kv_list(i)%key = lowercase(self%kv_list(i)%key) 107 | end do 108 | do i = 1,self%nblk 109 | self%blk_list(i)%header = lowercase(self%blk_list(i)%header) 110 | do j = 1,self%blk_list(i)%nkv 111 | self%blk_list(i)%kv_list(j)%key = lowercase(self%blk_list(i)%kv_list(j)%key) 112 | end do 113 | end do 114 | end subroutine root_lowercase_keys 115 | 116 | subroutine root_print(self) 117 | class(root_object) :: self 118 | integer :: i 119 | if (allocated(self%filename)) then 120 | write (stdout,'(1x,a)') self%filename 121 | end if 122 | do i = 1,self%nkv 123 | if (i < self%nkv) then 124 | write (stdout,'(1x,a,a)') '├──',trim(self%kv_list(i)%print()) 125 | else 126 | write (stdout,'(1x,a,a)') '└──',trim(self%kv_list(i)%print()) 127 | end if 128 | end do 129 | do i = 1,self%nblk 130 | call self%blk_list(i)%print() 131 | end do 132 | end subroutine root_print 133 | 134 | 135 | subroutine root_print2(self) 136 | class(root_object) :: self 137 | integer :: i 138 | if (allocated(self%filename)) then 139 | write(stdout,'(a)') repeat('*',80) 140 | write (stdout,'("*",1x,a,a,a)') 'INPUT FILE ',self%filename,' content (without comments):' 141 | end if 142 | write(stdout,'(a)') repeat('*',80) 143 | do i = 1,self%nkv 144 | write (stdout,'("*",1x,a)') trim(self%kv_list(i)%print2()) 145 | end do 146 | do i = 1,self%nblk 147 | call self%blk_list(i)%print2() 148 | end do 149 | write(stdout,'(a)') repeat('*',80) 150 | end subroutine root_print2 151 | 152 | 153 | !========================================================================================! 154 | end module parse_datastruct 155 | -------------------------------------------------------------------------------- /src/parsing/parse_inputfile.F90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | module parse_inputfile 21 | use crest_parameters 22 | use crest_data 23 | use parse_datastruct 24 | use parse_toml 25 | implicit none 26 | private 27 | 28 | public :: parse_test 29 | public :: parse_input 30 | 31 | external creststop 32 | 33 | !========================================================================================! 34 | !========================================================================================! 35 | contains !> MODULE PROCEDURES START HERE 36 | !========================================================================================! 37 | !========================================================================================! 38 | 39 | subroutine parse_test(fname) 40 | implicit none 41 | character(len=*) :: fname !> name of the input file 42 | type(root_object) :: dict 43 | call parse_input(fname,dict) 44 | call dict%print() 45 | return 46 | end subroutine parse_test 47 | 48 | !========================================================================================! 49 | 50 | subroutine parse_input(fname,dict) 51 | implicit none 52 | 53 | character(len=*) :: fname !> name of the input file 54 | type(root_object),intent(out) :: dict 55 | 56 | character(len=:),allocatable :: extension 57 | integer :: p 58 | logical :: ex 59 | 60 | !>-- check for existance of file 61 | inquire (file=fname,exist=ex) 62 | if (.not.ex) then 63 | return 64 | end if 65 | dict%filename = trim(fname) 66 | 67 | !>-- get file-type extension 68 | p = index(fname,'.',.true.) 69 | if (p .ne. 0) then 70 | extension = trim(fname(p:)) 71 | else 72 | extension = 'none' 73 | end if 74 | 75 | select case (extension) 76 | case default 77 | write (stdout,'(a,a)') 'Unknown file format of input file ',trim(fname) 78 | call creststop(status_input) 79 | case ('.toml') 80 | #ifdef WITH_TOMLF 81 | !>--- parse .toml file via the toml-f library (the DEFAULT setting) 82 | call parse_tomlf(fname,dict) 83 | #else 84 | !>--- or, as a fallback only, via the intrinisc routine 85 | call parse_toml_input_fallback(fname,dict) 86 | #endif 87 | end select 88 | 89 | end subroutine parse_input 90 | 91 | !========================================================================================! 92 | end module parse_inputfile 93 | -------------------------------------------------------------------------------- /src/qcg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/volume.f90" 21 | "${dir}/solvtool_misc.f90" 22 | "${dir}/solvtool.f90" 23 | ) 24 | 25 | set(srcs ${srcs} PARENT_SCOPE) 26 | -------------------------------------------------------------------------------- /src/qcg/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'solvtool.f90', 19 | 'solvtool_misc.f90', 20 | 'volume.f90', 21 | ) 22 | -------------------------------------------------------------------------------- /src/qmhelpers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/wiberg_mayer.f90" 21 | "${dir}/intpack.f90" 22 | "${dir}/lopt.f90" 23 | "${dir}/local.f90" 24 | ) 25 | 26 | set(srcs ${srcs} PARENT_SCOPE) 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/qmhelpers/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'wiberg_mayer.f90', 19 | 'intpack.f90', 20 | 'lopt.f90', 21 | 'local.f90', 22 | ) 23 | -------------------------------------------------------------------------------- /src/rigidconf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}") 18 | 19 | list(APPEND srcs 20 | "${dir}/rigidconf.f90" 21 | "${dir}/tree.f90" 22 | "${dir}/analyze.f90" 23 | "${dir}/reconstruct.f90" 24 | ) 25 | 26 | set(srcs ${srcs} PARENT_SCOPE) 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/rigidconf/meson.build: -------------------------------------------------------------------------------- 1 | # This file is part of crest. 2 | # SPDX-Identifier: LGPL-3.0-or-later 3 | # 4 | # crest is free software: you can redistribute it and/or modify it under 5 | # the terms of the GNU Lesser General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # crest is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public License 15 | # along with crest. If not, see . 16 | 17 | srcs += files( 18 | 'rigidconf.f90', 19 | 'tree.f90', 20 | 'analyze.f90', 21 | 'reconstruct.f90', 22 | ) 23 | -------------------------------------------------------------------------------- /src/rigidconf/reconstruct.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht, Christopher Zurek, Christoph Bannwarth 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | ! 19 | ! Routines were adapted from the xtb code (github.com/grimme-lab/xtb) 20 | ! under the Open-source software LGPL-3.0 Licencse. 21 | !================================================================================! 22 | 23 | !========================================================================================! 24 | !========================================================================================! 25 | subroutine construct_new_zmat(nat,zmat,combi,ndieder,dvalues,dstep,ztod,zmat_new) 26 | !************************************************************ 27 | !* Given a reference zmatrix and information about 28 | !* dihedral angles, this routine constructs a new zmatrix 29 | !* 30 | !* Input: 31 | !* zmat,ndieder,dvalues,ztod,dstep,combi 32 | !* 33 | !* Output: 34 | !* zmat_new 35 | !* 36 | !************************************************************ 37 | use crest_parameters 38 | use geo 39 | implicit none 40 | !> INPUT 41 | integer,intent(in) :: nat 42 | real(wp),intent(in) :: zmat(3,nat) 43 | integer,intent(in) :: ndieder 44 | integer(int8),intent(in) :: combi(ndieder) 45 | integer,intent(in) :: dvalues(ndieder) 46 | real(wp),intent(in) :: dstep(ndieder) 47 | integer,intent(in) :: ztod(nat) 48 | !> OUTPUT 49 | real(wp),intent(out) :: zmat_new(3,nat) 50 | !> LOCAL 51 | integer :: V,i,j,k,l,m 52 | real(wp) :: xref,xnew 53 | !========================================================================================! 54 | 55 | zmat_new(:,:) = zmat(:,:) 56 | do i = 1,ndieder 57 | do j = 1,nat 58 | if (ztod(j) == i) then 59 | xref = zmat(3,j)+((float(combi(i))-1.0_wp)*dstep(i)) 60 | xnew = angleshift(xref) 61 | zmat_new(3,j) = xnew 62 | end if 63 | end do 64 | end do 65 | 66 | return 67 | end subroutine construct_new_zmat 68 | !========================================================================================! 69 | !========================================================================================! 70 | subroutine reconstruct_zmat_to_mol(nat,at,zmat,na,nb,nc,mol) 71 | use crest_parameters 72 | use strucrd 73 | use INTERNALS_mod,only:GMETRY2 74 | implicit none 75 | !> INPUT 76 | integer,intent(in) :: nat 77 | integer,intent(in) :: at(nat) 78 | real(wp),intent(in) :: zmat(3,nat) 79 | integer,intent(in) :: na(nat),nb(nat),nc(nat) 80 | !> OUTPUT 81 | type(coord),intent(out) :: mol 82 | 83 | call mol%deallocate() 84 | allocate (mol%at(nat)) 85 | allocate (mol%xyz(3,nat)) 86 | mol%nat = nat 87 | mol%at = at 88 | call GMETRY2(nat,zmat,mol%xyz,na,nb,nc) 89 | end subroutine reconstruct_zmat_to_mol 90 | 91 | -------------------------------------------------------------------------------- /src/rigidconf/rigidconf.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023 Philipp Pracht, Christopher Zurek, Christoph Bannwarth 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | ! 19 | ! Routines were adapted from the xtb code (github.com/grimme-lab/xtb) 20 | ! under the Open-source software LGPL-3.0 Licencse. 21 | !================================================================================! 22 | 23 | !========================================================================================! 24 | !========================================================================================! 25 | subroutine crest_rigidconf(env,tim) 26 | !************************************************************ 27 | !* Standalone runtype for conformer generation 28 | !* based on chemoinformatic principles. 29 | !* 30 | !* Input: 31 | !* env - CREST's systemdata 32 | !* tim - CREST's timer object 33 | !* 34 | !************************************************************ 35 | use crest_parameters 36 | use crest_data 37 | use strucrd 38 | implicit none 39 | !> INPUT/OUTPUT 40 | type(systemdata),intent(inout) :: env 41 | type(timer),intent(inout) :: tim 42 | !> LOCAL 43 | type(coord) :: start_mol 44 | 45 | !========================================================================================! 46 | call this_header() 47 | call tim%start(14,'rule-based isomer generation') 48 | 49 | !>--- some calculation info should be printed out at this point. TODO 50 | 51 | !========================================================================================! 52 | !>--- get structure from reference 53 | call env%ref%to(start_mol) 54 | write (stdout,*) 55 | call smallhead('Input structure:') 56 | call start_mol%append(stdout) 57 | write (stdout,*) 58 | 59 | !========================================================================================! 60 | !>--- pass the structure to the desired algorithm 61 | select case (env%rigidconf_algo) 62 | !case ( 1 ) !> "genetic crossing"-type algo 63 | 64 | ! 65 | 66 | case default !> straight-forward generation ("tree"-type algo) 67 | 68 | call rigidconf_tree(env,start_mol) 69 | 70 | end select 71 | 72 | !========================================================================================! 73 | call tim%stop(14) 74 | return 75 | !========================================================================================! 76 | contains 77 | !========================================================================================! 78 | subroutine this_header 79 | implicit none 80 | write (stdout,'(/)') 81 | write (stdout,'(7x,"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓")') 82 | write (stdout,'(7x,"┃ R I G I D C O N F ┃ ")') 83 | write (stdout,'(7x,"┃ (name is work-in-progress) ┃ ")') 84 | !write(stdout,'(7x,"┃ R i C o ┃")') 85 | !write(stdout,'(7x,"┃ ConfAcc ┃")') 86 | write (stdout,'(7x,"┃ rule-based conformer generator ┃")') 87 | write (stdout,'(7x,"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛")') 88 | !write(stdout,'(12x,"C.Zurek, C.Bannwarth, P.Pracht")') 89 | !write(stdout,*) 90 | end subroutine this_header 91 | end subroutine crest_rigidconf 92 | !========================================================================================! 93 | !========================================================================================! 94 | -------------------------------------------------------------------------------- /src/scratch.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !> scratch directory handling (for simplicity just use shell commands) 21 | 22 | !=========================================================================================! 23 | subroutine scrdir(env) 24 | use crest_parameters 25 | use crest_data 26 | use iomod 27 | type(systemdata) :: env ! MAIN STORAGE OS SYSTEM DATA 28 | integer :: ich,io 29 | 30 | if (len_trim(env%scratchdir) .lt. 1) then 31 | call command('mktemp -d > tmpconf 2>/dev/null',io) 32 | open (newunit=ich,file='tmpconf') 33 | read (ich,'(a)',iostat=io) env%scratchdir 34 | if (io < 0) then ! if mktemp failed and tmpconf is empty 35 | env%scratchdir = '' 36 | error stop 'Failed to create scratch directory!' 37 | return 38 | end if 39 | close (ich,status='delete') 40 | end if 41 | 42 | write (stdout,'(a,a)') 'Home directory : ',trim(env%homedir) 43 | write (stdout,'(a,a)') 'Using scratch directory : ',trim((env%scratchdir)) 44 | io = makedir(trim(env%scratchdir)) 45 | 46 | call copy('.CHRG',trim(env%scratchdir)//'/'//'.CHRG') 47 | call copy('.UHF',trim(env%scratchdir)//'/'//'.UHF') 48 | 49 | write (stdout,'(a)',advance='no') 'Copying data to scratch directory ...' 50 | flush (stdout) 51 | call command('scp -r ./* '//trim(env%scratchdir)//'/') 52 | write (stdout,*) 'done.' 53 | 54 | call chdir(trim(env%scratchdir)) 55 | 56 | end subroutine scrdir 57 | 58 | subroutine scrend(env) 59 | use crest_parameters 60 | use crest_data 61 | use iomod 62 | type(systemdata) :: env ! MAIN STORAGE OS SYSTEM DATA 63 | character(len=1024) :: crefi,crefi2 64 | logical :: ex 65 | 66 | if (len_trim(env%scratchdir) .lt. 1) then 67 | return 68 | end if 69 | 70 | write (stdout,'(/,a)',advance='no') 'Retrieving data from scratch directory ...' 71 | flush (stdout) 72 | call command('scp -r '//trim(env%scratchdir)//'/* '//trim(env%homedir)//'/') 73 | write (stdout,*) 'done.' 74 | 75 | if (.not.env%keepScratch) then 76 | write (stdout,'(a)',advance='no') 'Removing scratch directory ...' 77 | flush (stdout) 78 | call rmrf(env%scratchdir) 79 | write (stdout,*) 'done.' 80 | end if 81 | 82 | return 83 | end subroutine scrend 84 | -------------------------------------------------------------------------------- /src/sdfio.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !--------------------------------------------------------------------------------- 21 | ! Routines for the handling of molecules in the chemoinformatical *.SDF format 22 | !--------------------------------------------------------------------------------- 23 | subroutine inpsdf(env,fname) 24 | use iso_fortran_env,only:wp => real64 25 | use crest_data 26 | use strucrd 27 | implicit none 28 | type(systemdata) :: env 29 | character(len=*) :: fname 30 | type(coord) :: mol 31 | integer :: i 32 | env%sdfformat = .true. 33 | call checkcoordtype(fname,i) 34 | if (any((/31,32/) == i)) then 35 | call mol%open(fname) 36 | else 37 | error stop 'file not in sdf format' 38 | end if 39 | return 40 | end subroutine inpsdf 41 | 42 | subroutine new_wrsdfens(env,fname,oname,conf) 43 | use iso_fortran_env,only:wp => real64 44 | use iomod 45 | use crest_data 46 | use strucrd 47 | use zdata,only:readwbo 48 | implicit none 49 | type(systemdata) :: env 50 | character(len=*),intent(in) :: fname 51 | character(len=*),intent(in) :: oname 52 | logical,intent(in),optional :: conf 53 | integer :: nat,nall 54 | integer,allocatable :: at(:) 55 | real(wp),allocatable :: eread(:) 56 | real(wp),allocatable :: xyz(:,:,:) 57 | real(wp),allocatable :: c0(:,:) 58 | real(wp),allocatable :: wbo(:,:) 59 | real(wp),allocatable :: icharges(:) 60 | integer :: i,j,ich 61 | real(wp) :: er 62 | logical :: ex,loopwbo,atmchrg 63 | character(len=120) :: sdfcomment 64 | loopwbo = .false. 65 | atmchrg = .false. 66 | if (present(conf)) loopwbo = conf 67 | !>--- read existing ensemble 68 | call rdensembleparam(fname,nat,nall) 69 | allocate (at(nat),eread(nat),xyz(3,nat,nall)) 70 | call rdensemble(fname,nat,nall,at,xyz,eread) 71 | allocate (wbo(nat,nat),c0(3,nat),source=0.0_wp) 72 | !>--- determine how to obtain wbos 73 | wbo = 0.0_wp 74 | inquire (file='wbo',exist=ex) 75 | if (ex.and..not.loopwbo) then 76 | call readwbo('wbo',nat,wbo) 77 | elseif (.not.ex.and..not.loopwbo) then 78 | call xtbsp(env,0) !> gfn0 singlepoint 79 | call readwbo('wbo',nat,wbo) 80 | end if 81 | !>--- (optional) some special settings 82 | if (env%properties == p_protonate) atmchrg = .true. 83 | 84 | if (atmchrg) allocate (icharges(nat),source=0.0_wp) 85 | 86 | !>--- open sdf output file 87 | open (newunit=ich,file=oname) 88 | do i = 1,nall 89 | write (sdfcomment,'(a,i0,a,i0)') 'structure ',i,' of ',nall 90 | c0(1:3,1:nat) = xyz(1:3,1:nat,i) 91 | er = eread(i) 92 | if (loopwbo) then 93 | call wrxyz('tmpstruc.xyz',nat,at,c0) 94 | call xtbsp2('tmpstruc.xyz',env) !> singlepoint for wbos 95 | call readwbo('wbo',nat,wbo) 96 | end if 97 | if (atmchrg) then 98 | if (env%properties == p_protonate) then 99 | call set_prot_icharges(nat,wbo,icharges) 100 | end if 101 | call wrsdf(ich,nat,at,c0,er,env%chrg,wbo,sdfcomment,icharges) 102 | else 103 | call wrsdf(ich,nat,at,c0,er,env%chrg,wbo,sdfcomment) 104 | end if 105 | end do 106 | close (ich) 107 | 108 | if (allocated(icharges)) deallocate (icharges) 109 | deallocate (c0,wbo,xyz,eread,at) 110 | 111 | contains 112 | subroutine set_prot_icharges(nat,wbo,icharges) 113 | !>--- special routine for protonation mode 114 | ! find the atom on which the proton was set 115 | ! and set its charge to 1. The added proton is 116 | ! always the last in the list, k=nat 117 | integer,intent(in) :: nat 118 | real(wp),intent(in) :: wbo(nat,nat) 119 | real(wp),intent(out) :: icharges(nat) 120 | integer :: i,j,k 121 | icharges = 0.0_wp 122 | k = nat 123 | do i = 1,nat 124 | if (nint(wbo(i,k)) .ne. 0) then 125 | icharges(i) = 1.0_wp 126 | end if 127 | end do 128 | return 129 | end subroutine set_prot_icharges 130 | end subroutine new_wrsdfens 131 | -------------------------------------------------------------------------------- /src/select.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !=================================================================! 21 | ! subroutine mrec 22 | ! molcount: number of total fragments (increased during search) 23 | ! xyz: overall Cart. coordinates 24 | ! nat: overall number of atoms 25 | ! at: atomic number array 26 | ! molvec: assignment vector of atom to fragment 27 | !=================================================================! 28 | subroutine mrec(molcount,xyz,nat,at,molvec) 29 | use crest_parameters 30 | use crest_cn_module 31 | implicit none 32 | real(wp) :: xyz(3,nat),cn(nat),bond(nat,nat) 33 | integer :: nat,molvec(nat),i,molcount,at(nat) 34 | logical :: taken(nat) 35 | molvec = 0 36 | molcount = 1 37 | taken = .false. 38 | cn = 0.0d0 39 | bond = 0.0d0 40 | call calc_ncoord(nat,at,xyz,cn,bond) 41 | do i = 1,nat 42 | if (.not.taken(i)) then 43 | molvec(i) = molcount 44 | taken(i) = .true. 45 | call neighbours(i,xyz,at,taken,nat,cn,bond,molvec,molcount) 46 | molcount = molcount+1 47 | end if 48 | end do 49 | molcount = molcount-1 50 | end subroutine mrec 51 | 52 | !=================================================================! 53 | ! subroutine mreclm 54 | ! a variant of the mrec routine with less allocate statements 55 | ! should be faster than the old version if several thousand 56 | ! calls are done. 57 | !=================================================================! 58 | subroutine mreclm(molcount,nat,at,xyz,molvec,bond,rcov,cn) 59 | use iso_fortran_env,only:wp => real64 60 | use crest_cn_module 61 | implicit none 62 | integer :: molcount,nat 63 | integer :: at(nat),molvec(nat) 64 | real(wp) :: xyz(3,nat) 65 | real(wp) :: cn(nat),bond(nat,nat) 66 | real(wp) :: bref(nat,nat) 67 | real(wp) :: rcov(*) 68 | integer :: i 69 | logical :: taken(nat) 70 | molvec = 0 71 | molcount = 1 72 | taken = .false. 73 | cn = 0.0d0 74 | bond = 0.0d0 75 | call calc_ncoord(nat,at,xyz,rcov,cn,400.0_wp,bond) 76 | bref = bond 77 | do i = 1,nat 78 | if (.not.taken(i)) then 79 | molvec(i) = molcount 80 | taken(i) = .true. 81 | call neighbours(i,xyz,at,taken,nat,cn,bond,molvec,molcount) 82 | molcount = molcount+1 83 | end if 84 | end do 85 | molcount = molcount-1 86 | bond = bref 87 | end subroutine mreclm 88 | 89 | !==================================================================================! 90 | recursive subroutine neighbours(i,xyz,iat,taken,nat,cn,bond,molvec,molcnt) 91 | use crest_parameters 92 | implicit none 93 | real(wp) :: xyz(3,nat),tr,xi(3),cn(nat),bond(nat,nat) 94 | integer :: i,nat,molcnt,molvec(nat),j,iat(nat),icn,k 95 | logical :: taken(nat) 96 | tr = 2.0d0 97 | 98 | xi(1:3) = xyz(1:3,i) 99 | icn = nint(cn(i)) 100 | do k = 1,icn 101 | j = maxloc(bond(:,i),1) 102 | bond(j,i) = 0.0d0 103 | if (i .eq. j) cycle 104 | if (.not.taken(j)) then 105 | molvec(j) = molcnt 106 | taken(j) = .true. 107 | call neighbours(j,xyz,iat,taken,nat,cn,bond,molvec,molcnt) 108 | end if 109 | end do 110 | end subroutine neighbours 111 | 112 | !========================================================================================! 113 | 114 | subroutine neighdist(natoms,at,xyz,nb,dist) 115 | use crest_parameters 116 | use miscdata,only:rad => rcov 117 | implicit none 118 | integer :: at(natoms),natoms,nb(200,natoms) 119 | real(wp) :: xyz(3,natoms),dist(natoms,natoms) 120 | logical :: da 121 | integer :: iat,i,j,k,nn 122 | real(wp) :: dx,dy,dz,r,rco,r2,f 123 | 124 | nb = 0 125 | nn = min(natoms,2)-1 126 | 127 | do i = 1,natoms 128 | f = 1.0d0 129 | k = 0 130 | do while (k .lt. 1.and.f .lt. 1.5d0) 131 | 100 do iat = 1,natoms 132 | da = .false. 133 | do j = 1,k 134 | if (nb(j,i) .eq. iat) da = .true. 135 | end do 136 | dx = xyz(1,iat)-xyz(1,i) 137 | dy = xyz(2,iat)-xyz(2,i) 138 | dz = xyz(3,iat)-xyz(3,i) 139 | r2 = dx*dx+dy*dy+dz*dz 140 | r = sqrt(r2) 141 | dist(iat,i) = r 142 | if (iat .ne. i.and.(.not.da)) then 143 | rco = rad(at(i))+rad(at(iat)) 144 | !>-- critical step 145 | if (r .lt. f*rco.and.k .lt. 199) then 146 | k = k+1 147 | nb(k,i) = iat 148 | end if 149 | end if 150 | end do 151 | !if(k.lt.1.and.f.lt.1.5)then 152 | f = f*1.1d0 153 | ! goto 100 154 | !endif 155 | end do 156 | nb(200,i) = k 157 | end do 158 | 159 | end subroutine neighdist 160 | 161 | -------------------------------------------------------------------------------- /src/signal.c: -------------------------------------------------------------------------------- 1 | /* 2 | * --- taken from the internet --- 3 | * 4 | * It overrides the FORTRAN intrinsic signal routine 5 | * and gives the possibility to use custom signal 6 | * handlers instead of the standard ones, pretty simple 7 | * code but actually impossible to do with FORTRAN only. 8 | */ 9 | #include 10 | 11 | typedef void (*sighandler_t)(int); 12 | 13 | void signal_( int* signum, sighandler_t handler) 14 | { 15 | signal(*signum, handler); 16 | } 17 | -------------------------------------------------------------------------------- /src/sigterm.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2023-2024 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | subroutine creststop(io) 21 | use crest_parameters 22 | use crest_data 23 | implicit none 24 | integer,intent(in) :: io 25 | 26 | select case(io) 27 | case (status_normal) 28 | write (stdout,*) 'CREST terminated normally.' 29 | case default 30 | write (stdout,*) 'CREST terminated abnormally.' 31 | case ( status_error ) 32 | write (stdout,*) 'CREST terminated with errors.' 33 | case ( status_ioerr ) 34 | write (stdout,*) 'CREST terminated with I/O errors.' 35 | case ( status_args ) 36 | write (stdout,*) 'CREST terminated due to invalid parameters.' 37 | case ( status_input ) 38 | write (stdout,*) 'CREST terminated due to failed input file read.' 39 | case ( status_config ) 40 | write (stdout,*) 'CREST terminated due to invalid configuration.' 41 | case ( status_failed ) 42 | write (stdout,*) 'CREST terminated with failures.' 43 | case ( status_safety ) 44 | write (stdout,*) 'Safety termination of CREST.' 45 | end select 46 | call exit(io) 47 | 48 | end subroutine creststop 49 | 50 | !================================================================================! 51 | !CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC! 52 | !================================================================================! 53 | 54 | subroutine wsigint !> Ctrl+C 55 | use crest_parameters,only:stderr,stdout 56 | use crest_restartlog,only:dump_restart 57 | use ConfSolv_module 58 | integer :: myunit,io 59 | write (*,*) 60 | write (stderr,'(" recieved SIGINT, trying to terminate CREST...")') 61 | !call dump_restart() 62 | call cs_shutdown(io) 63 | call exit(130) 64 | error stop 65 | end subroutine wsigint 66 | 67 | subroutine wsigquit !> Ctrl+D or Ctrl+\ 68 | use crest_parameters,only:stderr,stdout 69 | use crest_restartlog,only:dump_restart 70 | use ConfSolv_module 71 | integer :: myunit,io 72 | write (*,*) 73 | write (stderr,'(" recieved SIGQUIT, trying to terminate CREST...")') 74 | !call dump_restart() 75 | call cs_shutdown(io) 76 | call exit(131) 77 | error stop 78 | end subroutine wsigquit 79 | 80 | subroutine wsigterm !> Recieved by the "kill" pid command 81 | use crest_parameters,only:stderr,stdout 82 | use crest_restartlog,only:dump_restart 83 | use ConfSolv_module 84 | integer :: io 85 | write (stdout,*) 86 | write (stderr,'(" recieved SIGTERM, trying to terminate CREST...")') 87 | !call dump_restart() 88 | call cs_shutdown(io) 89 | call exit(143) 90 | error stop 91 | end subroutine wsigterm 92 | 93 | subroutine wsigkill 94 | use crest_parameters,only:stderr,stdout 95 | use crest_restartlog,only:dump_restart 96 | use ConfSolv_module 97 | integer :: io 98 | !call dump_restart() 99 | call cs_shutdown(io) 100 | call exit(137) 101 | error stop 'CREST recieved SIGKILL.' 102 | end subroutine wsigkill 103 | 104 | subroutine initsignal() 105 | external :: wSIGINT 106 | external :: wSIGTERM 107 | external :: wSIGKILL 108 | external :: wSIGQUIT 109 | 110 | call signal(2,wSIGINT) 111 | call signal(3,wSIGQUIT) 112 | call signal(9,wSIGKILL) 113 | call signal(15,wSIGTERM) 114 | call signal(69,wSIGINT) 115 | end subroutine initsignal 116 | 117 | -------------------------------------------------------------------------------- /src/sortens.f90: -------------------------------------------------------------------------------- 1 | !================================================================================! 2 | ! This file is part of crest. 3 | ! 4 | ! Copyright (C) 2018-2020 Philipp Pracht 5 | ! 6 | ! crest is free software: you can redistribute it and/or modify it under 7 | ! the terms of the GNU Lesser General Public License as published by 8 | ! the Free Software Foundation, either version 3 of the License, or 9 | ! (at your option) any later version. 10 | ! 11 | ! crest is distributed in the hope that it will be useful, 12 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | ! GNU Lesser General Public License for more details. 15 | ! 16 | ! You should have received a copy of the GNU Lesser General Public License 17 | ! along with crest. If not, see . 18 | !================================================================================! 19 | 20 | !! ------------------------------------------------------------------ 21 | ! Sort ensemble file according to different criteria 22 | !! ------------------------------------------------------------------ 23 | subroutine sort_ens(sort,infile,verbose) 24 | use crest_parameters 25 | use crest_data 26 | use strucrd,only:rdensembleparam,rdensemble,wrxyz 27 | implicit none 28 | type(protobj) :: sort 29 | 30 | character(len=*),intent(in) :: infile 31 | 32 | integer :: n 33 | integer :: nall 34 | real(wp),allocatable :: xyz(:,:,:) 35 | real(wp),allocatable :: xyz_new(:,:,:) 36 | real(wp),allocatable :: eread(:) 37 | real(wp),allocatable :: e_new(:) 38 | integer,allocatable :: at(:) 39 | real(wp) :: e_rel 40 | 41 | real(wp),allocatable :: xdum(:,:) 42 | integer,allocatable :: molvec(:) 43 | integer :: frag 44 | integer :: minl,minll(1) 45 | integer :: i,k 46 | integer :: ich,ochan 47 | real(wp) :: dE 48 | logical :: verbose 49 | character(len=128) :: atmp 50 | 51 | real(wp),parameter :: kcal = 627.5095_wp 52 | 53 | ochan = 6 !stdout 54 | 55 | !sort=env%protb 56 | 57 | associate (& 58 | & allowFrag => sort%allowFrag,ewin => sort%ewin, & 59 | & protdeprot => sort%protdeprot,deprotprot => sort%deprotprot, & 60 | & nfrag => sort%nfrag,threshsort => sort%threshsort) 61 | 62 | call rdensembleparam(infile,n,nall) 63 | allocate (xyz(3,n,nall),eread(nall),at(n),xyz_new(3,n,nall),e_new(nall)) 64 | call rdensemble(infile,n,nall,at,xyz,eread) 65 | 66 | !--- sort ensemble for energy 67 | do i = 1,nall 68 | minll = minloc(eread) 69 | minl = minll(1) 70 | e_new(i) = eread(minl) 71 | xyz_new(:,:,i) = xyz(:,:,minl) 72 | eread(minl) = 0.0_wp 73 | end do 74 | 75 | !--- sort out structures that dissociated in the process (if requested) 76 | if (.not.allowFrag) then 77 | k = 0 78 | allocate (xdum(3,n),molvec(n)) 79 | do i = 1,nall 80 | xdum(:,:) = xyz_new(:,:,i)/bohr 81 | call mrec(frag,xdum,n,at,molvec) 82 | if (frag .gt. nfrag) then 83 | e_new(i) = 0.0_wp ! structures with E=0.0 are not written to file 84 | k = k+1 85 | end if 86 | end do 87 | deallocate (molvec,xdum) 88 | if (k .gt. 0) then 89 | write (*,'(1x,''Structures sorted out due to dissociation:'',i5)') k 90 | end if 91 | end if 92 | 93 | !--- apply threshold within tautomerization sorting 94 | if (threshsort) then 95 | do i = 1,nall 96 | if (e_new(i) .lt. 0.0_wp) then 97 | e_rel = (e_new(i)-minval(e_new))*kcal 98 | if (e_rel .gt. ewin) e_new(i) = 0.0_wp !will not be included 99 | end if 100 | end do 101 | end if 102 | 103 | !--- write the ensemble file sorted 104 | open (file=infile,newunit=ich) 105 | do i = 1,nall 106 | if (e_new(i) .lt. 0.0_wp) then 107 | write (atmp,*) e_new(i) 108 | call wrxyz(ich,n,at,xyz_new(:,:,i),atmp) 109 | end if 110 | end do 111 | close (ich) 112 | 113 | !--- printout? 114 | if (verbose) then 115 | write (ochan,*) 116 | write (ochan,'(a)') '===================================================' 117 | write (ochan,'(a)') '============= ordered structure list ==============' 118 | write (ochan,'(a)') '===================================================' 119 | write (ochan,'(a,a,a)') ' written to file <',trim(infile),'>' 120 | write (ochan,*) 121 | write (ochan,'('' structure ΔE(kcal/mol) Etot(Eh)'')') 122 | do i = 1,nall 123 | dE = (e_new(i)-e_new(1))*kcal 124 | write (ochan,'(i5,6x,F10.2,4x,F14.6)') i,dE,e_new(i) 125 | end do 126 | write (ochan,*) 127 | end if 128 | !--- deallocate 129 | deallocate (e_new,xyz_new,at,eread,xyz) 130 | 131 | end associate 132 | end subroutine sort_ens 133 | -------------------------------------------------------------------------------- /src/symmetry2.f90: -------------------------------------------------------------------------------- 1 | ! This file is part of xtb, modified for crest 2 | ! 3 | ! Copyright (C) 2017-2020 Stefan Grimme 4 | ! 5 | ! xtb is free software: you can redistribute it and/or modify it under 6 | ! the terms of the GNU Lesser General Public License as published by 7 | ! the Free Software Foundation, either version 3 of the License, or 8 | ! (at your option) any later version. 9 | ! 10 | ! xtb is distributed in the hope that it will be useful, 11 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ! GNU Lesser General Public License for more details. 14 | ! 15 | ! You should have received a copy of the GNU Lesser General Public License 16 | ! along with xtb. If not, see . 17 | 18 | Subroutine get_schoenflies(n,iat,xyz,sfsym,paramar) 19 | Use iso_c_binding 20 | Implicit None 21 | integer,parameter :: wp = selected_real_kind(15,307) 22 | 23 | Interface c_interface 24 | !Interface to c routine for symmetry recognition 25 | !attypes are Atom types as integers (e.g 6 for Carbon etc...) 26 | !coord must be ``one dimensional'' sequential(!) arrays of doubles 27 | !symbol is the recognized schoenflies symbol 28 | Subroutine schoenflies(natoms,attypes,coord,symbol,paramar) & 29 | & bind(C,name="schoenflies") 30 | Use iso_c_binding 31 | import 32 | Implicit None 33 | Integer(c_int),Intent(In),value :: natoms 34 | integer(c_int),intent(in) :: attypes(*) 35 | real(c_double),intent(in) :: coord(3,*) 36 | Character(kind=c_char),Intent(out) :: symbol(*) 37 | real(c_double),intent(in) :: paramar(*) 38 | End Subroutine schoenflies 39 | End Interface c_interface 40 | 41 | !Dummy Arguments 42 | Character(Len=*) :: sfsym 43 | Integer,Intent(In) :: n 44 | Integer,Intent(In) :: iat(n) 45 | Real(wp),Intent(In) :: xyz(3,n) 46 | Real(wp),Intent(In) :: paramar(11) 47 | 48 | !local variables for passing to c routine: 49 | Integer(c_int) :: natoms 50 | Integer(c_int),Allocatable,Dimension(:) :: attypes 51 | Real(c_double),Allocatable,Dimension(:,:) :: coord 52 | Real(c_double),Allocatable,Dimension(:) :: c_paramar 53 | character(kind=c_char) :: symbol(6) 54 | 55 | !local stack: 56 | Integer :: i 57 | 58 | Allocate (attypes(n)) 59 | Allocate (coord(3,n)) 60 | Allocate (c_paramar(11)) 61 | 62 | !now, copy contents 63 | natoms = n 64 | attypes = iat 65 | coord = xyz 66 | c_paramar = paramar 67 | symbol = C_NULL_CHAR 68 | 69 | Call schoenflies(natoms,attypes,coord,symbol,c_paramar) 70 | 71 | sfsym = "" 72 | do i = 1,size(symbol) 73 | if (symbol(i) .eq. c_null_char) exit 74 | sfsym(i:i) = symbol(i) 75 | end do 76 | 77 | !deallocate arrays: 78 | Deallocate (attypes,coord,c_paramar) 79 | End Subroutine get_schoenflies 80 | 81 | subroutine getsymmetry2(pr,iunit,n,iat,xyz,symthr,maxatdesy,sfsym) 82 | use iso_c_binding,only:c_char,c_null_char 83 | use iso_fortran_env,only:wp => real64 84 | implicit none 85 | integer,intent(in) :: iunit 86 | integer n,iat(n),maxatdesy 87 | real(wp) xyz(3,n) 88 | real(wp) symthr 89 | Character(len=*) sfsym 90 | logical pr 91 | Character(len=4) atmp 92 | 93 | Real(wp) :: paramar(11) !parameter array for get_schoenflies_ 94 | 95 | if (n .gt. maxatdesy) then 96 | if (pr) write (iunit,*) 'symmetry recognition skipped because # atoms >',maxatdesy 97 | sfsym = 'none' 98 | return 99 | end if 100 | 101 | if (pr) write (iunit,'(a)') 102 | !parameters for symmetry recognition: 103 | paramar(1) = -1 ! verbose, increase for more detailed output (to stdout) 104 | paramar(2) = 10 ! MaxAxisOrder 105 | paramar(3) = 100 ! MaxOptCycles 106 | paramar(4) = 0.001d0 ! ToleranceSame 107 | paramar(5) = 0.5d0 ! TolerancePrimary 108 | paramar(6) = symthr ! ToleranceFinal, THIS IS THE IMPORTANT VALUE 109 | paramar(7) = 0.5d0 ! MaxOptStep 110 | paramar(8) = 1.0D-7 ! MinOptStep 111 | paramar(9) = 1.0D-7 ! GradientStep 112 | paramar(10) = 1.0D-8 ! OptChangeThreshold 113 | paramar(11) = 5 ! OptChangeHits 114 | 115 | atmp = ' ' 116 | Call get_schoenflies(n,iat,xyz,atmp,paramar) 117 | !call flush(iunit) 118 | 119 | !TM stuff (trafo table) 120 | sfsym(1:3) = atmp(1:3) 121 | if (sfsym(1:1) .eq. 'D') sfsym(1:1) = 'd' 122 | if (sfsym(1:1) .eq. 'C') sfsym(1:1) = 'c' 123 | if (sfsym(1:1) .eq. 'T') sfsym(1:1) = 't' 124 | if (sfsym(1:1) .eq. 'O') sfsym(1:1) = 'o' 125 | if (sfsym(1:1) .eq. 'I') sfsym(1:1) = 'i' 126 | if (sfsym(1:1) .eq. 'S') sfsym(1:1) = 's' 127 | if (sfsym .eq. 'dih') sfsym = 'd6h' 128 | if (sfsym .eq. 'civ') sfsym = 'c6v' 129 | if (sfsym(3:3) .gt. 'v'.or.sfsym(3:3) .lt. 'a') sfsym(3:3) = ' ' 130 | 131 | if (pr) then 132 | write (iunit,'(a3,'' symmetry found (for desy threshold: '',e9.2,'')'')') sfsym,symthr 133 | end if 134 | 135 | End subroutine getsymmetry2 136 | 137 | -------------------------------------------------------------------------------- /subprojects/.gitignore: -------------------------------------------------------------------------------- 1 | /*/ 2 | json-fortran-8.2.5.wrap 3 | dftd4.wrap 4 | mstore.wrap 5 | multicharge.wrap 6 | s-dftd3.wrap 7 | mctc-lib.wrap 8 | xhcff 9 | lammps* 10 | 11 | !lwoniom 12 | !gfn0 13 | !toml-f 14 | !gfnff 15 | !tblite 16 | !test-drive 17 | !pvol 18 | 19 | !packagefiles 20 | !packagefiles/tblite 21 | !packagefiles/tblite/rm_app_test.patch 22 | -------------------------------------------------------------------------------- /subprojects/README.md: -------------------------------------------------------------------------------- 1 | ## Using CREST subprojects 2 | 3 | Newer versions of CREST use external projects: 4 | 5 | | Library | Description | Build Option | git submodule | CMake build | `meson` build | 6 | | ------- | ----------- | ------------ | :-----------: | :---------: | :-----------: | 7 | | [`toml-f`](https://github.com/toml-f/toml-f) | A TOML parser for Fortran | `-DWITH_TOMLF=true` (default) | ✅ | ✅ | ✅ | 8 | | [`gfn0`](https://github.com/pprcht/gfn0) | A GFN0-xTB standalone library | `-DWITH_GFN0=true` (default) | ✅ | ✅ | ✅ | 9 | | [`gfnff`](https://github.com/pprcht/gfnff) | A GFN-FF standalone library | `-DWITH_GFNFF=true` (default) | ✅ | ✅ | ✅ | 10 | | [`tblite`](https://github.com/tblite/tblite) | A lightweight implementation of the GFN1 and GFN2-xTB Hamiltonians | `-DWITH_TBLITE=true` (default) | ✅ | ✅ | ✅ | 11 | | [`lwoniom`](https://github.com/crest-lab/lwoniom) | A lightweight ONIOM implementation | `-DWITH_LWONIOM=true` (default) | ✅ | ✅ | ✅ | 12 | 15 | 16 | 17 | Both `cmake` and `meson` should be **able to handle the download automatically** (with meson being a little bit better at this). The build option can be specified in the respective setup step. 18 | 19 | However, some projects are also set up as `git` submodules (see table) if you want to download the most current commits by hand. 20 | To do so, in the CREST main directory use 21 | ```bash 22 | git submodule init 23 | git submodule update 24 | ``` 25 | which should check out all the subprojects. 26 | 27 | To update the submodule sources from the respective remote branches 28 | ```bash 29 | git submodule update --remote 30 | ``` 31 | can be used. 32 | 33 | Alternatively, a source directory of the respective project can be placed in the subprojects directory, or a symbolic link can be set. 34 | -------------------------------------------------------------------------------- /subprojects/gfn0.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = gfn0 3 | url = https://github.com/pprcht/gfn0 4 | revision = head 5 | -------------------------------------------------------------------------------- /subprojects/gfnff.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = gfnff 3 | url = https://github.com/pprcht/gfnff 4 | revision = head 5 | -------------------------------------------------------------------------------- /subprojects/libpvol.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = pvol 3 | url = https://github.com/neudecker-group/libpvol.git 4 | revision = head 5 | -------------------------------------------------------------------------------- /subprojects/lwoniom.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = lwoniom 3 | url = https://github.com/crest-lab/lwoniom 4 | revision = head 5 | -------------------------------------------------------------------------------- /subprojects/packagefiles/tblite/tblite_patch.patch: -------------------------------------------------------------------------------- 1 | diff --git a/meson.build b/meson.build 2 | index 9384afd..e4b73bb 100644 3 | --- a/meson.build 4 | +++ b/meson.build 5 | @@ -57,7 +57,7 @@ tblite_dep = declare_dependency( 6 | ) 7 | 8 | # Add executable targets 9 | -subdir('app') 10 | +#subdir('app') 11 | 12 | # Package the license files 13 | tblite_lic = files( 14 | @@ -121,7 +121,7 @@ if install 15 | endif 16 | 17 | # add the testsuite 18 | -subdir('test') 19 | +#subdir('test') 20 | 21 | if get_option('python') 22 | subdir('python/tblite') 23 | -------------------------------------------------------------------------------- /subprojects/tblite.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = tblite 3 | url = https://github.com/ppracht/tblite 4 | revision = xtb_solvation 5 | -------------------------------------------------------------------------------- /subprojects/toml-f.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = toml-f 3 | url = https://github.com/toml-f/toml-f 4 | revision = head 5 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Unit testing 2 | set( 3 | tests 4 | "tblite" 5 | "gfnff" 6 | "gfn0" 7 | "gfn0occ" 8 | "CN" 9 | "optimization" 10 | ) 11 | set( 12 | test-srcs 13 | "testmol.f90" 14 | "helpers.f90" 15 | "main.f90" 16 | ) 17 | foreach(t IN LISTS tests) 18 | string(MAKE_C_IDENTIFIER ${t} t) 19 | list(APPEND test-srcs "test_${t}.F90") 20 | endforeach() 21 | 22 | add_executable( 23 | "${PROJECT_NAME}-tester" 24 | "${test-srcs}" 25 | ) 26 | target_link_libraries( 27 | "${PROJECT_NAME}-tester" 28 | PRIVATE 29 | "lib-${PROJECT_NAME}-static" 30 | "test-drive::test-drive" 31 | ) 32 | 33 | foreach(t IN LISTS tests) 34 | add_test("${PROJECT_NAME}/${t}" "${PROJECT_NAME}-tester" "${t}") 35 | endforeach() 36 | -------------------------------------------------------------------------------- /test/helpers.f90: -------------------------------------------------------------------------------- 1 | module test_helpers 2 | use testdrive,only:error_type,check,test_failed 3 | use crest_parameters 4 | use crest_testmol 5 | use crest_calculator 6 | use strucrd 7 | implicit none 8 | private 9 | 10 | public :: test_e,test_g 11 | 12 | !========================================================================================! 13 | !========================================================================================! 14 | contains !> Helper routines for testing 15 | !========================================================================================! 16 | !========================================================================================! 17 | 18 | subroutine test_e(mol,calc,error,ref) 19 | !*********************************************** 20 | !* calculate energy and cross-check with 21 | !* a given reference 22 | !*********************************************** 23 | !> Error handling 24 | type(error_type),allocatable,intent(out) :: error 25 | !> calculation data 26 | type(calcdata),intent(inout) :: calc 27 | !> molecule 28 | type(coord),intent(inout) :: mol 29 | !> reference energy 30 | real(wp),intent(in) :: ref 31 | !> LOCAL 32 | real(wp),parameter :: thr = sqrt(epsilon(1.0_wp)) 33 | real(wp),allocatable :: gradient(:,:) 34 | integer :: io 35 | real(wp) :: energy 36 | 37 | energy=0.0_wp 38 | 39 | !> calculation 40 | allocate (gradient(3,mol%nat),source=0.0_wp) 41 | call engrad(mol,calc,energy,gradient,io) 42 | 43 | if (abs(energy-ref) > thr) then 44 | !call test_failed(error,"energy does not match reference") 45 | call calc%info(stdout) 46 | call check(error,energy,ref,thr=thr) 47 | end if 48 | 49 | end subroutine test_e 50 | 51 | subroutine test_g(mol,calc,error) 52 | !*********************************************** 53 | !* calculate numerical gradient and cross-check 54 | !* with the one returned by calculator 55 | !*********************************************** 56 | !> Error handling 57 | type(error_type),allocatable,intent(out) :: error 58 | !> calculation data 59 | type(calcdata),intent(inout) :: calc 60 | !> molecule 61 | type(coord),intent(inout) :: mol 62 | !> LOCAL 63 | real(wp),parameter :: thr = 1.0E-6_wp 64 | real(wp),allocatable :: gradient(:,:),numg(:,:) 65 | integer :: io 66 | real(wp) :: energy 67 | 68 | !> calculation 69 | allocate (gradient(3,mol%nat),source=0.0_wp) 70 | call engrad(mol,calc,energy,gradient,io) 71 | 72 | call numgrad(mol,calc,numgradient=numg) 73 | 74 | if (any(abs(gradient-numg) > thr)) then 75 | call test_failed(error,"Gradient does not match") 76 | call calc%info(stdout) 77 | print '(3es20.13)',gradient 78 | print '(a)',"---" 79 | print '(3es20.13)',numg 80 | print '(a)',"---" 81 | print '(3es20.13)',gradient-numg 82 | end if 83 | end subroutine test_g 84 | 85 | !========================================================================================! 86 | !========================================================================================! 87 | end module test_helpers 88 | -------------------------------------------------------------------------------- /test/main.f90: -------------------------------------------------------------------------------- 1 | !> Driver for unit testing 2 | program tester 3 | use, intrinsic :: iso_fortran_env, only : error_unit 4 | use testdrive, only : run_testsuite, new_testsuite, testsuite_type, & 5 | & select_suite, run_selected, get_argument 6 | use test_tblite, only : collect_tblite 7 | use test_gfnff, only : collect_gfnff 8 | use test_gfn0, only: collect_gfn0 9 | use test_gfn0occ, only: collect_gfn0occ 10 | use test_cn, only: collect_cn 11 | use test_optimization, only: collect_optimization 12 | implicit none 13 | integer :: stat, is 14 | character(len=:), allocatable :: suite_name, test_name 15 | type(testsuite_type), allocatable :: testsuites(:) 16 | character(len=*), parameter :: fmt = '("#", *(1x, a))' 17 | external ompmklset,openblasset 18 | 19 | !> only run on one thread 20 | call ompmklset(1) 21 | call openblasset(1) 22 | 23 | stat = 0 24 | 25 | !&< 26 | !> note: these must have the same name as in CMakeLists.txt 27 | testsuites = [ & 28 | new_testsuite("tblite", collect_tblite), & 29 | new_testsuite("gfnff", collect_gfnff), & 30 | new_testsuite("gfn0", collect_gfn0), & 31 | new_testsuite("gfn0occ", collect_gfn0occ), & 32 | new_testsuite("CN",collect_CN), & 33 | new_testsuite("optimization", collect_optimization) & 34 | ] 35 | !&> 36 | 37 | call get_argument(1, suite_name) 38 | call get_argument(2, test_name) 39 | 40 | if (allocated(suite_name)) then 41 | is = select_suite(testsuites, suite_name) 42 | if (is > 0 .and. is <= size(testsuites)) then 43 | if (allocated(test_name)) then 44 | write(error_unit, fmt) "Suite:", testsuites(is)%name 45 | call run_selected(testsuites(is)%collect, test_name, error_unit, stat) 46 | if (stat < 0) then 47 | error stop 1 48 | end if 49 | else 50 | write(error_unit, fmt) "Testing:", testsuites(is)%name 51 | call run_testsuite(testsuites(is)%collect, error_unit, stat) 52 | end if 53 | else 54 | write(error_unit, fmt) "Available testsuites" 55 | do is = 1, size(testsuites) 56 | write(error_unit, fmt) "-", testsuites(is)%name 57 | end do 58 | error stop 1 59 | end if 60 | else 61 | do is = 1, size(testsuites) 62 | write(error_unit, fmt) "Testing:", testsuites(is)%name 63 | call run_testsuite(testsuites(is)%collect, error_unit, stat) 64 | end do 65 | end if 66 | 67 | if (stat > 0) then 68 | write(error_unit, '(i0, 1x, a)') stat, "test(s) failed!" 69 | error stop 1 70 | end if 71 | 72 | end program tester 73 | -------------------------------------------------------------------------------- /test/testmol.f90: -------------------------------------------------------------------------------- 1 | module crest_testmol 2 | !> coffeine 3 | use iso_fortran_env,only:wp => real64 4 | use strucrd 5 | implicit none 6 | private 7 | 8 | public :: get_testmol 9 | 10 | !&< 11 | integer,parameter :: caffeine_nat = 24 12 | integer, parameter :: caffeine_at(caffeine_nat) = [6,7,6,7,6,6,6,8,7,6,8,7,6,6, & 13 | & 1,1,1,1,1,1,1,1,1,1] 14 | real(wp),parameter :: caffeine_xyz(3,caffeine_nat) = reshape(& 15 | &[ 2.02799738646442_wp, 0.09231312124713_wp, -0.14310895950963_wp, & 16 | & 4.75011007621000_wp, 0.02373496014051_wp, -0.14324124033844_wp, & 17 | & 6.33434307654413_wp, 2.07098865582721_wp, -0.14235306905930_wp, & 18 | & 8.72860718071825_wp, 1.38002919517619_wp, -0.14265542523943_wp, & 19 | & 8.65318821103610_wp, -1.19324866489847_wp, -0.14231527453678_wp, & 20 | & 6.23857175648671_wp, -2.08353643730276_wp, -0.14218299370797_wp, & 21 | & 5.63266886875962_wp, -4.69950321056008_wp, -0.13940509630299_wp, & 22 | & 3.44931709749015_wp, -5.48092386085491_wp, -0.14318454855466_wp, & 23 | & 7.77508917214346_wp, -6.24427872938674_wp, -0.13107140408805_wp, & 24 | & 10.30229550927022_wp, -5.39739796609292_wp, -0.13672168520430_wp, & 25 | & 12.07410272485492_wp, -6.91573621641911_wp, -0.13666499342053_wp, & 26 | & 10.70038521493902_wp, -2.79078533715849_wp, -0.14148379504141_wp, & 27 | & 13.24597858727017_wp, -1.76969072232377_wp, -0.14218299370797_wp, & 28 | & 7.40891694074004_wp, -8.95905928176407_wp, -0.11636933482904_wp, & 29 | & 1.38702118184179_wp, 2.05575746325296_wp, -0.14178615122154_wp, & 30 | & 1.34622199478497_wp, -0.86356704498496_wp, 1.55590600570783_wp, & 31 | & 1.34624089204623_wp, -0.86133716815647_wp, -1.84340893849267_wp, & 32 | & 5.65596919189118_wp, 4.00172183859480_wp, -0.14131371969009_wp, & 33 | & 14.67430918222276_wp, -3.26230980007732_wp, -0.14344911021228_wp, & 34 | & 13.50897177220290_wp, -0.60815166181684_wp, 1.54898960808727_wp, & 35 | & 13.50780014200488_wp, -0.60614855212345_wp, -1.83214617078268_wp, & 36 | & 5.41408424778406_wp, -9.49239668625902_wp, -0.11022772492007_wp, & 37 | & 8.31919801555568_wp, -9.74947502841788_wp, 1.56539243085954_wp, & 38 | & 8.31511620712388_wp, -9.76854236502758_wp, -1.79108242206824_wp], & 39 | & shape(caffeine_xyz)) 40 | !&> 41 | 42 | !&< 43 | !> distorted methane 44 | integer,parameter :: methane_nat = 5 45 | integer, parameter :: methane_at(methane_nat) = [6,1,1,1,1] 46 | real(wp),parameter :: methane_xyz(3,methane_nat) = reshape(& 47 | & [-2.901604086313, 2.032342621828, -0.000007558904, & 48 | & -4.142827301385, 1.660246889672, 1.875960807537, & 49 | & -4.354204487169, 0.990001535591, -1.470244961017, & 50 | & -3.376685347364, 4.088767344235, -0.405769514737, & 51 | & -1.351217548539, 1.424026988612, 0.000022676711],& 52 | & shape(methane_xyz)) 53 | !&> 54 | 55 | 56 | !&< 57 | !> distorted methane 58 | integer,parameter :: cytosine_nat = 13 59 | integer, parameter :: cytosine_at(cytosine_nat) = [8,6,7,6,6,6,7,7,1,1,1,1,1] 60 | real(wp),parameter :: cytosine_xyz(3,cytosine_nat) = reshape(& 61 | & [-4.142195348814, 2.008151058305, -0.018151734373, & 62 | & -2.160173249661, 0.802767457051, -0.000058193762, & 63 | & -2.268542712629, -1.794135272435, 0.003855688769, & 64 | & -0.191488773092, -3.309463007997, -0.005095763012, & 65 | & 2.109332653259, -2.284418067990, -0.007062235327, & 66 | & 2.185078861327, 0.516677179272, 0.028019148471, & 67 | & 4.467560431809, 1.727180498582, 0.071380211323, & 68 | & 0.177657703530, 1.926043596048, 0.012000916144, & 69 | & -4.036103295159, -2.521391305153, 0.014335396651, & 70 | & -0.507864921184, -5.333664751031, -0.008697813741, & 71 | & 3.837497023245, -3.367210871956, -0.007065809214, & 72 | & 5.961039176371, 0.856469245914, -0.742491063662, & 73 | & 4.318834327087, 3.589804055892, -0.368535366892],& 74 | & shape(cytosine_xyz)) 75 | !&> 76 | 77 | contains 78 | 79 | subroutine get_testmol(name,mol) 80 | character(len=*),intent(in) :: name 81 | type(coord),intent(out) :: mol 82 | select case (name) 83 | case ('methane') 84 | mol%nat = methane_nat 85 | allocate (mol%at(mol%nat)) 86 | mol%at(:) = methane_at(:) 87 | allocate (mol%xyz(3,mol%nat)) 88 | mol%xyz(:,:) = methane_xyz(:,:) 89 | mol%chrg = 0 90 | mol%uhf = 0 91 | case ('cytosine') 92 | mol%nat = cytosine_nat 93 | allocate (mol%at(mol%nat)) 94 | mol%at(:) = cytosine_at(:) 95 | allocate (mol%xyz(3,mol%nat)) 96 | mol%xyz(:,:) = cytosine_xyz(:,:) 97 | mol%chrg = 0 98 | mol%uhf = 0 99 | case default 100 | !> caffeine 101 | mol%nat = caffeine_nat 102 | allocate (mol%at(mol%nat)) 103 | mol%at(:) = caffeine_at(:) 104 | allocate (mol%xyz(3,mol%nat)) 105 | mol%xyz(:,:) = caffeine_xyz(:,:) 106 | mol%chrg = 0 107 | mol%uhf = 0 108 | end select 109 | end subroutine get_testmol 110 | 111 | end module crest_testmol 112 | --------------------------------------------------------------------------------