Create function#
Create and analyze model#
Create command for model and analyze
- analyze_model(controls, topdir=None, verbose=False)[source]#
Analyze model.
- Parameters:
controls (str or [str] or dict or [dict]) – control file(s) or dict(s).
topdir (str, optional) – top directory.
verbose (bool, optional) – verbose ?
- Returns:
(bool) – if no error occurs, return False.
Note
if topdir is None, current directory is used, which should contain model directory.
- convert_model(model, controls=None, parameter=None, topdir=None, pdf=None, qtdraw=None, verbose=False)[source]#
Convert a model (.pkl) of MultiPie Ver.2, or of Ver.3 before 3.2.0, into the current version, and the weights z_j of its control files.
- Parameters:
model (str) – model name, i.e., “topdir/model/model.pkl”.
controls (str or [str], optional) – control file(s) of mp_analyze whose SAMB weights are converted.
parameter (dict, optional) – weights of the SAMB of the old model to convert, dict[zj, float or str], e.g., a fit.
topdir (str, optional) – top directory. [default: cwd]
pdf (bool, optional) – create PDF ? [default: as in the old model]
qtdraw (bool, optional) – create QtDraw file ? [default: as in the old model]
verbose (bool, optional) – verbose ?
- Returns:
(dict) – report of the conversion.
Note
Ver.2: the model is created again with the current version from the input rebuilt from the model of Ver.2, which is written as “topdir/model_in.py”. The model of Ver.2 is kept as “topdir/model/model_v2.pkl”. The f orbitals are renamed (f3x, f3y, f2, f1 -> fx, fy, fc, fs), and max_neighbor and search_cell_range are dropped. The neighbors are chosen by the distances of the bonds of Ver.2 (Ver.2 may have missed a part of the neighbor shells). The conversion is refused if the kets differ or the SAMB of Ver.2 are not in the space of those of Ver.3. The weights z_j of Ver.3 are the projections of H = sum_j z_j Z_j of Ver.2 onto the SAMB of Ver.3, z_j(Ver.3) = Tr[Z_j(Ver.3) H]. A converted control file is written as “control_v3.py”.
Ver.3 before 3.2.0: the SAMB are the same, but numbered in another order. The model is created again from “topdir/model_in.py” if it exists, or else from the input rebuilt from the old model (written as “topdir/model_in.py”). The old model is kept as “topdir/model/model_v3.1.pkl” (its version). The SAMB are matched one to one (the conversion is refused otherwise), and the SAMB in “samb/parameter”, “output/callback_info”, “output/dispersion/z” and “output/z_expectation” are renumbered. A converted control file is written as “control_v3.2.py” (the current version).
the weights given by parameter are converted into report[“parameter”], dict[zj, float].
for a model already converted (model.pkl of the current version, and model_v2.pkl or model_v3.x.pkl), only the weights are converted.
- create_model(models, topdir=None, verbose=False)[source]#
Create model.
- Parameters:
models (str or [str] or dict or [dict]) – model file name(s) or dict(s).
topdir (str, optional) – top directory.
verbose (bool, optional) – verbose ?
- Returns:
(bool) – if no error occurs, return False.
Note
model name directory is created to store results in top directory.
if topdir is None, current directory is used.