diff --git a/README.md b/README.md index ef3cdf8d..2b908283 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Pytorch Implementation of Real Space Quantum Monte Carlo Simulations of Molecula ## Documentation https://qmctorch.readthedocs.io/en/latest/intro.html + + diff --git a/qmctorch/sampler/walkers.py b/qmctorch/sampler/walkers.py index 60743a9e..7c3bb558 100644 --- a/qmctorch/sampler/walkers.py +++ b/qmctorch/sampler/walkers.py @@ -66,7 +66,7 @@ def _init_center(self): Returns: torch.tensor: positions of the walkers """ - eps = 1E-6 + eps = 1E-3 pos = -eps + 2 * eps * \ torch.rand(self.nwalkers, self.nelec * self.ndim) return pos.type( @@ -131,7 +131,7 @@ def _init_atomic(self): elif nelec_placed[_idx] < 5: s = 2. / (self.init_domain['atom_num'][_idx] - 2) else: - s = 3. / (self.init_domain['atom_num'][_idx] - 10) + s = 3. / (self.init_domain['atom_num'][_idx] - 3) xyz[ielec, :] += np.random.normal(scale=s, size=(1, 3)) nelec_placed[_idx] += 1 diff --git a/qmctorch/utils/plot_data.py b/qmctorch/utils/plot_data.py index 496fd718..0507e810 100644 --- a/qmctorch/utils/plot_data.py +++ b/qmctorch/utils/plot_data.py @@ -74,12 +74,12 @@ def plot_data(observable, obsname): plt.show() -def plot_walkers_traj(eloc, traj_index='all'): +def plot_walkers_traj(eloc, walkers='mean'): """Plot the trajectory of all the individual walkers Args: obs (SimpleNamespace): Namespace of the observables - traj_index (int, str, optional): all or index of a given walker Defaults to 'all' + walkers (int, str, optional): all, mean or index of a given walker Defaults to 'all' Returns: float : Decorelation time @@ -97,21 +97,28 @@ def plot_walkers_traj(eloc, traj_index='all'): Tc = (var_decor / var)**2 - if traj_index is not None: - plt.subplot(1, 2, 1) - - if traj_index == 'all': + if walkers is not None: + # plt.subplot(1, 2, 1) + if walkers == 'all': plt.plot(eloc, 'o', alpha=1 / nwalkers, c='grey') cmap = cm.hot(np.linspace(0, 1, nwalkers)) for i in range(nwalkers): plt.plot(celoc.T[:, i], color=cmap[i]) + + elif walkers == 'mean': + plt.plot(eloc, 'o', alpha=1 / nwalkers, c='grey') + plt.plot(np.mean(celoc.T, axis=1), linewidth=5) + else: - plt.plot(eloc[traj_index, :], 'o', + plt.plot(eloc[walkers, :], 'o', alpha=1 / nwalkers, c='grey') plt.plot(celoc.T[traj_index, :]) - plt.subplot(1, 2, 2) - plt.hist(Tc) + plt.grid() + plt.xlabel('Monte Carlo Steps') + plt.ylabel('Energy (Hartree)') + # plt.subplot(1, 2, 2) + # plt.hist(Tc) plt.show()