{"id":18574506,"url":"https://github.com/dftd4/dftd4-fit","last_synced_at":"2026-01-24T14:40:48.707Z","repository":{"id":43372424,"uuid":"425339602","full_name":"dftd4/dftd4-fit","owner":"dftd4","description":"Driver to combine dftd4 and minpack/nlopt for damping parameter optimization","archived":false,"fork":false,"pushed_at":"2023-03-30T12:40:59.000Z","size":69,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-25T04:42:14.773Z","etag":null,"topics":["damping-parameters","dftd4","dispersion-correction","minpack","nlopt"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dftd4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-06T20:16:20.000Z","updated_at":"2024-11-11T07:24:02.000Z","dependencies_parsed_at":"2022-09-13T19:00:36.000Z","dependency_job_id":null,"html_url":"https://github.com/dftd4/dftd4-fit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dftd4%2Fdftd4-fit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dftd4%2Fdftd4-fit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dftd4%2Fdftd4-fit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dftd4%2Fdftd4-fit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dftd4","download_url":"https://codeload.github.com/dftd4/dftd4-fit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239311284,"owners_count":19618008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["damping-parameters","dftd4","dispersion-correction","minpack","nlopt"],"created_at":"2024-11-06T23:15:39.629Z","updated_at":"2025-11-01T17:30:36.860Z","avatar_url":"https://github.com/dftd4.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DFT-D4 damping parameter optimization\n\nThis project provides a driver for optimization of damping parameters in the DFT-D4 method.\n\n## Installation\n\nTo use this project the following dependencies are required\n\n- [`dftd4`](https://github.com/dftd4/dftd4) version 3.0.0 or newer,\n  for evaluation of the DFT-D4 dispersion correction\n- [`nlopt`](https://nlopt.readthedocs.io) version 2.0.0 to 2.5.0,\n  for the optimization of the damping parameters\n- [`nlopt-f`](https://github.com/grimme-lab/nlopt-f),\n  to provide Fortran bindings for `nlopt`\n- [`minpack`](https://github.com/fortran-lang/minpack),\n  for the optimization of the damping parameters\n- [`mctc-lib`](https://github.com/grimme-lab/mctc-lib),\n  for reading geometry inputs when creating the data set\n\n### Meson\n\nCreate a new build with\n\n```\nmeson setup _build --prefix ~/.local\n```\n\nThe Fortran compiler can be adjusted by setting the `FC` environment variable.\nMeson will find installed dependencies automatically or fetch them automatically if they are not available.\n\nTo build the project use\n\n```\nmeson compiler -C _build\n```\n\nFinally, you install the binary with\n\n```\nmeson install -C _build\n```\n\n### Fortran package manager\n\nThis project is built with the Fortran package manager ([fpm](https://github.com/fortran-lang/fpm)).\nFpm will handle the dependencies for `dftd4`, `minpack`, `nlopt-f` and `mctc-lib`, only `nlopt` has to be provided on the system.\n\nTo create the binaray use\n\n```\nfpm install --profile release --flag -fopenmp\n```\n\nThis will install `dftd4-fit` to `~/.local/bin` on Unix and `%APPDATA%\\local\\bin` on Windows.\nMake sure the respective directories are in your `PATH` or adjust the installation prefix with the `--prefix` option.\n\n## Usage\n\n```\ngit clone https://github.com/dftd4/dftd4-fitset\ndftd4-fit -C dftd4-fitset ./data.csv\n```\n\nThe data set must contain the missing dispersion energies for each (association) reaction in Hartree.\nThe missing dispersion energy is calculated as follows:\n\n```math\n\\left(E^{\\text{complex}}_{\\text{reference}} - \\sum_i^\\text{monomers} E^{i}_{\\text{reference}}\\right) - \\left(E^{\\text{complex}}_{\\text{DFT}} - \\sum_i^\\text{monomers} E^{i}_{\\text{DFT}} \\right) = \\sum_i^\\text{reactants} \\vartheta^i E^{i}_{\\text{reference}} - \\sum_i^\\text{reactants} \\vartheta^i E^{i}_{\\text{DFT}}\n```\n\nCorrespondingly, this energy is negative for most functionals, because the reference method binds the complex more strongly.\nThe lack of dispersion in DFT reduces the interaction energy.\n\n#### Data set format 1: No stoichiometry coefficients\n\nThis format is the default (`--format 1`).\n\nNote that the first entry must be the product (stoichiometry factor $\\vartheta = 1$).\nAll other entries are assumed to be educts (stoichiometry factor $\\vartheta = -1$).\nAn example is given below:\n\n```csv\nS22x5/01-0.9, S22x5/01-A, S22x5/01-B, -1.0007611865e-03\nS22x5/01-1.0, S22x5/01-A, S22x5/01-B, -1.5228237266e-03\nS22x5/01-1.2, S22x5/01-A, S22x5/01-B, -1.6586059147e-03\nS22x5/01-1.5, S22x5/01-A, S22x5/01-B, -1.2297590834e-03\nS22x5/01-2.0, S22x5/01-A, S22x5/01-B, -6.2420992500e-04\n...\n```\n\n#### Data set format 2: Explicit stoichiometry coeffiecients\n\nThis option can be requested with `--format 2`.\n\nHere, the stoichiometry coefficients must be given after the directory name, i.e., directory name and stoichiometry coefficient are given in an alternating fashion.\nThe example from above would now look as follows:\n\n```csv\nS22x5/01-0.9, 1, S22x5/01-A, -1, S22x5/01-B, -1, -1.0007611865e-03\nS22x5/01-1.0, 1, S22x5/01-A, -1, S22x5/01-B, -1, -1.5228237266e-03\nS22x5/01-1.2, 1, S22x5/01-A, -1, S22x5/01-B, -1, -1.6586059147e-03\nS22x5/01-1.5, 1, S22x5/01-A, -1, S22x5/01-B, -1, -1.2297590834e-03\nS22x5/01-2.0, 1, S22x5/01-A, -1, S22x5/01-B, -1, -6.2420992500e-04\n...\n```\n\n#### Data set format: Legacy\n\nThis option can be requested with `--format 0`.\n\nIn the first versions, the missing dispersion energy (target energy) is calculated the other way round:\n\n```math\nE_{\\text{target}} = \\left(E^{\\text{complex}}_{\\text{DFT}} - \\sum_i^\\text{monomers} E^{i}_{\\text{DFT}}\\right) - \\left(E^{\\text{complex}}_{\\text{reference}} - \\sum_i^\\text{monomers} E^{i}_{\\text{reference}} \\right) = \\sum_i^\\text{reactants} \\vartheta^i E^{i}_{\\text{DFT}} - \\sum_i^\\text{reactants} \\vartheta^i E^{i}_{\\text{reference}}\n```\n\nHence, the energies are mostly positive.\n\nIn the fit, however, the error is defined as\n\n```math\nE_{\\text{target}} - E_{\\text{D4}} = (E_{\\text{DFT}} - E_{\\text{reference}}) - E_{\\text{D4}} = (E_{\\text{DFT}} - E_{\\text{D4}}) - E_{\\text{reference}} \\text{,}\n```\n\nwhich introduces a wrong sign ($- E_{\\text{D4}}$ is positive, making the dispersion-corrected energy even more repulsive).\nTherefore, the reactions in the data set are taken as dissociations, i.e., the first entry must be the educt (stoichiometry factor $\\vartheta = -1$) and all other entries are assumed to be products (stoichiometry factor $\\vartheta = 1$).\nAn example is given below:\n\n```csv\nS22x5/01-0.9, S22x5/01-A, S22x5/01-B, 1.0007611865e-03\nS22x5/01-1.0, S22x5/01-A, S22x5/01-B, 1.5228237266e-03\nS22x5/01-1.2, S22x5/01-A, S22x5/01-B, 1.6586059147e-03\nS22x5/01-1.5, S22x5/01-A, S22x5/01-B, 1.2297590834e-03\nS22x5/01-2.0, S22x5/01-A, S22x5/01-B, 6.2420992500e-04\n...\n```\n\n#### More Information\n\nFor more information checkout the project help page\n\n```\nfpm run -- --help\n```\n\nFor an overview over all command line arguments use the `--help` argument or checkout the [`dftd4-fit(1)`](man/dftd4-fit.1.adoc) manpage.\n\n## License\n\nThis project is free software: you can redistribute it and/or modify it under\nthe terms of the Lesser GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis project is distributed in the hope that it will be useful,\nbut without any warranty; without even the implied warranty of\nmerchantability or fitness for a particular purpose. See the\nLesser GNU General Public License for more details.\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in this project by you, as defined in the\nLesser GNU General Public license, shall be licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdftd4%2Fdftd4-fit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdftd4%2Fdftd4-fit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdftd4%2Fdftd4-fit/lists"}