OSCR

Neural Quantum States Based on Selected Configurations.

Code ↔ Paper

2 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 2 matches
  1. [1] § H2O ↔ src/nqs/main.py, lines 20–71 · score 0.72 · C2H4, Li2O, LiCl, STO, optimized, N2
  2. [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

  1. # This code is licensed under the 3-clause BSD license.
  2. # Copyright ETH Zurich, Department of Chemistry and Applied Biosciences, Reiher Group.
  3. # See LICENSE.txt for details.
  4. """
  5. Module containing the `main()` function of the program.
  6. """
  7. import click
  8. from click_option_group import optgroup
  9. import numpy as np
  10. from nqs.exact import calculate_reference_fci, calculate_reference_exd, diagonalize_subspace, variational_evaluation
  11. from nqs.nqs import train_nqs
  12. from nqs.operators import generate_hamiltonian, generate_spin_operators, calculate_observables
  13. from nqs.utilities import print_horizontal_line, print_system_config, get_molecule, \
  14. load_oec_from_cache, store_oec_in_cache, create_fcidump, write_results_to_disk
  15. @click.command()
  16. @click.help_option('--help', hidden=True,
  17. help='Show this message and exit.'
  18. )
  19. @optgroup.group('Quantum Chemical Parameters')
  20. @optgroup.option('--molecule', type=click.Choice(['H2', 'H8s', 'N2', 'N2s', 'LiH', 'LiF', 'LiCl', 'Li2O', 'BeH2',
  21. 'H2O', 'H2S', 'NH3', 'PH3', 'CH4', 'C2H2', 'C2H4', 'SiH4'],
  22. case_sensitive=False), default='H2',
  23. help='Molecule to be modeled.'
  24. )
  25. @optgroup.option('--basis', type=str, default='STO-3G',
  26. help='Basis set to be used.'
  27. )
  28. @optgroup.option('--orbitals', type=click.Choice(['RHF', 'MP2-NO'], case_sensitive=False), default='RHF',
  29. help='Molecular orbitals to be used.'
  30. )
  31. @optgroup.option('--eigv', type=click.IntRange(1, None), default=1,
  32. help='Number of eigenvalues to be computed using full CI & exact diagonalization.'
  33. )
  34. @optgroup.group('Optimization Parameters')
  35. @optgroup.option('--iters', type=click.IntRange(0, None), default=10000,
  36. help='Number of iterations to be used for training.'
  37. )
  38. @optgroup.option('--sampler', type=click.Choice(['Exact', 'SC'], case_sensitive=False), default='Exact',
  39. help='Sampler to be used during the optimization procedure.'
  40. )
  41. @optgroup.option('--sampler_seed', type=click.IntRange(0, 0xFFFFFFFF), default=42,
  42. help='Random seed to be used for initializing the sampler.'
  43. )
  44. @optgroup.option('--samples', type=click.IntRange(1, None), default=1024,
  45. help='Number of samples to be taken during a single variational Monte Carlo (VMC) iteration.'
  46. )
  47. @optgroup.option('--optimizer', type=click.Choice(['Adam'], case_sensitive=False), default='Adam',
  48. help="Gradient-based optimizer to be used for updating the model's parameters."
  49. )
  50. @optgroup.option('--learning_rate', type=click.FloatRange(0, min_open=True), default=5e-3,
  51. help='Learning rate to be used.'
  52. )
  53. @optgroup.option('--kernels', type=click.IntRange(1, None), default=1,
  54. help='Number of different `n_unique` values for which `energy_forces_kernel()` should be compiled (ignored if --sampler=SC).'
  55. )
  56. @optgroup.option('--select', type=click.IntRange(1, None), default=1,
  57. help='The `n_select` parameter of the selected configurations procedure.'
  58. )
  59. @optgroup.option('--expand', type=click.IntRange(1, None), default=1,
  60. help='The `n_expand` parameter of the selected configurations procedure.'
  61. )
  62. @optgroup.option('--chunk_size', type=click.IntRange(0, None), default=0,
  63. help='Chunk size to be used (the value `0` corresponds to no chunking being used).'
  64. )
  65. @optgroup.group('Model Parameters')
  66. @optgroup.option('--model', type=click.Choice(['NBF'], case_sensitive=False), default='NBF',
  67. help='Neural network architecture to be applied.'
  68. )
  69. @optgroup.option('--model_seed', type=click.IntRange(0, 0xFFFFFFFF), default=42,
  70. help="Random seed to be used for initializing the model's learnable parameters."
  71. )
  72. @optgroup.option('--precision', type=click.Choice([4, 8]), default=4,
  73. help='Floating-point model precision to be employed in bytes.'
  74. )
  75. @optgroup.option('--layers', type=click.IntRange(0, None), default=1,
  76. help='Number of hidden (fully-connected) layers.'
  77. )
  78. @optgroup.option('--width', type=click.IntRange(0, None), default=32,
  79. help='Width of the hidden (fully-connected) layers.'
  80. )
  81. @optgroup.option('--determinants', type=click.IntRange(1, None), default=1,
  82. help='Number of model-internal determinants to be used.'
  83. )
  84. def main(molecule, basis, orbitals, eigv,
  85. iters, sampler, sampler_seed, samples, optimizer, learning_rate, kernels, select, expand, chunk_size,
  86. model, model_seed, precision, layers, width, determinants):
  87. """
  88. Test bench for neural quantum states (NQS) applied to second-quantized electronic structure theory.
  89. """
  90. np.random.seed(sampler_seed)
  91. chunk_size = None if chunk_size == 0 else chunk_size
  92. opt_params = {
  93. 'iters': iters,
  94. 'sampler': sampler,
  95. 'sampler_seed': sampler_seed,
  96. 'samples': samples,
  97. 'optimizer': optimizer,
  98. 'learning_rate': learning_rate,
  99. 'kernels': kernels,
  100. 'select': select,
  101. 'expand': expand,
  102. 'chunk_size': chunk_size,
  103. }
  104. model_params = {
  105. 'model': model,
  106. 'model_seed': model_seed,
  107. 'precision': precision,
  108. 'layers': layers,
  109. 'width': width,
  110. 'determinants': determinants,
  111. }
  112. fcidump_path = 'cache/fcidump/' + '-'.join(map(str, [molecule, basis, orbitals])) + '.fcidump'
  113. oec_path = 'cache/oec/' + '-'.join(map(str, [molecule, basis, orbitals, eigv])) + '.npz'
  114. kernels_path = 'cache/kernels/' + '-'.join(map(str, [molecule, basis, orbitals, samples, chunk_size, optimizer, kernels]
  115. + list(model_params.values()))) + '.npz'
  116. results_path = 'results/' + '-'.join(map(str, [molecule, basis, orbitals, eigv]
  117. + list(opt_params.values()) + list(model_params.values()))) + '.npz'
  118. opt_params.update({'kernels_path': kernels_path})
  119. print_system_config()
  120. print_horizontal_line()
  121. mol = get_molecule(molecule, basis)
  122. oec = load_oec_from_cache(oec_path)
  123. if oec is None:
  124. E_RHF, C_RHF, E_FCI, C_FCI = calculate_reference_fci(mol, orbitals, eigv)
  125. H = generate_hamiltonian(mol, C_RHF)
  126. S2, Sz = generate_spin_operators(H.hilbert, n_orbitals=H.hilbert.size // 2)
  127. if H.hilbert.n_states < 100_000:
  128. E_ExD, C_ExD = calculate_reference_exd(H, eigv)
  129. else:
  130. E_ExD, C_ExD = E_FCI, C_FCI
  131. if E_FCI is None or C_FCI is None:
  132. E_FCI, C_FCI = E_ExD, C_ExD
  133. operators = {'H': H, 'S2': S2, 'Sz': Sz}
  134. energies = {'FCI': E_FCI, 'ExD': E_ExD, 'RHF': E_RHF}
  135. coefficients = {'FCI': C_FCI, 'ExD': C_ExD, 'RHF': C_RHF}
  136. oec = {'O': operators, 'E': energies, 'C': coefficients}
  137. store_oec_in_cache(oec_path, oec)
  138. else:
  139. operators, energies, coefficients = oec
  140. H, S2, Sz = operators.values()
  141. E_FCI, E_ExD, E_RHF = energies.values()
  142. C_FCI, C_ExD, C_RHF = coefficients.values()
  143. if 100_000 <= H.hilbert.n_states:
  144. H = generate_hamiltonian(mol, C_RHF)
  145. operators['H'] = H
  146. print_horizontal_line()
  147. print(f'Considering {H.hilbert.n_fermions} electrons in {H.hilbert.size} spin orbitals → {H.hilbert.n_states} configurations.')
  148. model_params['width'] = H.hilbert.size if model_params['width'] == 0 else model_params['width']
  149. print_horizontal_line()
  150. print('*** Reference Energies ***')
  151. print(f'RHF energy: {f'{E_RHF[0]:.18f}'[:20]} Ha')
  152. print(f'FCI energy: {f'{E_FCI[0]:.18f}'[:20]} Ha')
  153. print(f'ExD energy: {f'{E_ExD[0]:.18f}'[:20]} Ha')
  154. print_horizontal_line()
  155. create_fcidump(mol, fcidump_path, C_RHF)
  156. states, C_NQS, E_NQS, S2_NQS, Sz_NQS = train_nqs(operators, opt_params, model_params)
  157. E_SCQ = variational_evaluation(states, H.hilbert.n_fermions_per_spin, fcidump_path, C_NQS)
  158. E_SCI, C_SCI = diagonalize_subspace(states, H.hilbert.n_fermions_per_spin, fcidump_path)
  159. if H.hilbert.n_states < 100_000:
  160. # pylint: disable=unbalanced-tuple-unpacking
  161. S2_ExD, Sz_ExD = calculate_observables([S2, Sz], C_ExD[0])
  162. else:
  163. S2_ExD, Sz_ExD = [None], [None]
  164. print_horizontal_line()
  165. print('*** Full CI (FCI) ***')
  166. print(f'FCI spectrum: {E_FCI}')
  167. print('FCI ground-state coeffs.:')
  168. print(C_FCI[0])
  169. print_horizontal_line()
  170. print('*** Exact Diagonalization (ExD) ***')
  171. print(f'ExD spectrum: {E_ExD}')
  172. print('ExD ground-state coeffs.:')
  173. print(C_ExD[0])
  174. print(f'ExD spin (S2): {S2_ExD[0]}')
  175. print(f'ExD spin (Sz): {Sz_ExD[0]}')
  176. print_horizontal_line()
  177. print('*** Neural Quantum State (NQS) ***')
  178. print(f'NQS spectrum: {E_NQS}')
  179. print('NQS ground-state coeffs.:')
  180. print(C_NQS[0])
  181. print(f'NQS spin (S2): {S2_NQS[0]}')
  182. print(f'NQS spin (Sz): {Sz_NQS[0]}')
  183. print_horizontal_line()
  184. print('*** Final Energy Comparison ***')
  185. print(f'RHF energy: {f'{E_RHF[0]:.18f}'[:20]} Ha')
  186. print(f'FCI energy: {f'{E_FCI[0]:.18f}'[:20]} Ha')
  187. print(f'ExD energy: {f'{E_ExD[0]:.18f}'[:20]} Ha')
  188. print(f'NQS energy: {f'{E_NQS[0].real:.18f}'[:20]} Ha (Imaginary: {E_NQS[0].imag} Ha)')
  189. if not C_SCI is None:
  190. print(f'SCQ energy: {f'{E_SCQ[0]:.18f}'[:20]} Ha')
  191. print(f'SCI energy: {f'{E_SCI[0]:.18f}'[:20]} Ha')
  192. print_horizontal_line()
  193. tot_err = E_NQS[0].real - E_FCI[0]
  194. rel_err = -100 * tot_err / E_FCI[0]
  195. chm_acc = tot_err / 0.0016
  196. print('*** Energy Error Evaluation ***')
  197. print(f'Absolute error: {f'{tot_err:.18f}'[:20]} Ha')
  198. print(f'Relative error: {f'{rel_err:.18f}'[:20]} %')
  199. print(f'Chemical accu.: {f'{chm_acc:.18f}'[:20]} x')
  200. print_horizontal_line()
  201. energies = {'RHF': np.asarray(E_RHF), 'FCI': np.asarray(E_FCI), 'ExD': np.asarray(E_ExD),
  202. 'NQS': np.asarray(E_NQS), 'SCI': np.asarray(E_SCI), 'SCQ': np.asarray(E_SCQ),
  203. }
  204. coefficients = {'RHF': np.asarray(C_RHF), 'FCI': np.asarray(C_FCI), 'ExD': np.asarray(C_ExD),
  205. 'NQS': np.asarray(C_NQS), 'SCI': np.asarray(C_SCI),
  206. }
  207. spins = {'ExD': np.asarray(S2_ExD), 'NQS': np.asarray(S2_NQS)}
  208. magnetizations = {'ExD': np.asarray(Sz_ExD), 'NQS': np.asarray(Sz_NQS)}
  209. results = {'states': np.asarray(states), 'E': energies, 'C': coefficients, 'S2': spins, 'Sz': magnetizations}
  210. write_results_to_disk(results_path, results)

main.py, under BSD-3-Clause · at the source

Overview

Authors: Marco Julian Solanki1, Lexin Ding1, Markus Reiher1
  1. Department of Chemistry and Applied Biosciences, ETH Zürich, Vladimir-Prelog-Weg 2, CH-8093 Zürich, Switzerland
Institutions: ETH Zurich (Switzerland)
Journal: The journal of physical chemistry letters, volume 17, issue 18, pages 5180-5190
Dates: received 13 February 2026; accepted 13 April 2026; published online 23 April 2026; in print May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1021/acs.jpclett.6c00520 · PMID 42024858 · PMCID PMC13158996 · OpenAlex W7155390398
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Journal subjects: Physical Insights into Quantum Phenomena and Function
Topic: Quantum many-body systems (Atomic and Molecular Physics, and Optics, Physics and Astronomy), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 70 references in the paper

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

License: BSD-3-Clause
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: the references
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (7 files), JAX (5 files)
Availability: 1 check, the latest on 29 September 2026: the link answers (HTTP 200)
  • 29 September 2026: the link answers (HTTP 200)
12 files
At the source:

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://doi.org/10.1021/acs.jpclett.6c00520

BibTeX

@article{juliansolanki2026neural,
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/acs.jpclett.6c00520},
url = {https://doi.org/10.1021/acs.jpclett.6c00520},
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/04/23
VL - 17
IS - 18
SP - 5180
EP - 5190
SN - 1948-7185
PB - American Chemical Society
DO - 10.1021/acs.jpclett.6c00520
UR - https://doi.org/10.1021/acs.jpclett.6c00520
LA - en
ER -

CSL-JSON

{
"id": "10.1021/acs.jpclett.6c00520",
"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": "J Phys Chem Lett",
"volume": "17",
"issue": "18",
"page": "5180-5190",
"DOI": "10.1021/acs.jpclett.6c00520",
"PMID": "42024858",
"PMCID": "PMC13158996",
"ISSN": "1948-7185",
"publisher": "American Chemical Society",
"URL": "https://doi.org/10.1021/acs.jpclett.6c00520",
"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 computation
In 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 communications
In common: 4 references
[3] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: JAX, NumPy
[4] doi:10.1126/sciadv.aeg6797 [code]
Dorsoventral gradient of theta sweeps in the medial entorhinal cortex.
Journal: Science advances
In common: JAX, NumPy
[5] doi:10.1002/hipo.70131 [code]
Decoding Medial Entorhinal Cortical Dynamics Produces Planning-Like Alternations in Hippocampal theta Sequences.
Journal: Hippocampus
In 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 biology
In common: JAX, NumPy
[7] doi:10.1371/journal.pone.0354021 [code]
A genetic algorithm for self-supervised models of oscillatory neurodynamics.
Journal: PloS one
In common: JAX, NumPy
[8] doi:10.1038/s41467-026-75959-w [code]
Charting higher-order models of brain function beyond pairwise interactions.
Journal: Nature communications
In 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 sciences
In 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 cell
In 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.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

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.