================================================================================================ * Used to calculate the partial power spectrum with the mu=1, nu=1 compression * scheme from Darby et al. It is possible to implement the other compression * schemes from Darby et al. by modifying the one shown here, although the mu=1 * nu=1 performed by far the best in their experiments and is most
| 2303 | * for many-element systems. |
| 2304 | */ |
| 2305 | void getPDWithCompression( |
| 2306 | py::detail::unchecked_mutable_reference<double, 2> &descriptor_mu, |
| 2307 | py::detail::unchecked_reference<double, 4> &Cnnd_u, |
| 2308 | py::detail::unchecked_reference<double, 3> &Cnnd_ave_mu, |
| 2309 | int Ns, |
| 2310 | int Ts, |
| 2311 | int nCenters, |
| 2312 | int lMax |
| 2313 | ) { |
| 2314 | |
| 2315 | // The power spectrum is multiplied by an l-dependent prefactor that comes |
| 2316 | // from the normalization of the Wigner D matrices. This prefactor is |
| 2317 | // mentioned in the arrata of the original SOAP paper: On representing |
| 2318 | // chemical environments, Phys. Rev. B 87, 184115 (2013). Here the square |
| 2319 | // root of the prefactor in the dot-product kernel is used, so that after a |
| 2320 | // possible dot-product the full prefactor is recovered. |
| 2321 | for(int i = 0; i < nCenters; i++){ |
| 2322 | int shiftAll = 0; |
| 2323 | for(int j = 0; j < Ts; j++){ |
| 2324 | for(int m=0; m <= lMax; m++){ |
| 2325 | double prel; |
| 2326 | if(m > 1){prel = PI*sqrt(8.0/(2.0*m+1.0))*PI3;} |
| 2327 | else{prel = PI*sqrt(8.0/(2.0*m+1.0));} |
| 2328 | for(int k = 0; k < Ns; k++){ |
| 2329 | for(int kd = 0; kd < Ns; kd++){ |
| 2330 | double buffDouble = 0; |
| 2331 | for(int buffShift = m*m; buffShift < (m+1)*(m+1); buffShift++){ |
| 2332 | //Notice that we multiply the coefficient i,j,k,bS against |
| 2333 | //the sum of coefficients (over all species in the environment) |
| 2334 | //i,kd,bS. This is the mu=1,nu=1 compression scheme from Darby |
| 2335 | //et al. |
| 2336 | buffDouble += Cnnd_u(i,j,k,buffShift) * Cnnd_ave_mu(i,kd,buffShift); |
| 2337 | } |
| 2338 | descriptor_mu(i, shiftAll) = prel*buffDouble; |
| 2339 | shiftAll++; |
| 2340 | } |
| 2341 | } |
| 2342 | } |
| 2343 | } |
| 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | |
| 2348 |