Skip to content

Commit 0ce3411

Browse files
committed
Merge pull request #110 from APerezFadon:main
PiperOrigin-RevId: 914789354 Change-Id: Ie5b25ec5cd6e2f8c7be1e588eb832699cdb3f374
2 parents 9a549ed + 4ec5854 commit 0ce3411

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

ferminet/pbc/hamiltonian.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ def local_energy(
158158
complex_output: bool = False,
159159
laplacian_method: str = 'default',
160160
states: int = 0,
161+
state_specific: bool = False,
162+
pp_type: str = 'ccecp',
163+
pp_symbols: Sequence[str] | None = None,
161164
lattice: Optional[jnp.ndarray] = None,
162165
heg: bool = True,
163166
convergence_radius: int = 5,
@@ -176,6 +179,10 @@ def local_energy(
176179
'folx': use Microsoft's implementation of forward laplacian
177180
states: Number of excited states to compute. Not implemented, only present
178181
for consistency of calling convention.
182+
state_specific: Not implemented.
183+
pp_type: type of pseudopotential to use. Not implemented.
184+
pp_symbols: sequence of element symbols for which the pseudopotential is
185+
used. Not implemented.
179186
lattice: Shape (ndim, ndim). Matrix of lattice vectors. Default: identity
180187
matrix.
181188
heg: bool. Flag to enable features specific to the electron gas.
@@ -186,9 +193,13 @@ def local_energy(
186193
energy of the wavefunction given the parameters params, RNG state key,
187194
and a single MCMC configuration in data.
188195
"""
189-
if states:
196+
if states > 0 or state_specific:
190197
raise NotImplementedError('Excited states not implemented with PBC.')
198+
if pp_symbols:
199+
raise NotImplementedError('Pseudopotentials not implemented with PBC.')
200+
191201
del nspins
202+
del pp_type
192203
if lattice is None:
193204
lattice = jnp.eye(3)
194205

ferminet/train.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,8 @@ def log_network(*args, **kwargs):
742742
)
743743
# Construct loss and optimizer
744744
laplacian_method = cfg.optim.get('laplacian', 'default')
745+
pp_symbols = cfg.system.get('pp', {'symbols': None}).get('symbols')
745746
if cfg.system.make_local_energy_fn:
746-
if laplacian_method != 'default':
747-
raise NotImplementedError(f'Laplacian method {laplacian_method}'
748-
'not yet supported by custom local energy fns.')
749-
if cfg.optim.objective == 'vmc_overlap':
750-
raise NotImplementedError('Overlap penalty not yet supported for custom'
751-
'local energy fns.')
752747
local_energy_module, local_energy_fn = (
753748
cfg.system.make_local_energy_fn.rsplit('.', maxsplit=1))
754749
local_energy_module = importlib.import_module(local_energy_module)
@@ -758,10 +753,15 @@ def log_network(*args, **kwargs):
758753
charges=charges,
759754
nspins=nspins,
760755
use_scan=False,
756+
complex_output=use_complex,
757+
laplacian_method=laplacian_method,
761758
states=cfg.system.get('states', 0),
762-
**cfg.system.make_local_energy_kwargs)
759+
state_specific=(cfg.optim.objective == 'vmc_overlap'),
760+
pp_type=cfg.system.get('pp', {'type': 'ccecp'}).get('type'),
761+
pp_symbols=pp_symbols if cfg.system.get('use_pp') else None,
762+
**cfg.system.make_local_energy_kwargs,
763+
)
763764
else:
764-
pp_symbols = cfg.system.get('pp', {'symbols': None}).get('symbols')
765765
local_energy_fn = hamiltonian.local_energy(
766766
f=signed_network,
767767
charges=charges,

0 commit comments

Comments
 (0)