matador.swaps package¶
This module implements the AtomicSwapper class which takes a Query object and a desired “swap”, e.g. swap all group [I] elements to Li, ready to be re-relaxed.
-
class
matador.swaps.
AtomicSwapper
(cursor, swap=None, uniq=False, top=None, maintain_num_species=True, debug=False, **kwargs)[source]¶ Bases:
object
This class handles the creation of input files from database queries that have swapped atoms.
Initialise class with query cursor and arguments.
- Parameters
cursor (list) – cursor of documents to swap.
- Keyword Arguments
swap (str) – specification of swaps to perform, e.g. “LiP:KSn” will swap all Li->P and all K->Sn in the cursor.
uniq (bool/float) – filter documents by similarity with the default sim_tol (True) or the value provided here.
top (int) – only swap from the first top structures in the cursor.
maintain_num_species (bool) – only perform swaps that maintain the number of species in the structure
debug (bool) – enable debug output
kwargs (dict) – dictionary of extra arguments that should be ignored.
-
parse_swaps
(swap_args=None)[source]¶ Parse command line options into valid atomic species swaps.
e.g. –swap LiP:NaAs
==> [[[‘Li’], [‘P’]], [[‘Na’], [‘P’]].
Handles multiple many-to-many swaps, macros for groups of the periodic table, and wildcards.
- Keyword Arguments
swap_args (str) – overrides command-line swap args.
Submodules¶
matador.swaps.swaps module¶
This file implements atomic swaps through the AtomicSwapper class.
-
class
matador.swaps.swaps.
AtomicSwapper
(cursor, swap=None, uniq=False, top=None, maintain_num_species=True, debug=False, **kwargs)[source]¶ Bases:
object
This class handles the creation of input files from database queries that have swapped atoms.
Initialise class with query cursor and arguments.
- Parameters
cursor (list) – cursor of documents to swap.
- Keyword Arguments
swap (str) – specification of swaps to perform, e.g. “LiP:KSn” will swap all Li->P and all K->Sn in the cursor.
uniq (bool/float) – filter documents by similarity with the default sim_tol (True) or the value provided here.
top (int) – only swap from the first top structures in the cursor.
maintain_num_species (bool) – only perform swaps that maintain the number of species in the structure
debug (bool) – enable debug output
kwargs (dict) – dictionary of extra arguments that should be ignored.
-
parse_swaps
(swap_args=None)[source]¶ Parse command line options into valid atomic species swaps.
e.g. –swap LiP:NaAs
==> [[[‘Li’], [‘P’]], [[‘Na’], [‘P’]].
Handles multiple many-to-many swaps, macros for groups of the periodic table, and wildcards.
- Keyword Arguments
swap_args (str) – overrides command-line swap args.