-
Hello, Is there a way to set the seed for the random number generator used in There doesn't seem to be a function argument related to the seed and nothing appeared when I searched for "seed" in the docs. Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
hczhai
Feb 16, 2024
Replies: 1 comment
-
You can use from pyblock2.driver.core import DMRGDriver, SymmetryTypes
from pyblock2.algebra.io import MPSTools
ncas, n_elec, spin = 10, 10, 0
driver = DMRGDriver(scratch="./tmp", symm_type=SymmetryTypes.SZ, n_threads=4)
driver.initialize_system(n_sites=ncas, n_elec=n_elec, spin=spin)
driver.bw.b.Random.rand_seed(1234)
ket = driver.get_random_mps(tag="GS", bond_dim=10, nroots=1, dot=1, occs=[0.5] * ncas)
pyket = MPSTools.from_block2(ket)
print('random block at site 1 =\n', pyket.tensors[1].blocks[0].reduced) Note:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hczhai
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
driver.bw.b.Random.rand_seed
to set a random seed before callingdriver.get_random_mps
. For example:Note:
driver.bw.b.Random.rand_seed(0)
will generate different results every tim…