{"id":18419126,"url":"https://github.com/richard-hartmann/bcfutils","last_synced_at":"2026-03-19T04:17:09.038Z","repository":{"id":210883470,"uuid":"727232651","full_name":"richard-hartmann/BCFUtils","owner":"richard-hartmann","description":"utilizuies to manage bath correlation function and related quantities including fitting of multi-exponential representations in time domain","archived":false,"fork":false,"pushed_at":"2024-01-11T21:22:31.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-06T02:41:14.562Z","etag":null,"topics":["correlation-functions","fitting","open-quantum-systems","quantum-physics"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richard-hartmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-04T13:05:02.000Z","updated_at":"2023-12-05T23:13:18.000Z","dependencies_parsed_at":"2024-01-12T01:19:09.683Z","dependency_job_id":null,"html_url":"https://github.com/richard-hartmann/BCFUtils","commit_stats":null,"previous_names":["richard-hartmann/bcfutils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/richard-hartmann/BCFUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richard-hartmann%2FBCFUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richard-hartmann%2FBCFUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richard-hartmann%2FBCFUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richard-hartmann%2FBCFUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richard-hartmann","download_url":"https://codeload.github.com/richard-hartmann/BCFUtils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richard-hartmann%2FBCFUtils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272124753,"owners_count":24877720,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["correlation-functions","fitting","open-quantum-systems","quantum-physics"],"created_at":"2024-11-06T04:15:55.015Z","updated_at":"2026-02-12T11:06:35.103Z","avatar_url":"https://github.com/richard-hartmann.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BCFUtils\n\nA collection of utilities to manage bath correlation function and related quantities, including fitting of multi-exponential representations in time domain.\n\n### basics\n\nThe package provides the functions:\n\n* **spectral density**, `sd(w, b::AbstractBath)`\n* (zero temperature) **bath correlation function**, `bcf(t, b::AbstractBath)`\n\nfor some bath `b`.\n\n\u003e **ToDo:** Add at some point\n\u003e   * effective thermal spectral density\n\u003e   * thermal bath correlation function \n\u003e   * thermal contribution of the BCF\n\nAvailable baths:\n\n* (sub- / super-) **Ohmic with exponential cutoff**, `OhmicExpCO(s, η, wc)`\n* **multi exponential BCF**, `MultiExpBCF(G, W)` or `MultiExpBCF(u)` (see Examples)\n\n\u003e **ToDo:** Use numeric integration to handle more complicated baths\n\n### multi exponential approximation (fitting in time)\n\nA multi exponential representation $α(τ) = ∑_i exp(-u^{(i)}_{12} - u^{(i)}_{34} τ)$ of the BCF has turned out very useful for numerical methods solving open quantum system dynamics.\nThe subscript \"12\" and \"34\" indicate that $u$ is complex valued and, thus, has two independent parameters ($u_{12} = u_1 + i u_2$).\nMinimizing the difference to a give given reference BCF amount to a high  dimensional optimization problem.\nThe search for the global minimum is done by deterministically sampling initial condition for the minimization using Sobol sequences.\nThe `BFCUtil` package allows to conveniently save the sequences of improved minima as well as the latest Sobol state.\nIn that way restarting the minimization with the same parameters will continue a previous search.\n\nParameters for the minimization are stored in \n`struct FitCfg` which has members\n\n* `b::AbstractBath`, the bath `b` defines the reference BCF\n* `tau_range::AbstractTauIter`, an iterator which yields the times `t_i` at which the difference with the reference is calculated. The minimizer will then minimize the p-norm of the difference vector `d_i = |bcf_ref(t_i) - bcf_apprx(t_i)|`\n* `num_exp_terms`, the number of exponential terms used for the multi-exp-representation\n* `p` of the p-norm \n* `u_init_min` minimum of $u$ when sampling initial condition as a four-tuple `[u_1,u_2,_3,u_4]` (same limits for all $u^{(i)}$). Note that $u_1$ is the scale and $u_2$ the phase of the pre-factor. $u_3$ is usually positive, otherwise the there is exponential growth in time. The angular velocity $u_4$ is arbitrary, for Ohmic baths its usually positive.\n* `u_init_max` maximum of $u$ when sampling initial condition as a four-tuple `[u_1,u_2,u_3,u_4]`. Since $u_{12}$ comes with a minus sign, large u_1 mean pre-factors with small magnitude.\n* `diff_kind`, so far absolute `:abs_p_diff` and relative `:rel_p_diff` has been implemented\n* `maxiters`, maximum number of allowed iterations for the minimizer\n\nTo trigger the minimization call `fit(ofc::FitCfg, num_samples, path=\".fit\"; verbose=true)` with arguments\n* `ofc`, an instance of the above explained `FitCfg`\n* `num_samples`, the maximum number of Sobol samples (initial conditions) to consider. \n* `path=\".fit\"`, the path where results are saved\n* `verbose=false`, if `false` show only a message when a new minima outreaches previous ones, otherwise give detailed information for each sample.\n\n### convenience `FitCfg` for Ohmic baths\n\n\u003e **ToDo:** Explain `FitCfg_for_Ohmic_bath` \n\n# examples\n\n### Ohmic spectral density with exponential cutoff \n\n$$J(ω) = η ω^s e^{-ω / ω_c}$$\n\nInstantiate a bath `b` with s=0.3, η=0.1 and wc = 7.\n```jldoctest\njulia\u003e using BCFUtils\njulia\u003e b = OhmicExpCO(0.3, 0.1, 7)\nOhmicExpCO{Float64}(0.3, 0.1, 7.0, 0.028567379519453845)\n```\n\nEvaluate the spectral density and bath correlation function for the bath `b`.\n```jldoctest\njulia\u003e sd(2.4, b)\n0.09229164933483118\njulia\u003e bcf(3.6, b)\n-0.0021995074140912564 - 0.004929562274049971im\n```\n\n### multi exponential BCF\n\n$$α(τ) = ∑_i G_i e^{-W_i τ} ≡ ∑_i e^{-(u^{(i)}_0 + u^{(i)}_1 τ)}$$\n\nThe parameters $G_i$, $W_i$ and, likewise, $u^{(i)}_0$, and $u^{(i)}_1$ can be complex valued.\nAs an example, a 2-exp-term BCF with`G=[1,2]` and `W=[3,4]` can be created as\n\n```jldoctest\nb = MultiExpBCF([1,2im], [3im,4])\nMultiExpBCF{Float64}([-0.0, -0.0, 0.0, 3.0, -0.6931471805599453, -1.5707963267948966, 4.0, 0.0], 2)\n```\n\nNote that the parameters are stored in $u$-representation with separated real and imaginary part.\nSo for each exponential term four parameters are stored.\n\nAlternatively the $u$-representation can be passed directly.\n\n\n\n# MIT License\n\nCopyright © 2024 Richard Hartmann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichard-hartmann%2Fbcfutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichard-hartmann%2Fbcfutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichard-hartmann%2Fbcfutils/lists"}