- Recurrent neural networks and layers have been added to
nkx.models
andnkx.nn
#1305. - Added experimental support for running NetKet on multiple jax devices (as an alternative to MPI). It is enabled by setting the environment variable/configuration flag
NETKET_EXPERIMENTAL_SHARDING=1
. Parallelization is achieved by distributing the Markov chains / samples equally across all available devices utilizingjax.Array
sharding. On GPU multi-node setups are supported via jax.distribued, whereas on CPU it is limited to a single process but several threads can be used by settingXLA_FLAGS='--xla_force_host_platform_device_count=XX'
#1511. - {class}
netket.experimental.operator.FermionOperator2nd
is a new Jax-compatible implementation of fermionic operators. It can also be constructed starting from a standard fermionic operator by callingoperator.to_jax_operator()
, or used in combination withpyscf
converters#1675,#1684. - {class}
netket.operator.LocalOperatorJax
is a new Jax-compatible implementation of local operators. It can also be constructed starting from a standard operator by callingoperator.to_jax_operator()
#1654. - The logger interface has been formalised and documented in the abstract base class {class}
netket.logging.AbstractLog
#1665. - The {class}
~netket.experimental.sampler.ParticleExchange
sampler and corresponding rule {class}~netket.experimental.sampler.rules.ParticleExchangeRule
has been added, which special cases {class}~netket.sampler.ExchangeSampler
to fermionic spaces in order to avoid proposing moves where the two site exchanged have the same population #1683.
- The {class}
netket.models.Jastrow
wave-function now only has {math}N (N-1)
variational parameters, instead of the {math}N^2
redundant ones it had before. Saving and loading format has now changed and won't be compatible with previous versions#1664. - Finalize deprecations of some old methods in
nk.sampler
namespace (see original commit 1f77ad8267e16fe8b2b2641d1d48a0e7ae94832e) - Finalize deprecations of 2D input to DenseSymm layers, which now turn into error and
extra_bias
option of Equivariant Networks/GCNNs (see original commit c61ea542e9d0f3e899d87a7471dea96d4f6b152d) - Finalize deprecations of very old input/properties to Lattices 0f6f520da9cb6afcd2361dd6fd029e7ad6a2693e)
MetropolisSampler.n_sweeps
has been renamed to {attr}~netket.sampler.MetropolisSampler.MetropolisSampler.sweep_size
for clarity. Usingn_sweeps
when constructing the sampler now throws a deprecation warning;sweep_size
should be used instead going forward #1657.- Samplers and metropolis rules defined as {func}
netket.utils.struct.dataclass
are deprecated because the base class is now a {class}netket.utils.struct.Pytree
. The only change needed is to remove the dataclass decorator and define a standard init method #1653.
- A new class {class}
netket.utils.struct.Pytree
, can be used to create Pytrees for which inheritance autoamtically works and for which it is possible to define__init__
. Several structures such as samplers and rules have been transitioned to this new interface instead of old style@struct.dataclass
#1653. - The {class}
~netket.experimental.operator.FermionOperator2nd
and related classes now store the constant diagonal shift as another term instead of a completely special cased scalar value. The same operators now also respect thecutoff
keyword argument more strictly #1686. - Dtypes of the matrix elements of operators are now handled more correctly, and fewer warnings are raised when running NetKet in X32 mode. Moreover, operators like Ising now default to floating point dtype even if the coefficients are integers #1697.
- Support multiplication of Discrete Operators by Sparse arrays #1661.
- Fixed a bug where it was not possible to recompile functions using two identical but different instances of PauliStringJax #1647.
- Fixed a minor bug where chunking was never actually used inside of {meth}
~netket.vqs.MCState.local_estimators
. This will turn on chunking for some other drivers such as {class}netket.experimental.driver.VMC_SRt
and {class}netket.experimental.driver.TDVPSchmitt
) #1650. - {class}
netket.operator.Ising
now throws an error when it is constructed using a non-{class}netket.hilbert.Spin
hilbert space #1648.
- Added support for neural networks with complex parameters to {class}
netket.experimental.driver.VMC_SRt
, which was just crashing with unreadable errors before #1644.
The highlights of this version are a new experimental driver to optimise networks with millions of parameters using SR, and introduces new utility functions to convert a pyscf molecule to a netket Hamiltonian.
Read below for a more detailed changelog
- Added new {class}
netket.experimental.driver.VMC_SRt
driver, which leads in identical parameter updates as the standard Stochastic Reconfiguration with diagonal shift regularization. Therefore, it is essentially equivalent to using the standard {class}netket.driver.VMC
with the {class}netket.optimizer.SR
preconditioner. The advantage of this method is that it requires the inversion of a matrix with side number of samples instead of number of parameters, making this formulation particularly useful in typical deep learning scenarios #1623. - Added a new function {func}
netket.experimental.operator.from_pyscf_molecule
to construct the electronic hamiltonian of a given molecule specified through pyscf. This is accompanied by {func}netket.experimental.operator.pyscf.TV_from_pyscf_molecule
to compute the T and V tensors of a pyscf molecule #1602. - Added the operator computing the Rényi2 entanglement entropy on Hilbert spaces with discrete dofs #1591.
- It is now possible to disable netket's double precision default activation and force all calculations to be performed using single precision by setting the environment variable/configuration flag
NETKET_ENABLE_X64=0
, which also setsJAX_ENABLE_X64=0
. When running with this flag, the number of warnings printed by jax is considerably reduced as well #1544. - Added new shortcuts to build the identity operator as {func}
netket.operator.spin.identity
and {func}netket.operator.boson.identity
#1601. - Added new {class}
netket.hilbert.Particle
constructor that only takes as input the number of dimensions of the system #1577. - Added new {class}
netket.experimental.models.Slater2nd
model implementing a Slater ansatz #1622. - Added new {func}
netket.jax.logdet_cmplx
function to compute the complex log-determinant of a batch of matrices #1622.
- {class}
netket.experimental.hilbert.SpinOrbitalFermions
attributes have been changed: {attr}~netket.experimental.hilbert.SpinOrbitalFermions.n_fermions
now always returns an integer with the total number of fermions in the system (if specified). A new attribute {attr}~netket.experimental.hilbert.SpinOrbitalFermions.n_fermions_per_spin
has been introduced that returns the same tuple of fermion number per spin subsector as before. A few fields are now marked as read-only as modifications where ignored #1622. - The {class}
netket.nn.blocks.SymmExpSum
layer is now normalised by the number of elements in the symmetry group in order to maintain a reasonable normalisation #1624. - The labelling of spin sectors in {func}
netket.experimental.operator.fermion.create
and similar operators has now changed from the eigenvalue of the spin operator ({math}\pm 1/2
and so on) to the eigenvalue of the Pauli matrices ({math}\pm 1
and so on) #1637. - The connected elements and expectation values of all non-simmetric fermionic operators is now changed in order to be correct #1640.
- Considerably reduced the memory consumption of {class}
~netket.operator.LocalOperator
, especially in the case of large local hilbert spaces. Also leveraged sparsity in the terms to speed up compilation (_setup
) in the same cases #1558. - {class}
netket.nn.blocks.SymmExpSum
now works with inputs of arbitrary dimensions, while previously it errored for all inputs that were not 2D #1616 - Stop using
FrozenDict
fromflax
and instead return standard dictionaries for the variational parameters from the variational state. This makes it much easier to edit parameters #1547. - Vastly improved, finally readable documentation of all Flax modules and neural network architectures #1641.
- Fixed minor bug where {class}
netket.operator.LocalOperator
could not be built withnp.matrix
object obtained by converting scipy sparse matrices to dense #1597. - Raise correct error instead of unintelligible one when multiplying {class}
netket.experimental.operator.FermionOperator2nd
with other operators #1599. - Do not rescale the output of {func}
netket.jax.jacobian
by the square root of number of samples. Previously, when specifyingcenter=True
we were incorrectly rescaling the output #1614. - Fix bug in {class}
netket.operator.PauliStrings
that caused the dtype to get out of sync with the dtype of the internal arrays, causing errors when manipulating them symbolically #1619. - Fix bug that prevented the use of {class}
netket.operator.DiscreteJaxOperator
as observables with all drivers #1625. - Fermionic operator
get_conn
method was returning values as if the operator was transposed, and has now been fixed. This will break the expectation value of non-simmetric fermionic operators, but hopefully nobody was looking into them #1640.
This release requires at least Python 3.9 and Jax 0.4.
- Fix a bug introduced in version 3.9 for {class}
netket.experimental.driver.TDVPSchmitt
which resulted in the wrong dynamics #1551.
- Fix a bug in the construction of {class}
netket.operator.PauliStringsJax
in some cases #1539.
This release requires Python 3.8 and Jax 0.4.
- {class}
netket.callbacks.EarlyStopping
now supports relative tolerances for determining when to stop #1481. - {class}
netket.callbacks.ConvergenceStopping
has been added, which can stop a driver when the loss function reaches a certain threshold #1481. - A new base class {class}
netket.operator.DiscreteJaxOperator
has been added, which will be used as a base class for a set of operators that are jax-compatible #1506. - {func}
netket.sampler.rules.HamiltonianRule
has been split into two implementations, {class}netket.sampler.rules.HamiltonianRuleJax
and {class}netket.sampler.rules.HamiltonianRuleNumba
, which are to be used for {class}~netket.operator.DiscreteJaxOperator
and standard numba-based {class}~netket.operator.DiscreteOperator
s. The user-facing API is unchanged, but the returned type might now depend on the input operator #1514. - {class}
netket.operator.PauliStringsJax
is a new operator that behaves as {class}netket.operator.PauliStrings
but is Jax-compatible, meaning that it can be used inside of jax-jitted contexts and works better with chunking. It can also be constructed starting from a standard Ising operator by callingoperator.to_jax_operator()
#1506. - {class}
netket.operator.IsingJax
is a new operator that behaves asnetket.operator.Ising
but is Jax-compatible, meaning that it can be used inside of jax-jitted contexts and works better with chunking. It can also be constructed starting from a standard Ising operator by callingoperator.to_jax_operator()
#1506. - Added a new method {meth}
netket.operator.LocalOperator.to_pauli_strings
to convert {class}netket.operator.LocalOperator
to {class}netket.operator.PauliStrings
. As PauliStrings can be converted to Jax-operators, this now allows to convert arbitrary operators to Jax-compatible ones #1515. - The constructor of {meth}
~netket.optimizer.qgt.QGTOnTheFly
now takes an optional boolean argumentholomorphic : Optional[bool]
in line with the other geometric tensor implementations. This flag does not affect the computation algorithm, but will be used to raise an error if the user attempts to call {meth}~netket.optimizer.qgt.QGTOnTheFly.to_dense()
with a non-holomorphic ansatz. While this might break past code, the numerical results were incorrect.
- The first two axes in the output of the samplers have been swapped, samples are now of shape
(n_chains, n_samples_per_chain, ...)
consistent withnetket.stats.statistics
. Custom samplers need to be updated to return arrays of shape(n_chains, n_samples_per_chain, ...)
instead of(n_samples_per_chain, n_chains, ...)
. #1502 - The tolerance arguments of {class}
~netket.experimental.dynamics.TDVPSchmitt
have all been renamed to more understandable quantities without inspecting the source code. In particular,num_tol
has been renamed torcond
,svd_tol
torcond_smooth
andnoise_tol
tonoise_atol
.
netket.vqs.ExactState
has been renamed to {class}netket.vqs.FullSumState
to better reflect what it does. Using the old name will now raise a warning #1477.
- The new
Jax
-friendly operators do not work with {class}netket.vqs.FullSumState
because they are not hashable. This will be fixed in a minor patch (coming soon).
This is the last NetKet release to support Python 3.7 and Jax 0.3. Starting with NetKet 3.9 we will require Jax 0.4, which in turns requires Python 3.8 (and soon 3.9).
- {class}
netket.hilbert.TensorHilbert
has been generalised and now works with both discrete, continuous or a combination of discrete and continuous hilbert spaces #1437. - NetKet is now compatible with Numba 0.57 and therefore with Python 3.11 #1462.
- The new Metropolis sampling transition proposal rules {func}
netket.sampler.rules.MultipleRules
has been added, which can be used to pick from different transition proposals according to a certain probability distribution. - The new Metropolis sampling transition proposal rules {func}
netket.sampler.rules.TensorRule
has been added, which can be used to combine different transition proposals acting on different subspaces of the Hilbert space together. - The new Metropolis sampling transition proposal rules {func}
netket.sampler.rules.FixedRule
has been added, which does not change the configuration.
- The non-public API function to select the default QGT mode for
QGTJacobian
, located atnk.optimizer.qgt.qgt_jacobian_common.choose_jacobian_mode
has been renamed and made part of the public API of asnk.jax.jacobian_default_mode
. If you were using this function, please update your codes #1473.
- Fix issue #1435, where a 0-tangent originating from integer samples was not correctly handled by {func}
nk.jax.vjp
#1436. - Fixed a bug in {class}
netket.sampler.rules.LangevinRule
when settingchunk_size
#1465.
- {class}
netket.operator.ContinuousOperator
has been improved and now they correctly test for equality and generate a consistent hash. Moreover, the internal logic of {class}netket.operator.SumOperator
and {class}netket.operator.Potential
has been improved, and they lead to less recompilations when constructed again but identical. A few new attributes for those operators have also been exposed #1440. - {func}
nk.nn.to_array
accepts an optional keyword argumentchunk_size
, and related methods on variational states now use the chunking specified in the variational state when generating the dense array #1470.
- Jax version
0.4
is now required, meaning that NetKet no longer works on Python 3.7.
- Input and hidden layer masks can now be specified for {class}
netket.models.GCNN
#1387. - Support for Jax 0.4 added #1416.
- Added a continuous space langevin-dynamics transition rule {class}
netket.sampler.rules.LangevinRule
and its corresponding shorthand for constructing the MCMC sampler {func}netket.sampler.MetropolisAdjustedLangevin
#1413. - Added an experimental Quantum State Reconstruction driver at {class}
netket.experimental.QSR
to reconstruct states from data coming from quantum computers or simulators #1427. - Added
netket.nn.blocks.SymmExpSum
flax module that symmetrizes a bare neural network module by summing the wave-function over all possible symmetry-permutations given by a certain symmetry group #1433.
- Parameters of models {class}
netket.models.GCNN
and layers {class}netket.nn.DenseSymm
and {class}netket.nn.DenseEquivariant
are stored as an array of shape '[features,in_features,mask_size]'. Masked parameters are now excluded from the model instead of multiplied by zero #1387.
- The underlying extension API for Autoregressive models that can be used with Ancestral/Autoregressive samplers has been simplified and stabilized and will be documented as part of the public API. For most models, you should now inherit from {class}
netket.models.AbstractARNN
and define the method {meth}~netket.models.AbstractARNN.conditionals_log_psi
. For additional performance, implementers can also redefine {meth}~netket.models.AbstractARNN.__call__
and {meth}~netket.models.AbstractARNN.conditional
but this should not be needed in general. This will cause some breaking changes if you were relying on the old undocumented interface #1361. - {class}
netket.operator.PauliStrings
now works with non-homogeneous Hilbert spaces, such as those obtained by taking the tensor product of multiple Hilbert spaces #1411. - The {class}
netket.operator.LocalOperator
now keep sparse matrices sparse, leading to faster algebraic manipulations of those objects. The overall computational and memory cost is, however, equivalent, when running VMC calculations. All pre-constructed operators such as {func}netket.operator.spin.sigmax
and {func}netket.operator.boson.create
now build sparse-operators #1422. - When multiplying an operator by it's conjugate transpose NetKet does not return anymore a lazy {class}
~netket.operator.Squared
object if the operator is hermitian. This avoids checking if the object is hermitian which greatly speeds up algebric manipulations of operators, and returns more unbiased epectation values #1423.
- Fixed a bug where {meth}
nk.hilbert.Particle.random_state
could not be jit-compiled, and therefore could not be used in the sampling #1401. - Fixed bug #1405 where {meth}
nk.nn.DenseSymm
and {meth}nk.models.GCNN
did not work or correctly consider masks #1428.
- {meth}
netket.models.AbstractARNN._conditional
has been removed from the API, and its use will throw a deprecation warning. Update your ARNN models accordingly! #1361. - Several undocumented internal methods from {class}
netket.models.AbstractARNN
have been removed #1361.
- Added a new 'Full statevector' model {class}
netket.models.LogStateVector
that stores the exponentially large state and can be used as an exact ansatz #1324. - Added a new experimental {class}
~netket.experimental.driver.TDVPSchmitt
driver, implementing the signal-to-noise ratio TDVP regularisation by Schmitt and Heyl #1306. - Added a new experimental {class}
~netket.experimental.driver.TDVPSchmitt
driver, implementing the signal-to-noise ratio TDVP regularisation by Schmitt and Heyl #1306. - QGT classes accept a
chunk_size
parameter that overrides thechunk_size
set by the variational state object #1347. - {func}
~netket.optimizer.qgt.QGTJacobianPyTree
and {func}~netket.optimizer.qgt.QGTJacobianDense
support diagonal entry regularisation with constant and scale-invariant contributions. They accept a newdiag_scale
argument to pass the scale-invariant component #1352. - {func}
~netket.optimizer.SR
preconditioner now supports scheduling of the diagonal shift and scale regularisations #1364.
- {meth}
~netket.vqs.ExactState.expect_and_grad
now returns a {class}netket.stats.Stats
object that also contains the variance, as {class}~netket.vqs.MCState
does #1325. - Experimental RK solvers now store the error of the last timestep in the integrator state #1328.
- {class}
~netket.operator.PauliStrings
can now be constructed by passing a single string, instead of the previous requirement of a list of strings #1331. - {class}
~flax.core.frozen_dict.FrozenDict
can now be logged to netket's loggers, meaning that one does no longer need to unfreeze the parameters before logging them #1338. - Fermion operators are much more efficient and generate fewer connected elements #1279.
- NetKet now is completely PEP 621 compliant and does not have anymore a
setup.py
in favour of apyproject.toml
based on hatchling. To install NetKet you should use a recent version ofpip
or a compatible tool such as poetry/hatch/flint #1365. - {func}
~netket.optimizer.qgt.QGTJacobianDense
can now be used with {class}~netket.vqs.ExactState
#1358.
- {meth}
netket.vqs.ExactState.expect_and_grad
returned a scalar while {meth}~netket.vqs.ExactState.expect
returned a {class}netket.stats.Stats
object with 0 error. The inconsistency has been addressed and now they both return aStats
object. This changes the format of the files logged when runningVMC
, which will now store the average underMean
instead ofvalue
#1325. - {func}
netket.optimizer.qgt.QGTJacobianDense
now returns the correct output for models with mixed real and complex parameters #1397
- The
rescale_shift
argument of {func}~netket.optimizer.qgt.QGTJacobianPyTree
and {func}~netket.optimizer.qgt.QGTJacobianDense
is deprecated in favour the more flexible syntax withdiag_scale
.rescale_shift=False
should be removed.rescale_shift=True
should be replaced withdiag_scale=old_diag_shift
. #1352. - The call signature of preconditioners passed to {class}
netket.driver.VMC
and other drivers has changed as a consequence of scheduling, and preconditioners should now accept an extra optional argumentstep
. The old signature is still supported but is deprecated and will eventually be removed #1364.
- {class}
~netket.operator.PauliStrings
now support the subtraction operator #1336. - Autoregressive networks had a default activation function (
selu
) that did not act on the imaginary part of the inputs. We now changed that, and the activation function isreim_selu
, which acts independently on the real and imaginary part. This changes nothing for real parameters, but improves the defaults for complex ones #1371. - A major performance degradation that arose when using {class}
~netket.operator.LocalOperator
has been addressed. The bug caused our operators to be recompiled every time they were queried, imposing a large overhead 1377.
- Added a new configuration option
netket.config.netket_experimental_disable_ode_jit
to disable jitting of the ODE solvers. This can be useful to avoid hangs that might happen when working on GPUs with some particular systems #1304.
- Continuous operatorors now work correctly when
chunk_size != None
. This was broken in v3.5 #1316. - Fixed a bug (#1101) that crashed NetKet when trying to take the product of two different Hilber spaces. It happened because the logic to build a
TensorHilbert
was ending in an endless loop. #1321.
This release adds support and needed functions to run TDVP for neural networks with real/non-holomorphic parameters, an experimental HDF5 logger, and an MCState
method to compute the local estimators of an observable for a set of samples.
This release also drops support for older version of flax, while adopting the new interface which completely supports complex-valued neural networks. Deprecation warnings might be raised if you were using some layers from netket.nn
that are now avaiable in flax.
A new, more accurate, estimation of the autocorrelation time has been introduced, but it is disabled by default. We welcome feedback.
- The method {meth}
~netket.vqs.MCState.local_estimators
has been added, which returns the local estimatorsO_loc(s) = 〈s|O|ψ〉 / 〈s|ψ〉
(which are known as local energies ifO
is the Hamiltonian). #1179 - The permutation equivariant {class}
nk.models.DeepSetRelDistance
for use with particles in periodic potentials has been added together with an example. #1199 - The class {class}
HDF5Log
has been added to the experimental submodule. This logger writes log data and variational state variables into a single HDF5 file. #1200 - Added a new method {meth}
~nk.logging.RuntimeLog.serialize
to store the content of the logger to disk #1255. - New {class}
nk.callbacks.InvalidLossStopping
which stops optimisation if the loss function reaches aNaN
value. An optionalpatience
argument can be set. #1259 - Added a new method {meth}
nk.graph.SpaceGroupBuilder.one_arm_irreps
to construct GCNN projection coefficients to project on single-wave-vector components of irreducible representations. #1260. - New method {meth}
~nk.vqs.MCState.expect_and_forces
has been added, which can be used to compute the variational forces generated by an operator, instead of only the (real-valued) gradient of an expectation value. This in general is needed to write the TDVP equation or other similar equations. #1261 - TDVP now works for real-parametrized wavefunctions as well as non-holomorphic ones because it makes use of {meth}
~nk.vqs.MCState.expect_and_forces
. #1261 - New method {meth}
~nk.utils.group.Permutation.apply_to_id
can be used to apply a permutation (or a permutation group) to one or more lattice indices. #1293 - It is now possible to disable MPI by setting the environment variable
NETKET_MPI
. This is useful in cases where mpi4py crashes upon load #1254. - The new function {func}
nk.nn.binary_encoding
can be used to encode a set of samples according to the binary shape defined by an Hilbert space. It should be used similarly to {func}flax.linen.one_hot
and works with non homogeneous Hilbert spaces #1209. - A new method to estimate the correlation time in Markov chain Monte Carlo (MCMC) sampling has been added to the {func}
nk.stats.statistics
function, which uses the full FFT transform of the input data. The new method is not enabled by default, but can be turned on by setting theNETKET_EXPERIMENTAL_FFT_AUTOCORRELATION
environment variable to1
. In the future we might turn this on by default #1150.
- NetKet now requires at least Flax v0.5
nk.nn.Module
andnk.nn.compact
have been deprecated. Please use the {class}flax.linen.Module
and {func}flax.linen.compact
instead.nk.nn.Dense(dtype=mydtype)
and related Modules (Conv
,DenseGeneral
andConvGeneral
) are deprecated. Please useflax.linen.***(param_dtype=mydtype)
instead. Before flax v0.5 they did not support complex numbers properly within their modules, but starting with flax 0.5 they now do so we have removed our linear module wrappers and encourage you to use them. Please notice that thedtype
argument previously used by netket should be changed toparam_dtype
to maintain the same effect. #...
- Fixed bug where a
nk.operator.LocalOperator
representing the identity would lead to a crash. #1197 - Fix a bug where Fermionic operators {class}
nkx.operator.FermionOperator2nd
would not result hermitian even if they were. #1233 - Fix serialization of some arrays with complex dtype in
RuntimeLog
andJsonLog
#1258 - Fixed bug where the {class}
nk.callbacks.EarlyStopping
callback would not work as intended when hitting a local minima. #1238 chunk_size
and the random seed of Monte Carlo variational states are now serialised. States serialised previous to this change can no longer be unserialised #1247- Continuous-space hamiltonians now work correctly with neural networks with complex parameters #1273.
- NetKet now works under MPI with recent versions of jax (>=0.3.15) #1291.
- Several deprecation warnings related to
jax.experimental.loops
being deprecated have been resolved by changing those calls to {func}jax.lax.fori_loop
. Jax should feel more tranquillo now. #1172
- Several type promotion bugs that would end up promoting single-precision models to double-precision have been squashed. Those involved
nk.operator.Ising
andnk.operator.BoseHubbard
#1180,nkx.TDVP
#1186 and continuous-space samplers and operators #1187. nk.operator.Ising
,nk.operator.BoseHubbard
andnk.operator.LocalLiouvillian
now return connected samples with the same precision (dtype
) as the input samples. This allows to preserve low precision along the computation when using those operators.#1180nkx.TDVP
now updates the expectation value displayed in the progress bar at every time step. #1182- Fixed bug #1192 that affected most operators (
nk.operator.LocalOperator
) constructed on non-homogeneous hilbert spaces. This bug was first introduced in version 3.3.4 and affects all subsequent versions until 3.4.2. #1193 - It is now possible to add an operator and it's lazy transpose/hermitian conjugate #1194
- Several deprecation warnings related to
jax.tree_util.tree_multimap
being deprecated have been resolved by changing those calls tojax.tree_util.tree_map
. Jax should feel more tranquillo now. #1156
(not yet fixed)TDVP
now supports model with real parameters such asRBMModPhase
. #1139- An error is now raised when user attempts to construct a
LocalOperator
with a matrix of the wrong size (bug #1157. #1158 - A bug where
QGTJacobian
could not be used with models in single precision has been addressed (bug #1153. #1155
Lattice
supports specifying arbitrary edge content for each unit cell via the kwargcustom_edges
. A generator for hexagonal lattices with coloured edges is implemented asnk.graph.KitaevHoneycomb
.nk.graph.Grid
again supports colouring edges by direction. #1074- Fermionic hilbert space (
nkx.hilbert.SpinOrbitalFermions
) and fermionic operators (nkx.operator.fermion
) to treat systems with a finite number of Orbitals have been added to the experimental submodule. The operators are also integrated with OpenFermion. Those functionalities are still in development and we would welcome feedback. #1090 - It is now possible to change the integrator of a
TDVP
object without reconstructing it. #1123 - A
nk.nn.blocks
has been added and contains anMLP
(Multi-Layer Perceptron). #1295
- The gradient for models with real-parameter is now multiplied by 2. If your model had real parameters you might need to change the learning rate and halve it. Conceptually this is a bug-fix, as the value returned before was wrong (see Bug Fixes section below for additional details) #1069
- In the statistics returned by
netket.stats.statistics
, the.R_hat
diagnostic has been updated to be able to detect non-stationary chains via the split-Rhat diagnostic (see, e.g., Gelman et al., Bayesian Data Analysis, 3rd edition). This changes (generally increases) the numerical values ofR_hat
for existing simulations, but should strictly improve its capabilities to detect MCMC convergence failure. #1138
- The gradient obtained with
VarState.expect_and_grad
for models with real-parameters was off by a factor of $ 1/2 $ from the correct value. This has now been corrected. As a consequence, the correct gradient for real-parameter models is equal to the old times 2. If your model had real parameters you might need to change the learning rate and halve it. #1069 - Support for coloured edges in
nk.graph.Grid
, removed in #724, is now restored. #1074 - Fixed bug that prevented calling
.quantum_geometric_tensor
onnetket.vqs.ExactState
. #1108 - Fixed bug where the gradient of
C->C
models (complex parameters, complex output) was computed incorrectly withnk.vqs.ExactState
. #1110 - Fixed bug where
QGTJacobianDense.state
andQGTJacobianPyTree.state
would not correctly transform the starting pointx0
ifholomorphic=False
. #1115 - The gradient of the expectation value obtained with
VarState.expect_and_grad
forSquaredOperator
s was off by a factor of 2 in some cases, and wrong in others. This has now been fixed. #1065.
- Support for Python 3.10 #952.
- The minimum optax version is now
0.1.1
, which finally correctly supports complex numbers. The internal implementation of Adam which was introduced in 3.3 (#1069) has been removed. If an older version ofoptax
is detected, an import error is thrown to avoid providing wrong numerical results. Please update your optax version! #1097
- Allow
LazyOperator@densevector
for operators such as lazyAdjoint
,Transpose
andSquared
. #1068 - The logic to update the progress bar in {class}
nk.experimental.TDVP
has been improved, and it should now display updates even if there are very sparsesave_steps
. #1084 - The
nk.logging.TensorBoardLog
is now lazily initialized to better work in an MPI environment. #1086 - Converting a
nk.operator.BoseHubbard
to ank.operator.LocalOperator
multiplied by 2 the nonlinearityU
. This has now been fixed. #1102
- Initialisation of all implementations of
DenseSymm
,DenseEquivariant
,GCNN
now defaults to truncated normals with Lecun variance scaling. For layers without masking, there should be no noticeable change in behaviour. For masked layers, the same variance scaling now works correctly. #1045 - Fix bug that prevented gradients of non-hermitian operators to be computed. The feature is still marked as experimental but will now run (we do not guarantee that results are correct). #1053
- Common lattice constructors such as
Honeycomb
now accepts the same keyword arguments asLattice
. #1046 - Multiplying a
QGTOnTheFly
representing the real part of the QGT (showing up when the ansatz has real parameters) with a complex vector now throws an error. Previously the result would be wrong, as the imaginary part was casted away. #885
- The interface to define expectation and gradient function of arbitrary custom operators is now stable. If you want to define it for a standard operator that can be written as an average of local expectation terms, you can now define a dispatch rule for {func}
netket.vqs.get_local_kernel_arguments
and {func}netket.vqs.get_local_kernel
. The old mechanism is still supported, but we encourage to use the new mechanism as it is more terse. #954 - {func}
nk.optimizer.Adam
now supports complex parameters, and you can use {func}nk.optimizer.split_complex
to make optimizers process complex parameters as if they are pairs of real parameters. #1009 - Chunking of
MCState.expect
andMCState.expect_and_grad
computations is now supported, which allows to bound the memory cost in exchange of a minor increase in computation time. #1006 (and discussions in #918 and #830) - A new variational state that performs exact summation over the whole Hilbert space has been added. It can be constructed with {class}
nk.vqs.ExactState
and supports the same Jax neural networks as {class}nk.vqs.MCState
. #953 - {func}
nk.nn.DenseSymm
allows multiple input features. #1030 - [Experimental] A new time-evolution driver {class}
nk.experimental.TDVP
using the time-dependent variational principle (TDVP) has been added. It works with time-independent and time-dependent Hamiltonians and Liouvillians. #1012 - [Experimental] A set of JAX-compatible Runge-Kutta ODE integrators has been added for use together with the new TDVP driver. #1012
- The method
sample_next
inSampler
and exact samplers (ExactSampler
andARDirectSampler
) is removed, and it is only defined inMetropolisSampler
. The module functionnk.sampler.sample_next
also only works withMetropolisSampler
. For exact samplers, please use the methodsample
instead. #1016 - The default value of
n_chains_per_rank
inSampler
and exact samplers is changed to 1, and specifyingn_chains
orn_chains_per_rank
when constructing them is deprecated. Please changechain_length
when callingsample
. ForMetropolisSampler
, the default value is changed fromn_chains = 16
(across all ranks) ton_chains_per_rank = 16
. #1017 GCNN_Parity
allowed biasing both the parity-preserving and the parity-flip equivariant layers. These enter into the network output the same way, so having both is redundant and makes QGTs unstable. The biases of the parity-flip layers are now removed. The previous behaviour can be restored using the deprecatedextra_bias
switch; we only recommend this for loading previously saved parameters. Such parameters can be transformed to work with the new default usingnk.models.update_GCNN_parity
. #1030- Kernels of
DenseSymm
are now three-dimensional, not two-dimensional. Parameters saved from earlier implementations can be transformed to the new convention usingnk.nn.update_dense_symm
. #1030
- The method
Sampler.samples
is added to return a generator of samples. The module functionsnk.sampler.sampler_state
,reset
,sample
,samples
, andsample_next
are deprecated in favor of the corresponding class methods. #1025 - Kwarg
in_features
ofDenseEquivariant
is deprecated; the number of input features are inferred from the input. #1030 - Kwarg
out_features
ofDenseEquivariant
is deprecated in favour offeatures
. #1030
- The definitions of
MCState
andMCMixedState
have been moved to an internal module,nk.vqs.mc
that is hidden by default. #954 - Custom deepcopy for
LocalOperator
to avoid buildingLocalOperator
from scratch each time it is copied #964
- The constructor of
TensorHilbert
(which is used by the product operator*
for inhomogeneous spaces) no longer fails when one of the component spaces is non-indexable. #1004 - The {func}
~nk.hilbert.random.flip_state
method used byMetropolisLocal
now throws an error when called on a {class}nk.hilbert.ContinuousHilbert
hilbert space instead of entering an endless loop. #1014 - Fixed bug in conversion to qutip for
MCMixedState
, where the resulting shape (hilbert space size) was wrong. #1020 - Setting
MCState.sampler
now recomputesMCState.chain_length
according toMCState.n_samples
and the newsampler.n_chains
. #1028 GCNN_Parity
allowed biasing both the parity-preserving and the parity-flip equivariant layers. These enter into the network output the same way, so having both is redundant and makes QGTs unstable. The biases of the parity-flip layers are now removed. #1030
GraphOperator
(andHeisenberg
) now support passing a custom mapping of graph nodes to Hilbert space sites via the newacting_on_subspace
argument. This makes it possible to createGraphOperator
s that act on a subset of sites, which is useful in composite Hilbert spaces. #924PauliString
now supports any Hilbert space with local size 2. The Hilbert space is now the optional first argument of the constructor. #960PauliString
now can be multiplied and summed together, performing some simple algebraic simplifications on the strings they contain. They also lazily initialize their internal data structures, making them faster to construct but slightly slower the first time that their matrix elements are accessed. #955PauliString
s can now be constructed starting from anOpenFermion
operator. #956- In addition to nearest-neighbor edges,
Lattice
can now generate edges between next-nearest and, more generally, k-nearest neighbors via the constructor argumentmax_neighbor_order
. The edges can be distinguished by theircolor
property (which is used, e.g., byGraphOperator
to apply different bond operators). #970 - Two continuous-space operators (
KineticEnergy
andPotentialEnergy
) have been implemented. #971 Heisenberg
Hamiltonians support different coupling strengths onGraph
edges with different colors. #972.- The
little_group
andspace_group_irreps
methods ofSpaceGroupBuilder
take the wave vector as either varargs or iterables. #975 - A new
netket.experimental
submodule has been created and all experimental features have been moved there. Note that in contrast to the othernetket
submodules,netket.experimental
is not imported by default. #976
- Moved
nk.vqs.variables_from_***
tonk.experimental.vqs
module. Also moved the experimental samplers tonk.sampler.MetropolisPt
andnk.sampler.MetropolisPmap
tonk.experimental.sampler
. #976 operator.size
, has been deprecated. If you were using this function, please transition tooperator.hilbert.size
. #985
- A bug where
LocalOperator.get_conn_flattened
would read out-of-bounds memory has been fixed. It is unlikely that the bug was causing problems, but it triggered warnings when running Numba with boundscheck activated. #966 - The dependency
python-igraph
has been updated toigraph
following the rename of the upstream project in order to work on conda. #986 - {attr}
~netket.vqs.MCState.n_samples_per_rank
was returning wrong values and has now been fixed. #987 - The
DenseSymm
layer now also accepts objects of typeHashableArray
assymmetries
argument. #989 - A bug where
VMC.info()
was erroring has been fixed. #984
- Added Conversion methods
to_qobj()
to operators and variational states, that produce QuTiP's qobjects. - A function
nk.nn.activation.reim
has been added that transforms a nonlinearity to act seperately on the real and imaginary parts - Nonlinearities
reim_selu
andreim_relu
have been added - Autoregressive Neural Networks (ARNN) now have a
machine_pow
field (defaults to 2) used to change the exponent used for the normalization of the wavefunction. #940.
- The default initializer for
netket.models.GCNN
has been changed to fromjax.nn.selu
tonetket.nn.reim_selu
#892 netket.nn.initializers
has been deprecated in favor ofjax.nn.initializers
#935.- Subclasses of {class}
netket.models.AbstractARNN
must define the fieldmachine_pow
#940 nk.hilbert.HilbertIndex
andnk.operator.spin.DType
are now unexported (they where never intended to be visible). #904AbstractOperator
s have been renamedDiscreteOperator
s.AbstractOperator
s still exist, but have almost no functionality and they are intended as the base class for more arbitrary (eg. continuous space) operators. If you have defined a custom operator inheriting fromAbstractOperator
you should change it to derive fromDiscreteOperator
. #929
PermutationGroup.product_table
now consumes less memory and is more performant. This is helpfull when working with large symmetry groups. #884 #891- Added size check to
DiscreteOperator.get_conn
and throw helpful error messages if those do not match. #927 - The internal
numba4jax
module has been factored out into a standalone library, named (how original)numba4jax
. This library was never intended to be used by external users, but if for any reason you were using it, you should switch to the external library. #934 netket.jax
now includes several batching utilities likebatched_vmap
andbatched_vjp
. Those can be used to build memory efficient batched code, but are considered internal, experimental and might change without warning. #925.
- Autoregressive networks now work with
Qubit
hilbert spaces. #937
- The default initializer for
netket.nn.Dense
layers now matches the same default asflax.linen
, and it islecun_normal
instead ofnormal(0.01)
#869 - The default initializer for
netket.nn.DenseSymm
layers is now chosen in order to give variance 1 to every output channel, therefore defaulting tolecun_normal
#870
- DenseSymm now accepts a mode argument to specify whever the symmetries should be computed with a full dense matrix or FFT. The latter method is much faster for sufficiently large systems. Other kwargs have been added to satisfy the interface. The api changes are also reflected in RBMSymm and GCNN. #792
- The so-called legacy netket in
netket.legacy
has been removed. #773
- The methods
expect
andexpect_and_grad
ofMCState
now use dispatch to select the relevant implementation of the algorithm. They can therefore be expanded and overridden without editing NetKet's source code. #804 netket.utils.mpi_available
has been moved tonetket.utils.mpi.available
to have a more consistent api interface (all mpi-related properties in the same submodule). #827netket.logging.TBLog
has been renamed tonetket.logging.TensorBoardLog
for better readability. A deprecation warning is now issued if the older name is used #827- When
MCState
initializes a model by callingmodel.init
, the call is now jitted. This should speed it up for non-trivial models but might break non-jit invariant models. #832 operator.get_conn_padded
now supports arbitrarily-dimensioned bitstrings as input and reshapes the output accordingly. #834- NetKet's implementation of dataclasses now support
pytree_node=True/False
on cached properties. #835 - Plum version has been bumped to 1.5.1 to avoid broken versions (1.4, 1.5). #856.
- Numba version 0.54 is now allowed #857.
- Fix Progress bar bug. #810
- Make the repr/printing of history objects nicer in the REPL. #819
- The field
MCState.model
is now read-only, to prevent user errors. #822 - The order of the operators in
PauliString
does no longer influences the estimate of the number of non-zero connected elements. #836
- The {py:mod}
netket.utils.group
submodule provides utilities for geometrical and permutation groups.Lattice
(and its specialisations likeGrid
) use these to automatically construct the space groups of lattices, as well as their character tables for generating wave functions with broken symmetry. #724 - Autoregressive neural networks, sampler, and masked linear layers have been added to
models
,sampler
andnn
#705.
- The
netket.graph.Grid
class has been removed. {ref}netket.graph.Grid
will now return an instance of {class}graph.Lattice
supporting the same API but with new functionalities related to spatial symmetries. Thecolor_edges
optional keyword argument has been removed without deprecation. #724 MCState.n_discard
has been renamedMCState.n_discard_per_chain
and the old binding has been deprecated #739.nk.optimizer.qgt.QGTOnTheFly
optioncentered=True
has been removed because we are now convinced the two options yielded equivalent results.QGTOnTheFly
now always behaves as ifcentered=False
#706.
networkX
has been replaced byigraph
, yielding a considerable speedup for some graph-related operations #729.netket.hilbert.random
module now usesplum-dispatch
(throughnetket.utils.dispatch
) to select the correct implementation ofrandom_state
andflip_state
. This makes it easy to define new hilbert states and extend their functionality easily. #734.- The AbstractHilbert interface is now much smaller in order to also support continuous Hilbert spaces. Any functionality specific to discrete hilbert spaces (what was previously supported) has been moved to a new abstract type
netket.hilbert.DiscreteHilbert
. Any Hilbert space previously subclassing {ref}netket.hilbert.AbstractHilbert
should be modified to subclass {ref}netket.hilbert.DiscreteHilbert
#800.
nn.to_array
andMCState.to_array
, ifnormalize=False
, do not subtract the logarithm of the maximum value from the state #705.- Autoregressive networks now work with Fock space and give correct errors if the hilbert space is not supported #806.
- Autoregressive networks are now much (x10-x100) faster #705.
- Do not throw errors when calling
operator.get_conn_flattened(states)
with a jax array #764. - Fix bug with the driver progress bar when
step_size != 1
#747.
- Group Equivariant Neural Networks have been added to
models
#620 - Permutation invariant RBM and Permutation invariant dense layer have been added to
models
andnn.linear
#573 - Add the property
acceptance
toMetropolisSampler
'sSamplerState
, computing the MPI-enabled acceptance ratio. #592. - Add
StateLog
, a new logger that stores the parameters of the model during the optimization in a folder or in a tar file. #645 - A warning is now issued if NetKet detects to be running under
mpirun
but MPI dependencies are not installed #631 operator.LocalOperator
s now do not return a zero matrix element on the diagonal if the whole diagonal is zero. #623.logger.JSONLog
now automatically flushes at every iteration if it does not consume significant CPU cycles. #599- The interface of Stochastic Reconfiguration has been overhauled and made more modular. You can now specify the solver you wish to use, NetKet provides some dense solvers out of the box, and there are 3 different ways to compute the Quantum Geometric Tensor. Read the documentation to learn more about it. #674
- Unless you specify the QGT implementation you wish to use with SR, we use an automatic heuristic based on your model and the solver to pick one. This might affect SR performance. #674
- For all samplers,
n_chains
now sets the total number of chains across all MPI ranks. This is a breaking change compared to the old API, wheren_chains
would set the number of chains on a single MPI rank. It is still possible to set the number of chains per MPI rank by specifyingn_chains_per_rank
instead ofn_chains
. This change, while breaking allows us to be consistent with the interface of {class}variational.MCState
, wheren_samples
is the total number of samples across MPI nodes. MetropolisSampler.reset_chain
has been renamed toMetropolisSampler.reset_chains
. Likewise in the constructor of all samplers.- Briefly during development releases
MetropolisSamplerState.acceptance_ratio
returned the percentage (not ratio) of acceptance.acceptance_ratio
is now deprecated in favour of the correctacceptance
. models.Jastrow
now internally symmetrizes the matrix before computing its value #644MCState.evaluate
has been renamed toMCState.log_value
#632nk.optimizer.SR
no longer accepts keyword argument relative to the sparse solver. Those should be passed inside the closure orfunctools.partial
passed assolver
argument.nk.optimizer.sr.SRLazyCG
andnk.optimizer.sr.SRLazyGMRES
have been deprecated and will soon be removed.- Parts of the
Lattice
API have been overhauled, with deprecations of several methods in favor of a consistent usage ofLattice.position
for real-space location of sites andLattice.basis_coords
for location of sites in terms of basis vectors.Lattice.sites
has been added, which provides a sequence ofLatticeSite
objects combining all site properties. Furthermore,Lattice
now provides lookup of sites from their position viaid_from_position
using a hashing scheme that works across periodic boundaries. #703 #715 nk.variational
has been renamed tonk.vqs
and will be removed in a future release.
- Fix
operator.BoseHubbard
usage under jax Hamiltonian Sampling #662 - Fix
SROnTheFly
forR->C
models with non homogeneous parameters #661 - Fix MPI Compilation deadlock when computing expectation values #655
- Fix bug preventing the creation of a
hilbert.Spin
Hilbert space with odd sites and evenS
. #641 - Fix bug #635 preventing the usage of
NumpyMetropolisSampler
withMCState.expect
#635 - Fix bug #635 where the {class}
graph.Lattice
was not correctly computing neighbours because of floating point issues. #633 - Fix bug the Y Pauli matrix, which was stored as its conjugate. #618 #617 #615
-
Hilbert space constructors do not store the lattice graph anymore. As a consequence, the constructor does not accept the graph anymore.
-
Special Hamiltonians defined on a lattice, such as {class}
operator.BoseHubbard
, {class}operator.Ising
and {class}operator.Heisenberg
, now require the graph to be passed explicitly through agraph
keyword argument. -
{class}
operator.LocalOperator
now default to real-valued matrix elements, except if you construct them with a complex-valued matrix. This is also valid for operators such as :func:operator.spin.sigmax
and similars. -
When performing algebraic operations {code}
*, -, +
on pairs of {class}operator.LocalOperator
, the dtype of the result iscomputed using standard numpy promotion logic.- Doing an operation in-place {code}
+=, -=, *=
on a real-valued operator will now fail if the other is complex. While this might seem annoying, it's useful to ensure that smaller types such asfloat32
orcomplex64
are preserved if the user desires to do so.
- Doing an operation in-place {code}
-
{class}
AbstractMachine
has been removed. It's functionality is now split among the model itself, which is defined by the user and {class}variational.MCState
for pure states or {class}variational.MCMixedState
for mixed states.-
The model, in general is composed by two functions, or an object with two functions: an
init(rng, sample_val)
function, accepting a {func}jax.random.PRNGKey
object and an input, returning the parameters and the state of the model for that particular sample shape, and a {code}apply(params, samples, **kwargs)
function, evaluating the model for the given parameters and inputs. -
Some models (previously machines) such as the RBM (Restricted Boltzmann Machine) Machine, NDM (Neural Density Matrix) or MPS (Matrix Product State ansatz) are available in
Pre-built models
. -
Machines, now called models, should be written using Flax or another jax framework.
-
Serialization and deserialization functionality has now been moved to {class}
netket.variational.MCState
, which support the standard Flax interface through MsgPack. See Flax docs for more information -
{code}
AbstractMachine.init_random_parameters
functionality has now been absorbed into {meth}netket.vqs.VariationalState.init_parameters
, which however has a different syntax.
-
-
{ref}
Samplers <Sampler>
now require the Hilbert space upon which they sample to be passed in to the constructor. Also note that several keyword arguments of the samplers have changed, and new one are available. -
It's now possible to change {ref}
Samplers <Sampler>
dtype, which controls the type of the output. By default they use double-precision samples (np.float64
). Be wary of type promotion issues with your models. -
{ref}
Samplers <Sampler>
no longer take a machine as an argument. -
{ref}
Samplers <Sampler>
are now immutable (frozen)dataclasses
(defined throughflax.struct.dataclass
) that only hold the sampling parameters. As a consequence it is no longer possible to change their settings such asn_chains
orn_sweeps
without creating a new sampler. If you wish to update only one parameter, it is possible to construct the new sampler with the updated value by using thesampler.replace(parameter=new_value)
function. -
{ref}
Samplers <Sampler>
are no longer stateful objects. Instead, they can construct an immutable state objectnetket.sampler.init_state
, which can be passed to sampling functions such asnetket.sampler.sample
, which now return also the updated state. However, unless you have particular use-cases we advise you use the variational stateMCState
instead. -
The {ref}
netket.optimizer
module has been overhauled, and now only re-exports flax optim module. We advise not to use netket's optimizer but instead to use optax . -
The {ref}
netket.optimizer.SR
object now is only a set of options used to compute the SR matrix. The SR matrix, now calledquantum_geometric_tensor
can be obtained by calling {meth}variational.MCState.quantum_geometric_tensor
. Depending on the settings, this can be a lazy object. -
netket.Vmc
has been renamed to {class}netket.VMC
-
{class}
netket.models.RBM
replaces the old {code}RBM
machine, but has real parameters by default. -
As we rely on Jax, using {code}
dtype=float
or {code}dtype=complex
, which are weak types, will sometimes lead to loss of precision because they might be converted tofloat32
. Use {code}np.float64
or {code}np.complex128
instead if you want double precision when defining your models.