# C2DB 2D-property data file ## Usage ```bash bash download.sh # runs the scraper; writes data.csv and schema.json ``` The scrape walks the live C2DB browse UI at (the 2DHub redirect target) page by page. The run takes ~8–12 minutes end to end; progress prints to stdout. Re-running the script is idempotent (it overwrites ``data.csv``). ``data.csv`` is gitignored per the repo-wide rule (``benchmarks/**/data/data.*`` in ``.gitignore``) — you always rebuild it locally from this script. Only this ``README.md`` and the optional ``schema.json`` are kept in git. ## Source and license - Upstream landing: - Browse UI (what we scrape): - DTU Figshare record: - License: CC-BY-4.0 (declared on the Figshare record). - Primary citation: Haastrup et al., *2D Mater.* **5**, 042002 (2018), ; update Gjerding et al., *2D Mater.* **8**, 044002 (2021), . When redistributing or publishing work that uses this ``data.csv``, cite the Haastrup and Gjerding papers (both are vendored offline in ``../reference/``). ## Filter applied The C2DB browse UI ships a server-side default filter ``ehull in [0.0, 0.2] eV/atom`` and rejects wider ranges with HTTP 500 (tried: ``to_ehull`` = 0.5, 1.0, 2.0, 5.0, 10.0 — all 500). The scraper therefore collects the 9706 visible rows out of the 17001 total C2DB entries. This is the same "energetically accessible" subset the official web UI shows to anyone clicking "Browse data"; the remaining ~7000 entries are above 0.2 eV/atom above the convex hull and likely not synthesizable. If you need the full 17k entries, you have to contact the C2DB authors ("The full dataset is provided upon request", per 2dhub.org). This entry deliberately does not try to back-door that process. ## Column order in ``data.csv`` Column 0 is the primary output (``hform``, heat of formation eV/atom). Columns 1..N are inputs, in this order: 1. ``hform`` — **output** — Heat of formation [eV/atom] (PBE) 2. ``uid`` — C2DB unique material identifier (string) 3. ``formula`` — chemical formula (string) 4. ``layergroup`` — 2D layer group symbol (string) 5. ``is_magnetic`` — Magnetic Yes/No 6. ``dyn_stab`` — Dynamically stable Yes/No/Unknown Then every other scalar column the C2DB web UI exposes, in alphabetical order. Depending on the live schema at build time, this includes: | key | description | unit | |------------------------|--------------------------------------------------|----------------| | ``A`` | Single-ion anisotropy (out-of-plane) | meV | | ``E_B`` | Exciton binding energy (BSE) | eV | | ``J`` | Nearest-neighbour exchange coupling | meV | | ``N_nn`` | Number of nearest neighbours | (int) | | ``Px`` / ``Py`` / ``Pz`` | Spontaneous polarization components | pC/m | | ``P_spontaneous_norm`` | Spontaneous polarization norm | pC/m | | ``alphax`` / ``alphay`` / ``alphaz`` | Static polarizability (ph + el) | Å | | ``alphax_el`` / ``alphay_el`` / ``alphaz_el`` | Interband polarizability | Å | | ``alphax_lat`` / ``alphay_lat`` / ``alphaz_lat`` | Phonon polarizability | Å | | ``area`` | 2D unit-cell area | Ų | | ``bravais_type`` | 2D Bravais type (e.g. Hexagonal (hp)) | (text) | | ``cbm`` / ``cbm_evac`` / ``cbm_u`` / ``cbm_hse`` / ``cbm_gw`` | CBM vs vacuum (PBE/PBE+U/HSE/GW) | eV | | ``cod_id`` | Parent bulk structure in COD | (int) | | ``dE_zx`` / ``dE_zy`` | Magnetic anisotropy energy | meV/unit cell | | ``dipz`` | Out-of-plane dipole moment | e·Å/unit cell | | ``efermi`` / ``efermi_u`` / ``efermi_hse`` / ``efermi_gw`` | Fermi level vs vacuum | eV | | ``ehull`` | Energy above convex hull | eV/atom | | ``emass_cbm`` / ``emass_vbm`` | DOS effective masses (PBE) | m_e | | ``energy`` | PBE total energy | eV | | ``evac`` / ``evacdiff`` | Vacuum level and vacuum-level shift | eV | | ``gap`` / ``gap_u`` / ``gap_hse`` / ``gap_gw`` | Indirect band gaps | eV | | ``gap_dir`` / ``gap_dir_u`` / ``gap_dir_hse`` / ``gap_dir_gw`` | Direct gaps | eV | | ``halfmetal_gap`` / ``halfmetal_gap_hse`` / ``halfmetal_gap_dir`` / ``halfmetal_gap_dir_hse`` | Minority-spin gaps | eV | | ``has_inversion_symmetry`` | Inversion symmetry flag | (bool) | | ``icsd_id`` | Parent bulk structure in ICSD | (int) | | ``is_ferroelectric`` | Ferroelectric flag | (bool) | | ``is_magnetic_u`` | Magnetic flag (PBE+U) | (bool) | | ``label`` | Origin label (e.g. Original18, ICSD-derived) | (text) | | ``lam`` | Anisotropic exchange (out-of-plane) | meV | | ``lgnum`` | Layer group number | (int) | | ``magmom`` | Total magnetic moment | μ_B | | ``natoms`` | Number of atoms per unit cell | (int) | | ``nspecies`` | Number of distinct chemical species | (int) | | ``number`` | Bulk space group number (AA-stacked) | (int) | | ``plasmafrequency_x`` / ``plasmafrequency_y`` | Drude plasma frequency | eV·Å^0.5 | | ``spin`` | Max S_z at magnetic sites | (dim-less) | | ``thickness`` | 2D layer thickness (out-of-plane extent) | Å | | ``vbm`` / ``vbm_evac`` / ``vbm_u`` / ``vbm_hse`` / ``vbm_gw`` | VBM vs vacuum (PBE/PBE+U/HSE/GW) | eV | | ``workfunction`` | Work function (averaged for polar slabs) | eV | Text-only / internal columns are intentionally skipped by the download script: ``doi`` (free-text citation), ``publication`` (free-text), ``folder`` (internal DTU path), ``olduid`` (legacy id), ``stoichiometry`` (redundant text), ``reduced`` (redundant text), ``international`` / ``pointgroup`` (text symbols). The exact runtime column set is saved to ``schema.json`` by ``download.sh`` for auditing. ## Missing values A cell is empty ("") whenever that property is undefined for a given material or simply wasn't computed in the run the web UI serves: - ``gap_gw`` / ``gap_dir_gw`` / ``vbm_gw`` / ``cbm_gw`` / ``efermi_gw`` / ``E_B`` — computed only for the ~300-material GW/BSE subset. - ``workfunction`` / ``efermi`` — often blank for metals, where vacuum-alignment is ambiguous in the presence of dipoles. - ``emass_cbm`` / ``emass_vbm`` — undefined for metals / half-metals. - ``J`` / ``lam`` / ``A`` / ``dE_zx`` / ``dE_zy`` / ``magmom`` — blank for non-magnetic materials. - ``Px`` / ``Py`` / ``Pz`` / ``P_spontaneous_norm`` — blank for non-ferroelectric materials. - ``cod_id`` / ``icsd_id`` — blank for materials derived from generative models rather than from ICSD/COD parents. - Many properties (especially optical / phonon) may be blank for newer, partially-computed entries (the 2022-09 generative-model additions and the 2024-05 restructuring). Pandas users: ``pd.read_csv('data.csv', na_values=[''], keep_default_na=True)`` is the recommended reader. ## Known build-time quirks - The ``sid`` session id in the scraper URL is server-side state; it gets reallocated on every ``GET /`` hit. The script creates exactly one sid and sticks with it. - Toggle requests are sent with the ``HX-Request: true`` header to match the htmx client the UI was built around. Server-side toggling is purely per-session, so concurrent scrapers would interfere with each other on shared sids — do not parallelize this script. - A 0.35 s sleep between page GETs keeps the rate well below what the CAMD web server serves to an interactive user; this is intentional.