htesp.convergence_test¶
Module to submit convergence tests. Runs with ‘mainprogram convtest’
Functions
|
Collect the total energies of a finished convergence test. |
|
Return the lines of |
|
Insert k-points into the SCF input file. |
|
Function to write kpoint. |
|
Entry point for |
|
Execute convergence test calculations for kinetic energy cutoff. |
|
Execute convergence test calculations for kinetic energy cutoff. |
|
Strip the cutoffs/pseudo_dir from an scf input and force |
|
|
|
Return the lines of |
|
Run |
|
Submit a jobscript for computation based on parameters. |
|
Write |
- htesp.convergence_test.pushd(path)[source]¶
cd pathfor the body, always coming back.FIX(22): every
os.chdir(...) ... os.chdir("../../")chain in this module left the process in the wrong directory when anything in between raised, so the next material was set up inside the previous one’s run directory.
- htesp.convergence_test.read_lines(path)[source]¶
Return the lines of
pathwithout their trailing newline.
- htesp.convergence_test.write_lines(path, lines)[source]¶
Write
lines(no trailing newlines needed) topath.
- htesp.convergence_test.run(command, cwd=None, check=True)[source]¶
Run
command(a list) without a shell, reporting a failure.
- htesp.convergence_test.kpoint_vasp(kpoint, kconv=False)[source]¶
Function to write kpoint.
Parameters:
kpoint (list): List containing the k-point coordinates.
kconv (bool): True writes into R<kx>-<ky>-<kz>/KPOINTS, False rewrites KPOINTS in the current directory.
Returns:
None
Example:
To write kpoints for a convergence calculation: >>> kpoint_vasp([2, 2, 2], kconv=True)
To write kpoints for a regular calculation: >>> kpoint_vasp([4, 4, 4])
- htesp.convergence_test.submission(param, jobscript, A, B, jj, cwd=None)[source]¶
Submit a jobscript for computation based on parameters.
Parameters:
param (str): Parameter type, ‘ecut’ or ‘kpoint’.
jobscript (str): Name of the jobscript to be submitted.
A (str): Materials Id.
B (str): Name for the compound.
jj (str or tuple): The value of the parameter. If param is ‘ecut’, it’s a string; if param is ‘kpoint’, it’s a list (e.g., (kx, ky, kz)).
cwd (str, optional): directory holding the jobscript. Defaults to the current one, which is what the callers used to arrange with os.chdir.
Returns:
None
Example:
To submit a jobscript named ‘myjob.sh’ for computation with parameter type ‘ecut’, Materials Id ‘mp-123’, compound name ‘Si’, and parameter value ‘500’: >>> submission(‘ecut’, ‘myjob.sh’, ‘mp-123’, ‘Si’, ‘500’)
- htesp.convergence_test.incar_base(path, drop=('ISIF', 'NSW', 'ENCUT', 'ENAUG'), add=(('NSW', 0),))[source]¶
Return the lines of
pathwithoutdrop, plus theaddpairs.The key is matched at the start of the line so that dropping ENCUT does not also drop ENCUTGW, which
sed '/ENCUT/d'did.
- htesp.convergence_test.main_vasp(file_name, parameter, start, end)[source]¶
Execute convergence test calculations for kinetic energy cutoff.
Parameters: - file_name (str): File holding materials id and name information. - parameter (str): Parameter to control the type of calculation. - start (int) : Starting index - end (int) : Ending index (not included)
Returns: - None
This function iterates through the specified range of indices and performs convergence test calculations. It modifies input files, creates directories, and submits jobs based on the provided parameter.
Example: To perform a convergence test for kinetic energy cutoff (‘ecut’) from index 1 to 10: >>> main_vasp(“mpid.in”, “ecut”, 1, 10)
- htesp.convergence_test.kpoint_qe(kpoint, mpid)[source]¶
Insert k-points into the SCF input file.
Parameters: - kpoint (list): List containing the k-point coordinates. - mpid (str): The ID of the compound.
Returns: - str: the path of the file written (‘scf_dir/temp.in’).
Example: >>> kpoint_qe([0.5, 0.5, 0.5], “mp-12345”)
- htesp.convergence_test.prepare_qe_template(source, dest)[source]¶
Strip the cutoffs/pseudo_dir from an scf input and force
calculation='scf'.Replaces the five chained
sedinvocations that wrote and deleted four intermediate files.
- htesp.convergence_test.main_qe(file_name, parameter, start, end)[source]¶
Execute convergence test calculations for kinetic energy cutoff.
Parameters:
file_name (str): File holding materials id and name information.
parameter (str): Parameter to control the type of calculation.
start (int) : Starting index
end (int) : Ending index (not included)
Returns:
list: the temporary files this run created, so the caller can remove exactly those.
This function iterates through the specified range of indices and performs convergence test calculations. It modifies input files, creates directories, and submits jobs based on the provided parameter.
Example:
>>> main_qe("mpid.in", "ecut", 1, 5)
- htesp.convergence_test.extract(file_name, parameter, start, end, calc)[source]¶
Collect the total energies of a finished convergence test.
Parameters: - file_name (str): File holding materials id and name information. - parameter (str): ‘ecut’ or ‘kpoint’. - start, end (int): range of tracking-file entries (end is exclusive). - calc (str): ‘QE’ or ‘VASP’.
Returns: - None
Writes
R<id>-<comp>/<parameter>/param-energy.txtfor each material and copies it intoconvergence_result/.