bsym.configuration

class bsym.configuration.Configuration(vector)[source]

Bases: object

A Configuration describes a specific arrangement of objects in the vector space of possible positions. Objects are represented by integers, with indistinguishable objects denoted by identical integers. This class subclasses numpy.matrix. Each configuration in the vector space of positions is represented as a column vector.

count

If symmetry-inequivalent configurations have been generated for a configuration space, this records the number of configurations equivalent to this one. Value at initialisation is None.

Type:int
lowest_numeric_representation

If the numeric representations for the set of equivalent configurations are calculated, this can be used to store the lowest valued numeric representation, for use as a simple hash.

Type:int

Example

>>> Configuration( [1, 1, 0] )
Configuration([1, 1, 0])
as_number

A numeric representation of this configuration.

Examples

>>> c = Configuration( [ 1, 2, 0 ] )
>>> c.as_number
120
classmethod from_tuple(this_tuple)[source]

Construct a Configuration from a tuple, e.g.:

Configuration.from_tuple( ( 1, 1, 0 ) )
Parameters:this_tuple (tuple) – The tuple used to construct this Configuration.
Returns:The new Configuration.
Return type:(Configuration)
has_equivalent_in_list(the_list, symmetry_operations)[source]

Test whether this configuration is equivalent by symmetry to one or more in a list of configurations.

Parameters:
  • list (list(bsym.Configuration)) – A list of Configuration instances.
  • symmetry_operations (list(bsym.SymmetryOperation)) – A list of SymmetryOperation objects.
Returns:

True | False

Return type:

(bool)

is_equivalent_to(test_configuration, symmetry_operations)[source]

Test whether this configuration is equivalent to another configuration under one or more of a set of symmetry operations.

Parameters:
  • test_configuration (Configuration) – The configuration to compare against.
  • symmetry_operations (list(SymmetryOperation) – A list of SymmetryOperation objects.
Returns:

True | False

Return type:

(bool)

is_in_list(the_list)[source]

Test whether this configuration is in a list of configurations.

Parameters:list (list(bsym.Comfiguration)) – A list of Configuration instances.
Returns:True | False
Return type:(bool)
map_objects(objects)[source]

Returns a dict of objects sorted according to this configuration.

Parameters:[list] (objects) – A list of objects.
Returns:A dictionary of sorted objects.
Return type:sorted_objects [dict]
matches(test_configuration)[source]

Test whether this configuration is equal to another configuration.

Parameters:test_configuration (Configuration) – The configuration to compare against.
Returns:True | False.
Return type:(bool)
numeric_equivalents(symmetry_operations)[source]

Returns a list of all symmetry equivalent configurations generated by a set of symmetry operations with each configuration given in numeric representation.

Parameters:symmetry_operations (list) – A list of SymmetryOperation instances.
Returns:A list of numbers representing each equivalent configuration.
Return type:(list(int))
position(label)[source]

Returns the vector indices where elements are equal to label.

Parameters:label (int) – The label used to select the vector positions.
Returns:A list of all positions that match label.
Return type:(list)
pprint()[source]
set_lowest_numeric_representation(symmetry_operations)[source]

Sets self.lowest_numeric_representation to the lowest value numeric representation of this configuration when permutated under a set of symmetry operations.

Parameters:symmetry_operations (list) – A list of SymmetryOperation instances.
Returns:None
tolist()[source]

Returns the configuration data as a list.

Parameters:None
Returns:(List)
bsym.configuration.as_number(a)[source]