Resolve "Minimize usage of Structure class in ClusterCounts"

Description

This MR does an almost entire rewrite of the python-side cluster counts module to make it more pythonic and user-friendly. Initialization is now done with an orbit list and a structure like so:

cluster_counts = ClusterSpace(orbit_list, atoms)

The actual counts can be accessed with both an icet Cluster as a key or an integer:

counts = cluster_counts[cluster]
counts = cluster_counts[1]

The print function now works,

print(cluster_counts)

and the output has been polished. The c++ side print may then perhaps be removed, but I haven't done that.

Comments

Some possible controversial changes:

  • I commented out a snippet of the c++ code sorting clusters. That part seemed to be non-functional, and the sorting is now instead done on the python side.
  • I changed the example to use a PBC system since non-PBC does not really work as it should ATM.
  • The non-PBC unit test fails, probably for the same reasons. I kept it but gave it an expected failure decoration.

Summary of changes

  • icet/core/cluster_counts.py rewritten
  • tests/unittest/core/test_cluster_counts.py modified to accomodate the changes
  • tests/integration/test_counting.py likewise
  • examples/get_cluster_count.py updated with new interface (now much simpler)
  • doc/userguide/source/advanced/get_cluster_count.rst reflects these changes
  • src/ClusterCounts.cpp sorting commented out

Closes #188 (closed)

Edited by Magnus Rahm

Merge request reports

Loading