{"id":28989632,"url":"https://github.com/dylanljones/triqs_cpa","last_synced_at":"2026-04-02T02:47:48.443Z","repository":{"id":300191186,"uuid":"1001391294","full_name":"dylanljones/triqs_cpa","owner":"dylanljones","description":"Single site disorder solvers for TRIQS","archived":false,"fork":false,"pushed_at":"2025-08-04T19:24:03.000Z","size":1083,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"unstable","last_synced_at":"2025-08-04T22:14:36.943Z","etag":null,"topics":["ata","cpa","disorder","physics","triqs","vca"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylanljones.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"COPYING.txt","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,"zenodo":null}},"created_at":"2025-06-13T09:49:48.000Z","updated_at":"2025-06-23T14:46:26.000Z","dependencies_parsed_at":"2025-07-21T21:05:22.521Z","dependency_job_id":"28a17cbd-03c4-4a8e-a741-e0d9f9fc21e6","html_url":"https://github.com/dylanljones/triqs_cpa","commit_stats":null,"previous_names":["dylanljones/triqs_cpa"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dylanljones/triqs_cpa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanljones%2Ftriqs_cpa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanljones%2Ftriqs_cpa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanljones%2Ftriqs_cpa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanljones%2Ftriqs_cpa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylanljones","download_url":"https://codeload.github.com/dylanljones/triqs_cpa/tar.gz/refs/heads/unstable","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylanljones%2Ftriqs_cpa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269892478,"owners_count":24491924,"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-11T02:00:10.019Z","response_time":75,"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":["ata","cpa","disorder","physics","triqs","vca"],"created_at":"2025-06-24T23:11:30.270Z","updated_at":"2026-04-02T02:47:48.407Z","avatar_url":"https://github.com/dylanljones.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# triqs-cpa\n\n[![build](https://github.com/dylanljones/triqs_cpa/workflows/build/badge.svg)](https://github.com/TRIQS/triqs_cpa/actions?query=workflow%3Abuild)\n\n\u003e ⚠️ **This package is currently in development!**\n\nThe triqs_cpa package includes the follwoing algorithms:\n\n- VCA: Virtual Crystal Approximation\n- ATA: Average T-matrix Approximation\n- CPA: Coherent Potential Approximation\n\n## Installation\n\n### Installing via pip\n\n\u003e Coming soon!\n\nThe package is available on PyPI and can be installed with pip:\n\n```bash\npip install triqs_cpa\n```\n\n### Installing from source\n\nThe installation instructions for this package are the same as for any TRIQS application:\n\n1. Clone the latest stable version of the ``triqs_cpa`` repository:\n   ```bash\n   git clone git@github.com:dylanljones/triqs_cpa.git triqs_cpa.src\n   ```\n\n2. Create and move to a new directory where you will compile the code:\n   ```bash\n   mkdir triqs_cpa.build \u0026\u0026 cd triqs_cpa.build\n   ```\n\n3. Ensure that your shell contains the TRIQS environment variables by sourcing the ``triqsvars.sh`` file from your TRIQS installation:\n   ```bash\n   source path_to_triqs/share/triqs/triqsvars.sh\n   ```\n   If you are using TRIQS from Anaconda, you can use the ``CONDA_PREFIX`` environment variable:\n   ```bash\n   source $CONDA_PREFIX/share/triqs/triqsvars.sh\n   ```\n\n4. In the build directory call cmake, including any additional custom CMake options, see below:\n   ```bash\n   cmake ../triqs_cpa.src\n   ```\n\n5. Finally, compile the code and install the application:\n   ```bash\n   make install\n   ```\n\n\n## Examples\n\nSimple example of a two-component semi-circular DOS:\n\n```python\nfrom triqs.gf import Gf, MeshReFreq\nfrom triqs.plot.mpl_interface import oplot, plt\n\nfrom triqs_cpa import SemiCircularHt, G_component, G_coherent, solve_cpa\n\n# Parameters\nmesh = MeshReFreq(-2, +2, 2001)        # Frequency mesh\neta = 1e-2                             # Broadening for the Green's function\nconc = [0.2, 0.8]                      # Concentrations of the two components\neps = [-0.4, +0.4]                     # On-size energies of the two components\nht = SemiCircularHt(half_bandwidth=1)  # Semi-circular Hilbert transform\n\n# Set up self energy\nsigma = Gf(mesh=mesh, target_shape=[1, 1])\n\n# Solve the CPA equations\nsolve_cpa(ht, sigma, conc, eps, eta=eta)\n\n# Compute the coherent and component Green's functions\ng_coh = G_coherent(ht, sigma, eta=eta)\ng_cmpt = G_component(ht, sigma, conc, eps, eta=eta, scale=True)\n\n# Plot the results\noplot(-g_coh.imag, color=\"k\", label=\"$G$\")\noplot(-g_cmpt[\"A\"].imag, label=\"$G_A$\")\noplot(-g_cmpt[\"B\"].imag, label=\"$G_B$\")\nplt.show()\n\n```\n\nBlockGf example:\n```python\nfrom triqs.gf import MeshReFreq\nfrom triqs.plot.mpl_interface import oplot, plt\n\nfrom triqs_cpa import SemiCircularHt, G_coherent, solve_cpa, blockgf\n# Parameters\nmesh = MeshReFreq(-2, +2, 2001)        # Frequency mesh\ngf_struct = [(\"up\", 1), (\"dn\", 1)]     # Structure of the Green's function\neta = 1e-2                             # Broadening for the Green's function\nconc = [0.2, 0.8]                      # Concentrations of the two components\neps = [-0.4, +0.4]                     # On-size energies of the two components\nht = SemiCircularHt(half_bandwidth=1)  # Semi-circular Hilbert transform\n\n# Set up self energy\nsigma = blockgf(mesh, gf_struct=gf_struct)\n\n# Solve the CPA equations\nsolve_cpa(ht, sigma, conc, eps, eta=eta)\n\n# Compute the coherent Green's functions\ng_coh = G_coherent(ht, sigma, eta=eta)\n\n# Plot the results\noplot(-g_coh[\"up\"].imag)\noplot(g_coh[\"dn\"].imag)\nplt.show()\n```\n\nk-sum example:\n```python\nfrom triqs.gf import MeshReFreq\nfrom triqs.lattice.tight_binding import TBLattice\nfrom triqs.sumk import SumkDiscreteFromLattice\nfrom triqs.utility import mpi\nfrom triqs.plot.mpl_interface import oplot, plt\n\nfrom triqs_cpa import G_coherent, solve_cpa, blockgf\n\n# Parameters\nmesh = MeshReFreq(-3, +3, 2001)     # Frequency mesh\ngf_struct = [(\"up\", 1), (\"dn\", 1)]  # Structure of the Green's function\neta = 1e-2                          # Broadening for the Green's function\nconc = [0.2, 0.8]                   # Concentrations of the two components\neps = [-0.4, +0.4]                  # On-size energies of the two components\nt = 0.5                             # Hopping parameter\n\n# Set up the tight-binding lattice and k-sum\ntb = TBLattice(\n    units=[\n        (1, 0, 0),  # basis vector in the x-direction\n        (0, 1, 0),  # basis vector in the y-direction\n    ],\n    hoppings={\n        (+1, 0): [[-t]],  # hopping in the +x direction\n        (-1, 0): [[-t]],  # hopping in the -x direction\n        (0, +1): [[-t]],  # hopping in the +y direction\n        (0, -1): [[-t]],  # hopping in the -y direction\n    })\nsk = SumkDiscreteFromLattice(lattice=tb, n_points=256)\n\n# Set up self energy\nsigma = blockgf(mesh, gf_struct=gf_struct)\n\n# Solve the CPA equations\nsolve_cpa(sk, sigma, conc, eps, eta=eta, verbosity=2)\n\n# Compute the coherent Green's functions\ng_coh = G_coherent(sk, sigma, eta=eta)\n\n# Plot the results\nif mpi.is_master_node():\n    oplot(-g_coh[\"up\"].imag)\n    oplot(g_coh[\"dn\"].imag)\n    plt.show()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanljones%2Ftriqs_cpa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylanljones%2Ftriqs_cpa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylanljones%2Ftriqs_cpa/lists"}