Skip to content

Commit 4ec5854

Browse files
committed
Remove NotImplementedError and add missing arguments to custom Hamiltonians
1 parent 9a549ed commit 4ec5854

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

ferminet/pbc/hamiltonian.py

Lines changed: 6 additions & 0 deletions
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,
@@ -188,6 +191,9 @@ def local_energy(
188191
"""
189192
if states:
190193
raise NotImplementedError('Excited states not implemented with PBC.')
194+
if pp_symbols:
195+
raise NotImplementedError('Pseudopotentials not implemented with PBC.')
196+
191197
del nspins
192198
if lattice is None:
193199
lattice = jnp.eye(3)

ferminet/train.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,6 @@ def log_network(*args, **kwargs):
743743
# Construct loss and optimizer
744744
laplacian_method = cfg.optim.get('laplacian', 'default')
745745
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.')
752746
local_energy_module, local_energy_fn = (
753747
cfg.system.make_local_energy_fn.rsplit('.', maxsplit=1))
754748
local_energy_module = importlib.import_module(local_energy_module)
@@ -758,7 +752,12 @@ def log_network(*args, **kwargs):
758752
charges=charges,
759753
nspins=nspins,
760754
use_scan=False,
755+
complex_output=use_complex,
756+
laplacian_method=laplacian_method,
761757
states=cfg.system.get('states', 0),
758+
state_specific=(cfg.optim.objective == 'vmc_overlap'),
759+
pp_type=cfg.system.get('pp', {'type': 'ccecp'}).get('type'),
760+
pp_symbols=pp_symbols if cfg.system.get('use_pp') else None,
762761
**cfg.system.make_local_energy_kwargs)
763762
else:
764763
pp_symbols = cfg.system.get('pp', {'symbols': None}).get('symbols')

0 commit comments

Comments
 (0)