Ordering of bisection localization vector

Questions and discussions regarding the use of Qbox
Forum rules
You must be a registered user to post in this forum. Registered users may also post new topics if they consider that their subject does not correspond to any topic already present on the forum.
Post Reply
Posts: 4
Joined: Thu Sep 03, 2020 10:33 pm

Ordering of bisection localization vector

Post by andyx » Fri Nov 20, 2020 2:07 am

Hi users,

a. I'd like to understand the ordering of the localization vector in the bisection printout -- from left to right, is the ordering all the x first, then y, then z? Or is it x, y, z, x, y, z, ...?

For example, suppose we choose blHF = 2 3 1 with a simulation cell of 1 x 1 x 1 for simplicity, and the localization vector is (bunch of zeros)010111111001. Would this correspond to the following (going from left to right) -- 01 meaning localized [0.5, 1] in x direction; 01 meaning localized [0.5, 0.75] (which means right bit corresponds to where Walsh function is 1) in x (or is it [0.75, 1], meaning right bit corresponding to whichever segment is "more to the right"?), 11 meaning still localized [0, 1] in y, 11 meaning localized [0, 1] in y, 10 meaning localized [0.125, 0.375] and [0.625, 0.875] in y, and 01 meaning localized in [0.5, 1] in z?

b. I'd like to see if I can compare localization vectors.

Specifically, assuming I use the same blHF and same simulation cell size, would I be able to compare the localization vectors between the orbitals of different systems to tell if they overlap in each subdomain, since the same blHF and cell size should mean that the subdomains exactly correspond to each other?

Site Admin
Posts: 139
Joined: Tue Jun 17, 2008 7:03 pm

Re: Ordering of bisection localization vector

Post by fgygi » Sat Nov 21, 2020 12:44 am

The total number of Walsh projectors used in the bisection process is nlevels[0]+nlevels[1]+nlevels[2], where the values of nlevels are the 3 values of the blHF variable, or the first 3 arguments of the bisection command.

The Walsh projectors are ordered by level and by direction (x,y,z). Thus for nlevels = (2,2,2), the projectors are:
level 0, x
level 0, y
level 0, z
level 1, x
level 1, y
level 1, z

The description of the localization of each orbital (after bisection) is given by two bits for each projector. The two bits describe whether the orbital is localized on the region where the projector is 0 (the "zero side", bit pair=(10)), the region where the projector is 1 (the "one side", bit pair=(01)), or both regions (bit pair=(11)). Note that the combination (00) cannot occur. The bits are packed in a localization vector that consists of a 64 bit integer. The logic of the construction of the localization vector is best explained by the corresponding code in function Bisection::compute_localization in Bisection.cpp:

Code: Select all

void Bisection::compute_localization(double epsilon)
  // compute localization vector for a threshold epsilon
  for ( int n = 0; n < nst_; n++ )
    localization_[n] = 0;
    for ( int imat = 0; imat < nmat_; imat++ )
      if ( adiag_[imat][n] < epsilon )
        localization_[n] += 1<<(2*imat);
      else if ( adiag_[imat][n] > 1.0-epsilon)
        localization_[n] += 1<<(2*imat+1);
        localization_[n] += (1<<(2*imat)) + (1<<(2*imat+1));
where the index imat runs overs all projectors. The first projector (level 0, x) is represented by the two least significant bits of the localization vector. The second projector (level 0, y) is represented by the next two bits, and so on.

Example: After performing a bisection using the bisection 2 2 2 0.01 command for a 64-molecule water sample, the localization vector of orbital 244 (counting starting from 0) is printed on output as

Code: Select all

localization[244]: 2491 000000000000000000100110111011 size: 0.0625 overlaps: 36
This shows that this orbital is (starting from the least significant bits):
- delocalized across both sides of the (level 0, x) projector (bits 11)
- localized on the 0 side of the (level 0, y) projector (bits 10)
- delocalized across both sides of the (level 0, z) projector (bits 11)
- localized on the 0 side of the (level 1, x) projector (bits 10)
- localized on the 1 side of the (level 1, y) projector (bits 01)
- localized on the 0 side of the (level 1, z) projector (bits 10).
All the following (00) pairs are indicating an absence of projectors. Localization vectors are always represented a a full 64 bit string.

The value 0.0625 indicates the fraction of the unit cell on which the orbital is localized: each "successful" bisection by a projector (i.e. yielding bit pairs 10 or 01) contributes a factor 1/2. The total number of "successful" projectors in this example is 4, so that the size is 1/2**4 = 1/16 = 0.0625. This orbital overlaps with 36 other orbitals.
Note that the localization vector, the size, and the number of overlapping orbitals depend on the value of the threshold used. In the limit of small threshold, all the bit pairs become (11).

For comparison of localization of orbitals in different systems, note that the localization vector specifies a subdomain of the unit cell. If two orbitals have different localization vectors, it is possible to determine whether they overlap using the Bisection::overlap function in Bisection.cpp:

Code: Select all

bool Bisection::overlap(const vector<long int>& loc_, int i, int j) const
  // overlap: return true if the functions i and j overlap according
  // to the localization vector loc_
  long int loc_i = loc_[i];
  long int loc_j = loc_[j];
  while ( loc_i!=0 && loc_j!=0 )
    // get the weight of projections for each state
    bool p_right_i = loc_i & 1;
    bool p_left_i  = loc_i & 2;
    bool p_right_j = loc_j & 1;
    bool p_left_j  = loc_j & 2;

    // return false as soon as the states are found to be separated
    if ( !( ( p_right_i && p_right_j ) || ( p_left_i && p_left_j ) ) )
      return false;

    loc_i >>= 2;
    loc_j >>= 2;

  // return true if the states overlap
  return true;

Posts: 4
Joined: Thu Sep 03, 2020 10:33 pm

Re: Ordering of bisection localization vector

Post by andyx » Tue Nov 24, 2020 12:26 am

Thank you very much Francois!

Post Reply