New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Representing symmetries #703
Comments
Let me check I understand (the space group and Symmetry operations that are elements of Regarding the Since we can implement @dispatch
def product(a: PGSymmetry, b: PGSymmetry):
return PGSymmetry(M=a.M @ b.M) this would work well with the existing symmetry group code (and if we make |
Exactly. The advantage of
I see. I was thinking about it as a symmetry of the Hamiltonian, though up till now they mean the same.
Yep, this should work and would speed up writing stuff like dihedral groups.
I think |
Re @PhilipVinc's suggestion to have the separate the logic from all classes: #702 (comment) I think that's feasible and might help with neat design. The only thing we really need def point_group_to_graph_group(p: PointGroup, g: Graph): GraphGroup:
perms = []
sites = g.positions()
for pgs in p:
preimages = pgs.preimage(sites)
perms.append(g.locate(preimages))
return GraphGroup(perms) We can then wrap this function in either class. I'd still favour |
I like this idea. I.e. the group is stored abstractly and then finds the concrete implementation by interacting with Lattice.py (or whatever it needs to interact with). That being said I will defer to someone else to implement this :) As a note, we do have a quick and dirty way to implement higher dimensional groups. For example the cubic point group (in Lattice.py) could be constructed by:
Yeah, I know it’s not an irreducible representation but at least the elements are labeled. This is a pretty general procedure too. |
I was always under the impression that this doesn't generate the triads around the [111] axes (which are usually used to define cubic symmetry), but I might be wrong, and it has to do with what is the least you need for cubic symmetry...
I can take a stab at implementing it, though not right now, I have work to do! 😛 |
@PhilipVinc @femtobit is it OK with the v3.0 timeline if I submit a PR for this mid-next-week or so with significant API changes? I have thought about this a lot and have a pile of notes for implementation, so it would make sense that I work through this in the first place, but I have a lot to do these days, so it would take a while to get around everything. |
I’m on a day off today.
I’ll try to review this properly tomorrow.
There’s a bunch of things that I think should be addressed and In any case, before merging, I would like to have a clear idea of the design we are aiming for and the extension points.
Once things are released we cannot change the api anymore, it’s set in stone (maybe chalk and not granite, but still it’s Stoney).
In any case i would rather not have those things in 3.0, and leave them for a later 3.x.
3.0 is about the new API, which right now only means SR/QGT, which will soon be merged, stability/no bugs , which I think we have somewhat achieved, a cleanup of the extension points, which is still todo, and documentation, which still needs work.
Aka: take your time.
Il 13 mag 2021, 17:31 +0200, Attila Szabó ***@***.***>, ha scritto:
… @PhilipVinc @femtobit is it OK with the v3.0 timeline if I submit a PR for this mid-next-week or so? I have thought about this a lot and have a pile of notes for implementation, so it would make sense that I work through this in the first place, but I have a lot to do these days, so it would take a while to get around everything.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I agree with the idea of having a general If we then implement its elements, I think this would allow us to get rid of the two rotation implementations and the reflection, right? -- I think we should start moving things to a Can you write some pseudocode for the general API we should have before writign the actual code? -- def point_group_to_graph_group(p: PointGroup, g: Graph): GraphGroup:
....
return GraphGroup(perms) Unless i'm missing something, the Maybe what's confusing is that you want to write -- As for symmetries in general: all the simmetries we are working with are simmetries of the lattice. Let's keep the discussion in this issue focused about lattice simmetries. |
@PhilipVinc Thinking about it, nothing in Not sure if this is off-topic, but a slightly related point: Several parts of our code I think still have the implicit assumption that all nodes of a graph are labeled precisely by (By the way: I agree that Hamiltonian symmetries etc. are out of scope here. Let's just focus on [lattice] permutations for now.) |
|
Okay. The only API decision would be is whether we want to leave room for these other symmetries, so we would have a reserved name for every kind of Hamiltonian symmetry, which would (later if not now) be subclassed by graph permutation symmetries |
Agreed. |
Technically you are right. My question is simply: can it inherit from SymmGroup and respect it's interface while implementing the extra bells and whistles it needs?
We don't even know what form this will take! |
Again, |
Why do you want a non-permutation group to be derived from a permutation group? I'd rather say to put everything that works for any group (like constructing times tables) into a class that is
Yes, but how you do that depends on the particular lattice, and there are a lot of things a |
I'm not sure how pseudocode is easier than python :-) But I'll type out what the structure is that I have in mind in words, bear with me |
What I was missing is that My point is, all those objects are groups. What are the (relevant) operations we can do on group? for example, does it make sense to combine a PointGroup with a SymmGroup? This kind of thing. Do we have other groups than PointGroup that we might want to implement in the future? can you also sketch them in (even if they won't be implemented now) to be sure that we have a good idea of things that might come? Can you sketch a list of what operations we need to do on all those different objects and their elements? |
Groups
I'm not sure atm what other groups we'd need later, probably not more than these for this RFC. An example would be the Another question is where to put all this. I think both |
Graphs
|
Odds and ends
|
not really, because they act on different things. But if you specify a Graph, a PointGroup can be translated into a SymmGroup by calculating its permutation action on that graph |
@femtobit @PhilipVinc @chrisrothUT How do you like this layout? |
I definitely like the layout. A few comments
I think that Lattice.py should just contain the generators of rotation/translation/reflection (which are the perm functions I’ve written)
Why do this all in Lattice? What I’m envisioning is something like
Ignore the weird capitalization, the IPad be like that sometimes. TLDR: just let lattice specify the generators, and let this new group object do everything else that way if we want to add new functionality we don’t have to look all over the place As for the whole grid thing, we should probably just make it a subclass of Lattice, and add some other common subclasses like triangular lattice etc. . |
Agreed. I'll write
This is nice. However, I would then decouple the PointG → PermG translation from PS. It turns out there is a very generic (but pretty slow) algorithm for building the character table out of the times table. I'll implement it in |
I have no idea how this could be possible. How could you distinguish between a D_6 on a Kagome and a D_6 on a triangular?
Yeah, this seems pretty necessary. It’s probably possible to build a symmetry group from a generic graph object, but that does not seem worth it at all to me. It may be worth it to allow lattice to take a list of space coordinates as input.
How slow? It’s a startup cost, and nothing could possibly take as long as the NetworkX automorphisms function. Definitely seems worth implementing over a specialized method, as this could be done for any possible group.
As long as the group elements are ordered in a sensible way, shouldn’t the character table be ordered the same way? |
I mean you wouldn't make the
Yeah, I guess the counterargument is that someone might want to implement things very differently from Lattice, but it seems like a fringe case, or they will just subclass Lattice...
It requires diagonalising a matrix with as many rows/columns as there are conjugacy classes/irreps. Fine for a point group with <10 classes, not great for a space group on a large lattice.
It's more that you get hundreds of irreps with not very intuitive characters (because they contain sums of phase factors for a bunch of different wave vectors). It's better if you have a function that allows you to get the one you're looking for directly. (See above) |
Ahh misread what you said. Although I’m still a bit confused about how you’d know what permutation corresponds to a translation without using Lattice. I do think it may be worth it to have permutation functions work for a general translations/rotations (instead of generators) so we don’t have to permute arrays a bunch of times EDIT: Actually applying the matching algorithm is probably slower than calling perm[perm] so never mind.
This is definitely true. Is the plan right now to just import a database with the space groups in <=3D and allow the user to specify that information? |
Of course you need the information content in Lattice, it's just that you'd have a function external to it that takes a
Maybe, but this is a minor startup cost, and I think the hashing trick gets us close in performance anyway. It's more that you don't have to explain the rotation group of a tetrahedron (for instance) in terms of generators, but you can just pass a premade 12-element
I would stop at point groups.
With decorating |
Yeah I’m definitely on the same page about everything, except I don’t really see the point of why you’d use an external function instead of just having the function exist within in the Group object itself (as long as we give it access to lattice). I’m new to working on open source projects though, so I don’t have a strong opinion on this.
Ahh I see the point of your layout now, it avoids the extra step of having to express point group operations in terms of generators when you can just express them as coordinate transforms then use the hashing trick to find the perm.
Hmm yeah though the 73 symmorphic group sounds like a lot too. I’d be happy to help with the grunt work |
This started off as a request from @PhilipVinc who doesn't like code that marries two classes to be tied to either of them. I don't think it has much to do with open-source, rather than NetKet being a big project, so you want to write stuff that is easy to maintain/refactor. In this specific case,
Exactly – it's not a trivial thing for many point groups, especially if you don't want a lot of repetitions.
Well, it's certainly not a high priority :-) Most of them are so obscure anyway that cataloguing them wouldn't benefit anyone, point groups are a bit more versatile |
I believe this issue is resolved by #724, do you agree? @PhilipVinc @attila-i-szabo @chrisrothUT |
Yeah this issue is certainly resolved |
Space groups
A limitation of the "interpretable" symmetry group implemented in #702 is the kinds of point group that can be easily represented in it. Namely, we are restricted to dihedral groups that act within a Cartesian coordinate plane. This is enough in 2D, but 3D space groups do get more complicated (e.g. on the cubic lattice).
I would recommend to introduce a
PointGroup
class for point-group symmetries (I think finite translation groups are better handled by theLattice
class that knows how large the lattice is). Its elements would be objects that transform Cartesian coordinates (and maybe calculate preimages too):The symmetries of the actual lattice are still better written in terms of permutations of sites (e.g. it makes constructing times tables for
DenseEquivariant
easier). We could have a method in eitherPointGroup
orLattice
(I think the latter makes more sense because we can have different graphs with different implementations) that turn aPGSymmetry
into a permutation. The result could be semidirect-producted [1] with the translation group, which would be generated the same way as it is now, without direct reference to actual geometry.Once this is done, we could offer a catalogue of ready-made common point groups:
[1]
SemiGroup::@
is not a direct product, for we don't check whether the elements commute. I think it would usually be a semidirect product in the cases we care for.Nice things to potentially add to
PGSymmetry
M
.rotation by ...°
,reflection across axis at ...°
.rotation by ...° around (x,y,z)
,reflection across plane (x,y,z)
,inversion
,rotoreflection
(not even sure how to describe it)Lattice
too since it has to check for equality modulo reciprocal lattice vectors...Non-space-group symmetries
It would also be nice to support symmetries beyond the space group. A good example is parity symmetry in spin systems, which is very useful for calculating spin gaps, etc.
This requires us to generalise
SymmGroup
beyond permutation groups, as well asDenseSymm
to embed input vectors into groups that aren't just permutations. A most generalSymmGroup
has to provide two things:DenseEquivariant
DenseSymm
. For a general symmetry we need a function that takes care of the all aspects of the convolution inDenseSymm::__call__
; in some cases (permutations, permutations+parity), we could get away with tweakingfull_kernel
.I'd recommend that we keep
SymmGroup
as the base class (i.e. we take it to mean "symmetry group of the Hamiltonian" and call the permutation groups that encode graph symmetriesGraphGroup
, and make it a subclass ofSymmGroup
For the specific case of parity, I'd define a
ParityGroup
that wraps anotherSymmGroup
and doubles its size. I don't think@
ing would cut it in this case, because we need to provide a times table and the logic, which is not done by a basicSemiGroup
.Odds and ends
Grid
,SemiGroup
, etc.) into one place, saynetket.symm
@chrisrothUT @femtobit @PhilipVinc @fabienalet @gcarleo what do you think?
The text was updated successfully, but these errors were encountered: