NetKet 3.17__tar.gz → 3.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. {netket-3.17 → netket-3.18}/PKG-INFO +4 -4
  2. {netket-3.17 → netket-3.18}/netket/_version.py +2 -2
  3. {netket-3.17 → netket-3.18}/netket/experimental/__init__.py +4 -1
  4. netket-3.18/netket/experimental/geometry/__init__.py +8 -0
  5. netket-3.18/netket/experimental/geometry/cell.py +88 -0
  6. {netket-3.17 → netket-3.18}/netket/experimental/hilbert/__init__.py +7 -6
  7. netket-3.18/netket/experimental/hilbert/continuous_hilbert.py +45 -0
  8. netket-3.18/netket/experimental/hilbert/particle.py +85 -0
  9. netket-3.18/netket/experimental/hilbert/random/__init__.py +75 -0
  10. {netket-3.17/netket → netket-3.18/netket/experimental}/hilbert/random/particle.py +6 -5
  11. {netket-3.17 → netket-3.18}/netket/experimental/logging/hdf5_log.py +14 -8
  12. {netket-3.17 → netket-3.18}/netket/experimental/operator/__init__.py +5 -0
  13. netket-3.18/netket/experimental/operator/_normal_order_utils.py +422 -0
  14. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/__init__.py +6 -0
  15. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/_conversion.py +114 -0
  16. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/_fermihubbard.py +92 -0
  17. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/_kernels.py +393 -0
  18. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/_operator_data.py +577 -0
  19. netket-3.18/netket/experimental/operator/_particle_number_conserving_fermionic/_operators.py +485 -0
  20. netket-3.17/netket/experimental/operator/pyscf.py → netket-3.18/netket/experimental/operator/_pyscf_utils.py +44 -170
  21. netket-3.18/netket/experimental/operator/pyscf.py +157 -0
  22. {netket-3.17 → netket-3.18}/netket/graph/lattice.py +58 -39
  23. {netket-3.17 → netket-3.18}/netket/graph/space_group.py +257 -98
  24. {netket-3.17 → netket-3.18}/netket/hilbert/__init__.py +2 -19
  25. {netket-3.17 → netket-3.18}/netket/hilbert/random/__init__.py +1 -1
  26. {netket-3.17 → netket-3.18}/netket/hilbert/random/base.py +0 -4
  27. {netket-3.17 → netket-3.18}/netket/jax/__init__.py +1 -0
  28. netket-3.18/netket/jax/_sparse.py +79 -0
  29. {netket-3.17 → netket-3.18}/netket/logging/base.py +6 -4
  30. {netket-3.17 → netket-3.18}/netket/logging/runtime_log.py +5 -3
  31. {netket-3.17 → netket-3.18}/netket/logging/state_log.py +5 -3
  32. {netket-3.17 → netket-3.18}/netket/logging/tensorboard.py +2 -2
  33. {netket-3.17 → netket-3.18}/netket/models/deepset.py +7 -4
  34. {netket-3.17 → netket-3.18}/netket/operator/_fermion2nd/jax.py +2 -9
  35. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/helpers.py +1 -1
  36. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/jax.py +2 -8
  37. {netket-3.17 → netket-3.18}/netket/operator/_pauli_strings/base.py +1 -1
  38. {netket-3.17 → netket-3.18}/netket/sampler/metropolis.py +5 -1
  39. {netket-3.17 → netket-3.18}/netket/sampler/parallel_tempering.py +7 -15
  40. {netket-3.17 → netket-3.18}/netket/sampler/rules/continuous_gaussian.py +3 -2
  41. {netket-3.17 → netket-3.18}/netket/sampler/rules/exchange.py +0 -4
  42. {netket-3.17 → netket-3.18}/netket/sampler/rules/langevin.py +3 -2
  43. {netket-3.17 → netket-3.18}/netket/sampler/rules/multiple.py +1 -5
  44. {netket-3.17 → netket-3.18}/netket/sampler/rules/tensor.py +1 -1
  45. {netket-3.17 → netket-3.18}/netket/stats/_autocorr.py +1 -1
  46. {netket-3.17 → netket-3.18}/netket/utils/deprecation.py +1 -1
  47. {netket-3.17 → netket-3.18}/netket/utils/group/_permutation_group.py +85 -15
  48. {netket-3.17 → netket-3.18}/netket/utils/history/history_dict.py +12 -1
  49. {netket-3.17 → netket-3.18}/netket/utils/struct/pytree.py +6 -2
  50. {netket-3.17 → netket-3.18}/pyproject.toml +4 -4
  51. netket-3.17/netket/hilbert/continuous_hilbert.py +0 -70
  52. netket-3.17/netket/hilbert/custom_hilbert.py +0 -101
  53. netket-3.17/netket/hilbert/particle.py +0 -114
  54. netket-3.17/netket/hilbert/random/custom.py +0 -63
  55. {netket-3.17 → netket-3.18}/.gitignore +0 -0
  56. {netket-3.17 → netket-3.18}/LICENSE +0 -0
  57. {netket-3.17 → netket-3.18}/README.md +0 -0
  58. {netket-3.17 → netket-3.18}/hatch.toml +0 -0
  59. {netket-3.17 → netket-3.18}/netket/__init__.py +0 -0
  60. {netket-3.17 → netket-3.18}/netket/callbacks/__init__.py +0 -0
  61. {netket-3.17 → netket-3.18}/netket/callbacks/convergence_stopping.py +0 -0
  62. {netket-3.17 → netket-3.18}/netket/callbacks/early_stopping.py +0 -0
  63. {netket-3.17 → netket-3.18}/netket/callbacks/invalid_loss_stopping.py +0 -0
  64. {netket-3.17 → netket-3.18}/netket/callbacks/timeout.py +0 -0
  65. {netket-3.17 → netket-3.18}/netket/driver/__init__.py +0 -0
  66. {netket-3.17 → netket-3.18}/netket/driver/abstract_variational_driver.py +0 -0
  67. {netket-3.17 → netket-3.18}/netket/driver/steady_state.py +0 -0
  68. {netket-3.17 → netket-3.18}/netket/driver/vmc.py +0 -0
  69. {netket-3.17 → netket-3.18}/netket/driver/vmc_common.py +0 -0
  70. {netket-3.17 → netket-3.18}/netket/errors.py +0 -0
  71. {netket-3.17 → netket-3.18}/netket/exact.py +0 -0
  72. {netket-3.17 → netket-3.18}/netket/experimental/driver/__init__.py +0 -0
  73. {netket-3.17 → netket-3.18}/netket/experimental/driver/tdvp.py +0 -0
  74. {netket-3.17 → netket-3.18}/netket/experimental/driver/tdvp_common.py +0 -0
  75. {netket-3.17 → netket-3.18}/netket/experimental/driver/tdvp_schmitt.py +0 -0
  76. {netket-3.17 → netket-3.18}/netket/experimental/driver/vmc_srt.py +0 -0
  77. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/__init__.py +0 -0
  78. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_integrator.py +0 -0
  79. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_integrator_params.py +0 -0
  80. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_integrator_state.py +0 -0
  81. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_rk/__init__.py +0 -0
  82. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_rk/_solver.py +0 -0
  83. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_rk/_tableau.py +0 -0
  84. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_solver.py +0 -0
  85. {netket-3.17 → netket-3.18}/netket/experimental/dynamics/_utils.py +0 -0
  86. {netket-3.17 → netket-3.18}/netket/experimental/logging/__init__.py +0 -0
  87. {netket-3.17 → netket-3.18}/netket/experimental/models/__init__.py +0 -0
  88. {netket-3.17 → netket-3.18}/netket/experimental/models/fast_rnn.py +0 -0
  89. {netket-3.17 → netket-3.18}/netket/experimental/models/rnn.py +0 -0
  90. {netket-3.17 → netket-3.18}/netket/experimental/nn/__init__.py +0 -0
  91. {netket-3.17 → netket-3.18}/netket/experimental/nn/rnn/__init__.py +0 -0
  92. {netket-3.17 → netket-3.18}/netket/experimental/nn/rnn/cells.py +0 -0
  93. {netket-3.17 → netket-3.18}/netket/experimental/nn/rnn/layers.py +0 -0
  94. {netket-3.17 → netket-3.18}/netket/experimental/nn/rnn/layers_fast.py +0 -0
  95. {netket-3.17 → netket-3.18}/netket/experimental/nn/rnn/ordering.py +0 -0
  96. {netket-3.17 → netket-3.18}/netket/experimental/observable/__init__.py +0 -0
  97. {netket-3.17 → netket-3.18}/netket/experimental/observable/renyi2/S2_operator.py +0 -0
  98. {netket-3.17 → netket-3.18}/netket/experimental/observable/renyi2/__init__.py +0 -0
  99. {netket-3.17 → netket-3.18}/netket/experimental/observable/renyi2/exact.py +0 -0
  100. {netket-3.17 → netket-3.18}/netket/experimental/observable/renyi2/expect.py +0 -0
  101. {netket-3.17 → netket-3.18}/netket/experimental/observable/variance/__init__.py +0 -0
  102. {netket-3.17 → netket-3.18}/netket/experimental/observable/variance/exact.py +0 -0
  103. {netket-3.17 → netket-3.18}/netket/experimental/observable/variance/expect.py +0 -0
  104. {netket-3.17 → netket-3.18}/netket/experimental/observable/variance/variance_operator.py +0 -0
  105. {netket-3.17 → netket-3.18}/netket/experimental/operator/fermion.py +0 -0
  106. {netket-3.17 → netket-3.18}/netket/experimental/qsr/__init__.py +0 -0
  107. {netket-3.17 → netket-3.18}/netket/experimental/qsr/dataset.py +0 -0
  108. {netket-3.17 → netket-3.18}/netket/experimental/qsr/driver.py +0 -0
  109. {netket-3.17 → netket-3.18}/netket/experimental/qsr/logic_helpers.py +0 -0
  110. {netket-3.17 → netket-3.18}/netket/experimental/sampler/__init__.py +0 -0
  111. {netket-3.17 → netket-3.18}/netket/experimental/sampler/rules/__init__.py +0 -0
  112. {netket-3.17 → netket-3.18}/netket/experimental/vqs/__init__.py +0 -0
  113. {netket-3.17 → netket-3.18}/netket/experimental/vqs/io.py +0 -0
  114. {netket-3.17 → netket-3.18}/netket/graph/__init__.py +0 -0
  115. {netket-3.17 → netket-3.18}/netket/graph/_lattice_draw.py +0 -0
  116. {netket-3.17 → netket-3.18}/netket/graph/_lattice_edge_logic.py +0 -0
  117. {netket-3.17 → netket-3.18}/netket/graph/abstract_graph.py +0 -0
  118. {netket-3.17 → netket-3.18}/netket/graph/common_lattices.py +0 -0
  119. {netket-3.17 → netket-3.18}/netket/graph/graph.py +0 -0
  120. {netket-3.17 → netket-3.18}/netket/hilbert/abstract_hilbert.py +0 -0
  121. {netket-3.17 → netket-3.18}/netket/hilbert/constraint/__init__.py +0 -0
  122. {netket-3.17 → netket-3.18}/netket/hilbert/constraint/base.py +0 -0
  123. {netket-3.17 → netket-3.18}/netket/hilbert/constraint/multiple.py +0 -0
  124. {netket-3.17 → netket-3.18}/netket/hilbert/constraint/sum.py +0 -0
  125. {netket-3.17 → netket-3.18}/netket/hilbert/constraint/sum_partition.py +0 -0
  126. {netket-3.17 → netket-3.18}/netket/hilbert/discrete_hilbert.py +0 -0
  127. {netket-3.17 → netket-3.18}/netket/hilbert/doubled_hilbert.py +0 -0
  128. {netket-3.17 → netket-3.18}/netket/hilbert/fock.py +0 -0
  129. {netket-3.17 → netket-3.18}/netket/hilbert/homogeneous.py +0 -0
  130. {netket-3.17 → netket-3.18}/netket/hilbert/index/__init__.py +0 -0
  131. {netket-3.17 → netket-3.18}/netket/hilbert/index/base.py +0 -0
  132. {netket-3.17 → netket-3.18}/netket/hilbert/index/constrained_generic.py +0 -0
  133. {netket-3.17 → netket-3.18}/netket/hilbert/index/constrained_sum.py +0 -0
  134. {netket-3.17 → netket-3.18}/netket/hilbert/index/constrained_sum_partitions.py +0 -0
  135. {netket-3.17 → netket-3.18}/netket/hilbert/index/unconstrained.py +0 -0
  136. {netket-3.17 → netket-3.18}/netket/hilbert/index/uniform_tensor.py +0 -0
  137. {netket-3.17 → netket-3.18}/netket/hilbert/qubit.py +0 -0
  138. {netket-3.17 → netket-3.18}/netket/hilbert/random/doubled.py +0 -0
  139. {netket-3.17 → netket-3.18}/netket/hilbert/random/fock.py +0 -0
  140. {netket-3.17 → netket-3.18}/netket/hilbert/random/homogeneous.py +0 -0
  141. {netket-3.17 → netket-3.18}/netket/hilbert/random/qubit.py +0 -0
  142. {netket-3.17 → netket-3.18}/netket/hilbert/random/tensor_hilbert.py +0 -0
  143. {netket-3.17 → netket-3.18}/netket/hilbert/spin.py +0 -0
  144. {netket-3.17 → netket-3.18}/netket/hilbert/spin_orbital_fermions.py +0 -0
  145. {netket-3.17 → netket-3.18}/netket/hilbert/tensor_hilbert.py +0 -0
  146. {netket-3.17 → netket-3.18}/netket/hilbert/tensor_hilbert_discrete.py +0 -0
  147. {netket-3.17 → netket-3.18}/netket/jax/_chunk_utils.py +0 -0
  148. {netket-3.17 → netket-3.18}/netket/jax/_expect.py +0 -0
  149. {netket-3.17 → netket-3.18}/netket/jax/_grad.py +0 -0
  150. {netket-3.17 → netket-3.18}/netket/jax/_jacobian/__init__.py +0 -0
  151. {netket-3.17 → netket-3.18}/netket/jax/_jacobian/default_mode.py +0 -0
  152. {netket-3.17 → netket-3.18}/netket/jax/_jacobian/jacobian_dense.py +0 -0
  153. {netket-3.17 → netket-3.18}/netket/jax/_jacobian/jacobian_pytree.py +0 -0
  154. {netket-3.17 → netket-3.18}/netket/jax/_jacobian/logic.py +0 -0
  155. {netket-3.17 → netket-3.18}/netket/jax/_math.py +0 -0
  156. {netket-3.17 → netket-3.18}/netket/jax/_scanmap.py +0 -0
  157. {netket-3.17 → netket-3.18}/netket/jax/_sort.py +0 -0
  158. {netket-3.17 → netket-3.18}/netket/jax/_utils_dtype.py +0 -0
  159. {netket-3.17 → netket-3.18}/netket/jax/_utils_random.py +0 -0
  160. {netket-3.17 → netket-3.18}/netket/jax/_utils_tree.py +0 -0
  161. {netket-3.17 → netket-3.18}/netket/jax/_vjp.py +0 -0
  162. {netket-3.17 → netket-3.18}/netket/jax/_vjp_chunked.py +0 -0
  163. {netket-3.17 → netket-3.18}/netket/jax/_vmap_chunked.py +0 -0
  164. {netket-3.17 → netket-3.18}/netket/jax/sharding.py +0 -0
  165. {netket-3.17 → netket-3.18}/netket/logging/__init__.py +0 -0
  166. {netket-3.17 → netket-3.18}/netket/logging/json_log.py +0 -0
  167. {netket-3.17 → netket-3.18}/netket/models/README.md +0 -0
  168. {netket-3.17 → netket-3.18}/netket/models/__init__.py +0 -0
  169. {netket-3.17 → netket-3.18}/netket/models/autoreg.py +0 -0
  170. {netket-3.17 → netket-3.18}/netket/models/equivariant.py +0 -0
  171. {netket-3.17 → netket-3.18}/netket/models/fast_autoreg.py +0 -0
  172. {netket-3.17 → netket-3.18}/netket/models/full_space.py +0 -0
  173. {netket-3.17 → netket-3.18}/netket/models/gaussian.py +0 -0
  174. {netket-3.17 → netket-3.18}/netket/models/jastrow.py +0 -0
  175. {netket-3.17 → netket-3.18}/netket/models/mlp.py +0 -0
  176. {netket-3.17 → netket-3.18}/netket/models/ndm.py +0 -0
  177. {netket-3.17 → netket-3.18}/netket/models/rbm.py +0 -0
  178. {netket-3.17 → netket-3.18}/netket/models/slater.py +0 -0
  179. {netket-3.17 → netket-3.18}/netket/models/tensor_networks/__init__.py +0 -0
  180. {netket-3.17 → netket-3.18}/netket/models/tensor_networks/mpdo.py +0 -0
  181. {netket-3.17 → netket-3.18}/netket/models/tensor_networks/mps.py +0 -0
  182. {netket-3.17 → netket-3.18}/netket/models/utils.py +0 -0
  183. {netket-3.17 → netket-3.18}/netket/nn/__init__.py +0 -0
  184. {netket-3.17 → netket-3.18}/netket/nn/activation.py +0 -0
  185. {netket-3.17 → netket-3.18}/netket/nn/blocks/__init__.py +0 -0
  186. {netket-3.17 → netket-3.18}/netket/nn/blocks/deepset.py +0 -0
  187. {netket-3.17 → netket-3.18}/netket/nn/blocks/mlp.py +0 -0
  188. {netket-3.17 → netket-3.18}/netket/nn/blocks/symmetry_sum.py +0 -0
  189. {netket-3.17 → netket-3.18}/netket/nn/fast_masked_linear.py +0 -0
  190. {netket-3.17 → netket-3.18}/netket/nn/masked_linear.py +0 -0
  191. {netket-3.17 → netket-3.18}/netket/nn/symmetric_linear.py +0 -0
  192. {netket-3.17 → netket-3.18}/netket/nn/utils.py +0 -0
  193. {netket-3.17 → netket-3.18}/netket/operator/__init__.py +0 -0
  194. {netket-3.17 → netket-3.18}/netket/operator/_abstract_observable.py +0 -0
  195. {netket-3.17 → netket-3.18}/netket/operator/_abstract_operator.py +0 -0
  196. {netket-3.17 → netket-3.18}/netket/operator/_abstract_super_operator.py +0 -0
  197. {netket-3.17 → netket-3.18}/netket/operator/_bose_hubbard/__init__.py +0 -0
  198. {netket-3.17 → netket-3.18}/netket/operator/_bose_hubbard/base.py +0 -0
  199. {netket-3.17 → netket-3.18}/netket/operator/_bose_hubbard/jax.py +0 -0
  200. {netket-3.17 → netket-3.18}/netket/operator/_bose_hubbard/numba.py +0 -0
  201. {netket-3.17 → netket-3.18}/netket/operator/_continuous_operator.py +0 -0
  202. {netket-3.17 → netket-3.18}/netket/operator/_discrete_operator.py +0 -0
  203. {netket-3.17 → netket-3.18}/netket/operator/_discrete_operator_jax.py +0 -0
  204. {netket-3.17 → netket-3.18}/netket/operator/_fermion2nd/__init__.py +0 -0
  205. {netket-3.17 → netket-3.18}/netket/operator/_fermion2nd/base.py +0 -0
  206. {netket-3.17 → netket-3.18}/netket/operator/_fermion2nd/numba.py +0 -0
  207. {netket-3.17 → netket-3.18}/netket/operator/_fermion2nd/utils.py +0 -0
  208. {netket-3.17 → netket-3.18}/netket/operator/_graph_operator.py +0 -0
  209. {netket-3.17 → netket-3.18}/netket/operator/_hamiltonian.py +0 -0
  210. {netket-3.17 → netket-3.18}/netket/operator/_heisenberg.py +0 -0
  211. {netket-3.17 → netket-3.18}/netket/operator/_ising/__init__.py +0 -0
  212. {netket-3.17 → netket-3.18}/netket/operator/_ising/base.py +0 -0
  213. {netket-3.17 → netket-3.18}/netket/operator/_ising/jax.py +0 -0
  214. {netket-3.17 → netket-3.18}/netket/operator/_ising/numba.py +0 -0
  215. {netket-3.17 → netket-3.18}/netket/operator/_kinetic.py +0 -0
  216. {netket-3.17 → netket-3.18}/netket/operator/_lazy.py +0 -0
  217. {netket-3.17 → netket-3.18}/netket/operator/_local_liouvillian.py +0 -0
  218. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/__init__.py +0 -0
  219. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/base.py +0 -0
  220. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/compile_helpers.py +0 -0
  221. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/convert.py +0 -0
  222. {netket-3.17 → netket-3.18}/netket/operator/_local_operator/numba.py +0 -0
  223. {netket-3.17 → netket-3.18}/netket/operator/_pauli_strings/__init__.py +0 -0
  224. {netket-3.17 → netket-3.18}/netket/operator/_pauli_strings/jax.py +0 -0
  225. {netket-3.17 → netket-3.18}/netket/operator/_pauli_strings/numba.py +0 -0
  226. {netket-3.17 → netket-3.18}/netket/operator/_potential.py +0 -0
  227. {netket-3.17 → netket-3.18}/netket/operator/_sumoperators.py +0 -0
  228. {netket-3.17 → netket-3.18}/netket/operator/boson.py +0 -0
  229. {netket-3.17 → netket-3.18}/netket/operator/fermion.py +0 -0
  230. {netket-3.17 → netket-3.18}/netket/operator/spin.py +0 -0
  231. {netket-3.17 → netket-3.18}/netket/optimizer/__init__.py +0 -0
  232. {netket-3.17 → netket-3.18}/netket/optimizer/linear_operator.py +0 -0
  233. {netket-3.17 → netket-3.18}/netket/optimizer/preconditioner.py +0 -0
  234. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/__init__.py +0 -0
  235. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/common.py +0 -0
  236. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/default.py +0 -0
  237. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_jacobian.py +0 -0
  238. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_jacobian_common.py +0 -0
  239. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_jacobian_dense.py +0 -0
  240. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_jacobian_pytree.py +0 -0
  241. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_onthefly.py +0 -0
  242. {netket-3.17 → netket-3.18}/netket/optimizer/qgt/qgt_onthefly_logic.py +0 -0
  243. {netket-3.17 → netket-3.18}/netket/optimizer/solver/__init__.py +0 -0
  244. {netket-3.17 → netket-3.18}/netket/optimizer/solver/solvers.py +0 -0
  245. {netket-3.17 → netket-3.18}/netket/optimizer/sr.py +0 -0
  246. {netket-3.17 → netket-3.18}/netket/sampler/__init__.py +0 -0
  247. {netket-3.17 → netket-3.18}/netket/sampler/autoreg.py +0 -0
  248. {netket-3.17 → netket-3.18}/netket/sampler/base.py +0 -0
  249. {netket-3.17 → netket-3.18}/netket/sampler/exact.py +0 -0
  250. {netket-3.17 → netket-3.18}/netket/sampler/metropolis_numpy.py +0 -0
  251. {netket-3.17 → netket-3.18}/netket/sampler/rules/__init__.py +0 -0
  252. {netket-3.17 → netket-3.18}/netket/sampler/rules/base.py +0 -0
  253. {netket-3.17 → netket-3.18}/netket/sampler/rules/custom_numpy.py +0 -0
  254. {netket-3.17 → netket-3.18}/netket/sampler/rules/fermion_2nd.py +0 -0
  255. {netket-3.17 → netket-3.18}/netket/sampler/rules/fixed.py +0 -0
  256. {netket-3.17 → netket-3.18}/netket/sampler/rules/hamiltonian.py +0 -0
  257. {netket-3.17 → netket-3.18}/netket/sampler/rules/hamiltonian_numpy.py +0 -0
  258. {netket-3.17 → netket-3.18}/netket/sampler/rules/local.py +0 -0
  259. {netket-3.17 → netket-3.18}/netket/sampler/rules/local_numpy.py +0 -0
  260. {netket-3.17 → netket-3.18}/netket/stats/__init__.py +0 -0
  261. {netket-3.17 → netket-3.18}/netket/stats/mc_stats.py +0 -0
  262. {netket-3.17 → netket-3.18}/netket/stats/mc_stats_old.py +0 -0
  263. {netket-3.17 → netket-3.18}/netket/stats/mpi_stats.py +0 -0
  264. {netket-3.17 → netket-3.18}/netket/tools/__init__.py +0 -0
  265. {netket-3.17 → netket-3.18}/netket/tools/_common.py +0 -0
  266. {netket-3.17 → netket-3.18}/netket/tools/_cpu_info.py +0 -0
  267. {netket-3.17 → netket-3.18}/netket/tools/_mpi_info.py +0 -0
  268. {netket-3.17 → netket-3.18}/netket/tools/check_mpi.py +0 -0
  269. {netket-3.17 → netket-3.18}/netket/tools/info.py +0 -0
  270. {netket-3.17 → netket-3.18}/netket/utils/__init__.py +0 -0
  271. {netket-3.17 → netket-3.18}/netket/utils/_dependencies_check.py +0 -0
  272. {netket-3.17 → netket-3.18}/netket/utils/_serialization.py +0 -0
  273. {netket-3.17 → netket-3.18}/netket/utils/api_utils.py +0 -0
  274. {netket-3.17 → netket-3.18}/netket/utils/array.py +0 -0
  275. {netket-3.17 → netket-3.18}/netket/utils/config_flags.py +0 -0
  276. {netket-3.17 → netket-3.18}/netket/utils/dispatch.py +0 -0
  277. {netket-3.17 → netket-3.18}/netket/utils/display/__init__.py +0 -0
  278. {netket-3.17 → netket-3.18}/netket/utils/display/repr.py +0 -0
  279. {netket-3.17 → netket-3.18}/netket/utils/float.py +0 -0
  280. {netket-3.17 → netket-3.18}/netket/utils/group/__init__.py +0 -0
  281. {netket-3.17 → netket-3.18}/netket/utils/group/_group.py +0 -0
  282. {netket-3.17 → netket-3.18}/netket/utils/group/_point_group.py +0 -0
  283. {netket-3.17 → netket-3.18}/netket/utils/group/_semigroup.py +0 -0
  284. {netket-3.17 → netket-3.18}/netket/utils/group/axial.py +0 -0
  285. {netket-3.17 → netket-3.18}/netket/utils/group/cubic.py +0 -0
  286. {netket-3.17 → netket-3.18}/netket/utils/group/icosa.py +0 -0
  287. {netket-3.17 → netket-3.18}/netket/utils/group/planar.py +0 -0
  288. {netket-3.17 → netket-3.18}/netket/utils/history/__init__.py +0 -0
  289. {netket-3.17 → netket-3.18}/netket/utils/history/accum.py +0 -0
  290. {netket-3.17 → netket-3.18}/netket/utils/history/history.py +0 -0
  291. {netket-3.17 → netket-3.18}/netket/utils/holomorphic.py +0 -0
  292. {netket-3.17 → netket-3.18}/netket/utils/jax.py +0 -0
  293. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/__init__.py +0 -0
  294. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/base.py +0 -0
  295. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/equinox.py +0 -0
  296. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/flax.py +0 -0
  297. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/haiku.py +0 -0
  298. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/jax.py +0 -0
  299. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/nnx.py +0 -0
  300. {netket-3.17 → netket-3.18}/netket/utils/model_frameworks/nnx_wrapped.py +0 -0
  301. {netket-3.17 → netket-3.18}/netket/utils/moduletools.py +0 -0
  302. {netket-3.17 → netket-3.18}/netket/utils/mpi/__init__.py +0 -0
  303. {netket-3.17 → netket-3.18}/netket/utils/mpi/gpu_autorank_util.py +0 -0
  304. {netket-3.17 → netket-3.18}/netket/utils/mpi/mpi.py +0 -0
  305. {netket-3.17 → netket-3.18}/netket/utils/mpi/primitives.py +0 -0
  306. {netket-3.17 → netket-3.18}/netket/utils/numbers.py +0 -0
  307. {netket-3.17 → netket-3.18}/netket/utils/optional_deps.py +0 -0
  308. {netket-3.17 → netket-3.18}/netket/utils/partial.py +0 -0
  309. {netket-3.17 → netket-3.18}/netket/utils/seed.py +0 -0
  310. {netket-3.17 → netket-3.18}/netket/utils/static_number.py +0 -0
  311. {netket-3.17 → netket-3.18}/netket/utils/static_range.py +0 -0
  312. {netket-3.17 → netket-3.18}/netket/utils/struct/__init__.py +0 -0
  313. {netket-3.17 → netket-3.18}/netket/utils/struct/dataclass.py +0 -0
  314. {netket-3.17 → netket-3.18}/netket/utils/struct/fields.py +0 -0
  315. {netket-3.17 → netket-3.18}/netket/utils/struct/pytree_serialization_sharding.py +0 -0
  316. {netket-3.17 → netket-3.18}/netket/utils/struct/utils.py +0 -0
  317. {netket-3.17 → netket-3.18}/netket/utils/summation.py +0 -0
  318. {netket-3.17 → netket-3.18}/netket/utils/timing.py +0 -0
  319. {netket-3.17 → netket-3.18}/netket/utils/types.py +0 -0
  320. {netket-3.17 → netket-3.18}/netket/utils/version_check.py +0 -0
  321. {netket-3.17 → netket-3.18}/netket/vqs/__init__.py +0 -0
  322. {netket-3.17 → netket-3.18}/netket/vqs/base.py +0 -0
  323. {netket-3.17 → netket-3.18}/netket/vqs/full_summ/__init__.py +0 -0
  324. {netket-3.17 → netket-3.18}/netket/vqs/full_summ/expect.py +0 -0
  325. {netket-3.17 → netket-3.18}/netket/vqs/full_summ/state.py +0 -0
  326. {netket-3.17 → netket-3.18}/netket/vqs/mc/__init__.py +0 -0
  327. {netket-3.17 → netket-3.18}/netket/vqs/mc/common.py +0 -0
  328. {netket-3.17 → netket-3.18}/netket/vqs/mc/kernels.py +0 -0
  329. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_mixed_state/__init__.py +0 -0
  330. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_mixed_state/expect.py +0 -0
  331. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_mixed_state/expect_chunked.py +0 -0
  332. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_mixed_state/state.py +0 -0
  333. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/__init__.py +0 -0
  334. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect.py +0 -0
  335. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect_chunked.py +0 -0
  336. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect_forces.py +0 -0
  337. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect_forces_chunked.py +0 -0
  338. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect_grad.py +0 -0
  339. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/expect_grad_chunked.py +0 -0
  340. {netket-3.17 → netket-3.18}/netket/vqs/mc/mc_state/state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NetKet
3
- Version: 3.17
3
+ Version: 3.18
4
4
  Summary: Netket : Machine Learning toolbox for many-body quantum systems.
5
5
  Project-URL: homepage, https://www.netket.org
6
6
  Project-URL: documentation, https://netket.readthedocs.io/en/latest/#
@@ -17,7 +17,7 @@ Classifier: Operating System :: POSIX :: Linux
17
17
  Classifier: Operating System :: Unix
18
18
  Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Topic :: Scientific/Engineering :: Physics
20
- Requires-Python: >=3.10
20
+ Requires-Python: >=3.11
21
21
  Requires-Dist: equinox>=0.11.3
22
22
  Requires-Dist: flax>=0.10.2
23
23
  Requires-Dist: igraph>=0.10.0
@@ -29,6 +29,7 @@ Requires-Dist: orjson<4,>=3.4
29
29
  Requires-Dist: plum-dispatch>=2.4
30
30
  Requires-Dist: rich>=12.0
31
31
  Requires-Dist: scipy<2,>=1.5.3
32
+ Requires-Dist: sparse>=0.12.0
32
33
  Requires-Dist: tqdm<5,>=4.60
33
34
  Provides-Extra: dev
34
35
  Requires-Dist: black==24.1.0; extra == 'dev'
@@ -50,9 +51,9 @@ Requires-Dist: myst-parser<4.1.0,>=2.0.0; extra == 'docs'
50
51
  Requires-Dist: sphinx-autodoc-typehints<4.0,>=1.22; extra == 'docs'
51
52
  Requires-Dist: sphinx-book-theme~=1.1.0; extra == 'docs'
52
53
  Requires-Dist: sphinx-design>=0.4.0; extra == 'docs'
53
- Requires-Dist: sphinx<8.2,>=7.0; extra == 'docs'
54
54
  Requires-Dist: sphinxcontrib-fulltoc~=1.2.0; extra == 'docs'
55
55
  Requires-Dist: sphinxcontrib-jsmath~=1.0.1; extra == 'docs'
56
+ Requires-Dist: sphinx~=8.2.3; extra == 'docs'
56
57
  Provides-Extra: extra
57
58
  Requires-Dist: h5py>=3.7.0; extra == 'extra'
58
59
  Requires-Dist: openfermion>=1.0.0; extra == 'extra'
@@ -63,7 +64,6 @@ Requires-Dist: mpi4jax>=0.3.9; extra == 'mpi'
63
64
  Requires-Dist: mpi4py<5,>=3.0.1; extra == 'mpi'
64
65
  Provides-Extra: pyscf
65
66
  Requires-Dist: pyscf>=2.0; extra == 'pyscf'
66
- Requires-Dist: sparse>=0.12.0; extra == 'pyscf'
67
67
  Description-Content-Type: text/markdown
68
68
 
69
69
  <div align="center">
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '3.17'
21
- __version_tuple__ = version_tuple = (3, 17)
20
+ __version__ = version = '3.18'
21
+ __version_tuple__ = version_tuple = (3, 18)
@@ -15,6 +15,7 @@
15
15
  __all__ = [
16
16
  "driver",
17
17
  "dynamics",
18
+ "geometry",
18
19
  "sampler",
19
20
  "vqs",
20
21
  "TDVP",
@@ -23,18 +24,20 @@ __all__ = [
23
24
  "operator",
24
25
  "logging",
25
26
  "observable",
27
+ "QSR",
26
28
  ]
27
29
 
30
+ from . import geometry
28
31
  from . import hilbert
29
32
  from . import operator
30
33
  from . import driver
31
34
  from . import dynamics
32
35
  from . import sampler
33
- from . import models
34
36
  from . import vqs
35
37
  from . import logging
36
38
  from . import qsr
37
39
  from . import observable
40
+ from . import models
38
41
 
39
42
  from .driver import TDVP
40
43
  from .qsr import QSR
@@ -0,0 +1,8 @@
1
+ """Geometry classes for continuous Hilbert spaces."""
2
+
3
+ __all__ = [
4
+ "Cell",
5
+ "FreeSpace",
6
+ ]
7
+
8
+ from .cell import Cell, FreeSpace
@@ -0,0 +1,88 @@
1
+ from dataclasses import dataclass
2
+ from typing import Sequence
3
+
4
+ import jax.numpy as jnp
5
+ import numpy as np
6
+ from jax.tree_util import register_pytree_node_class
7
+
8
+
9
+ @register_pytree_node_class
10
+ @dataclass(frozen=True)
11
+ class Cell:
12
+ """A finite region in continuous space."""
13
+
14
+ extent: tuple[float, ...]
15
+ pbc: tuple[bool, ...]
16
+
17
+ def __init__(
18
+ self,
19
+ d: int,
20
+ L: float | Sequence[float] = 1.0,
21
+ pbc: bool | Sequence[bool] = True,
22
+ ) -> None:
23
+ if d <= 0:
24
+ raise ValueError("d must be positive")
25
+
26
+ if hasattr(L, "__len__"):
27
+ if len(L) != d:
28
+ raise ValueError("Length of L must match d")
29
+ extent = tuple(float(x) for x in L)
30
+ else:
31
+ extent = (float(L),) * d
32
+
33
+ if isinstance(pbc, bool):
34
+ pbc_tuple = (pbc,) * d
35
+ else:
36
+ if len(pbc) != d:
37
+ raise ValueError("Length of pbc must match d")
38
+ pbc_tuple = tuple(bool(x) for x in pbc)
39
+
40
+ for e, b in zip(extent, pbc_tuple):
41
+ if np.isinf(e) and b:
42
+ raise ValueError(
43
+ "Cannot combine periodic boundary conditions with infinite extent"
44
+ )
45
+
46
+ object.__setattr__(self, "extent", extent)
47
+ object.__setattr__(self, "pbc", pbc_tuple)
48
+
49
+ def tree_flatten(self):
50
+ data = (jnp.asarray(self.extent), jnp.asarray(self.pbc))
51
+ return data, None
52
+
53
+ @classmethod
54
+ def tree_unflatten(cls, aux, data):
55
+ extent, pbc = data
56
+ return cls(
57
+ d=len(extent),
58
+ L=tuple(float(x) for x in extent),
59
+ pbc=tuple(bool(x) for x in pbc),
60
+ )
61
+
62
+ @property
63
+ def dimension(self) -> int:
64
+ return len(self.extent)
65
+
66
+ def distance(
67
+ self, r1: Sequence[float] | jnp.ndarray, r2: Sequence[float] | jnp.ndarray
68
+ ) -> jnp.ndarray:
69
+ """Euclidean distance between ``r1`` and ``r2`` considering boundary conditions."""
70
+
71
+ r1 = jnp.asarray(r1)
72
+ r2 = jnp.asarray(r2)
73
+ diff = r1 - r2
74
+ ext = jnp.asarray(self.extent)
75
+ pbc = jnp.asarray(self.pbc)
76
+
77
+ shift = jnp.where(pbc, jnp.round(diff / ext) * ext, 0.0)
78
+ diff = diff - shift
79
+ return jnp.linalg.norm(diff, axis=-1)
80
+
81
+
82
+ @register_pytree_node_class
83
+ @dataclass(frozen=True)
84
+ class FreeSpace(Cell):
85
+ """Infinite space without periodic boundary conditions."""
86
+
87
+ def __init__(self, d: int) -> None:
88
+ super().__init__(d=d, L=(np.inf,) * d, pbc=False)
@@ -13,11 +13,13 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- __all__ = ["SpinOrbitalFermions"]
16
+ __all__ = ["ContinuousHilbert", "Particle"]
17
17
 
18
+ from .continuous_hilbert import ContinuousHilbert
19
+ from .particle import Particle
20
+ from . import random
18
21
  from netket.hilbert import SpinOrbitalFermions as _deprecated_SpinOrbitalFermions
19
22
 
20
-
21
23
  _deprecations = {
22
24
  # May 2024
23
25
  "SpinOrbitalFermions": (
@@ -27,11 +29,10 @@ _deprecations = {
27
29
  ),
28
30
  }
29
31
 
32
+ from netket.utils import _auto_export
30
33
  from netket.utils.deprecation import deprecation_getattr as _deprecation_getattr
31
34
 
32
35
  __getattr__ = _deprecation_getattr(__name__, _deprecations)
33
- del _deprecation_getattr
34
-
35
- from netket.utils import _hide_submodules
36
+ _auto_export(__name__)
36
37
 
37
- _hide_submodules(__name__)
38
+ del _deprecation_getattr, _auto_export
@@ -0,0 +1,45 @@
1
+ # Copyright 2021 The NetKet Authors - All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from netket.hilbert.abstract_hilbert import AbstractHilbert
16
+
17
+
18
+ class ContinuousHilbert(AbstractHilbert):
19
+ """Abstract class for the Hilbert space of particles
20
+ in continuous space.
21
+
22
+ This class defines the common interface that
23
+ can be used to interact with particles defined
24
+ in continuous space.
25
+ """
26
+
27
+ def __init__(self, domain: tuple[float, ...]):
28
+ """
29
+ Constructs an Hilbert space with continuous degrees of freedom, given specifications of the space.
30
+
31
+ This object returns an Hilbert space.
32
+
33
+ Args:
34
+ domain: Tuple indicating the maximum of the continuous quantum number(s) in the configurations. Each entry
35
+ in the tuple corresponds to a different physical dimension.
36
+ A particle in a 3D box of size L would take `(L,L,L)`. A rotor model would take e.g. `(2pi,)`.
37
+ """
38
+ self._extent = tuple(domain)
39
+
40
+ super().__init__()
41
+
42
+ @property
43
+ def domain(self) -> tuple[float, ...]:
44
+ r"""Domain of the continuous variable, specified for each dimension"""
45
+ return self._extent
@@ -0,0 +1,85 @@
1
+ # Copyright 2021 The NetKet Authors - All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from .continuous_hilbert import ContinuousHilbert
15
+ from netket.experimental.geometry import Cell
16
+
17
+
18
+ class Particle(ContinuousHilbert):
19
+ r"""Hilbert space derived from ContinuousHilbert defining N particles
20
+ in continuous space with or without periodic boundary conditions."""
21
+
22
+ def __init__(
23
+ self,
24
+ N: int | tuple[int, ...],
25
+ *,
26
+ geometry: Cell,
27
+ ) -> None:
28
+ """
29
+ Constructs new ``Particles`` given specifications
30
+ of the continuous space they are defined in.
31
+
32
+ Args:
33
+ N: Number of particles. If int all have the same spin. If Tuple the entry indicates how many particles
34
+ there are with a certain spin-projection.
35
+ geometry: Instance of :class:`~netket.experimental.geometry.Cell` defining the geometry.
36
+ """
37
+
38
+ if not hasattr(N, "__len__"):
39
+ N = (N,)
40
+
41
+ if not isinstance(geometry, Cell):
42
+ raise TypeError(
43
+ "`geometry` must be an instance of `netket.experimental.geometry.Cell`."
44
+ )
45
+
46
+ self._N = sum(N)
47
+ self._n_per_spin = N
48
+ self._geometry = geometry
49
+
50
+ super().__init__(geometry.extent)
51
+
52
+ @property
53
+ def size(self) -> int:
54
+ return self._N * len(self.domain)
55
+
56
+ @property
57
+ def n_particles(self) -> int:
58
+ r"""The number of particles"""
59
+ return self._N
60
+
61
+ @property
62
+ def n_per_spin(self) -> tuple[int, ...]:
63
+ r"""Gives the number of particles in a specific spin
64
+ projection.
65
+
66
+ The length of this tuple indicates the total spin whereas
67
+ the position in the tuple indicates the spin projection.
68
+
69
+ Example: (10,5,3) describes 18 particles of total spin 1
70
+ where 10 of those have spin-projection -1, 5 have
71
+ spin-projection 0 and 3 have spin-projection 1.
72
+ """
73
+ return self._n_per_spin
74
+
75
+ @property
76
+ def geometry(self) -> Cell:
77
+ """Geometry of the continuous space."""
78
+ return self._geometry
79
+
80
+ @property
81
+ def _attrs(self):
82
+ return (self._N, self.geometry)
83
+
84
+ def __repr__(self):
85
+ return f"Particle(N={self.n_particles}, d={len(self.domain)})"
@@ -0,0 +1,75 @@
1
+ # Copyright 2021 The NetKet Authors - All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """
16
+ This module contains functions that act on hilbert spaces necessary
17
+ for sampling.
18
+
19
+ If you define custom hilbert spaces, and want to sample from it, you
20
+ should read carefully.
21
+
22
+ This module *exports* two functions:
23
+ - `random_state(hilbert, key, batch_size, dtype)` which generates a batch of random
24
+ states in the given hilbert space, in an array with the specified dtype.
25
+ - `flip_state(hilb, key, states, indices)` which, for every state σ in the batch of
26
+ states, considers σᵢ and returns a new state where that entry is different from the
27
+ previous. The new configuration is selected with uniform probability among the local
28
+ possible configurations.
29
+
30
+ Hilbert spaces must at least implement a `random_state` to support sampling.
31
+ `flip_state` is only necessary in order to use LocalRule samplers.
32
+ All hilbert spaces in netket implement both.
33
+
34
+ How to implement the two functions above
35
+ ----------------------------------------
36
+
37
+ While the *exported* function acts on batches, sometimes it is hard to implement
38
+ the function on batches. Therefore they can be implemented either as a scalar
39
+ function, that gets jax.vmap-ed automatically, or directly as a batched rule.
40
+ Of course, if you implement the batched rule you will most likely see better
41
+ performance.
42
+
43
+ In order to implement the scalar rule for your custom hilbert object `MyHilbert`
44
+ you should define a function taking 4 inputs, the hilbert space, a jax PRNG key and
45
+ the dtype of the desired result. For random operations you should use the key
46
+ provided.
47
+
48
+ @netket.utils.dispatch.dispatch
49
+ def random_state(hilb: MyHilbert, key, dtype):
50
+ return mystate
51
+
52
+ @netket.utils.dispatch.dispatch
53
+ def random_state(hilb: MyHilbert, key, batches: int, dtype):
54
+ return mystate
55
+
56
+ flip_state is implemented in the same way, through
57
+
58
+ @netket.utils.dispatch.dispatch
59
+ def flip_state_scalar(hilb: Fock, key, σ, idx):
60
+ return new_state, oldval
61
+
62
+ There is a vmapped default fallback for the batched version.
63
+
64
+ @netket.utils.dispatch.dispatch
65
+ def flip_state_batch(hilb: Fock, key, σ, idx):
66
+ return new_states, oldvals
67
+
68
+ """
69
+
70
+ from netket.utils import _hide_submodules
71
+
72
+ from . import particle
73
+ from netket.hilbert.random.base import flip_state, random_state
74
+
75
+ _hide_submodules(__name__)
@@ -17,7 +17,7 @@ from jax import numpy as jnp
17
17
  import numpy as np
18
18
 
19
19
  from netket import jax as nkjax
20
- from netket.hilbert import ContinuousHilbert, Particle
20
+ from netket.experimental.hilbert import ContinuousHilbert, Particle
21
21
  from netket.utils.dispatch import dispatch
22
22
 
23
23
 
@@ -38,10 +38,11 @@ def random_state(hilb: Particle, key, batches: int, *, dtype):
38
38
  If periodic boundary conditions are chosen only for certain dimensions, the periodic initialization is used for
39
39
  all of those dimensions and the free initialization is used for all the other ones.
40
40
  """
41
- pbc = np.array(hilb.n_particles * hilb.pbc)
41
+ pbc = np.array(hilb.n_particles * hilb.geometry.pbc)
42
42
  boundary = np.tile(pbc, (batches, 1))
43
43
 
44
- Ls = np.array(hilb.n_particles * hilb.extent)
44
+ # TODO genearalize to particles with diferent domains
45
+ Ls = np.array(hilb.n_particles * hilb.domain)
45
46
 
46
47
  # If we have PBCs this defines the size of the Gaussian noise in the particle positions.
47
48
  # Without PBCs this is never needed (initialization with random Gaussian)
@@ -65,9 +66,9 @@ def random_state(hilb: Particle, key, batches: int, *, dtype):
65
66
  noise = gaussian * width
66
67
 
67
68
  key = jax.random.split(key, num=batches)
68
- sdim = len(hilb.extent)
69
+ sdim = len(hilb.domain)
69
70
  n = int(np.ceil(hilb.n_particles ** (1 / sdim)))
70
- xs = jnp.linspace(0, min(hilb.extent), n)
71
+ xs = jnp.linspace(0, min(hilb.domain), n)
71
72
  uniform = jnp.array(jnp.meshgrid(*(sdim * [xs]))).reshape(-1, sdim)
72
73
  uniform = jnp.tile(uniform, (batches, 1, 1))
73
74
 
@@ -18,6 +18,7 @@ from flax.serialization import to_bytes
18
18
  from flax.core import pop as fpop, FrozenDict
19
19
 
20
20
  from netket.logging import AbstractLog
21
+ from netket.jax.sharding import extract_replicated
21
22
 
22
23
  _mode_shorthands = {"write": "w", "append": "a", "fail": "x"}
23
24
 
@@ -172,22 +173,27 @@ class HDF5Log(AbstractLog):
172
173
  if self._writer is None:
173
174
  self._init_output_file()
174
175
 
176
+ if self._steps_notsaved_params % self._save_params_every == 0:
177
+ variables = variational_state.variables
178
+
179
+ # TODO: remove - FrozenDict are deprecated
180
+ if isinstance(variables, FrozenDict):
181
+ variables = variables.unfreeze()
182
+ variables = extract_replicated(variables)
183
+ self._steps_notsaved_params = 0
184
+ else:
185
+ variables = None
186
+
175
187
  if self._is_master_process:
176
188
  tree_log(log_data, "data", self._writer, iter=step)
177
189
 
178
- if self._steps_notsaved_params % self._save_params_every == 0:
179
- variables = variational_state.variables
180
- # TODO: remove - FrozenDict are deprecated
181
- if isinstance(variables, FrozenDict):
182
- variables = variables.unfreeze()
183
-
190
+ if variables is not None:
184
191
  _, params = fpop(variables, "params")
185
192
  binary_data = to_bytes(variables)
186
193
  tree = {"model_state": binary_data, "parameters": params, "iter": step}
187
194
  tree_log(tree, "variational_state", self._writer)
188
- self._steps_notsaved_params = 0
189
-
190
195
  self._writer.flush()
196
+
191
197
  self._steps_notsaved_params += 1
192
198
 
193
199
  def flush(self, variational_state=None):
@@ -16,6 +16,11 @@
16
16
  __all__ = ["FermionOperator2nd", "FermionOperator2ndJax"]
17
17
 
18
18
  from .pyscf import from_pyscf_molecule
19
+ from ._particle_number_conserving_fermionic import (
20
+ ParticleNumberConservingFermioperator2nd,
21
+ ParticleNumberAndSpinConservingFermioperator2nd,
22
+ FermiHubbardJax,
23
+ )
19
24
 
20
25
 
21
26
  from . import fermion