gnrs.parallel¶
This module provides parallel processing utilities for Genarris.
This source code is licensed under the BSD-3 license found in the LICENSE file in the root directory of this source tree.
- gnrs.parallel.init_parallel(comm_in, seed=42)[source]¶
Initialize parallel environment with MPI communicator.
- Parameters:
comm_in (mpi4py.MPI.Comm) – MPI communicator object
seed (int) – Random seed
- Return type:
None
gnrs.parallel.structs¶
This module contains the DistributedStructs class, which is used to handle distributed structure dictionaries.
This source code is licensed under the BSD-3-Clause license found in the LICENSE file in the root directory of this source tree.
- class gnrs.parallel.structs.DistributedStructs[source]¶
Bases:
objectContains functions for handling distributed structure dictionaries.
Initialize with a dictionary of structures.
- Parameters:
structs – Dictionary mapping structure names to ASE Atoms objects
- Raises:
ValueError – If structs is not a dictionary
- __init__(structs)[source]¶
Initialize with a dictionary of structures.
- Parameters:
structs (dict) – Dictionary mapping structure names to ASE Atoms objects
- Raises:
ValueError – If structs is not a dictionary
- get_num_structs()[source]¶
Get the total number of structures in a distributed structures dictionary.
- Returns:
Total number of structures across all ranks
- Return type:
- find_matches(target, settings=None)[source]¶
Runs pymatgen duplicate checks on a distributed struct dictionary.
- Parameters:
target (ase.atoms.Atoms) – Target structure to be matched
settings (dict | None) – Settings for pymatgen StructureMatcher
- Returns:
List of matching structure IDs
- Return type:
- collect_property(prpty, ptype='info')[source]¶
Collects the property of all the structures into a list.
- find_spg(tol=0.001)[source]¶
Finds the space group of all structures. Space group number is stored in info[“spg”]
- Parameters:
tol (float) – Tolerance for symmetry finding
- Return type:
None
- property done: set[str]¶
Names of the structures already completed by the current task, i.e. restored from a checkpoint or checkpointed on this rank.
- checkpoint_save(path, name, xtal)[source]¶
Appends one completed structure to this rank’s checkpoint log. Does not communicate, so ranks can call it independently.
The structure is written as one line in the same form used inside structures.json (see
gnrs.parallel.io.encode_struct). A job killed mid-write can therefore damage only the last line.- Parameters:
path (str) – Directory for this rank’s checkpoint log
name (str) – Structure ID
xtal (ase.atoms.Atoms) – The completed structure. Need not belong to this rank’s pool, e.g. in serial DFT mode rank 0 computes copies of every rank’s structures.
- Return type:
None
- static checkpoint_clear(path)[source]¶
Removes checkpoint files left under a task’s calc directory. Call on one rank only; does not communicate.
- checkpoint_load(path)[source]¶
Merges checkpoints of an interrupted run into the current structures and spreads the remaining work evenly across ranks. Unlike save, load is a collective and blocking operation.
A checkpointed copy replaces the current copy of the same structure and is marked as done (see
done); structures that were never checkpointed (e.g. held by a rank that was killed before it finished its first calculation) are kept as they are. Checkpointed structures that are not in the current pool are ignored. Damaged lines and unreadable files are skipped with a warning; the affected structures are simply recomputed.
gnrs.parallel.io¶
This module provides functionality for reading and writing parallel data.
This source code is licensed under the BSD-3-Clause license found in the LICENSE file in the root directory of this source tree.
- gnrs.parallel.io.read_geometry_out(file_path)[source]¶
Master process reads geometry file and scatters data to other processes.
- gnrs.parallel.io.str2atoms(geometry_str)[source]¶
Constructs Atoms object from aims geometry format.
- Parameters:
geometry_string – List of strings containing geometry data
geometry_str (list)
- Returns:
ASE Atoms object representing the crystal structure
- Return type:
Atoms | None
- gnrs.parallel.io.encode_struct(name, xtal)[source]¶
Serialize one structure as a line of a structures.json file.