Parsl Tasks

parsl_tasks.gen_structures.run_gen_structures(config, n_chunks, chunk_id)

Parsl task that generates hypothetical structures from initial crystal structures.

The total search space is partitioned into n_chunks disjoint segments. This task processes the segment identified by chunk_id.

Parameters:
  • config (dict) –

    A ConfigManager (or dict with the same fields). The following keys are read:

    • work_dir (str): root working directory where outputs are written

    • num_workers (int): number of parallel workers for the inner loop

    • elements (str): target system (e.g., “Ce-Co-B”)

    • initial_structures_dir (str): directory containing initial structures

    See ConfigManager for complete field descriptions and defaults.

  • n_chunks (int) – Total number of chunks for the workload.

  • chunk_id (int) – Zero-based index of the partition to execute, where 0 <= chunk_id < n_chunks.

Returns:

Absolute path to this chunk’s id_prop.csv.

Return type:

str

Raises:
  • ValueError – if n_chunks is not positive or chunk_id is out of range

  • Exception – on directory navigation or file I/O failures

parsl_tasks.cgcnn.cmd_cgcnn_prediction(config, n_chunks, id)

Prepare the working environment and build the command to run CGCNN predictions.

The prediction workload is partitioned into n_chunks disjoint segments. This task handles the segment identified by id.

Parameters:
  • config (dict) –

    A ConfigManager (or dict with the same fields). The following keys are read:

    • work_dir (str): root working directory for inputs/outputs

    • batch_size (int): inference batch size

    • num_workers (int): data-loading workers for inference

    See ConfigManager for full field descriptions.

  • n_chunks (int) – Total number of chunks for the workload.

  • id (int) – Zero-based index of the partition to execute, where 0 <= id < n_chunks.

Returns:

Absolute path to this partition’s predictions CSV.

Return type:

str

Raises:
  • ValueError – if n_chunks is not positive or id is out of range

  • Exception – on directory navigation or file I/O failures

parsl_tasks.select_structures.run_select_structures(nomix_dir='nomix/', output_dir='new/', csv_file='test_results.csv', ef_threshold=-0.2, min_total=1000, max_total=4000, num_workers=4, natom_threshold=50, element_fractions='')

Identify and remove duplicate or near-duplicate structures, based on a structural similarity threshold.

Reads candidates from a CSV file, sort data by formation energy (Ef) and eliminates the structures above the ef_threshold. It then deduplicates per composition using pymatgen.analysis.structure_matcher.StructureMatcher, and writes the selected set to output_dir.

Parameters:
  • nomix_dir (str) – Root directory containing input CIFs laid out as {chunk_prefix}/{index}.cif.

  • output_dir (str) – Directory to write outputs (created if missing). Writes id_prop.csv and POSCAR_{i} files for selected structures.

  • csv_file (str) – Path to the input CSV with three columns: index, _ , Ef — where index matches CIF filenames and Ef is a float (formation energy or score used for ranking).

  • ef_threshold (float) – Maximum allowed Ef for initial filtering.

  • min_total (int) – Desired minimum number of selected structures. A warning is printed if the final count is smaller.

  • max_total (int) – Hard cap on the number of selected structures.

  • num_workers (int) – Number of worker processes (threads) for filtering and selection.

  • natom_threshold (int) – Maximum total atoms (reduced formula) allowed per structure.

  • element_fractions (str) – Comma-separated minimum fraction constraints by element. Structures with any listed element below its fraction are discarded. Empty string disables this filter.

Returns:

None

Return type:

None

parsl_tasks.dft_optimization.cmd_fused_vasp_calc(config, id, walltime=<class 'int'>)

Run a two-stage VASP calculation via a Python Parsl task.

It start by running a relaxation phase trying to find the lowest-energy configuration. If relaxation is successful, it runs the energy calculaction

Parameters:
  • config (dict) – ConfigManager (or dict). Keys used: - vasp_work_dir (str): directory for per-structure work subdirs. - work_dir (str): project root holding inputs (e.g., new/, POTCAR). - vasp_std_exe (str): path to the VASP executable (e.g., vasp_std). - vasp_timeout (int, s): max walltime per VASP invocation. - vasp_nsw (int): number of ionic steps (NSW) for relaxation.

  • id (int) – Structure identifier: maps to POSCAR_{id} and names outputs.

  • walltime (int) – Per-run timeout in seconds (unused; superseded by config[CK.VASP_TIMEOUT]).

Returns:

None

Return type:

None

Raises:
  • VaspNonReached – if relaxation fails to meet criteria.

  • Exception – on file I/O or subprocess failures.

parsl_tasks.hull.cmd_vasp_hull(config, work_subdir)

Using the total energies, computes the formation energies of each structure relative to reference elemental phases.

Parameters:
  • config (dict) – ConfigManager (or dict). Keys used: - vasp_std_exe (str): path to the VASP executable.

  • work_subdir (str) – Working subdirectory where the command should be executed.

Returns:

Shell command string.

Return type:

str

Raises:

Exception – on directory navigation failures.

parsl_tasks.ehull.cmd_calculate_ehul(config)

Select promising structures: Structures with low energy above the hull (Ehull) are identified as promising candidates. These are automatically copied to a dedicated folder for further analysis, such as evaluation of additional physical properties or preparation for experimental validation.

Parameters:

config (dict) – ConfigManager (or dict). Keys used: - elements (str): system spec, e.g. "Ce-Co-B". - vasp_work_dir (str): directory holding per-ID subdirs with CONTCAR_{id}. - energy_dat_out (str): filename (under vasp_work_dir) listing total energies. - post_processing_out_dir (str): directory for outputs. - mp_stable_out (str): output filename (under post_processing_out_dir) with reference stable phases.

Returns:

Absolute path to {post_processing_out_dir}/hull.dat.

Return type:

str

parsl_tasks.convex_hull.plot_convex_hull_ternary(elements_list, stable_dat, full_path_input_csv, threshold, output_file)

Plot the ternary convex hull and metastable points for a 3-element system.

Parameters:
  • elements_list (list[str]) – Three element symbols (e.g., ["Ce", "Co", "B"]).

  • stable_dat (str) – Path to a text file with elemental reference energies.

  • full_path_input_csv (str) – CSV with rows Formula,Total_Energy_per_atom for calculated phases.

  • threshold (float) – Max Ehull (eV/atom) to display for metastable points (<= 0 hides them).

  • output_file (str) – Path for the saved image.

Returns:

output_file path (for convenience).

Return type:

str

parsl_tasks.convex_hull.plot_convex_hull_quaternary(elements_str, stable_path, input_csv_path, ehull_threshold, output_file=None)

Plot the quaternary convex hull and metastable points for a 3-element system.

Parameters:
  • elements_str (list[str]) – List of 4 element symbols (e.g., [‘Si’,’Ge’,’Sn’,’Pb’]).

  • stable_path (str) – Path to a text file with elemental reference energies.

  • input_csv_path (str) – CSV with rows Formula,Total_Energy_per_atom for calculated phases.

  • ehull_threshold (float) – Max Ehull (eV/atom) to display for metastable points (<= 0 hides them).

  • output_file (str) – Path for the saved image.

Returns:

output_file path (for convenience).

Return type:

str