JqmcToolCalculation#

JqmcToolCalculation (entry point jqmc.tool) runs one jqmc-tool subcommand: a conversion that produces a Hamiltonian, or the post-processing of checkpoints written by JqmcCalculation.

Subcommands#

command

reads

produces

trexio convert-to

input_file (a TREXIO file)

output_hamiltonian

trexio show-info, hamiltonian show-info

input_file (a TREXIO or Hamiltonian file)

output_parameters (the system summary)

hamiltonian to-xyz

input_file (a Hamiltonian)

output_structure

vmc analyze-output

the jqmc stdout of each parent_folders entry, in key order

output_graph with -s

vmc average-wf

the Hamiltonian files of the optimization steps, one per input_files entry, in key order

output_hamiltonian (the average)

qe

a Quantum ESPRESSO output directory: one parent_folders entry or input_folder, and save_path

output_hamiltonian

hamiltonian conv-wf

input_file (a Hamiltonian)

output_hamiltonian

mcmc compute-energy, lrdmc compute-energy

one parent_folders entry

output_parameters

mcmc compute-force, lrdmc compute-force

one parent_folders entry

output_parameters

lrdmc extrapolate-energy

one parent_folders entry per lattice spacing

output_parameters

Options#

options holds the options of the subcommand exactly as on the command line. A value of true is a flag, and a list repeats the option:

options = orm.Dict({"-j2": 1.0, "-j3": "mo"})  # trexio convert-to
options = orm.Dict({"-k": "pgto+pw", "-u": ["Li=Li.upf", "H=H.upf"]})  # qe
options = orm.Dict({"-w": 100, "-b": 10})  # compute-energy

The plugin chooses nothing here: Jastrow parameters, projection kinds, warmup and binning are the caller’s decisions. It sets only the output file (-o) of the conversions and to-xyz. With -s/--save-graph (analyze-output, extrapolate-energy) the graph is stored as output_graph, in the format of the given suffix. Options that open a window (-g/--plot-graph, -p/--plot_graph of analyze-output) are rejected.

vmc analyze-output tabulates what the VMC calculations already report in output_parameters["steps"]; use it for its graph.

Orbital tiling#

qe and trexio convert-to have first-class inputs for jQMC orbital tiling:

builder.tiling = orm.List([2, 1, 1])
builder.supertwist = orm.List([0.22, 0.13, 0.09])  # one sector
# or, instead of supertwist:
builder.twist_average = orm.Bool(True)  # weighted ensemble

tiling contains either three diagonal integers or nine row-major integers. It must be non-singular. supertwist contains three finite fractional supercell coordinates, requires tiling, and is mutually exclusive with twist_average. AiiDA serializes each matrix or vector as one argv element, for example --tiling, "2 1 1 1 1 1 3 2 1"; quote characters are not part of the value.

The converter checks the source k-point cosets. A nontrivial Gamma supercell still needs the complete primitive k-point coset. AiiDA neither fills missing points nor substitutes Gamma for an invalid sector. Converter errors are reported in the CalcJob exit message.

The six source/sector routes use the same ports:

source

Gamma supercell

one general supertwist

weighted ensemble

QE

tiling=[2,1,1], supertwist=[0,0,0]

tiling=[2,1,1], supertwist=[0.22,0.13,0.09]

tiling=[2,1,1], twist_average=True

PySCF/TREXIO

same

same

same

For QE, options selects --kind from pw, bspline, pgto and pgto+pw. For TREXIO, the converter preserves the Cartesian or spherical GTO form; --ao-conv-to is rejected for tiled input. pgto+bspline and tiled -j3 mo are unsupported and fail explicitly. Without these three inputs, the conversion is untiled. --tiling, --supertwist and --twist-average are given only through these inputs; in options they are rejected.

The tiled conversions through AiiDA are validated against the direct jqmc-tool conversion of the same source by tests/test_tiling.py.

Tiling ends at conversion. Do not add tiling or supertwist to the QMC TOML: JqmcCalculation receives the converted HDF5 as its hamiltonian input, as usual.

Files#

input_file

Copied into the working directory under its own file name, which is passed as the argument.

input_files (vmc average-wf)

Each file is copied as <key>/<file name> and passed in key order; the original file names are kept because jqmc-tool records them as the sources of the average. Pass the steps of one optimization, e.g. the output_hamiltonians of a VMC JqmcCalculation run with all_hamiltonians; jqmc-tool refuses files that are not steps of one optimization.

parent_folders (post-processing)

The remote_folder of a JqmcCalculation. Its checkpoint restart.h5 is linked as <key>/restart.h5 and passed as the argument, in key order; for a twist-averaged parent, its checkpoint directory restart_twists is linked instead. For extrapolate-energy, use one key per lattice spacing, e.g. {"a020": ..., "a030": ...}.

parent_folders and save_path (qe)

The folder, e.g. the remote_folder of an aiida-quantumespresso PwCalculation, is linked whole as <key>. save_path is the path of prefix.save, or of the directory holding exactly one *.save, inside it: out for aiida-quantumespresso.

input_folder (qe)

Instead of parent_folders: a Quantum ESPRESSO output directory stored in AiiDA (a FolderData), copied into the working directory as input_folder. save_path points inside it as above. The other subcommands reject it.

The tool runs on the computer of the parent folders (a parent_folders entry must be on the computer of code), without MPI by default (withmpi = False, one process).

from aiida import orm
from aiida.engine import submit
from aiida.plugins import CalculationFactory

JqmcToolCalculation = CalculationFactory("jqmc.tool")

pw = orm.load_node(PW_PK)  # a finished PwCalculation
builder = JqmcToolCalculation.get_builder()
builder.code = orm.load_code("jqmc-tool@<computer>")
builder.command = orm.Str("qe")
builder.parent_folders = {"pw": pw.outputs.remote_folder}
builder.save_path = orm.Str("out")
builder.options = orm.Dict({"-k": "pgto+pw", "-j2": 1.0})
builder.metadata.options = {"queue_name": "<queue>", "account": "<account>", "max_wallclock_seconds": 600}
node = submit(builder)
# node.outputs.output_hamiltonian -> the `hamiltonian` of a JqmcCalculation

Outputs and exit codes#

output_hamiltonian (conversions) is the hamiltonian_data.h5 written. For a tiled conversion, physical_structure is the supercell structure read back from that HDF5 with jQMC’s loader. conversion_metadata records the actual tiling matrix, representation and primitive block types, selected supertwists, raw and normalized sector weights, electron counts, J3 basis, jQMC build, source node UUID and Code UUID. These are output nodes of the conversion CalcJob, while AiiDA’s normal input links retain the primitive source. The primitive input structure is never presented as the structure of the QMC result.

output_parameters (post-processing) is what jqmc.output_parser extracts from the stdout: parse_tool_energy, parse_tool_force or parse_lrdmc_extrapolation, plus exception when jqmc-tool reported one.

status

label

meaning

301

ERROR_OUTPUT_STDOUT_MISSING

the stdout was not retrieved

303

ERROR_TOOL_FAILED

jqmc-tool reported an error or raised an exception

305

ERROR_NOT_STARTED

jqmc-tool wrote nothing

312

ERROR_OUTPUT_MISSING

jqmc-tool ended without its result (no Hamiltonian, energy, forces or extrapolation)

313

ERROR_TILING_CONVERSION_FAILED

jQMC rejected a tiled source, coset or option combination; the converter message is retained

314

ERROR_TILING_OUTPUT_INVALID

jQMC could not deserialize the tiled Hamiltonian that the converter wrote; it is not stored as output_hamiltonian

As for JqmcCalculation, a verdict set by the scheduler (e.g. the wall time) is kept.

Specification#

calcjobaiida_jqmc.calculations.tool.JqmcToolCalculation

Run one ``jqmc-tool`` subcommand: a conversion or the post-processing of checkpoints. ``command`` selects the subcommand (see ``SUBCOMMANDS``) and ``options`` holds its options verbatim. The plugin only wires the files: * conversions (``trexio convert-to``, ``hamiltonian conv-wf``) read ``input_file`` and produce ``output_hamiltonian``; * ``qe`` reads a Quantum ESPRESSO output directory: the one entry of ``parent_folders`` (e.g. the ``remote_folder`` of a PwCalculation) is linked whole (or ``input_folder``, a FolderData, is copied), and ``save_path`` points inside it at ``prefix.save`` or its parent (``out`` for aiida-quantumespresso); it produces ``output_hamiltonian``; * post-processing (``compute-energy``, ``compute-force``, ``extrapolate-energy``) reads the checkpoint ``restart.h5`` of each ``parent_folders`` entry (a JqmcCalculation ``remote_folder``) and reports the parsed stdout in ``output_parameters``.

Inputs:

  • code, (AbstractCode, NoneType), optional – The Code to use for this job. This input is required, unless the remote_folder input is specified, which means an existing job is being imported and no code will actually be run.
  • command, Str, required – The jqmc-tool subcommand, one of [‘hamiltonian conv-wf’, ‘hamiltonian show-info’, ‘hamiltonian to-xyz’, ‘lrdmc compute-energy’, ‘lrdmc compute-force’, ‘lrdmc extrapolate-energy’, ‘mcmc compute-energy’, ‘mcmc compute-force’, ‘qe’, ‘trexio convert-to’, ‘trexio show-info’, ‘vmc analyze-output’, ‘vmc average-wf’].
  • input_file, (SinglefileData, NoneType), optional – File read by a conversion.
  • input_files, Namespace – vmc average-wf: the Hamiltonian files of the optimization steps, passed in key order.
  • input_folder, (FolderData, NoneType), optional – qe only, instead of parent_folders: a Quantum ESPRESSO output directory stored in AiiDA.
  • metadata, Namespace
    • call_link_label, str, optional, is_metadata – The label to use for the CALL link if the process is called by another process.
    • computer, (Computer, NoneType), optional, is_metadata – When using a “local” code, set the computer on which the calculation should be run.
    • description, (str, NoneType), optional, is_metadata – Description to set on the process node.
    • disable_cache, (bool, NoneType), optional, is_metadata – Do not consider the cache for this process, ignoring all other caching configuration rules.
    • dry_run, bool, optional, is_metadata – When set to True will prepare the calculation job for submission but not actually launch it.
    • label, (str, NoneType), optional, is_metadata – Label to set on the process node.
    • options, Namespace
      • account, (str, NoneType), optional, is_metadata – Set the account to use in for the queue on the remote computer
      • additional_retrieve_list, (list, tuple, NoneType), optional, is_metadata – List of relative file paths that should be retrieved in addition to what the plugin specifies.
      • append_text, str, optional, is_metadata – Set the calculation-specific append text, which is going to be appended in the scheduler-job script, just after the code execution
      • custom_scheduler_commands, str, optional, is_metadata – Set a (possibly multiline) string with the commands that the user wants to manually set for the scheduler. The difference of this option with respect to the prepend_text is the position in the scheduler submission file where such text is inserted: with this option, the string is inserted before any non-scheduler command
      • environment_variables, dict, optional, is_metadata – Set a dictionary of custom environment variables for this calculation
      • environment_variables_double_quotes, bool, optional, is_metadata – If set to True, use double quotes instead of single quotes to escape the environment variables specified in environment_variables.
      • import_sys_environment, bool, optional, is_metadata – If set to true, the submission script will load the system environment variables
      • input_filename, (str, NoneType), optional, is_metadata – Filename to which the input for the code that is to be run is written.
      • max_memory_kb, (int, NoneType), optional, is_metadata – Set the maximum memory (in KiloBytes) to be asked to the scheduler
      • max_wallclock_seconds, (int, NoneType), optional, is_metadata – Set the wallclock in seconds asked to the scheduler
      • mpirun_extra_params, (list, tuple), optional, is_metadata – Set the extra params to pass to the mpirun (or equivalent) command after the one provided in computer.mpirun_command. Example: mpirun -np 8 extra_params[0] extra_params[1] … exec.x
      • output_filename, (str, NoneType), optional, is_metadata – Filename to which the content of stdout of the code that is to be run is written.
      • parser_name, (str, NoneType), optional, is_metadata – Set a string for the output parser. Can be None if no output plugin is available or needed
      • prepend_text, str, optional, is_metadata – Set the calculation-specific prepend text, which is going to be prepended in the scheduler-job script, just before the code execution
      • priority, (str, NoneType), optional, is_metadata – Set the priority of the job to be queued
      • qos, (str, NoneType), optional, is_metadata – Set the quality of service to use in for the queue on the remote computer
      • queue_name, (str, NoneType), optional, is_metadata – Set the name of the queue on the remote computer
      • rerunnable, (bool, NoneType), optional, is_metadata – Determines if the calculation can be requeued / rerun.
      • resources, dict, required, is_metadata – Set the dictionary of resources to be used by the scheduler plugin, like the number of nodes, cpus etc. This dictionary is scheduler-plugin dependent. Look at the documentation of the scheduler for more details.
      • scheduler_stderr, str, optional, is_metadata – Filename to which the content of stderr of the scheduler is written.
      • scheduler_stdout, str, optional, is_metadata – Filename to which the content of stdout of the scheduler is written.
      • stash, Namespace – Optional directives to stash files after the calculation job has completed.
        • dereference, (bool, NoneType), optional, is_metadata – Whether to follow symlinks while stashing or not, specific to StashMode.COMPRESS_* enums
        • fail_on_missing, (bool, NoneType), optional, is_metadata – If True, all files must be specified explicitly (no patterns) and all must exist, otherwise it results in calcjob failure. If False (default), patterns are allowed and missing files are skipped. Only affects copy and compress modes.
        • source_list, (tuple, list, NoneType), optional, is_metadata – Sequence of relative filepaths representing files in the remote directory that should be stashed.
        • stash_mode, (str, NoneType), optional, is_metadata – Mode with which to perform the stashing, should be value of aiida.common.datastructures.StashMode.
        • target_base, (str, NoneType), optional, is_metadata – The base location to where the files should be stashd. For example, for the copy stash mode, this should be an absolute filepath on the remote computer.
      • submit_script_filename, str, optional, is_metadata – Filename to which the job submission script is written.
      • unstash, Namespace – Optional directives to unstash files after upload.
        • source_list, (tuple, list, NoneType), optional, is_metadata – Sequence of relative filepaths representing files in the remote directory that should be unstashed.
        • unstash_target_mode, (str, NoneType), optional, is_metadata – Mode with which to perform the unstashing, should be value of aiida.common.datastructures.UnstashTargetMode.
      • withmpi, (bool, NoneType), optional, is_metadata – Set the calculation to use mpi
    • store_provenance, bool, optional, is_metadata – If set to False provenance will not be stored in the database.
  • monitors, Namespace – Add monitoring functions that can inspect output files while the job is running and decide to prematurely terminate the job.
  • options, (Dict, NoneType), optional – Options as on the command line, e.g. {‘-j2’: 1.0, ‘-j3’: ‘mo’}; true for a flag.
  • parent_folders, Namespace – Remote folders: of JqmcCalculations whose checkpoints are post-processed, or (qe) of the Quantum ESPRESSO run.
  • remote_folder, (RemoteData, NoneType), optional – Remote directory containing the results of an already completed calculation job without AiiDA. The inputs should be passed to the CalcJob as normal but instead of launching the actual job, the engine will recreate the input files and then proceed straight to the retrieve step where the files of this RemoteData will be retrieved as if it had been actually launched through AiiDA. If a parser is defined in the inputs, the results are parsed and attached as output nodes as usual.
  • save_path, (Str, NoneType), optional – qe only: path of prefix.save, or of its parent, inside the parent folder (default: the folder).
  • supertwist, (List, NoneType), optional – Tiled conversion only: three finite fractional coordinates selecting one physical-supercell sector.
  • tiling, (List, NoneType), optional – Conversion only: three diagonal integers or nine row-major integers for the non-singular tiling matrix.
  • twist_average, (Bool, NoneType), optional – Conversion only: retain every complete sector and its converter-defined weight.

Outputs:

  • conversion_metadata, Dict, optional – Tiled conversions: matrix, actual sectors and weights, physical counts and converter build information.
  • output_graph, SinglefileData, optional – The graph saved with -s/–save-graph.
  • output_hamiltonian, SinglefileData, optional – Conversions: the Hamiltonian written.
  • output_parameters, Dict, optional – Results parsed from the stdout.
  • output_structure, SinglefileData, optional – to-xyz: the xyz file.
  • physical_structure, StructureData, optional – Tiled conversions: the physical supercell structure deserialized from the converted Hamiltonian.
  • remote_folder, RemoteData, required – Input files necessary to run the process will be stored in this folder node.
  • remote_stash, RemoteStashData, optional – Contents of the stash.source_list option are stored in this remote folder after job completion.
  • retrieved, FolderData, required – Files that are retrieved by the daemon will be stored in this node. By default the stdout and stderr of the scheduler will be added, but one can add more by specifying them in CalcInfo.retrieve_list.