Skip to content
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
4485c22
first removal pass
jtkrogel Aug 27, 2026
bceb4fa
second removal pass
jtkrogel Aug 28, 2026
3b395e1
third removal pass
jtkrogel Aug 28, 2026
f28cd84
fourth removal pass
jtkrogel Aug 28, 2026
25e61c0
fifth removal pass
jtkrogel Aug 28, 2026
246e42f
sixth removal pass
jtkrogel Aug 28, 2026
6b58d5f
removal pass 7
jtkrogel Aug 28, 2026
154739b
removal pass 8
jtkrogel Aug 28, 2026
7ae139f
removal pass 9
jtkrogel Aug 28, 2026
33310ae
removal pass 10
jtkrogel Aug 28, 2026
4001b79
removal pass 11
jtkrogel Aug 28, 2026
da36f44
removal pass 12
jtkrogel Aug 28, 2026
c22625c
removal pass 13
jtkrogel Aug 28, 2026
70dc9f9
removal pass 14
jtkrogel Aug 28, 2026
14e9695
removal pass 15
jtkrogel Aug 28, 2026
280049d
removal pass 16
jtkrogel Aug 28, 2026
6696007
removal pass 17
jtkrogel Aug 28, 2026
2b302e3
removal pass 18
jtkrogel Aug 28, 2026
390bbc5
removal pass 19
jtkrogel Aug 28, 2026
19a4641
removal pass 20
jtkrogel Aug 28, 2026
e45984e
removal pass 21
jtkrogel Aug 28, 2026
3d88ca2
removal pass 22
jtkrogel Aug 28, 2026
5a18ddd
removal pass 23
jtkrogel Aug 28, 2026
c44fb95
removal pass 24
jtkrogel Aug 28, 2026
ddcab3a
removal pass 25
jtkrogel Aug 28, 2026
686b28c
removal pass 26
jtkrogel Aug 28, 2026
335e57b
removal pass 27
jtkrogel Aug 28, 2026
89ece81
removal pass 28
jtkrogel Aug 28, 2026
e50ee87
removal pass 29
jtkrogel Aug 28, 2026
dc630b7
removal pass 30
jtkrogel Aug 28, 2026
52efac6
removal pass 31
jtkrogel Aug 28, 2026
a41d7c8
removal pass 32
jtkrogel Aug 28, 2026
2cea6d2
removal pass 33
jtkrogel Aug 28, 2026
680a405
removal pass 34
jtkrogel Aug 28, 2026
26d9261
removal pass 35
jtkrogel Aug 28, 2026
7570c77
removal pass 36
jtkrogel Aug 28, 2026
ec6e057
removal pass 37
jtkrogel Aug 28, 2026
3d10c1f
Merge remote-tracking branch 'main/develop' into rem_nonfunc_inputs
jtkrogel Aug 31, 2026
93f0f28
Merge remote-tracking branch 'main/develop' into rem_nonfunc_inputs
jtkrogel Sep 11, 2026
32525a9
Defer Nexus input schema changes
jtkrogel Sep 11, 2026
5a046a2
Keep deferred Nexus changes local
jtkrogel Sep 11, 2026
194b9f4
remove unneeded unit tests
jtkrogel Sep 11, 2026
4ce8767
Merge remote-tracking branch 'main/develop' into rem_nonfunc_inputs
jtkrogel Sep 18, 2026
484462c
nexus: address review comments
jtkrogel Sep 18, 2026
dbca8d5
Address latest PR review comments
jtkrogel Sep 21, 2026
1b859ba
Merge remote-tracking branch 'main/develop' into rem_nonfunc_inputs
jtkrogel Sep 21, 2026
a9a0165
Restore radial cutoff comments
jtkrogel Sep 22, 2026
8cc555f
Merge remote-tracking branch 'main/develop' into rem_nonfunc_inputs
jtkrogel Sep 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,746 changes: 1,346 additions & 400 deletions nexus/nexus/qmcpack_input.py

Large diffs are not rendered by default.

252 changes: 251 additions & 1 deletion nexus/nexus/tests/test_qmcpack_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ def test_qixml_class_init():
elements = tuple,
text = str,
parameters = tuple,
parents = tuple,
attribs = tuple,
costs = tuple,
h5tags = tuple,
Expand All @@ -526,14 +527,17 @@ def test_qixml_class_init():
defaults = obj,
collection_id = str,
exp_names = obj,
attribute_aliases = obj,
element_aliases = obj,
unsupported = tuple,
params = tuple,
plurals_inv = obj,
plurals = obj,
expanded_names = obj,
afqmc_order = tuple,
)
optional = set(['expanded_names','afqmc_order'])
assert(len(attr_types)==21)
assert(len(attr_types)==25)

def valid_name(s):
v = True
Expand Down Expand Up @@ -569,11 +573,257 @@ def valid_name(s):
#end if
#end if
#end for
declared_inputs = set(cls.attributes+cls.parameters+cls.elements)
assert(set(cls.unsupported)<=declared_inputs)
#end for

#end def test_qixml_class_init


def test_qixml_live_and_unsupported_parameters(tmp_path):
from ..qmcpack_input import QIxml
from ..qmcpack_input import QmcpackInput
from ..qmcpack_input import atomicbasisset,bspline_builder,checkpoint_element,coefs_mem,determinant,detlist
from ..qmcpack_input import dmc,dmc_batch,group,init
from ..qmcpack_input import force,hamiltonian,harmonic_extpot,hybrid_optimizer
from ..qmcpack_input import linear,linear_batch,mpc,multideterminant,onebodydensitymatrices,optimize
from ..qmcpack_input import mcwalkerset,paircorrelation,particleset,pseudo,pseudopotential
from ..qmcpack_input import qmc_system_selector,qmcsystem,rpa_jastrow,simulation,simulationcell
from ..qmcpack_input import sposet,sposet_builder,sposet_collection,structurefactor,vmc,vmc_batch,walkerlogs

assert(QIxml.unsupported==())
assert(multideterminant.unsupported==('spo_down','fast'))
assert(detlist.unsupported==())
assert('basisset' not in determinant.unsupported)
assert('size' not in determinant.unsupported)
assert('cuspinfo' not in determinant.unsupported)
assert(pseudo.unsupported==('cutoff',))
assert(mpc.unsupported==('ecut','source','target'))
assert(force.unsupported==('addionion','weightexp','lrmethod'))
assert(structurefactor.unsupported==('report','hdf5','writerho','writeionion'))
assert(paircorrelation.unsupported==('debug','sources'))
assert('max_relative_change' in linear.unsupported)
assert('gpu' not in linear.unsupported)
assert('gpu' in vmc.unsupported)
assert('target' not in vmc.unsupported)
assert('trace' not in vmc.unsupported)
assert('trace' in vmc_batch.unsupported)
assert('walkers' not in vmc.unsupported)
assert('walkers' in vmc_batch.unsupported)
assert('walkers' in dmc_batch.unsupported)
assert('l2_diffusion' not in dmc.unsupported)
assert('reconfiguration' not in dmc.unsupported)
assert('reconfiguration' in dmc_batch.unsupported)
assert('l2_diffusion' in dmc_batch.unsupported)
assert(onebodydensitymatrices.unsupported==('reuse','basis_size','warmup'))
assert(mcwalkerset.unsupported==('target','walkers'))
assert(qmcsystem.unsupported==('dim',))
assert(simulationcell.unsupported==('name','tilematrix','reciprocal','uc_grid'))
assert(particleset.unsupported==('charge','source','role','simulationcell'))
assert(group.unsupported==('id','mass'))
assert(simulation.parents==())
assert(group.parents==('particleset',))
assert(force.parents==('hamiltonian',))

obdm = onebodydensitymatrices(
type = 'OneBodyDensityMatrices',
name = 'OneBodyDensityMatrices',
basis = 'spo_ud',
volume_normed = False,
warmup_samples = 17,
)
obdm_xml = obdm.write()
assert('<parameter name="volume_normed"' in obdm_xml)
assert('<parameter name="warmup_samples"' in obdm_xml)
assert('> no' in obdm_xml)

det_xml = determinant(
id = 'updet',
size = 2,
basisset = 'LCAOBSet',
cuspinfo = 'updet.cuspInfo.xml',
).write()
assert('size="2"' in det_xml)
assert('basisset="LCAOBSet"' in det_xml)
assert('cuspInfo="updet.cuspInfo.xml"' in det_xml)

detlist_xml = detlist(
type = 'CSF',
size = 2,
sortby = 'qchem_coeff',
zero_cutoff = 1e-8,
).write()
assert('sortby="qchem_coeff"' in detlist_xml)
assert('zero_cutoff="1e-08"' in detlist_xml)

cell = simulationcell(
vacuum = 1.5,
ewald_grid = 1001,
)
cell_xml = cell.write()
assert('<parameter name="vacuum"' in cell_xml)
assert('<parameter name="ewald_grid"' in cell_xml)

pset = particleset(
id = 'e',
gpu = 'omptarget',
spinor = True,
groups = [group(name='u',size=1,charge=-1)],
)
pset_xml = pset.write()
assert('<particleset id="e"' in pset_xml)
assert('gpu="omptarget"' in pset_xml)
assert('spinor="yes"' in pset_xml)

init_xml = init(source='ion0',target='e',use_volume=True).write()
assert('<init source="ion0" target="e" use_volume="yes"/>' in init_xml)

basis = atomicbasisset(elementtype='C',expm='yes')
assert('elementType="C"' in basis.write())
assert('expM="yes"' in basis.write())

builder = bspline_builder(
type = 'bspline',
skip_checks = True,
check_orb_norm = False,
save_coefs = True,
sposet = sposet(
name = 'spo-u',
size = 4,
coefs_mem = coefs_mem(distributed_ranks=2,shared_ranks=4),
),
)
builder_xml = builder.write()
assert('skip_checks="yes"' in builder_xml)
assert('check_orb_norm="no"' in builder_xml)
assert('save_coefs="yes"' in builder_xml)
assert('<coefs_mem distributed_ranks="2" shared_ranks="4"/>' in builder_xml)

pw_xml = sposet_builder(
type = 'pw',
twistindex = 2,
bufferlayer = 1,
expand = 3,
).write()
assert('<sposet_builder type="pw">' in pw_xml)
assert('<parameter name="twistIndex"' in pw_xml)
assert('<parameter name="bufferLayer"' in pw_xml)

collection_xml = sposet_collection(type='heg',source='ion0').write()
assert(collection_xml.startswith('<sposet_collection type="heg"'))

checkpoint_xml = vmc(
method = 'vmc',
checkpoint = -1,
checkpoint_element = checkpoint_element(stride=20),
).write()
assert('<qmc method="vmc" checkpoint="-1">' in checkpoint_xml)
assert('<checkpoint stride="20"/>' in checkpoint_xml)

rpa = rpa_jastrow(
type = 'rpa',
longrange = True,
shortrange = False,
rs = 2.0,
kc = 1.0,
)
rpa_xml = rpa.write()
assert('longrange="yes"' in rpa_xml)
assert('shortrange="no"' in rpa_xml)
assert('<parameter name="rs"' in rpa_xml)
assert('<parameter name="kc"' in rpa_xml)

pp = pseudopotential(
type = 'pseudo',
pbc = False,
physicalso = True,
spin_integrator = 'exact',
)
pp_xml = pp.write()
assert('pbc="no"' in pp_xml)
assert('physicalSO="yes"' in pp_xml)
assert('spin_integrator="exact"' in pp_xml)

ham = hamiltonian(
name = 'h0',
wavefunction = 'psi0',
extpot = harmonic_extpot(type='harmonic_ext',mass=1.0,frequency=2.0),
estimator = paircorrelation(type='paircorrelation',dr=0.1),
)
ham_xml = ham.write()
assert('wavefunction="psi0"' in ham_xml)
assert('<extpot type="harmonic_ext"' in ham_xml)
assert('<estimator type="PairCorrelation"' in ham_xml)

calc = dmc(
method = 'dmc',
append = 'yes',
drift_unr_a = 1.0,
maxdisplsq = 4.0,
energyupdateinterval = 10,
refenergy = -1.0,
maxcopy = 2,
qmc_system_selector = qmc_system_selector(
wavefunction = 'psi1',
hamiltonian = 'h1',
),
)
calc_xml = calc.write()
assert('append="yes"' in calc_xml)
assert('<parameter name="drift_UNR_a"' in calc_xml)
assert('<parameter name="maxDisplSq"' in calc_xml)
assert('<parameter name="energyUpdateInterval"' in calc_xml)
assert('<parameter name="refEnergy"' in calc_xml)
assert('<parameter name="maxCopy"' in calc_xml)
assert('<qmcsystem wavefunction="psi1" hamiltonian="h1"/>' in calc_xml)

selector_file = tmp_path/'qmc_system_selector.xml'
selector_file.write_text('''<simulation>
<project id="qmc" series="0"/>
<qmc method="dmc">
<qmcsystem wavefunction="psi1" hamiltonian="h1"/>
</qmc>
</simulation>
''')
selector_input = QmcpackInput(selector_file)
selector = selector_input.simulation.qmc.qmc_system_selector
assert(selector.wavefunction=='psi1')
assert(selector.hamiltonian=='h1')

opt = linear(
method = 'linear',
max_relative_cost_change = 5.0,
optimize = optimize(
method = 'gradient_test',
output_param_file = True,
finite_diff_delta = 1e-5,
),
optimizers = [
hybrid_optimizer(num_updates=3,minmethod='adaptive'),
hybrid_optimizer(num_updates=2,minmethod='descent'),
],
)
opt_xml = opt.write()
assert('<parameter name="max_relative_cost_change"' in opt_xml)
assert('<optimize method="gradient_test">' in opt_xml)
assert(opt_xml.count('<optimizer num_updates=')==2)
assert('<parameter name="MinMethod"' in opt_xml)

batched = linear_batch(
method = 'linear_batch',
**{'options_LMY_.targetExcited':'yes'},
)
assert('<parameter name="options_LMY_.targetExcited"' in batched.write())

sim = simulation(
walkerlogs = walkerlogs(step_period=4,particle=True,quantiles=False),
)
sim_xml = sim.write()
assert('<walkerlogs step_period="4" particle="yes" quantiles="no"/>' in sim_xml)

#end def test_qixml_live_and_unsupported_parameters



def test_compose():
import numpy as np
Expand Down
5 changes: 1 addition & 4 deletions src/Estimators/OneBodyDensityMatricesInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ OneBodyDensityMatricesInput::OneBodyDensityMatricesInput(xmlNodePtr cur)
input_section_.readXML(cur);
auto setIfInInput = LAMBDA_setIfInInput;
setIfInInput(name_, "name");
setIfInInput(energy_matrix_, "energy_matrix");
setIfInInput(use_drift_, "use_drift");
setIfInInput(normalized_, "normalized");
setIfInInput(volume_normalized_, "volume_normalized");
setIfInInput(check_overlap_, "check_overlap");
setIfInInput(check_derivatives_, "check_derivatives");
setIfInInput(volume_normalized_, "volume_normed");
setIfInInput(rstats_, "rstats");
setIfInInput(write_acceptance_ratio_, "acceptance_ratio");
setIfInInput(integrator_, "integrator");
Expand Down
14 changes: 3 additions & 11 deletions src/Estimators/OneBodyDensityMatricesInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ class OneBodyDensityMatricesInput
// clang-format off
section_name = "OneBodyDensityMatrices";
attributes = {"name"};
parameters = {"basis", "energy_matrix", "integrator", "evaluator", "scale",
parameters = {"basis", "integrator", "evaluator", "scale",
"corner", "center", "points", "samples", "warmup", "timestep",
"use_drift", "check_overlap", "check_derivatives", "acceptance_ratio", "rstats",
"normalized", "volumed_normed"};
bools = {"energy_matrix", "use_drift", "normalized", "volume_normed",
"check_overlap", "check_derivatives", "rstats", "acceptance_ratio"};
"use_drift", "acceptance_ratio", "rstats", "normalized", "volume_normed"};
bools = {"use_drift", "normalized", "volume_normed", "rstats", "acceptance_ratio"};
enums = {"integrator", "evaluator"};
strings = {"name"};
multi_strings = {"basis"};
Expand Down Expand Up @@ -108,12 +106,9 @@ class OneBodyDensityMatricesInput
OneBodyDensityMatricesInputSection input_section_;

// Default parameters for OneBodyDensityMatrices
bool energy_matrix_ = false;
bool use_drift_ = false;
bool normalized_ = true;
bool volume_normalized_ = true;
bool check_overlap_ = false;
bool check_derivatives_ = false;
bool rstats_ = false;
bool write_acceptance_ratio_ = false;
/// This flag is derived from input so if you construct an OBDMI directly with center it must be set.
Expand All @@ -134,12 +129,9 @@ class OneBodyDensityMatricesInput

public:
const std::string& get_name() const { return name_; }
bool get_energy_matrix() const { return energy_matrix_; }
bool get_use_drift() const { return use_drift_; }
bool get_normalized() const { return normalized_; }
bool get_volume_normalized() const { return volume_normalized_; }
bool get_check_overlap() const { return check_overlap_; }
bool get_check_derivatives() const { return check_derivatives_; }
bool get_rstats() const { return rstats_; }
bool get_write_acceptance_ratio() const { return write_acceptance_ratio_; }
Integrator get_integrator() const { return integrator_; }
Expand Down
1 change: 0 additions & 1 deletion src/Estimators/PairCorrelationInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ PairCorrelationInput::PairCorrelationInput(xmlNodePtr cur)
explicit_set_nbins_ = setIfInInput(nbins_, "num_bin");
explicit_set_rmax_ = setIfInInput(rmax_, "rmax");
explicit_set_delta_ = setIfInInput(delta_, "dr");
setIfInInput(debug_, "debug");
setIfInInput(sources_, "sources");
}

Expand Down
5 changes: 1 addition & 4 deletions src/Estimators/PairCorrelationInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ class PairCorrelationInput
{
section_name = type_tag;
section_name_alternates = {"gofr"};
attributes = {"name", "num_bin", "rmax", "dr", "debug", "sources"};
attributes = {"name", "num_bin", "rmax", "dr", "sources"};
strings = {"name"};
multi_strings = {"sources"};
reals = {"dr", "rmax"};
integers = {"num_bin"};
bools = {"debug"};
}
};

Expand All @@ -54,15 +53,13 @@ class PairCorrelationInput
bool explicit_set_delta_{false};
int nbins_{20};
bool explicit_set_nbins_{false};
bool debug_{false};

public:
std::string get_name() const { return name_; }
const std::vector<std::string>& get_sources() const { return sources_; }
Real get_rmax() const { return rmax_; }
Real get_delta() const { return delta_; }
int get_nbins() const { return nbins_; }
bool get_debug() const { return debug_; }
bool get_explicit_set_rmax() const { return explicit_set_rmax_; }
bool get_explicit_set_delta() const { return explicit_set_delta_; };
bool get_explicit_set_nbins() const { return explicit_set_nbins_; };
Expand Down
4 changes: 2 additions & 2 deletions src/Estimators/PerParticleHamiltonianLoggerInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class PerParticleHamiltonianLoggerInput
PerParticleHamiltonianLoggerInputSection()
{
section_name = type_tag;
attributes = {"to_stdout", "validate_per_particle_sum", "name"};
bools = {"to_stdout", "validate_per_particle_sum"};
attributes = {"to_stdout", "name"};
bools = {"to_stdout"};
strings = {"name"};
}
PerParticleHamiltonianLoggerInputSection(const PerParticleHamiltonianLoggerInputSection& other) = default;
Expand Down
1 change: 0 additions & 1 deletion src/Estimators/SpinDensityInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ SpinDensityInput::SpinDensityInput(xmlNodePtr cur)

setIfInInput(name_, "name");
setIfInInput(write_report_, "report");
setIfInInput(save_memory_, "save_memory");
have_dr_ = setIfInInput(dr_, "dr");
have_corner_ = setIfInInput(corner_, "corner");
have_center_ = setIfInInput(center_, "center");
Expand Down
Loading
Loading