Neural Quantum States Based on Selected Configurations.
The 2 matches
- [1] § H2O ↔ src/nqs/main.py, lines 20–71 · score 0.72 · C2H4, Li2O, LiCl, STO, optimized, N2
- [2] § H2O ↔ src/nqs/utilities.py, lines 70–112 · score 0.70 · C2H4, Li2O, LiCl, geometries, N2, chemical
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 255 lines · 10 KB · BSD-3-Clause · 1 match
- # This code is licensed under the 3-clause BSD license.
- # Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group.
- # See LICENSE.txt for details.
- """
- Module containing the `main()` function of the program.
- """
- import click
- from click_option_group import optgroup
- import numpy as np
- from nqs.exact import calculate_reference_fci, calculate_reference_exd, diagonalize_subspace, variational_evaluation
- from nqs.nqs import train_nqs
- from nqs.operators import generate_hamiltonian, generate_spin_operators, calculate_observables
- from nqs.utilities import print_horizontal_line, print_system_config, get_molecule, \
- load_oec_from_cache, store_oec_in_cache, create_fcidump, write_results_to_disk
- @click.command()
- @click.help_option('--help', hidden=True,
- help='Show this message and exit.'
- )
- @optgroup.group('Quantum Chemical Parameters')
- @optgroup.option('--molecule', type=click.Choice(['H2', 'H8s', 'N2', 'N2s', 'LiH', 'LiF', 'LiCl', 'Li2O', 'BeH2',
- 'H2O', 'H2S', 'NH3', 'PH3', 'CH4', 'C2H2', 'C2H4', 'SiH4'],
- case_sensitive=False), default='H2',
- help='Molecule to be modeled.'
- )
- @optgroup.option('--basis', type=str, default='STO-3G',
- help='Basis set to be used.'
- )
- @optgroup.option('--orbitals', type=click.Choice(['RHF', 'MP2-NO'], case_sensitive=False), default='RHF',
- help='Molecular orbitals to be used.'
- )
- @optgroup.option('--eigv', type=click.IntRange(1, None), default=1,
- help='Number of eigenvalues to be computed using full CI & exact diagonalization.'
- )
- @optgroup.group('Optimization Parameters')
- @optgroup.option('--iters', type=click.IntRange(0, None), default=10000,
- help='Number of iterations to be used for training.'
- )
- @optgroup.option('--sampler', type=click.Choice(['Exact', 'SC'], case_sensitive=False), default='Exact',
- help='Sampler to be used during the optimization procedure.'
- )
- @optgroup.option('--sampler_seed', type=click.IntRange(0, 0xFFFFFFFF), default=42,
- help='Random seed to be used for initializing the sampler.'
- )
- @optgroup.option('--samples', type=click.IntRange(1, None), default=1024,
- help='Number of samples to be taken during a single variational Monte Carlo (VMC) iteration.'
- )
- @optgroup.option('--optimizer', type=click.Choice(['Adam'], case_sensitive=False), default='Adam',
- help="Gradient-based optimizer to be used for updating the model's parameters."
- )
- @optgroup.option('--learning_rate', type=click.FloatRange(0, min_open=True), default=5e-3,
- help='Learning rate to be used.'
- )
- @optgroup.option('--kernels', type=click.IntRange(1, None), default=1,
- help='Number of different `n_unique` values for which `energy_forces_kernel()` should be compiled (ignored if --sampler=SC).'
- )
- @optgroup.option('--select', type=click.IntRange(1, None), default=1,
- help='The `n_select` parameter of the selected configurations procedure.'
- )
- @optgroup.option('--expand', type=click.IntRange(1, None), default=1,
- help='The `n_expand` parameter of the selected configurations procedure.'
- )
- @optgroup.option('--chunk_size', type=click.IntRange(0, None), default=0,
- help='Chunk size to be used (the value `0` corresponds to no chunking being used).'
- )
- @optgroup.group('Model Parameters')
- @optgroup.option('--model', type=click.Choice(['NBF'], case_sensitive=False), default='NBF',
- help='Neural network architecture to be applied.'
- )
- @optgroup.option('--model_seed', type=click.IntRange(0, 0xFFFFFFFF), default=42,
- help="Random seed to be used for initializing the model's learnable parameters."
- )
- @optgroup.option('--precision', type=click.Choice([4, 8]), default=4,
- help='Floating-point model precision to be employed in bytes.'
- )
- @optgroup.option('--layers', type=click.IntRange(0, None), default=1,
- help='Number of hidden (fully-connected) layers.'
- )
- @optgroup.option('--width', type=click.IntRange(0, None), default=32,
- help='Width of the hidden (fully-connected) layers.'
- )
- @optgroup.option('--determinants', type=click.IntRange(1, None), default=1,
- help='Number of model-internal determinants to be used.'
- )
- def main(molecule, basis, orbitals, eigv,
- iters, sampler, sampler_seed, samples, optimizer, learning_rate, kernels, select, expand, chunk_size,
- model, model_seed, precision, layers, width, determinants):
- """
- Test bench for neural quantum states (NQS) applied to second-quantized electronic structure theory.
- """
- np.random.seed(sampler_seed)
- chunk_size = None if chunk_size == 0 else chunk_size
- opt_params = {
- 'iters': iters,
- 'sampler': sampler,
- 'sampler_seed': sampler_seed,
- 'samples': samples,
- 'optimizer': optimizer,
- 'learning_rate': learning_rate,
- 'kernels': kernels,
- 'select': select,
- 'expand': expand,
- 'chunk_size': chunk_size,
- }
- model_params = {
- 'model': model,
- 'model_seed': model_seed,
- 'precision': precision,
- 'layers': layers,
- 'width': width,
- 'determinants': determinants,
- }
- fcidump_path = 'cache/fcidump/' + '-'.join(map(str, [molecule, basis, orbitals])) + '.fcidump'
- oec_path = 'cache/oec/' + '-'.join(map(str, [molecule, basis, orbitals, eigv])) + '.npz'
- kernels_path = 'cache/kernels/' + '-'.join(map(str, [molecule, basis, orbitals, samples, chunk_size, optimizer, kernels]
- + list(model_params.values()))) + '.npz'
- results_path = 'results/' + '-'.join(map(str, [molecule, basis, orbitals, eigv]
- + list(opt_params.values()) + list(model_params.values()))) + '.npz'
- opt_params.update({'kernels_path': kernels_path})
- print_system_config()
- print_horizontal_line()
- mol = get_molecule(molecule, basis)
- oec = load_oec_from_cache(oec_path)
- if oec is None:
- E_RHF, C_RHF, E_FCI, C_FCI = calculate_reference_fci(mol, orbitals, eigv)
- H = generate_hamiltonian(mol, C_RHF)
- S2, Sz = generate_spin_operators(H.hilbert, n_orbitals=H.hilbert.size // 2)
- if H.hilbert.n_states < 100_000:
- E_ExD, C_ExD = calculate_reference_exd(H, eigv)
- else:
- E_ExD, C_ExD = E_FCI, C_FCI
- if E_FCI is None or C_FCI is None:
- E_FCI, C_FCI = E_ExD, C_ExD
- operators = {'H': H, 'S2': S2, 'Sz': Sz}
- energies = {'FCI': E_FCI, 'ExD': E_ExD, 'RHF': E_RHF}
- coefficients = {'FCI': C_FCI, 'ExD': C_ExD, 'RHF': C_RHF}
- oec = {'O': operators, 'E': energies, 'C': coefficients}
- store_oec_in_cache(oec_path, oec)
- else:
- operators, energies, coefficients = oec
- H, S2, Sz = operators.values()
- E_FCI, E_ExD, E_RHF = energies.values()
- C_FCI, C_ExD, C_RHF = coefficients.values()
- if 100_000 <= H.hilbert.n_states:
- H = generate_hamiltonian(mol, C_RHF)
- operators['H'] = H
- print_horizontal_line()
- print(f'Considering {H.hilbert.n_fermions} electrons in {H.hilbert.size} spin orbitals → {H.hilbert.n_states} configurations.')
- model_params['width'] = H.hilbert.size if model_params['width'] == 0 else model_params['width']
- print_horizontal_line()
- print('*** Reference Energies ***')
- print(f'RHF energy: {f'{E_RHF[0]:.18f}'[:20]} Ha')
- print(f'FCI energy: {f'{E_FCI[0]:.18f}'[:20]} Ha')
- print(f'ExD energy: {f'{E_ExD[0]:.18f}'[:20]} Ha')
- print_horizontal_line()
- create_fcidump(mol, fcidump_path, C_RHF)
- states, C_NQS, E_NQS, S2_NQS, Sz_NQS = train_nqs(operators, opt_params, model_params)
- E_SCQ = variational_evaluation(states, H.hilbert.n_fermions_per_spin, fcidump_path, C_NQS)
- E_SCI, C_SCI = diagonalize_subspace(states, H.hilbert.n_fermions_per_spin, fcidump_path)
- if H.hilbert.n_states < 100_000:
- # pylint: disable=unbalanced-tuple-unpacking
- S2_ExD, Sz_ExD = calculate_observables([S2, Sz], C_ExD[0])
- else:
- S2_ExD, Sz_ExD = [None], [None]
- print_horizontal_line()
- print('*** Full CI (FCI) ***')
- print(f'FCI spectrum: {E_FCI}')
- print('FCI ground-state coeffs.:')
- print(C_FCI[0])
- print_horizontal_line()
- print('*** Exact Diagonalization (ExD) ***')
- print(f'ExD spectrum: {E_ExD}')
- print('ExD ground-state coeffs.:')
- print(C_ExD[0])
- print(f'ExD spin (S2): {S2_ExD[0]}')
- print(f'ExD spin (Sz): {Sz_ExD[0]}')
- print_horizontal_line()
- print('*** Neural Quantum State (NQS) ***')
- print(f'NQS spectrum: {E_NQS}')
- print('NQS ground-state coeffs.:')
- print(C_NQS[0])
- print(f'NQS spin (S2): {S2_NQS[0]}')
- print(f'NQS spin (Sz): {Sz_NQS[0]}')
- print_horizontal_line()
- print('*** Final Energy Comparison ***')
- print(f'RHF energy: {f'{E_RHF[0]:.18f}'[:20]} Ha')
- print(f'FCI energy: {f'{E_FCI[0]:.18f}'[:20]} Ha')
- print(f'ExD energy: {f'{E_ExD[0]:.18f}'[:20]} Ha')
- print(f'NQS energy: {f'{E_NQS[0].real:.18f}'[:20]} Ha (Imaginary: {E_NQS[0].imag} Ha)')
- if not C_SCI is None:
- print(f'SCQ energy: {f'{E_SCQ[0]:.18f}'[:20]} Ha')
- print(f'SCI energy: {f'{E_SCI[0]:.18f}'[:20]} Ha')
- print_horizontal_line()
- tot_err = E_NQS[0].real - E_FCI[0]
- rel_err = -100 * tot_err / E_FCI[0]
- chm_acc = tot_err / 0.0016
- print('*** Energy Error Evaluation ***')
- print(f'Absolute error: {f'{tot_err:.18f}'[:20]} Ha')
- print(f'Relative error: {f'{rel_err:.18f}'[:20]} %')
- print(f'Chemical accu.: {f'{chm_acc:.18f}'[:20]} x')
- print_horizontal_line()
- energies = {'RHF': np.asarray(E_RHF), 'FCI': np.asarray(E_FCI), 'ExD': np.asarray(E_ExD),
- 'NQS': np.asarray(E_NQS), 'SCI': np.asarray(E_SCI), 'SCQ': np.asarray(E_SCQ),
- }
- coefficients = {'RHF': np.asarray(C_RHF), 'FCI': np.asarray(C_FCI), 'ExD': np.asarray(C_ExD),
- 'NQS': np.asarray(C_NQS), 'SCI': np.asarray(C_SCI),
- }
- spins = {'ExD': np.asarray(S2_ExD), 'NQS': np.asarray(S2_NQS)}
- magnetizations = {'ExD': np.asarray(Sz_ExD), 'NQS': np.asarray(Sz_NQS)}
- results = {'states': np.asarray(states), 'E': energies, 'C': coefficients, 'S2': spins, 'Sz': magnetizations}
- write_results_to_disk(results_path, results)
main.py, under BSD-3-Clause · at the source
Overview
Abstract
Neural quantum states (NQS) provide a flexible and highly expressive parametrization of wave functions for strongly correlated problems in quantum chemistry. Despite rapid advances in network architectures, the evaluation of electronic energies remains almost exclusively based on variational Monte Carlo (VMC). While VMC is effective for structured systems such as spin chains, its accuracy and efficiency for electronic Hamiltonians are hindered by sharply peaked distributions, stochastic gradient noise, and slow convergence with sample size. In this Letter, we assess the capability of NQS-VMC to efficiently capture correlation in electronic ground states by comparing it to a recently developed NQS-based selected configuration (NQS-SC) approach. We set up a systematic comparison of the ground-state optimizations obtained with NQS-VMC and NQS-SC for molecular systems dominated by either static or dynamical correlation. The comparison demonstrates a clear advantage of NQS-SC over NQS-VMC in both energy accuracy and wave function coefficients, particularly for statically correlated molecules. Moreover, NQS-SC exhibits robust systematic improvability, whereas NQS-VMC does not. These findings position NQS-SC as the new default approach over NQS-VMC for electronic structure calculations. We further observe that neither NQS-SC nor NQS-VMC can efficiently capture dynamical correlation, highlighting the need for future hybrid methods, such as multiconfigurational perturbation theories built on top of NQS solutions.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
Zenodo 19609547
Availability: 1 check, the latest on 29 September 2026: the link answers (HTTP 200)
- 29 September 2026: the link answers (HTTP 200)
12 files
- src/
nqs/ , Python, 23 linesdrivers.py - src/
nqs/ , Python, 96 linesexact.py - src/
nqs/ , Python, 579 lineskernels.py - src/
nqs/ , Python, 61 linesloggers.py - src/
nqs/ , Python, 255 lines, 1 matchmain.py - src/
nqs/ , Python, 78 linesmodels.py - src/
nqs/ , Python, 122 linesnqs.py - src/
nqs/ , Python, 50 linesoperators.py - src/
nqs/ , Python, 502 linesstates.py - src/
nqs/ , Python, 187 lines, 1 matchutilities.py - LICENSE.txt, License, 11 lines
- README.md, Text, 188 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 10 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability
The data and source code used to produce the results of this work are available on Zenodo.
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 1 funder, 63 references.
Cite
This paper
Julian Solanki, M., Ding, L., & Reiher, M. (2026). Neural Quantum States Based on Selected Configurations. The journal of physical chemistry letters, 17(18), 5180-5190. https://
BibTeX
@article{juliansolanki20
author = {Julian Solanki, Marco and Ding, Lexin and Reiher, Markus},
title = {{Neural Quantum States Based on Selected Configurations}},
journal = {The journal of physical chemistry letters},
year = {2026},
month = apr,
volume = {17},
number = {18},
pages = {5180--5190},
publisher = {American Chemical Society},
issn = {1948-7185},
doi = {10.1021/
url = {https://
pmid = {42024858},
pmcid = {PMC13158996}
}
RIS
TY - JOUR
AU - Julian Solanki, Marco
AU - Ding, Lexin
AU - Reiher, Markus
TI - Neural Quantum States Based on Selected Configurations
T2 - The journal of physical chemistry letters
J2 - J Phys Chem Lett
PY - 2026
DA - 2026/
VL - 17
IS - 18
SP - 5180
EP - 5190
SN - 1948-7185
PB - American Chemical Society
DO - 10.1021/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1021/
"type": "article-journal",
"title": "Neural Quantum States Based on Selected Configurations",
"container-title": "The journal of physical chemistry letters",
"author": [
{
"family": "Julian Solanki",
"given": "Marco"
},
{
"family": "Ding",
"given": "Lexin"
},
{
"family": "Reiher",
"given": "Markus"
}
],
"container-title-short":
"volume": "17",
"issue": "18",
"page": "5180-5190",
"DOI": "10.1021/
"PMID": "42024858",
"PMCID": "PMC13158996",
"ISSN": "1948-7185",
"publisher": "American Chemical Society",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
23
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1021/acs.jctc.5c01852 [code]
- Modal Backflow Neural Quantum States for Anharmonic Vibrational Calculations.Journal: Journal of chemical theory and computationIn common: JAX, NumPy, 21 references, author Markus Reiher
- [2] doi:10.1038/s41467-026-74028-6 [code]
- Solving the Hubbard model with neural quantum states.Journal: Nature communicationsIn common: 4 references
- [3] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: JAX, NumPy
- [4] doi:10.1126/sciadv.aeg6797 [code]
- Dorsoventral gradient of theta sweeps in the medial entorhinal cortex.Journal: Science advancesIn common: JAX, NumPy
- [5] doi:10.1002/hipo.70131 [code]
- Decoding Medial Entorhinal Cortical Dynamics Produces Planning-Like Alternations in Hippocampal theta Sequences.Journal: HippocampusIn common: JAX, NumPy
- [6] doi:10.1371/journal.pcbi.1014657 [code]
- Population morphology implies a common developmental blueprint for Drosophila motion detectors.Journal: PLoS computational biologyIn common: JAX, NumPy
- [7] doi:10.1371/journal.pone.0354021 [code]
- A genetic algorithm for self-supervised models of oscillatory neurodynamics.Journal: PloS oneIn common: JAX, NumPy
- [8] doi:10.1038/s41467-026-75959-w [code]
- Charting higher-order models of brain function beyond pairwise interactions.Journal: Nature communicationsIn common: JAX, NumPy
- [9] doi:10.3390/ijms27156614 [code]
- Candidalysin Inhibits &
lt;i& gt;Porphyromonas gingivalis& lt;/ i& gt; Lipoprotein-Induced IL-1β Production in BV-2 Microglia via Hydrophobic Microbial Interactions. Journal: International journal of molecular sciencesIn common: JAX, NumPy - [10] doi:10.1016/j.molcel.2026.07.006 [code]
- DeorphaNN: Virtual screening of GPCR peptide agonists using AlphaFold-predicted active-state complexes and deep learning embeddings.Journal: Molecular cellIn common: JAX, NumPy
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 10 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:0cd9dacb439f4ca9…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
