chemcoord.Cartesian.partition_chem_env

Cartesian.partition_chem_env(n_sphere=4, use_lookup=None)

This function partitions the molecule into subsets of the same chemical environment.

A chemical environment is specified by the number of surrounding atoms of a certain kind around an atom with a certain atomic number represented by a tuple of a string and a frozenset of tuples. The n_sphere option determines how many branches the algorithm follows to determine the chemical environment.

Example: A carbon atom in ethane has bonds with three hydrogen (atomic number 1) and one carbon atom (atomic number 6). If n_sphere=1 these are the only atoms we are interested in and the chemical environment is:

('C', frozenset([('H', 3), ('C', 1)]))

If n_sphere=2 we follow every atom in the chemical enviromment of n_sphere=1 to their direct neighbours. In the case of ethane this gives:

('C', frozenset([('H', 6), ('C', 1)]))

In the special case of ethane this is the whole molecule; in other cases you can apply this operation recursively and stop after n_sphere or after reaching the end of branches.

Parameters:
  • n_sphere (int) –
  • use_lookup (bool) – Use a lookup variable for get_bonds(). The default is specified in settings['defaults']['use_lookup']
Returns:

The output will look like this:

{ (element_symbol, frozenset([tuples])) : set([indices]) }

A dictionary mapping from a chemical environment to
the set of indices of atoms in this environment.

Return type:

dict