global_defs#

In global_defs, users can define and check global constants used in the simulation, including datatypes, random keys, and Hilbert space information. The settings should be done right after importing Quantax, and before defining any model or state.

quantax.set_default_dtype(dtype: dtype) None#

Set the default data type in Quantax. Recommended to be jnp.float64 or jnp.complex128. Default to jnp.float64.

Note

This doesn’t alter the computation inside quantax.model.

quantax.get_default_dtype() dtype#

Return the default data type in Quantax.

quantax.get_real_dtype() dtype#

Return the default real data type in Quantax. If the default data type is complex, then return the corresponding real data type.

quantax.is_default_cpl() bool#

Return whether the default data type is complex.

quantax.set_random_seed(seed: int) None#

Set the initial random seed in Quantax. Default to be 42.

quantax.get_subkeys(num: int | None = None) Array#

Get jax keys stored in Quantax. The keys are replicated across all devices.

Parameters:

num – The number of returned keys. If num is not given, then return only 1 key instead of an array of keys.

Warning

This function is not jittable, because it reads and writes the global key stored in quantax.

quantax.PARTICLE_TYPE(*values)#

The enums to distinguish different particle types.

  • 0: spin

  • 1: spinful_fermion

  • 2: spinless_fermion

  • (Not implemented) 3: boson

quantax.get_sites() Sites#

Get the Sites used in the current program.

Warning

Unlike other NQS packages, in Quantax the geometry graph and the hilbert space is defined as a global constant which shouldn’t be changed within a single program.

quantax.get_lattice() Lattice#

Get the Lattice used in the current program. This is similar to get_sites, but will raise an error if the defined Sites is not a Lattice.