Better usage of the cluster class
Closes #555 (closed)
Purpose
The purpose of this MR is to make the relationship between the differnt C++ classes more logical, and to prepare for #562 (closed) and #565.
Changes
- Each
Orbitnow consists of a vector (instead of a vector of vectors ofLatticeSites). These are calledclustersinstead ofequivalent_clusters, since the latter seems redundant and possible even wrong if someone merges aggressively. - A
Clusternow knows about itsLatticeSites as well as theStructurethat these sites refer to. The structure is held in the form of a shared pointer. - Since a
Clusterknows about both the lattice sites and the structure, they can now be asked for the Cartesian coordinates of the sites, and a cluster can also compute its radius. This means we no longer need the C++Geometrymodule. - An important part of calculating a cluster vector is to build an orbit list for a supercell. When doing this, icet redefines lattice sites such that they refer to the supercell instead of the primitive structure. Previously this was done by an orbit list, but it is now instead in
Cluster.
Controversial changes
- The representative cluster is created as a separate
Clusterinstance in eachOrbit. It would probably be prettier to keep some sort of reference (pointer or index) to the cluster in_clusters(formerly_equivalent_cluster). But I couldn't find any way to do that in C++ without writing super-ugly code. Probably there is some nice solution though? The challenge is that_clustersget sorted every now and then.
Performance
I've seen no significant change in performance or memory consumption after these changes.
Edited by Magnus Rahm