def vmc_file(hdf_file, data, attr, configs): import pyqmc.hdftools as hdftools if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) hdf.create_dataset("configs", configs.configs.shape) hdftools.append_hdf(hdf, data) hdf["configs"][:, :, :] = configs.configs
def vmc_file(hdf_file, data, attr, configs): import pyqmc.hdftools as hdftools if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) configs.initialize_hdf(hdf) hdftools.append_hdf(hdf, data) configs.to_hdf(hdf)
def dmc_file(hdf_file, data, attr, configs, weights): import pyqmc.hdftools as hdftools if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) configs.initialize_hdf(hdf) if "weights" not in hdf.keys(): hdf.create_dataset("weights", weights.shape) hdftools.append_hdf(hdf, data) configs.to_hdf(hdf) hdf["weights"][:] = weights
def dmc_file(hdf_file, data, attr, configs, weights): import pyqmc.hdftools as hdftools if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data.loc[0], attr) hdf.create_dataset("configs", configs.configs.shape) if "weights" not in hdf.keys(): hdf.create_dataset("weights", weights.shape) for i in range(len(data)): hdftools.append_hdf(hdf, data.loc[i]) hdf["configs"][:, :, :] = configs.configs hdf["weights"][:] = weights
def ortho_hdf(hdf_file, data, attr, configs, parameters): if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) hdf.create_dataset("configs", configs.configs.shape) for k, it in parameters.items(): hdf.create_dataset("wf/" + k, data=it) hdftools.append_hdf(hdf, data) hdf["configs"][:, :, :] = configs.configs for k, it in parameters.items(): hdf["wf/" + k][...] = it.copy()
def hdf_save(hdf_file, data, attr, wfs): if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "energy" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) for wfi, wf in enumerate(wfs): for k, it in wf.parameters.items(): hdf.create_dataset(f"wf/{wfi}/" + k, data=it) hdftools.append_hdf(hdf, data) for wfi, wf in enumerate(wfs): for k, it in wf.parameters.items(): hdf[f"wf/{wfi}/" + k][...] = it.copy()
def opt_hdf(hdf_file, data, attr, configs, parameters): import pyqmc.hdftools as hdftools if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, data, attr) configs.initialize_hdf(hdf) hdf.create_group("wf") for k, it in parameters.items(): hdf.create_dataset("wf/" + k, data=gpu.asnumpy(it)) hdftools.append_hdf(hdf, data) configs.to_hdf(hdf) for k, it in parameters.items(): hdf["wf/" + k][...] = gpu.asnumpy(it.copy())
def vmc_file(hdf_file, data, attr, configs): import pyqmc.hdftools as hdftools npdata = jax.tree_util.tree_map(np.asarray, data) if hdf_file is not None: with h5py.File(hdf_file, "a") as hdf: if "configs" not in hdf.keys(): hdftools.setup_hdf(hdf, npdata, attr) hdf.create_dataset( "configs", configs.shape, chunks=True, maxshape=(None, *configs.shape[1:]), ) hdftools.append_hdf(hdf, npdata) hdf["configs"].resize(configs.shape) hdf["configs"][...] = configs