WagnerGroup / pyqmc

Python library for real space quantum Monte Carlo
MIT License
82 stars 33 forks source link

Attribute error in PeriodicConfigs object #425

Closed cychow2 closed 9 months ago

cychow2 commented 9 months ago

When I try to run a dmc with pyqmc.dmc.rundmc(wf, configs, tstep=0.02, accumulators=acc, verbose=True, nblocks=200, hdf_file=out_dmc_chkfile, client=client, npartitions=npartitions), I got the error below.

Calling _dist instead of dist seems to cause the error, and it seems to be something overlooked in the recent refactoring.

@willwheelera

Traceback (most recent call last):
  File "/projects/wagner/cychow2/research/cco/paper_geometry/pbe0/qmc/geminal/sjg_j_dmc.py", line 71, in <module>
    pyqmc.dmc.rundmc(wf, configs, tstep=0.02, accumulators=acc, verbose=True, nblocks=200, hdf_file=out_dmc_chkfile, client=client, npartitions=npartitions)
  File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/dmc.py", line 467, in rundmc
    df, configs = mc.vmc(
                  ^^^^^^^
  File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/mc.py", line 253, in vmc
    block_avg, configs = vmc_parallel(
                         ^^^^^^^^^^^^^
  File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/mc.py", line 155, in vmc_parallel
    config = configs.split(npartitions)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/coord.py", line 200, in split
    return [PeriodicConfigs(c, self.lvecs, w, dist=self._dist) for c, w in zip(clist, wlist)]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/coord.py", line 200, in <listcomp>
    return [PeriodicConfigs(c, self.lvecs, w, dist=self._dist) for c, w in zip(clist, wlist)]
                                                   ^^^^^^^^^^
AttributeError: 'PeriodicConfigs' object has no attribute '_dist'. Did you mean: 'dist'?
willwheelera commented 9 months ago

It may just be a typo. Can you try removing the underscore and see if it works properly?

Chun Yu Chow @.***> schrieb am Fr., 26. Jan. 2024, 17:34:

When I try to run a dmc with pyqmc.dmc.rundmc(wf, configs, tstep=0.02, accumulators=acc, verbose=True, nblocks=200, hdf_file=out_dmc_chkfile, client=client, npartitions=npartitions), I got the error below.

Calling _dist instead of dist seems to cause the error, and it seems to be something overlooked in the recent refactoring.

Traceback (most recent call last): File "/projects/wagner/cychow2/research/cco/paper_geometry/pbe0/qmc/geminal/sjg_j_dmc.py", line 71, in pyqmc.dmc.rundmc(wf, configs, tstep=0.02, accumulators=acc, verbose=True, nblocks=200, hdf_file=out_dmc_chkfile, client=client, npartitions=npartitions) File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/dmc.py", line 467, in rundmc df, configs = mc.vmc( ^^^^^^^ File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/mc.py", line 253, in vmc block_avg, configs = vmc_parallel( ^^^^^^^^^^^^^ File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/mc.py", line 155, in vmc_parallel config = configs.split(npartitions) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/coord.py", line 200, in split return [PeriodicConfigs(c, self.lvecs, w, dist=self._dist) for c, w in zip(clist, wlist)] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/projects/wagner/cychow2/.conda/envs/cco-new/lib/python3.11/site-packages/pyqmc/coord.py", line 200, in return [PeriodicConfigs(c, self.lvecs, w, dist=self._dist) for c, w in zip(clist, wlist)] ^^^^^^^^^^ AttributeError: 'PeriodicConfigs' object has no attribute '_dist'. Did you mean: 'dist'?

— Reply to this email directly, view it on GitHub https://github.com/WagnerGroup/pyqmc/issues/425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC25FZLK6OTXKTPRQY7AR7LYQQVP5AVCNFSM6AAAAABCM2BCRWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYDGMBQGM2TMMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

cychow2 commented 9 months ago

The error goes away by removing the underscore, so I think it works fine. I opened a pull request #426 for this.