Skip to content

Commit 8cc6583

Browse files
Merge pull request #19 from kousuke-nakano/update.turboworkflows
add description to turboworkflows class references
2 parents 5ed3047 + d9f5c33 commit 8cc6583

14 files changed

Lines changed: 526 additions & 0 deletions

‎source/_sources/03turboworkflows_manual/reference/workflow_convertfort10.rst‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,31 @@ convertfort10 parameters
3636
"in_fort10", "str", "fort.10_in", "input wavefunction file"
3737
"out_fort10", "str", "fort.10_out", "template wavefunction file"
3838
"grid_size", "float", "0.10", "grid size for xyz (bohr)"
39+
40+
41+
Description
42+
--------------------------------
43+
44+
In the :class:`Convertfort10_workflow` class, the convertfort10 workflow is
45+
executed asynchronously (via :meth:`async_launch`). The workflow runs a single
46+
conversion of a fort.10 file using grid-based interpolation with the
47+
convertfort10.x (or convertfort10-mpi.x) binary from TurboRVB.
48+
49+
If the pkl file already exists and :attr:`convertfort10_rerun` is
50+
:const:`False`, the calculation is skipped. Otherwise, the workflow:
51+
52+
- Builds a :class:`Convertfort10_genius` instance with :attr:`in_fort10`,
53+
:attr:`out_fort10`, and :attr:`grid_size`, and generates ``convertfort10.input``.
54+
- Submits the job, waits for submission and completion using
55+
:func:`asyncio.sleep`, then fetches output files (e.g. ``out_mol``,
56+
``fort.10_new``).
57+
- Persists state in a pkl file under the ``pkl`` directory.
58+
59+
On success, the method returns (status, list of output file paths under the
60+
root directory, and an empty output-values dict).
61+
62+
See also
63+
--------------------------------
64+
65+
- :class:`turbogenius.convertfort10_genius.Convertfort10_genius` — convertfort10
66+
driver used for input generation.

‎source/_sources/03turboworkflows_manual/reference/workflow_convertfort10mol.rst‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,33 @@ convertfort10mol parameters
3636
"add_random_mo", "bool", "True", "flag to add random molecular orbitals."
3737
"grid_size", "float", "0.10", "grid size for x,y,z (Bohr)."
3838
"additional_mo", "int", "0", "number of additional molecular orbitals to add."
39+
40+
41+
Description
42+
--------------------------------
43+
44+
In the :class:`Convertfort10mol_workflow` class, the convertfort10mol workflow is executed
45+
asynchronously (via :meth:`async_launch`). The workflow runs a single
46+
conversion of a fort.10 file to molecular format using the convertfort10mol.x
47+
binary, with optional random molecular orbital addition.
48+
49+
If the pkl file already exists and :attr:`convertfort10mol_rerun` is
50+
:const:`False`, the calculation is skipped. Otherwise, the workflow:
51+
52+
- Builds a :class:`Convertfort10mol_genius` instance with
53+
:attr:`add_random_mo`, :attr:`grid_size`, and :attr:`additional_mo`, and
54+
generates ``convertfort10mol.input``.
55+
- Submits the job (convertfort10mol.x or convertfort10mol-mpi.x), waits for
56+
submission and completion using :func:`asyncio.sleep`, then fetches output
57+
files (e.g. ``out_mol``, ``fort.10_new``).
58+
- Persists state in a pkl file under the ``pkl`` directory.
59+
60+
On success, the method returns (status, list of output file paths under the
61+
root directory, and an empty output-values dict).
62+
63+
64+
See also
65+
--------------------------------
66+
67+
- :class:`turbogenius.convertfort10mol_genius.Convertfort10mol_genius` —
68+
convertfort10mol driver used for input generation.

‎source/_sources/03turboworkflows_manual/reference/workflow_convertwf.rst‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,33 @@ conversion parameters
2929
"clean_flag", "bool ", "True", "clean temporary files."
3030
"only_generate_template", "bool ", "False", "only generate template without full conversion."
3131
"change_contr", "bool ", "True", "enable to change contraction coefficients."
32+
33+
34+
Description
35+
--------------------------------
36+
37+
In the :class:`Conversion_wf_workflow` class,
38+
the wavefunction conversion workflow is executed asynchronously (via
39+
:meth:`async_launch`). The workflow converts wavefunctions between formats
40+
(sd, agps, agpu, pf) using :meth:`Wavefunction.to_agp` for AGP singlet/triplet
41+
(no job submission; runs locally).
42+
43+
If the pkl file already exists and :attr:`conversion_wf_rerun` is
44+
:const:`False`, the conversion is skipped. Otherwise, the workflow:
45+
46+
- Reads ``fort.10`` with :class:`Wavefunction`. Depending on :attr:`to_wf`:
47+
conversion to ``sd`` or ``pf`` raises :exc:`NotImplementedError`; for
48+
``agps`` or ``agpu``, calls :meth:`to_agp` with :attr:`grid_size`,
49+
:attr:`additional_hyb`, :attr:`nosym`, :attr:`clean_flag`,
50+
:attr:`only_generate_template`, and :attr:`change_contr`.
51+
- Persists state in a pkl file under the ``pkl`` directory.
52+
53+
On success, the method returns (status, list of output file paths under the
54+
root directory, and an empty output-values dict).
55+
56+
57+
See also
58+
--------------------------------
59+
60+
- :class:`turbogenius.wavefunction.Wavefunction` — wavefunction I/O and
61+
conversion (e.g. :meth:`to_agp`).

‎source/_sources/03turboworkflows_manual/reference/workflow_init_occ.rst‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,33 @@ initialization parameters
2929
"mo_num_conv", "int ", "-1", "number of molecular orbitals to use for convergence. default is -1 (use all)."
3030
"mo_occ", "list ", "[]", "list of molecular orbital occupation eigenvalues."
3131
"mo_occ_delta", "float ", "0.05", "delta value for initializing occupation numbers."
32+
33+
34+
Description
35+
--------------------------------
36+
37+
In the :class:`Init_occ_workflow` class,
38+
the initial occupation workflow is executed asynchronously (via :meth:`async_launch`).
39+
The workflow initializes molecular orbital occupations in ``fort.10`` for
40+
LRDMC optimization by setting occupation numbers and constraint flags (no job
41+
submission; runs locally).
42+
43+
If the pkl file already exists and :attr:`init_occ_rerun` is :const:`False`,
44+
the operation is skipped. Otherwise, the workflow:
45+
46+
- Reads ``fort.10`` with :class:`turbogenius.pyturbo.io_fort10.IO_fort10`,
47+
selects MO indices from :attr:`mo_occ_thr` or :attr:`mo_num_conv`, and
48+
optionally fixes occupied orbitals via :attr:`mo_occ_fixed_list` and
49+
:attr:`mo_occ_fixed_occupied`.
50+
- Updates constraint and coefficient data (with :attr:`mo_occ_delta` for
51+
non-fixed orbitals) and writes the modified fort.10 in place.
52+
- Persists state in a pkl file under the ``pkl`` directory.
53+
54+
On success, the method returns (status, list of output file paths under the
55+
root directory, and an empty output-values dict).
56+
57+
See also
58+
--------------------------------
59+
60+
- :class:`turbogenius.pyturbo.io_fort10.IO_fort10` — fort.10 I/O used for
61+
occupation and constraint updates.

‎source/_sources/03turboworkflows_manual/reference/workflow_jastrowcopy.rst‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,28 @@ jastrowcopy parameters
2626
"jastrowcopy_fort10_to", "str ", "fort.10", "target fort.10 file to copy Jastrow factors to."
2727
"jastrowcopy_fort10_from", "str ", "fort.10_new", "source fort.10 file to copy Jastrow factors from."
2828
"jastrowcopy_twist_average", "bool ", "False", "if True, perform twist-averaged Jastrow copying."
29+
30+
31+
Description
32+
--------------------------------
33+
34+
In the :class:`Jastrowcopy_workflow` class,
35+
the Jastrow copy workflow is executed asynchronously (via :meth:`async_launch`).
36+
The workflow copies Jastrow factors from one fort.10 file to another (no job
37+
submission; runs locally).
38+
39+
If the pkl file already exists and :attr:`jastrowcopy_rerun` is
40+
:const:`False`, the operation is skipped. Otherwise, the workflow:
41+
42+
- Calls :func:`turbogenius.tools_genius.copy_jastrow` with
43+
:attr:`jastrowcopy_fort10_to`, :attr:`jastrowcopy_fort10_from`, and
44+
:attr:`jastrowcopy_twist_average` to copy Jastrow factors in place.
45+
- Persists state in a pkl file under the ``pkl`` directory.
46+
47+
On success, the method returns (status, list of output file paths under the
48+
root directory, and an empty output-values dict).
49+
50+
See also
51+
--------------------------------
52+
53+
- :func:`turbogenius.tools_genius.copy_jastrow` — Jastrow copy routine.

‎source/_sources/03turboworkflows_manual/reference/workflow_lrdmc.rst‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,54 @@ lrdmc parameters
5050
"lrdmc_force_calc_flag", "bool", "False", "if True, compute energy and force, if False, compute only energy"
5151
"lrdmc_pw_regularization", "float", "0.0", "if it is > 0.0, the Pathak-Wager regularization is turned on."
5252
"lrdmc_maxtime", "int", "172000", "maximum time (sec.)"
53+
54+
55+
Description
56+
--------------------------------
57+
58+
In the :class:`LRDMC_workflow` class, the LRDMC (Lattice Regularized
59+
Diffusion Monte Carlo) workflow is executed asynchronously (via
60+
:meth:`async_launch`). The workflow runs LRDMC in a continuation loop (up to
61+
:attr:`lrdmc_max_continuation` runs). For each continuation index
62+
:math:`i_{\mathrm{cont}}`:
63+
64+
**test run (icont = 0)**
65+
66+
- Uses fixed trial steps (:attr:`lrdmc_trial_steps`) to produce energy and
67+
error-bar data. Optionally enforces a minimum trial length when
68+
:attr:`lrdmc_safe_trial_steps` is :const:`True` (40 blocks plus warmup).
69+
- No step estimation is performed.
70+
- Results are used by the next run to estimate required LRDMC steps.
71+
72+
**production run (icont ≥ 1)**
73+
74+
- Loads the previous run's results from the corresponding pkl file and reads
75+
the number of MCMC steps from ``fort.12`` (with twist-averaging adjustment
76+
when :attr:`lrdmc_twist_average` is enabled).
77+
- If the current error bar is below 1.1 × :attr:`lrdmc_target_error_bar`, the
78+
workflow exits early and returns the current energy and error (target
79+
achieved).
80+
- Otherwise, estimates the total steps required to reach
81+
:attr:`lrdmc_target_error_bar` via
82+
:math:`N_{\mathrm{total}} \propto (\sigma / E_{\mathrm{target}})^2`, then
83+
sets the *additional* steps for this run to
84+
:math:`\max(N_{\mathrm{total}} - N_{\mathrm{done}}, 1)`.
85+
- Estimates runtime and builds a :class:`LRDMC_genius` instance with the
86+
(additional) ``lrdmcsteps``, generates input, and submits the job.
87+
88+
For each run, the workflow waits for job submission and completion (using
89+
:func:`asyncio.sleep`), fetches output files (e.g. ``fort.11``, ``fort.12``,
90+
``out_fn_*``, ``parminimized.d``), computes energy and forces with the
91+
configured bin block and warmup blocks, stores results, and persists state
92+
in pkl files under the ``pkl`` directory.
93+
94+
If all continuation pkl files already exist and :attr:`lrdmc_rerun` is
95+
:const:`False`, the calculation is skipped. On success, the method returns
96+
(status, list of output file paths, and an output-values dict containing
97+
``"energy"`` and ``"error"``).
98+
99+
See also
100+
--------------------------------
101+
102+
- :class:`turbogenius.lrdmc_genius.LRDMC_genius` — LRDMC driver used for
103+
input generation and result handling.

‎source/_sources/03turboworkflows_manual/reference/workflow_lrdmc_ext.rst‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,37 @@ LRDMC extrapolation parameters
5151
"lrdmc_pw_regularization", "float ", "0.0", "if it is > 0.0, the Pathak-Wager regularization is turned on."
5252
"lrdmc_maxtime", "int ", "172000", "maximum time (sec.)"
5353
"degree_poly", "int ", "2", "degree of polynomial for extrapolation."
54+
55+
56+
Description
57+
--------------------------------
58+
59+
In the :class:`LRDMC_ext_workflow` class, the LRDMC extrapolation workflow
60+
is executed asynchronously (via :meth:`async_launch`). The workflow runs LRDMC
61+
at multiple time step (alat) values and extrapolates the energy to the
62+
:math:`a \to 0` limit using polynomial fitting.
63+
64+
The workflow:
65+
66+
- For each value in :attr:`lrdmc_alat_list`, creates a subdirectory
67+
``alat_{value}``, copies :attr:`lrdmc_input_files` (e.g. ``fort.10``,
68+
``pseudo.dat``) into it, and launches an :class:`LRDMC_workflow` instance
69+
with that alat. All alat runs are launched concurrently with
70+
:func:`asyncio.gather`.
71+
- After all runs complete, collects energies and errors from each alat
72+
directory, writes ``evsa.in`` and ``evsa.gnu``, and runs ``funvsa.x`` to
73+
fit energy vs. :math:`a^2` with a polynomial of degree :attr:`degree_poly`.
74+
- Reads the extrapolated energy and error (constant term) from ``evsa.out``,
75+
stores them in ``output_values["energy"]`` and ``output_values["error"]``,
76+
and generates a plot ``Energy_vs_alat.png``.
77+
78+
No pkl-based skip logic is applied at the top level; each inner
79+
:class:`LRDMC_workflow` uses its own continuation and pkl state. On success,
80+
the method returns (status, list of output file paths under the root
81+
directory, and an output-values dict containing the extrapolated
82+
``"energy"`` and ``"error"``).
83+
84+
See also
85+
--------------------------------
86+
87+
- :class:`LRDMC_workflow` — inner workflow used for each alat value.

‎source/_sources/03turboworkflows_manual/reference/workflow_lrdmcopt.rst‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,49 @@ LRDMCopt parameters
6161
"lrdmcopt_twist_average", "bool ", "False", "flag for twist average"
6262
"lrdmcopt_kpoints", "list ", "[]", "Monkhorst-Pack k-grids, [kx,ky,kz,nx,ny,nz], kx,ky,kz for grids, nx,ny,nz for shift=0, noshift=1."
6363
"lrdmcopt_maxtime", "int ", "172000", "maximum time (sec.)"
64+
65+
66+
Description
67+
--------------------------------
68+
69+
In the :class:`LRDMCopt_workflow` class, the LRDMC optimization workflow is
70+
executed asynchronously (via :meth:`async_launch`). The workflow runs LRDMC
71+
optimization in a continuation loop (up to
72+
:attr:`lrdmcopt_max_continuation` runs). For each continuation index
73+
:math:`i_{\mathrm{cont}}`:
74+
75+
**test run (icont = 0)**
76+
77+
- Uses fixed trial parameters (:attr:`lrdmcopt_trial_optsteps`,
78+
:attr:`lrdmcopt_trial_steps`) to produce energy and error-bar data.
79+
- No step estimation is performed.
80+
- Results are used by the next run to estimate required LRDMC steps.
81+
82+
**production run (icont ≥ 1)**
83+
84+
- Loads the previous run's results from the corresponding pkl file.
85+
- Estimates the LRDMC steps required to reach
86+
:attr:`lrdmcopt_target_error_bar` via
87+
:math:`N_{\mathrm{steps}} \propto (\sigma / E_{\mathrm{target}})^2`.
88+
- Applies a minimum-step floor using :attr:`lrdmcopt_minimum_blocks` and
89+
:attr:`lrdmcopt_warmupblocks`.
90+
- Estimates total runtime and builds a :class:`LRDMCopt_genius` instance with
91+
the estimated ``steps`` and fixed :attr:`lrdmcopt_production_optsteps`,
92+
then generates input and submits the job.
93+
94+
For each run, the workflow waits for job submission and completion (using
95+
:func:`asyncio.sleep`), fetches output files (e.g. ``fort.10``, ``fort.11``,
96+
``fort.12``, ``out_fn_opt_*``, ``parminimized.d``), stores and plots results,
97+
and for :math:`i_{\mathrm{cont}} > 0` computes parameter averages discarding
98+
an initial fraction (:attr:`lrdmcopt_optwarmupsteps_ratio`). State is
99+
persisted in pkl files under the ``pkl`` directory.
100+
101+
If all continuation pkl files already exist and :attr:`lrdmcopt_rerun` is
102+
:const:`False`, the calculation is skipped. On success, the method returns
103+
(status, list of output file paths, and an empty output-values dict).
104+
105+
See also
106+
--------------------------------
107+
108+
- :class:`turbogenius.lrdmc_opt_genius.LRDMCopt_genius` — LRDMC optimization
109+
driver used for input generation and result handling.

‎source/_sources/03turboworkflows_manual/reference/workflow_makefort10.rst‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,30 @@ makefort10 parameters
4242
"same_phase_up_dn", "bool ", "False", "forced phase_up == phase_dn. valid only for gamma point. it is automatically detected for other points."
4343
"neldiff", "int ", "0", "difference in number of up and down electrons."
4444
"symmetry", "bool ", "True", "if false, nosym=.true., meaning that no symmetry is used."
45+
46+
47+
Description
48+
--------------------------------
49+
50+
In the :class:`Makefort10_workflow` class,
51+
the makefort10 workflow is executed asynchronously (via :meth:`async_launch`).
52+
The workflow generates a fort.10 wavefunction file from a structure file
53+
using the makefort10.x binary with specified basis sets and Jastrow factors
54+
(no job submission; runs locally via :meth:`Makefort10_genius.run_all`).
55+
56+
If the pkl file already exists and :attr:`makefort10_rerun` is :const:`False`,
57+
the calculation is skipped. Otherwise, the workflow:
58+
59+
- Builds a :class:`Makefort10_genius` instance from the constructor parameters
60+
(structure file, supercell, basis sets, Jastrow type, phase, etc.) and calls
61+
:meth:`run_all` to generate fort.10 and related files.
62+
- Persists state in a pkl file under the ``pkl`` directory.
63+
64+
On success, the method returns (status, list of output file paths under the
65+
root directory, and an empty output-values dict).
66+
67+
See also
68+
--------------------------------
69+
70+
- :class:`turbogenius.makefort10_genius.Makefort10_genius` — makefort10
71+
driver used for generation.

‎source/_sources/03turboworkflows_manual/reference/workflow_prep.rst‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,33 @@ DFT parameters
4747
"dft_independent_kpoints", "bool ", "False", "flag for independent k-point calculation"
4848
"dft_thr_lindep", "float ", "1.0e-13", "inverse of the condition number of basis sets. prep cuts the redundancy."
4949
"dft_kpoints", "list ", "[1, 1, 1, 0, 0, 0]", "Monkhorst-Pack k-grids, [kx,ky,kz,nx,ny,nz], kx,ky,kz for grids, nx,ny,nz for shift=0, noshift=1."
50+
51+
52+
Description
53+
--------------------------------
54+
55+
In the :class:`DFT_workflow` class, the DFT (prep) workflow is executed
56+
asynchronously (via :meth:`async_launch`). The workflow runs a single DFT
57+
calculation using the prep.x binary from TurboRVB, with support for
58+
twist-averaged boundary conditions and k-point sampling.
59+
60+
If the pkl file already exists and :attr:`dft_rerun` is :const:`False`, the
61+
calculation is skipped. Otherwise, the workflow:
62+
63+
- Builds a :class:`DFT_genius` instance from the constructor parameters (grid
64+
size, box, smearing, XC, twist averaging, etc.) and generates ``prep.input``.
65+
- Submits the job (prep-mpi.x or prep-serial.x), waits for submission and
66+
completion using :func:`asyncio.sleep`, then fetches output files (e.g.
67+
``out_prep``, ``occupationlevels.dat``, ``EDFT_vsk.dat``, and optionally
68+
``fort.10_new`` or twist-averaging scratch files).
69+
- Persists state in a pkl file under the ``pkl`` directory.
70+
71+
On success, the method returns (status, list of output file paths under the
72+
root directory, and an output-values dict with ``"energy"`` and ``"error"``
73+
set to :const:`None`).
74+
75+
See also
76+
--------------------------------
77+
78+
- :class:`turbogenius.prep_genius.DFT_genius` — DFT/prep driver used for
79+
input generation.

0 commit comments

Comments
 (0)