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: object

Contains 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:

int

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:

list

collect_property(prpty, ptype='info')[source]

Collects the property of all the structures into a list.

Parameters:
  • prpty (str) – Property name to collect

  • ptype (str) – Property type, either ‘info’ or ‘method’

Returns:

List of property values on master rank, None on other ranks

Return type:

list

get_statistics(prpty, ptype='info')[source]

Gets the statistics on a property of interest.

Parameters:
  • prpty (str) – Property name to analyze

  • ptype (str) – Get property from either ‘info’ or ‘method’

Returns:

Dictionary with statistics on master rank, None on other ranks

Return type:

dict

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

checkpoint_save(path)[source]

Checkpoints partially done calculation for restart. This routine doesn’t communicate to others so that ranks can execute independently.

Parameters:

path (str) – Directory path to save checkpoint

Return type:

None

checkpoint_load(path)[source]

Loads checkpoint. Unlike save, load is a collective and blocking operation.

Parameters:

path (str) – Directory path to load checkpoint from

Return type:

None

redistribute()[source]

Redistribute structures such that all ranks have almost equal number of structures. Helpful for balancing load across cores

Return type:

None

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.

Parameters:

file_path (str) – Path to the geometry output file

Returns:

Dictionary mapping random IDs to Atoms objects

Return type:

dict

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:

ase.Atoms

gnrs.parallel.io.write_parallel(file_path, struct_dict, gather=True, mode='w')[source]

Convert structures to JSON strings, gather and store to file.

Parameters:
  • file_path (str) – Path to output file

  • struct_dict (dict) – Dictionary of structures to write

  • gather (bool) – Whether to gather data from all processes

  • mode (str) – File opening mode

Return type:

None

gnrs.parallel.io.read_parallel(file_path, scatter=True)[source]

Reads JSON database of structures.

Parameters:
  • file_path (str) – Path to JSON file

  • scatter (bool) – Whether to scatter data to all processes

Returns:

Dictionary mapping IDs to Atoms objects

Return type:

dict