-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.html
1996 lines (1736 loc) · 196 KB
/
api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-content_root="./" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>API — DeepQMC 1.2.0 documentation</title>
<script data-cfasync="false">
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
</script>
<!-- Loaded before other Sphinx assets -->
<link href="_static/styles/theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="_static/styles/bootstrap.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="_static/styles/pydata-sphinx-theme.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link href="_static/vendor/fontawesome/6.5.2/css/all.min.css?digest=dfe6caa3a7d634c4db9b" rel="stylesheet" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2" />
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=a746c00c" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" />
<link rel="stylesheet" type="text/css" href="_static/katex-math.css?v=91adb8b6" />
<!-- Pre-loaded scripts that we'll load fully later -->
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=dfe6caa3a7d634c4db9b" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=dfe6caa3a7d634c4db9b" />
<script src="_static/vendor/fontawesome/6.5.2/js/all.min.js?digest=dfe6caa3a7d634c4db9b"></script>
<script src="_static/documentation_options.js?v=6efca38a"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/katex.min.js?v=be8ff15f"></script>
<script src="_static/auto-render.min.js?v=ad136472"></script>
<script src="_static/katex_autorenderer.js?v=bebc588a"></script>
<script>DOCUMENTATION_OPTIONS.pagename = 'api';</script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="References" href="refs.html" />
<link rel="prev" title="Tutorial" href="tutorial.html" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="en"/>
</head>
<body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">
<div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div>
<div id="pst-scroll-pixel-helper"></div>
<button type="button" class="btn rounded-pill" id="pst-back-to-top">
<i class="fa-solid fa-arrow-up"></i>Back to top</button>
<input type="checkbox"
class="sidebar-toggle"
id="pst-primary-sidebar-checkbox"/>
<label class="overlay overlay-primary" for="pst-primary-sidebar-checkbox"></label>
<input type="checkbox"
class="sidebar-toggle"
id="pst-secondary-sidebar-checkbox"/>
<label class="overlay overlay-secondary" for="pst-secondary-sidebar-checkbox"></label>
<div class="search-button__wrapper">
<div class="search-button__overlay"></div>
<div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
action="search.html"
method="get">
<i class="fa-solid fa-magnifying-glass"></i>
<input type="search"
class="form-control"
name="q"
id="search-input"
placeholder="Search the docs ..."
aria-label="Search the docs ..."
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"/>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
</div>
<div class="pst-async-banner-revealer d-none">
<aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside>
</div>
<header class="bd-header navbar navbar-expand-lg bd-navbar d-print-none">
<div class="bd-header__inner bd-page-width">
<button class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation">
<span class="fa-solid fa-bars"></span>
</button>
<div class="col-lg-3 navbar-header-items__start">
<div class="navbar-item">
<a class="navbar-brand logo" href="index.html">
<p class="title logo__title">DeepQMC 1.2.0 documentation</p>
</a></div>
</div>
<div class="col-lg-9 navbar-header-items">
<div class="me-auto navbar-header-items__center">
<div class="navbar-item">
<nav>
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item ">
<a class="nav-link nav-internal" href="installation.html">
Installation
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="cli.html">
Command-line interface
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="tutorial.html">
Tutorial
</a>
</li>
<li class="nav-item current active">
<a class="nav-link nav-internal" href="#">
API
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="refs.html">
References
</a>
</li>
</ul>
</nav></div>
</div>
<div class="navbar-header-items__end">
<div class="navbar-item navbar-persistent--container">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script>
</div>
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/deepqmc/deepqmc" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-github fa-lg" aria-hidden="true"></i>
<span class="sr-only">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<div class="navbar-persistent--mobile">
<script>
document.write(`
<button class="btn search-button-field search-button__button" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="fa-solid fa-magnifying-glass"></i>
<span class="search-button__default-text">Search</span>
<span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
</button>
`);
</script>
</div>
</div>
</header>
<div class="bd-container">
<div class="bd-container__inner bd-page-width">
<div class="bd-sidebar-primary bd-sidebar">
<div class="sidebar-header-items sidebar-primary__section">
<div class="sidebar-header-items__center">
<div class="navbar-item">
<nav>
<ul class="bd-navbar-elements navbar-nav">
<li class="nav-item ">
<a class="nav-link nav-internal" href="installation.html">
Installation
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="cli.html">
Command-line interface
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="tutorial.html">
Tutorial
</a>
</li>
<li class="nav-item current active">
<a class="nav-link nav-internal" href="#">
API
</a>
</li>
<li class="nav-item ">
<a class="nav-link nav-internal" href="refs.html">
References
</a>
</li>
</ul>
</nav></div>
</div>
<div class="sidebar-header-items__end">
<div class="navbar-item">
<script>
document.write(`
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i>
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i>
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i>
</button>
`);
</script></div>
<div class="navbar-item"><ul class="navbar-icon-links"
aria-label="Icon Links">
<li class="nav-item">
<a href="https://github.com/deepqmc/deepqmc" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-github fa-lg" aria-hidden="true"></i>
<span class="sr-only">GitHub</span></a>
</li>
</ul></div>
</div>
</div>
<div class="sidebar-primary-items__start sidebar-primary__section">
<div class="sidebar-primary-item">
<div
id="pst-page-navigation-heading-2"
class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> On this page
</div>
<nav class="bd-toc-nav page-toc" aria-labelledby="pst-page-navigation-heading-2">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#haiku">Haiku</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#training-and-evaluation">Training and evaluation</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#sampling">Sampling</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#module-deepqmc.optimizer">Optimizers</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#wave-functions">Wave functions</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#graph-neural-networks">Graph neural networks</a><ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#graphs">Graphs</a></li>
<li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#electron-gnn">Electron GNN</a></li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#excited-electronic-states">Excited electronic states</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#custom-data-types-and-type-aliases">Custom data types and type aliases</a></li>
</ul>
</nav></div>
</div>
<div class="sidebar-primary-items__end sidebar-primary__section">
</div>
<div id="rtd-footer-container"></div>
</div>
<main id="main-content" class="bd-main" role="main">
<div class="bd-content">
<div class="bd-article-container">
<div class="bd-header-article d-print-none">
<div class="header-article-items header-article__inner">
<div class="header-article-items__start">
<div class="header-article-item">
<nav aria-label="Breadcrumb" class="d-print-none">
<ul class="bd-breadcrumbs">
<li class="breadcrumb-item breadcrumb-home">
<a href="index.html" class="nav-link" aria-label="Home">
<i class="fa-solid fa-home"></i>
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">API</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="searchbox"></div>
<article class="bd-article">
<section id="id1">
<h1>API<a class="headerlink" href="#id1" title="Link to this heading">#</a></h1>
<p>This is the documentation of the API of the <code class="xref py py-class docutils literal notranslate"><span class="pre">deepqmc</span></code> package.</p>
<p>This implementation uses the <a class="reference external" href="https://github.com/google/jax">JAX library</a>, the documentation for which can be found here:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://jax.readthedocs.io/en/latest">JAX documentation</a></p></li>
</ul>
<dl class="py class" id="module-deepqmc.molecule">
<dt class="sig sig-object py" id="deepqmc.molecule.Molecule">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.molecule.</span></span><span class="sig-name descname"><span class="pre">Molecule</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coords</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charges</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charge</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">spin</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unit</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'bohr'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/molecule.html#Molecule"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.molecule.Molecule" title="Link to this definition">#</a></dt>
<dd><p>Represents a molecule.</p>
<p>The array-like arguments accept anything that can be transformed to
<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><code class="xref py py-class docutils literal notranslate"><span class="pre">jax.Array</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coords</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a><em>]</em>) – nuclear coordinates ((<span class="math">\(N_\text{nuc}\)</span>, 3), a.u.) as rows</p></li>
<li><p><strong>charges</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a><em>]</em>) – atom charges (<span class="math">\(N_\text{nuc}\)</span>)</p></li>
<li><p><strong>charge</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – total charge of a molecule</p></li>
<li><p><strong>spin</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – total spin multiplicity</p></li>
<li><p><strong>unit</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – units of the coordinates, either ‘bohr’ or ‘angstrom’</p></li>
<li><p><strong>data</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a>) – additional data stored with the molecule</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.molecule.Molecule.from_file">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/molecule.html#Molecule.from_file"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.molecule.Molecule.from_file" title="Link to this definition">#</a></dt>
<dd><p>Create a molecule from a YAML file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>file</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – path to the YAML file</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.molecule.Molecule.from_name">
<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/molecule.html#Molecule.from_name"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.molecule.Molecule.from_name" title="Link to this definition">#</a></dt>
<dd><p>Create a molecule from a database of named molecules.</p>
<p>The available names are in <code class="xref py py-attr docutils literal notranslate"><span class="pre">Molecule.all_names</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – name of the molecule (one of <code class="xref py py-attr docutils literal notranslate"><span class="pre">Molecule.all_names</span></code>)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class" id="module-deepqmc.hamil">
<dt class="sig sig-object py" id="deepqmc.hamil.LaplacianFactory">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hamil.</span></span><span class="sig-name descname"><span class="pre">LaplacianFactory</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hamil.html#LaplacianFactory"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hamil.LaplacianFactory" title="Link to this definition">#</a></dt>
<dd><p>Protocol class for Laplacian factories.</p>
<p>A Laplacian factory takes as input a function and returns a function that
computes the laplacian and gradient of the input function</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.hamil.MolecularHamiltonian">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hamil.</span></span><span class="sig-name descname"><span class="pre">MolecularHamiltonian</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mol</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ecp_type=None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ecp_mask=None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">elec_std=1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">laplacian_factory=<function</span> <span class="pre">laplacian></span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hamil.html#MolecularHamiltonian"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hamil.MolecularHamiltonian" title="Link to this definition">#</a></dt>
<dd><p>Hamiltonian of non-relativistic molecular systems.</p>
<p>The system consists of nuclei with fixed positions and electrons moving
around them. The total energy is defined as the sum of the nuclear-nuclear
and electron-electron repulsion, the nuclear-electron attraction, and the
kinetic energy of the electrons:
<span class="math">\(E=V_\text{nuc-nuc} + V_\text{el-el} + V_\text{nuc-el} + E_\text{kin}\)</span>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mol</strong> (<a class="reference internal" href="#deepqmc.molecule.Molecule" title="deepqmc.molecule.Molecule"><em>Molecule</em></a>) – the molecule to consider</p></li>
<li><p><strong>ecp_type</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – If set, use the appropriate effective core potential (ECP). The
string is passed to <code class="xref py py-func docutils literal notranslate"><span class="pre">pyscf.gto.M()</span></code> as <code class="xref py py-data docutils literal notranslate"><span class="pre">'ecp'</span></code> argument.
Supports ECPs that are implemented in the pyscf package, e.g. <code class="xref py py-data docutils literal notranslate"><span class="pre">'bfd'</span></code>
[Burkatzki et al. 2007] or <code class="xref py py-data docutils literal notranslate"><span class="pre">'ccECP'</span></code> [Bennett et al. 2017].</p></li>
<li><p><strong>ecp_mask</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a><em>]</em>) – list of True and False values (<span class="math">\(N_\text{nuc}\)</span>)
specifying whether to use an ECP for each nucleus.</p></li>
<li><p><strong>elec_std</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, a default value of the scaling factor
of the spread of electrons around the nuclei.</p></li>
<li><p><strong>laplacian_factory</strong> (<a class="reference internal" href="#deepqmc.hamil.LaplacianFactory" title="deepqmc.hamil.LaplacianFactory"><em>LaplacianFactory</em></a>) – creates a function that
returns a tuple containing the laplacian and gradient of the wave function.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.hamil.MolecularHamiltonian.as_pyscf">
<span class="sig-name descname"><span class="pre">as_pyscf</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coords</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hamil.html#MolecularHamiltonian.as_pyscf"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hamil.MolecularHamiltonian.as_pyscf" title="Link to this definition">#</a></dt>
<dd><p>Return the hamiltonian parameters in format pyscf can parse.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>coords</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a>) – optional, nuclear coordinates (<span class="math">\(N_\text{nuc}\)</span>, 3).</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.hamil.MolecularHamiltonian.init_sample">
<span class="sig-name descname"><span class="pre">init_sample</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rng</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">R</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">elec_std</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hamil.html#MolecularHamiltonian.init_sample"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hamil.MolecularHamiltonian.init_sample" title="Link to this definition">#</a></dt>
<dd><p>Guess some initial electron positions.</p>
<p>Tries to make an educated guess about plausible initial electron
configurations. Places electrons according to normal distributions
centered on the nuclei. If the molecule is not neutral, extra electrons
are placed on or removed from random nuclei. The resulting configurations
are usually very crude, a subsequent, thorough equilibration is needed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rng</strong> (<em>KeyArray</em>) – key used for PRNG.</p></li>
<li><p><strong>R</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a>) – nuclear coordinates of a single molecular geometry
(<span class="math">\(N_\text{nuc}\)</span>, 3)</p></li>
<li><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the number of initial electron configurations to generate.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><dl class="simple">
<dt>initial electron and nuclei</dt><dd><p>configurations</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#deepqmc.types.PhysicalConfiguration" title="deepqmc.types.PhysicalConfiguration"><code class="xref py py-class docutils literal notranslate"><span class="pre">PhysicalConfiguration</span></code></a></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<section id="haiku">
<h2>Haiku<a class="headerlink" href="#haiku" title="Link to this heading">#</a></h2>
<p>The JAX implementation uses the <a class="reference external" href="https://github.com/deepmind/dm-haiku">haiku library</a> to create, train and evaluate neural network models.
Some additional neural network functionality is implemented in the package and documented here.</p>
<dl class="py class" id="module-deepqmc.hkext">
<dt class="sig sig-object py" id="deepqmc.hkext.GLU">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">GLU</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#GLU"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.GLU" title="Link to this definition">#</a></dt>
<dd><p>Gated Linear Unit.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>out_dim</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the output dimension.</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – optional, the name of the network.</p></li>
<li><p><strong>bias</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – optional, whether to include a bias term.</p></li>
<li><p><strong>layer_norm_before</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – optional, whether to apply layer normalization before
the GLU operation.</p></li>
<li><p><strong>activation</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable" title="(in Python v3.13)"><em>Callable</em></a>) – default is sigmoid, the activation
function.</p></li>
<li><p><strong>b_init</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable" title="(in Python v3.13)"><em>Callable</em></a>) – default is zeros, the initialization
function for the bias term.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.hkext.Identity">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">Identity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#Identity"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.Identity" title="Link to this definition">#</a></dt>
<dd><p>Represent the identity operation.</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.hkext.MLP">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">MLP</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#MLP"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.MLP" title="Link to this definition">#</a></dt>
<dd><p>Represent a multilayer perceptron.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>out_dim</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the output dimension.</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – optional, the name of the network.</p></li>
<li><p><strong>hidden_layers</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#tuple" title="(in Python v3.13)"><em>tuple</em></a>) – optional, either (‘log’, <span class="math">\(N_\text{layers}\)</span>),
in which case the network will have <span class="math">\(N_\text{layers}\)</span> layers
with logarithmically changing widths, or a tuple of ints specifying
the width of each layer.</p></li>
<li><p><strong>bias</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a><em> | </em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – <p>optional, specifies which layers should have a bias term.
Possible values are</p>
<ul>
<li><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">True</span></code></a>: all layers will have a bias term</p></li>
<li><p><a class="reference external" href="https://docs.python.org/3/library/constants.html#False" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">False</span></code></a>: no layers will have a bias term</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">'not_last'</span></code>: all but the last layer will have a bias term</p></li>
</ul>
</p></li>
<li><p><strong>last_linear</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – optional, if <a class="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">True</span></code></a> the activation function
is not applied to the activation of the last layer.</p></li>
<li><p><strong>activation</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable" title="(in Python v3.13)"><em>Callable</em></a>) – optional, the activation function.</p></li>
<li><p><strong>init</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em> | </em><em>Callable</em>) – <p>optional, specifies the initialization of the
linear weights. Possible string values are:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">'default'</span></code>: the default haiku initialization method is used.</p></li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">'ferminet'</span></code>: the initialization method of the <code class="xref py py-class docutils literal notranslate"><span class="pre">ferminet</span></code></dt><dd><p>package is used.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">'deeperwin'</span></code>: the initialization method of the <code class="xref py py-class docutils literal notranslate"><span class="pre">deeperwin</span></code></dt><dd><p>package is used.</p>
</dd>
</dl>
</li>
</ul>
</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.hkext.ResidualConnection">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">ResidualConnection</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">normalize</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#ResidualConnection"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.ResidualConnection" title="Link to this definition">#</a></dt>
<dd><p>Represent a residual connection between pytrees.</p>
<p>The residual connection is only added if <code class="xref py py-data docutils literal notranslate"><span class="pre">inp</span></code> and <code class="xref py py-data docutils literal notranslate"><span class="pre">update</span></code>
have the same shape.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>normalize</strong> (<em>-</em>) – if <a class="reference external" href="https://docs.python.org/3/library/constants.html#True" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">True</span></code></a> the sum of <code class="xref py py-data docutils literal notranslate"><span class="pre">inp</span></code> and <code class="xref py py-data docutils literal notranslate"><span class="pre">update</span></code>
is normalized with <code class="xref py py-data docutils literal notranslate"><span class="pre">sqrt(2)</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.hkext.SumPool">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">SumPool</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">out_dim</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#SumPool"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.SumPool" title="Link to this definition">#</a></dt>
<dd><p>Represent a global sum pooling operation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>out_dim</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the output dimension.</p></li>
<li><p><strong>name</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – optional, the name of the network.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="deepqmc.hkext.ssp">
<span class="sig-prename descclassname"><span class="pre">deepqmc.hkext.</span></span><span class="sig-name descname"><span class="pre">ssp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/hkext.html#ssp"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.hkext.ssp" title="Link to this definition">#</a></dt>
<dd><p>Compute the shifted softplus activation function.</p>
<p>Computes the elementwise function
<span class="math">\(\text{softplus}(x)=\log(1+\text{e}^x)+\log\frac{1}{2}\)</span></p>
</dd></dl>
</section>
<section id="training-and-evaluation">
<h2>Training and evaluation<a class="headerlink" href="#training-and-evaluation" title="Link to this heading">#</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.types.TrainState">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.types.</span></span><span class="sig-name descname"><span class="pre">TrainState</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sampler</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opt</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/types.html#TrainState"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.types.TrainState" title="Link to this definition">#</a></dt>
<dd><p>Represent the current state of the training.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="deepqmc.types.TrainState.opt">
<span class="sig-name descname"><span class="pre">opt</span></span><a class="headerlink" href="#deepqmc.types.TrainState.opt" title="Link to this definition">#</a></dt>
<dd><p>Alias for field number 2</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="deepqmc.types.TrainState.params">
<span class="sig-name descname"><span class="pre">params</span></span><a class="headerlink" href="#deepqmc.types.TrainState.params" title="Link to this definition">#</a></dt>
<dd><p>Alias for field number 1</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="deepqmc.types.TrainState.sampler">
<span class="sig-name descname"><span class="pre">sampler</span></span><a class="headerlink" href="#deepqmc.types.TrainState.sampler" title="Link to this definition">#</a></dt>
<dd><p>Alias for field number 0</p>
</dd></dl>
</dd></dl>
<dl class="py function" id="module-deepqmc.train">
<dt class="sig sig-object py" id="deepqmc.train.train">
<span class="sig-prename descclassname"><span class="pre">deepqmc.train.</span></span><span class="sig-name descname"><span class="pre">train</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hamil</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ansatz</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">opt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sampler_factory</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">steps</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">electron_batch_size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">molecule_batch_size</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">electronic_states</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mols</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workdir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">train_state</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">init_step</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_restarts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_eq_steps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">eq_allow_early_stopping</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pretrain_steps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pretrain_kwargs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">chkpt_constructor</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">metric_logger_constructor</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">h5_logger_constructor</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">merge_keys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loss_function_factory</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">observable_monitors</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/train.html#train"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.train.train" title="Link to this definition">#</a></dt>
<dd><p>Train or evaluate a JAX wave function model.</p>
<p>It initializes and equilibrates the MCMC sampling of the wave function ansatz,
then optimizes or samples it using the variational principle. It optionally
saves checkpoints and rewinds the training/evaluation if an error is encountered.
If an optimizer is supplied, the Ansatz is optimized, otherwise the Ansatz is
only sampled.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>hamil</strong> (<a class="reference internal" href="#deepqmc.hamil.MolecularHamiltonian" title="deepqmc.hamil.MolecularHamiltonian"><em>MolecularHamiltonian</em></a>) – the Hamiltonian of the
physical system.</p></li>
<li><p><strong>ansatz</strong> (<a class="reference internal" href="#deepqmc.types.Ansatz" title="deepqmc.types.Ansatz"><em>Ansatz</em></a>) – the wave function Ansatz.</p></li>
<li><p><strong>opt</strong> (<code class="docutils literal notranslate"><span class="pre">kfac_jax</span></code> or <code class="docutils literal notranslate"><span class="pre">optax</span></code> optimizers | <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">None</span></code></a>) – <p>the optimizer. Possible values are:</p>
<ul>
<li><dl class="simple">
<dt><code class="xref py py-class docutils literal notranslate"><span class="pre">kfac_jax.Optimizer</span></code>:</dt><dd><p>the partially initialized KFAC optimizer is used</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>an <code class="xref py py-data docutils literal notranslate"><span class="pre">optax</span></code> optimizer instance:</dt><dd><p>the supplied <code class="xref py py-data docutils literal notranslate"><span class="pre">optax</span></code> optimizer is used.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><code class="xref py py-data docutils literal notranslate"><span class="pre">None</span></code></a>:</dt><dd><p>no optimizer is used, e.g. the evaluation of the Ansatz is performed.</p>
</dd>
</dl>
</li>
</ul>
</p></li>
<li><p><strong>sampler_factory</strong> (<a class="reference external" href="https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable" title="(in Python v3.13)"><em>Callable</em></a>) – a function that returns a Sampler
instance</p></li>
<li><p><strong>steps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – number of optimization steps.</p></li>
<li><p><strong>seed</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the seed used for PRNG.</p></li>
<li><p><strong>electron_batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the number of electron samples considered in a batch</p></li>
<li><p><strong>molecule_batch_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the number of molecules considered in a
batch. Only needed for transferable training.</p></li>
<li><p><strong>electronic_states</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the number of electronic states to consider.</p></li>
<li><p><strong>mols</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><a class="reference internal" href="#deepqmc.molecule.Molecule" title="deepqmc.molecule.Molecule"><em>Molecule</em></a><em>]</em>) – optional, a sequence of molecules
to consider for transferable training. If None the default molecule from
hamil is used.</p></li>
<li><p><strong>workdir</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – optional, path, where results should be saved.</p></li>
<li><p><strong>train_state</strong> (<a class="reference internal" href="#deepqmc.types.TrainState" title="deepqmc.types.TrainState"><em>TrainState</em></a>) – optional, training checkpoint to
restore training or run evaluation.</p></li>
<li><p><strong>init_step</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, initial step index, useful if
calculation is restarted from checkpoint saved on disk.</p></li>
<li><p><strong>max_restarts</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the maximum number of times the training is
retried before a <code class="xref py py-class docutils literal notranslate"><span class="pre">NaNError</span></code> is raised.</p></li>
<li><p><strong>max_eq_steps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, maximum number of equilibration steps if not
detected earlier.</p></li>
<li><p><strong>eq_allow_early_stopping</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – default <code class="docutils literal notranslate"><span class="pre">True</span></code>, whether to allow the
equilibration to stop early when the equilibration criterion has been met.</p></li>
<li><p><strong>pretrain_steps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the number of pretraining steps wrt. to the
Baseline wave function obtained with pyscf.</p></li>
<li><p><strong>pretrain_kwargs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a>) – optional, extra arguments for pretraining.</p></li>
<li><p><strong>chkpt_constructor</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Type" title="(in Python v3.13)"><em>Type</em></a><em>[</em><em>CheckpointStore</em><em>]</em>) – optional, an
object that saves training checkpoints to the working directory.</p></li>
<li><p><strong>metric_logger_constructor</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Type" title="(in Python v3.13)"><em>Type</em></a><em>[</em><em>MetricLogger</em><em>]</em>) – optional,
an object that consumes metric logging information. If not specified, the
default <code class="xref py py-class docutils literal notranslate"><span class="pre">TensorboardMetricLogger</span></code> is used to create
tensorboard logs.</p></li>
<li><p><strong>h5_logger_constructor</strong> (<a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.Type" title="(in Python v3.13)"><em>Type</em></a><em>[</em><em>H5Logger</em><em>]</em>) – optional, an object
that consumes metric logging information. If not specified, the default
<code class="xref py py-class docutils literal notranslate"><span class="pre">H5Logger</span></code> is used to write comprehensive training
statistics to an h5file.</p></li>
<li><p><strong>merge_keys</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – optional, list of strings for selecting parameters to be
shared across electronic states. Matching merge keys with (substrings of)
parameter keys.</p></li>
<li><p><strong>loss_function_factory</strong> (<em>LossFunctionFactory</em>) – optional, a callable returning a suitable loss function for the
optimization.</p></li>
<li><p><strong>observable_monitors</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a><em>[</em><em>ObservableMonitor</em><em>]</em>) – optional,
list of observable monitors to be evaluated during training or evaluation.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</section>
<section id="sampling">
<span id="module-deepqmc.fit"></span><h2>Sampling<a class="headerlink" href="#sampling" title="Link to this heading">#</a></h2>
<dl class="py attribute">
<dt class="sig sig-object py" id="deepqmc.types.SamplerState">
<span class="sig-prename descclassname"><span class="pre">deepqmc.types.</span></span><span class="sig-name descname"><span class="pre">SamplerState</span></span><a class="headerlink" href="#deepqmc.types.SamplerState" title="Link to this definition">#</a></dt>
<dd><p>alias of <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a></p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.base.ElectronSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.base.</span></span><span class="sig-name descname"><span class="pre">ElectronSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/base.html#ElectronSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.base.ElectronSampler" title="Link to this definition">#</a></dt>
<dd><p>Protocol for <a class="reference internal" href="#deepqmc.sampling.base.ElectronSampler" title="deepqmc.sampling.base.ElectronSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">ElectronSampler</span></code></a> objects.</p>
<p><a class="reference internal" href="#deepqmc.sampling.base.ElectronSampler" title="deepqmc.sampling.base.ElectronSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">ElectronSampler</span></code></a> objects implement Markov chain
samplers for the electron positions. The samplers are assumed to implement a batch
of walkers for a single electronic state on a single molecule and may be vmapped
to fit the respective context they are used in. Electron samplers can be combined
with <a class="reference internal" href="#deepqmc.sampling.chain" title="deepqmc.sampling.chain"><code class="xref py py-func docutils literal notranslate"><span class="pre">chain()</span></code></a>.</p>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.sampling.base.ElectronSampler.init">
<span class="sig-name descname"><span class="pre">init</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rng</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">R</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/base.html#ElectronSampler.init"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.base.ElectronSampler.init" title="Link to this definition">#</a></dt>
<dd><p>Initializes the sampler state.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rng</strong> (<em>KeyArray</em>) – an rng key for the initialization of electron
positions.</p></li>
<li><p><strong>params</strong> (<em>Params</em>) – the parameters of the wave function that is
being sampled.</p></li>
<li><p><strong>n</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the number of walkers to propagate in parallel.</p></li>
<li><p><strong>R</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a>) – the nuclei positions of the molecular configuration.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the sampler state holding electron
positions and data about the sampler trajectory.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#deepqmc.types.SamplerState" title="deepqmc.types.SamplerState"><code class="xref py py-type docutils literal notranslate"><span class="pre">SamplerState</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.sampling.base.ElectronSampler.sample">
<span class="sig-name descname"><span class="pre">sample</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rng</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">state</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">R</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/base.html#ElectronSampler.sample"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.base.ElectronSampler.sample" title="Link to this definition">#</a></dt>
<dd><p>Propagates the sampler state.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rng</strong> (<em>KeyArray</em>) – an rng key for the proposal of electron
positions.</p></li>
<li><p><strong>state</strong> (<em>SamplerState</em>) – the state of the sampler from the
previous step.</p></li>
<li><p><strong>params</strong> (<em>Params</em>) – the parameters of the wave function that is
being sampled.</p></li>
<li><p><strong>R</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a>) – the nuclei positions of the molecular configuration.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>tuple[<a class="reference internal" href="#deepqmc.types.SamplerState" title="deepqmc.types.SamplerState"><code class="xref py py-type docutils literal notranslate"><span class="pre">SamplerState</span></code></a>,
<a class="reference internal" href="#deepqmc.types.PhysicalConfiguration" title="deepqmc.types.PhysicalConfiguration"><code class="xref py py-type docutils literal notranslate"><span class="pre">PhysicalConfiguration</span></code></a>, <a class="reference internal" href="#deepqmc.types.Stats" title="deepqmc.types.Stats"><code class="xref py py-type docutils literal notranslate"><span class="pre">Stats</span></code></a>]:
the new sampler state, a physical configuration and statistics about the
sampling trajectory.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="deepqmc.sampling.base.ElectronSampler.update">
<span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">state</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">params</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">R</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/base.html#ElectronSampler.update"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.base.ElectronSampler.update" title="Link to this definition">#</a></dt>
<dd><p>Updates the sampler state.</p>
<p>The sampler state is updated to account for changes in the wave function due
to a parameter update.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>state</strong> (<em>SamplerState</em>) – the state of the sampler before
parameter update.</p></li>
<li><p><strong>params</strong> (<em>Params</em>) – the new parameters of the wave function.</p></li>
<li><p><strong>R</strong> (<a class="reference external" href="https://jax.readthedocs.io/en/latest/_autosummary/jax.Array.html#jax.Array" title="(in JAX)"><em>jax.Array</em></a>) – the nuclei positions of the molecular configuration.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the updated sampler state holding
electron positions and data about the sampler trajectory.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#deepqmc.types.SamplerState" title="deepqmc.types.SamplerState"><code class="xref py py-type docutils literal notranslate"><span class="pre">SamplerState</span></code></a></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="py class" id="module-deepqmc.sampling">
<dt class="sig sig-object py" id="deepqmc.sampling.DecorrSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">DecorrSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/electron_samplers.html#DecorrSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.DecorrSampler" title="Link to this definition">#</a></dt>
<dd><p>Insert decorrelating steps into chained samplers.</p>
<p>This sampler cannot be used as the last element of a sampler chain.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>length</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – the samples will be taken in every <code class="xref py py-data docutils literal notranslate"><span class="pre">length</span></code> MCMC step,
that is, <code class="xref py py-data docutils literal notranslate"><span class="pre">length</span></code> <span class="math">\(-1\)</span> decorrelating steps are inserted.</p>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.LangevinSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">LangevinSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hamil</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wf</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tau</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_acceptance</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.57</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_age</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/electron_samplers.html#LangevinSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.LangevinSampler" title="Link to this definition">#</a></dt>
<dd><p>Metropolis adjusted Langevin Monte Carlo sampler.</p>
<p>Derived from <a class="reference internal" href="#deepqmc.sampling.MetropolisSampler" title="deepqmc.sampling.MetropolisSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">MetropolisSampler</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>hamil</strong> (<a class="reference internal" href="#deepqmc.hamil.MolecularHamiltonian" title="deepqmc.hamil.MolecularHamiltonian"><em>MolecularHamiltonian</em></a>) – the Hamiltonian of the physical
system.</p></li>
<li><p><strong>wf</strong> – the <code class="xref py py-data docutils literal notranslate"><span class="pre">apply</span></code> method of the <code class="xref py py-data docutils literal notranslate"><span class="pre">haiku</span></code> transformed ansatz object.</p></li>
<li><p><strong>tau</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, the proposal step size scaling factor. Adjusted during
every step if <code class="xref py py-data docutils literal notranslate"><span class="pre">target_acceptance</span></code> is specified.</p></li>
<li><p><strong>target_acceptance</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, if specified the proposal step size
will be scaled such that the ratio of accepted proposal steps approaches
<code class="xref py py-data docutils literal notranslate"><span class="pre">target_acceptance</span></code>.</p></li>
<li><p><strong>max_age</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, if specified the next proposed step will always be
accepted for a walker that hasn’t moved in the last <code class="xref py py-data docutils literal notranslate"><span class="pre">max_age</span></code> steps.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.MetropolisSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">MetropolisSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hamil</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wf</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tau</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_acceptance</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.57</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_age</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/electron_samplers.html#MetropolisSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.MetropolisSampler" title="Link to this definition">#</a></dt>
<dd><p>Metropolis–Hastings Monte Carlo sampler.</p>
<p>The <code class="xref py py-meth docutils literal notranslate"><span class="pre">sample()</span></code> method of this class returns electron coordinate samples
from the distribution defined by the square of the sampled wave function.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>hamil</strong> (<a class="reference internal" href="#deepqmc.hamil.MolecularHamiltonian" title="deepqmc.hamil.MolecularHamiltonian"><em>MolecularHamiltonian</em></a>) – the Hamiltonian of the physical
system.</p></li>
<li><p><strong>wf</strong> – the <code class="xref py py-data docutils literal notranslate"><span class="pre">apply</span></code> method of the <code class="xref py py-data docutils literal notranslate"><span class="pre">haiku</span></code> transformed ansatz object.</p></li>
<li><p><strong>tau</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, the proposal step size scaling factor. Adjusted during
every step if <code class="xref py py-data docutils literal notranslate"><span class="pre">target_acceptance</span></code> is specified.</p></li>
<li><p><strong>target_acceptance</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, if specified the proposal step size
will be scaled such that the ratio of accepted proposal steps approaches
<code class="xref py py-data docutils literal notranslate"><span class="pre">target_acceptance</span></code>.</p></li>
<li><p><strong>max_age</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, if specified the next proposed step will always be
accepted for a walker that hasn’t moved in the last <code class="xref py py-data docutils literal notranslate"><span class="pre">max_age</span></code> steps.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.MoleculeIdxSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">MoleculeIdxSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rng</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_mols</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">batch_size</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shuffle</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/combined_samplers.html#MoleculeIdxSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.MoleculeIdxSampler" title="Link to this definition">#</a></dt>
<dd><p>Sample molecule indexes for transferable training.</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.MultiNuclearGeometrySampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">MultiNuclearGeometrySampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">elec_sampler</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nuc_sampler</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">warp_elec_fn</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">update_nuc_period</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">elec_equilibration_steps</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/combined_samplers.html#MultiNuclearGeometrySampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.MultiNuclearGeometrySampler" title="Link to this definition">#</a></dt>
<dd><p>This sampler samples from multiple nuclear geometries in parallel.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>elec_sampler</strong> (<em>ElectronSampler</em>) – the electronic sampler to use</p></li>
<li><p><strong>nuc_sampler</strong> (<em>NucleiSampler</em>) – the nuclei
sampler to use.</p></li>
<li><p><strong>warp_elec_fn</strong> (<em>ElectronWarp</em>) – the function
that warps the electrons to the new nuclear geometry.</p></li>
<li><p><strong>update_nuc_period</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the number of steps between nuclear updates.</p></li>
<li><p><strong>elec_equilibration_steps</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, the number of steps to equilibrate the
electronic state after a nuclear update.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="deepqmc.sampling.ResampledSampler">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">ResampledSampler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">period</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">threshold</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/electron_samplers.html#ResampledSampler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.ResampledSampler" title="Link to this definition">#</a></dt>
<dd><p>Add resampling to chained samplers.</p>
<p>This sampler cannot be used as the last element of a sampler chain.
The resampling is performed by accumulating weights on each MCMC walker
in each step. Based on a fixed resampling period <code class="xref py py-data docutils literal notranslate"><span class="pre">period</span></code> and/or a
threshold <code class="xref py py-data docutils literal notranslate"><span class="pre">threshold</span></code> on the normalized effective sample size the walker
positions are sampled according to the multinomial distribution defined by
these weights, and the weights are reset to one. Either <code class="xref py py-data docutils literal notranslate"><span class="pre">period</span></code> or
<code class="xref py py-data docutils literal notranslate"><span class="pre">threshold</span></code> have to be specified.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>period</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – optional, if specified the walkers are resampled every
<code class="xref py py-data docutils literal notranslate"><span class="pre">period</span></code> MCMC steps.</p></li>
<li><p><strong>threshold</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – optional, if specified the walkers are resampled if
the effective sample size normalized with the batch size is below
<code class="xref py py-data docutils literal notranslate"><span class="pre">threshold</span></code>.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="deepqmc.sampling.chain">
<span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">chain</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">samplers</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/sampling_utils.html#chain"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.chain" title="Link to this definition">#</a></dt>
<dd><p>Combine multiple sampler types, to create advanced sampling schemes.</p>
<p>For example <code class="xref py py-data docutils literal notranslate"><span class="pre">chain(DecorrSampler(10),MetropolisSampler(hamil,</span> <span class="pre">tau=1.))</span></code>
will create a <a class="reference internal" href="#deepqmc.sampling.MetropolisSampler" title="deepqmc.sampling.MetropolisSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">MetropolisSampler</span></code></a>, where the samples
are taken from every 10th MCMC step. The last element of the sampler chain has
to be either a <a class="reference internal" href="#deepqmc.sampling.MetropolisSampler" title="deepqmc.sampling.MetropolisSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">MetropolisSampler</span></code></a> or a <a class="reference internal" href="#deepqmc.sampling.LangevinSampler" title="deepqmc.sampling.LangevinSampler"><code class="xref py py-class docutils literal notranslate"><span class="pre">LangevinSampler</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>samplers</strong> (<a class="reference internal" href="#deepqmc.sampling.base.ElectronSampler" title="deepqmc.sampling.base.ElectronSampler"><em>ElectronSampler</em></a>) – one or more sampler instances
to combine.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the combined sampler.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference internal" href="#deepqmc.sampling.base.ElectronSampler" title="deepqmc.sampling.base.ElectronSampler"><code class="xref py py-type docutils literal notranslate"><span class="pre">ElectronSampler</span></code></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="deepqmc.sampling.combine_samplers">
<span class="sig-prename descclassname"><span class="pre">deepqmc.sampling.</span></span><span class="sig-name descname"><span class="pre">combine_samplers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">samplers</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hamil</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wf</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/deepqmc/sampling/sampling_utils.html#combine_samplers"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#deepqmc.sampling.combine_samplers" title="Link to this definition">#</a></dt>
<dd><p>Combine samplers to create more advanced sampling schemes.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>