wannier-developers / wannier90

Official repository of the Wannier90 code
http://www.wannier.org
GNU General Public License v2.0
235 stars 139 forks source link

Order of projections in nnkp file #463

Open stepan-tsirkin opened 9 months ago

stepan-tsirkin commented 9 months ago

I noticed that if I specify projections in one line for one atom, the order is not strictly preserved.

Say, if I put Fe:s;p or Fe:p;s - then I get the same : the s orbitals come in the nnkpt file first, and then the p's .Looks like the code orders projections by the number l. Accordingly, the hybrids come first (because the are associated with negative l)

Only if I give two lines, like

Fe:p
Fe:s

then I get p's first, s last

So, my questions are

  1. is this intended (if anyone remembers that)
  2. is this behavior documented (I did not hind such in the projections section of the user guide)

The order of projections is important in some cases, e.g. in the symmetrization of the Wannier Hamiltonians.

jryates commented 9 months ago

I think I coded that bit. It was a long time ago. It wasn't a conscious decision - and it won't be documented. At the time I would have assumed that the order of the projection in the nnkp was unimportant. We could maybe change the code such that the projections are written in a fixed way which doesn't depend on how they are specified in the win file.

Is the reason this is relevant is that you are assuming that the final WF have the symmetry of the initial projections - and are ordered in the same way as the nnkp file? That's not guaranteed to be true - although perhaps in practice is often is.

stepan-tsirkin commented 9 months ago

I think I coded that bit. It was a long time ago. It wasn't a conscious decision - and it won't be documented. At the time I would have assumed that the order of the projection in the nnkp was unimportant. We could maybe change the code such that the projections are written in a fixed way which doesn't depend on how they are specified in the win file.

Thanks for clarifying. I would say, any order is fine as long as it is documented. I understand that order of projections was not considered important at that time.

Is the reason this is relevant is that you are assuming that the final WF have the symmetry of the initial projections - and are ordered in the same way as the nnkp file? That's not guaranteed to be true - although perhaps in practice is often is.

Yes, we rely on this in the case of 0 iterations on maximal localization procedure, so just disentanglement+projections. I guess in that case the Wannier functions should transform in the same way as projections, at least approximately.

Of course, maximal localization procedure may land anywhere, e.g. it can often form sp3 hybrids when starting from pure s and pure p.