1 ////////////////////////////////////////////////////////////////////////////////////// 2 // This file is distributed under the University of Illinois/NCSA Open Source License. 3 // See LICENSE file in top directory for details. 4 // 5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. 6 // 7 // File developed by: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign 8 // 9 // File created by: Mark Dewing, markdewing@gmail.com, University of Illinois at Urbana-Champaign 10 ////////////////////////////////////////////////////////////////////////////////////// 11 12 13 #include "catch.hpp" 14 #include "Numerics/CartesianTensor.h" 15 16 #include <stdio.h> 17 #include <string> 18 19 using std::string; 20 21 namespace qmcplusplus 22 { 23 typedef OHMMS_PRECISION real_type; 24 25 26 // Use gen_gto.py to generate the checks 27 28 TEST_CASE("Cartesian Tensor", "[numerics]") 29 { 30 CartesianTensor<double, TinyVector<double, 3>> ct(6); 31 32 TinyVector<double, 3> pt(1.3, 1.2, -0.5); 33 //TinyVector<double, 3> pt(1.3, 0.0, 0.0); 34 35 ct.evaluate(pt); 36 37 //for (int i = 0; i < 35; i++) { 38 //std::cout << "XYZ = " << i << " " << ct.getYlm(i) << std::endl; 39 //} 40 REQUIRE(ct.getYlm(0) == Approx(0.282094791774)); 41 REQUIRE(ct.getYlm(1) == Approx(0.635183265474)); 42 REQUIRE(ct.getYlm(2) == Approx(0.586323014284)); 43 REQUIRE(ct.getYlm(3) == Approx(-0.244301255951)); 44 REQUIRE(ct.getYlm(4) == Approx(1.06602349055)); 45 REQUIRE(ct.getYlm(5) == Approx(0.908327707927)); 46 REQUIRE(ct.getYlm(6) == Approx(0.157695782626)); 47 REQUIRE(ct.getYlm(7) == Approx(1.70437555172)); 48 REQUIRE(ct.getYlm(8) == Approx(-0.710156479885)); 49 REQUIRE(ct.getYlm(9) == Approx(-0.655529058355)); 50 REQUIRE(ct.getYlm(10) == Approx(1.6397368054)); 51 REQUIRE(ct.getYlm(11) == Approx(1.28969740543)); 52 REQUIRE(ct.getYlm(12) == Approx(-0.0932940831475)); 53 REQUIRE(ct.getYlm(13) == Approx(3.38451965731)); 54 REQUIRE(ct.getYlm(14) == Approx(-1.41021652388)); 55 REQUIRE(ct.getYlm(15) == Approx(3.12417199136)); 56 REQUIRE(ct.getYlm(16) == Approx(-1.20160461206)); 57 REQUIRE(ct.getYlm(17) == Approx(0.542390970723)); 58 REQUIRE(ct.getYlm(18) == Approx(0.500668588359)); 59 REQUIRE(ct.getYlm(19) == Approx(-2.25467692526)); 60 REQUIRE(ct.getYlm(20) == Approx(2.41707280436)); 61 REQUIRE(ct.getYlm(21) == Approx(1.75485528067)); 62 REQUIRE(ct.getYlm(22) == Approx(0.0528927734576)); 63 REQUIRE(ct.getYlm(23) == Approx(5.90305249944)); 64 REQUIRE(ct.getYlm(24) == Approx(-2.4596052081)); 65 REQUIRE(ct.getYlm(25) == Approx(5.02981988118)); 66 REQUIRE(ct.getYlm(26) == Approx(-1.93454610815)); 67 REQUIRE(ct.getYlm(27) == Approx(-0.363846924275)); 68 REQUIRE(ct.getYlm(28) == Approx(-0.335858699331)); 69 REQUIRE(ct.getYlm(29) == Approx(7.03459200681)); 70 REQUIRE(ct.getYlm(30) == Approx(1.22128333452)); 71 REQUIRE(ct.getYlm(31) == Approx(1.04062011935)); 72 REQUIRE(ct.getYlm(32) == Approx(-5.07677948596)); 73 REQUIRE(ct.getYlm(33) == Approx(-4.68625798704)); 74 REQUIRE(ct.getYlm(34) == Approx(1.9526074946)); 75 REQUIRE(ct.getYlm(35) == Approx(3.47382688598)); 76 REQUIRE(ct.getYlm(36) == Approx(2.32807861094)); 77 REQUIRE(ct.getYlm(37) == Approx(-0.0292375806134)); 78 REQUIRE(ct.getYlm(38) == Approx(9.61982829963)); 79 REQUIRE(ct.getYlm(39) == Approx(-4.00826179151)); 80 REQUIRE(ct.getYlm(40) == Approx(7.56625548555)); 81 REQUIRE(ct.getYlm(41) == Approx(-2.91009826367)); 82 REQUIRE(ct.getYlm(42) == Approx(0.228053128784)); 83 REQUIRE(ct.getYlm(43) == Approx(0.210510580416)); 84 REQUIRE(ct.getYlm(44) == Approx(13.5641819555)); 85 REQUIRE(ct.getYlm(45) == Approx(2.35489270061)); 86 REQUIRE(ct.getYlm(46) == Approx(12.5207833436)); 87 REQUIRE(ct.getYlm(47) == Approx(1.85218688514)); 88 REQUIRE(ct.getYlm(48) == Approx(-0.905727961775)); 89 REQUIRE(ct.getYlm(49) == Approx(-0.771744535477)); 90 REQUIRE(ct.getYlm(50) == Approx(-9.78910512921)); 91 REQUIRE(ct.getYlm(51) == Approx(-8.34101265448)); 92 REQUIRE(ct.getYlm(52) == Approx(-1.44809247474)); 93 REQUIRE(ct.getYlm(53) == Approx(-11.6655511199)); 94 REQUIRE(ct.getYlm(54) == Approx(4.86064629996)); 95 REQUIRE(ct.getYlm(55) == Approx(4.48675043074)); 96 REQUIRE(ct.getYlm(56) == Approx(4.90938236205)); 97 REQUIRE(ct.getYlm(57) == Approx(3.03706593382)); 98 REQUIRE(ct.getYlm(58) == Approx(0.0158923005669)); 99 REQUIRE(ct.getYlm(59) == Approx(15.0300731514)); 100 REQUIRE(ct.getYlm(60) == Approx(-6.26253047974)); 101 REQUIRE(ct.getYlm(61) == Approx(10.9122088466)); 102 REQUIRE(ct.getYlm(62) == Approx(-4.19700340252)); 103 REQUIRE(ct.getYlm(63) == Approx(-0.137042874894)); 104 REQUIRE(ct.getYlm(64) == Approx(-0.126501115286)); 105 REQUIRE(ct.getYlm(65) == Approx(24.0303233904)); 106 REQUIRE(ct.getYlm(66) == Approx(4.17193114417)); 107 REQUIRE(ct.getYlm(67) == Approx(20.4755418238)); 108 REQUIRE(ct.getYlm(68) == Approx(3.0289263053)); 109 REQUIRE(ct.getYlm(69) == Approx(0.61714957754)); 110 REQUIRE(ct.getYlm(70) == Approx(0.525855261336)); 111 REQUIRE(ct.getYlm(71) == Approx(-17.3423920977)); 112 REQUIRE(ct.getYlm(72) == Approx(-13.6402610582)); 113 REQUIRE(ct.getYlm(73) == Approx(0.986708699234)); 114 REQUIRE(ct.getYlm(74) == Approx(26.2459034569)); 115 REQUIRE(ct.getYlm(75) == Approx(-1.89857519219)); 116 REQUIRE(ct.getYlm(76) == Approx(-1.49328080661)); 117 REQUIRE(ct.getYlm(77) == Approx(-24.4531767752)); 118 REQUIRE(ct.getYlm(78) == Approx(10.1888236563)); 119 REQUIRE(ct.getYlm(79) == Approx(-22.5721631771)); 120 REQUIRE(ct.getYlm(80) == Approx(8.68160122197)); 121 REQUIRE(ct.getYlm(81) == Approx(-3.91877832936)); 122 REQUIRE(ct.getYlm(82) == Approx(-3.61733384249)); 123 REQUIRE(ct.getYlm(83) == Approx(12.1418905657)); 124 } 125 126 TEST_CASE("Cartesian Tensor evaluateAll subset", "[numerics]") 127 { 128 CartesianTensor<double, TinyVector<double, 3>> ct(6); 129 130 TinyVector<double, 3> pt(1.3, 1.2, -0.5); 131 ct.evaluateAll(pt); 132 133 //for (int i = 0; i < 35; i++) { 134 // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getGradYlm(i) << " " << ct.getLaplYlm(i) << std::endl; 135 //} 136 137 REQUIRE(ct.getYlm(0) == Approx(0.282094791774)); 138 REQUIRE(ct.getGradYlm(0)[0] == Approx(0)); 139 REQUIRE(ct.getGradYlm(0)[1] == Approx(0)); 140 REQUIRE(ct.getGradYlm(0)[2] == Approx(0)); 141 REQUIRE(ct.getLaplYlm(0) == Approx(0)); 142 143 REQUIRE(ct.getYlm(1) == Approx(0.635183265474)); 144 REQUIRE(ct.getGradYlm(1)[0] == Approx(0.488602511903)); 145 REQUIRE(ct.getGradYlm(1)[1] == Approx(0)); 146 REQUIRE(ct.getGradYlm(1)[2] == Approx(0)); 147 REQUIRE(ct.getLaplYlm(1) == Approx(0)); 148 149 REQUIRE(ct.getYlm(8) == Approx(-0.710156479885)); 150 REQUIRE(ct.getGradYlm(8)[0] == Approx(-0.546274215296)); 151 REQUIRE(ct.getGradYlm(8)[1] == Approx(0)); 152 REQUIRE(ct.getGradYlm(8)[2] == Approx(1.42031295977)); 153 REQUIRE(ct.getLaplYlm(8) == Approx(0)); 154 155 REQUIRE(ct.getYlm(23) == Approx(5.90305249944)); 156 REQUIRE(ct.getGradYlm(23)[0] == Approx(13.6224288449)); 157 REQUIRE(ct.getGradYlm(23)[1] == Approx(4.9192104162)); 158 REQUIRE(ct.getGradYlm(23)[2] == Approx(0)); 159 REQUIRE(ct.getLaplYlm(23) == Approx(20.9575828383)); 160 161 REQUIRE(ct.getYlm(34) == Approx(1.9526074946)); 162 REQUIRE(ct.getGradYlm(34)[0] == Approx(1.50200576508)); 163 REQUIRE(ct.getGradYlm(34)[1] == Approx(1.62717291217)); 164 REQUIRE(ct.getGradYlm(34)[2] == Approx(-7.81042997841)); 165 REQUIRE(ct.getLaplYlm(34) == Approx(15.6208599568)); 166 167 REQUIRE(ct.getYlm(50) == Approx(-9.78910512921)); 168 REQUIRE(ct.getGradYlm(50)[0] == Approx(-22.5902426059)); 169 REQUIRE(ct.getGradYlm(50)[1] == Approx(-8.15758760768)); 170 REQUIRE(ct.getGradYlm(50)[2] == Approx(19.5782102584)); 171 REQUIRE(ct.getLaplYlm(50) == Approx(-34.7542193937)); 172 173 REQUIRE(ct.getYlm(83) == Approx(12.1418905657)); 174 REQUIRE(ct.getGradYlm(83)[0] == Approx(18.6798316395)); 175 REQUIRE(ct.getGradYlm(83)[1] == Approx(20.2364842761)); 176 REQUIRE(ct.getGradYlm(83)[2] == Approx(-48.5675622627)); 177 REQUIRE(ct.getLaplYlm(83) == Approx(128.367962683)); 178 } 179 180 TEST_CASE("Cartesian Tensor evaluateWithHessian subset", "[numerics]") 181 { 182 CartesianTensor<double, TinyVector<double, 3>> ct(6); 183 184 TinyVector<double, 3> pt(1.3, 1.2, -0.5); 185 ct.evaluateWithHessian(pt); 186 187 //for (int i = 0; i < 35; i++) { 188 // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getHessYlm(i) << std::endl; 189 //} 190 191 REQUIRE(ct.getYlm(0) == Approx(0.282094791774)); 192 REQUIRE(ct.getGradYlm(0)[0] == Approx(0)); 193 REQUIRE(ct.getGradYlm(0)[1] == Approx(0)); 194 REQUIRE(ct.getGradYlm(0)[2] == Approx(0)); 195 196 REQUIRE(ct.getHessYlm(0)(0, 0) == Approx(0)); 197 REQUIRE(ct.getHessYlm(0)(0, 1) == Approx(0)); 198 REQUIRE(ct.getHessYlm(0)(0, 2) == Approx(0)); 199 REQUIRE(ct.getHessYlm(0)(1, 0) == Approx(0)); 200 REQUIRE(ct.getHessYlm(0)(1, 1) == Approx(0)); 201 REQUIRE(ct.getHessYlm(0)(1, 2) == Approx(0)); 202 REQUIRE(ct.getHessYlm(0)(2, 0) == Approx(0)); 203 REQUIRE(ct.getHessYlm(0)(2, 1) == Approx(0)); 204 REQUIRE(ct.getHessYlm(0)(2, 2) == Approx(0)); 205 206 207 REQUIRE(ct.getYlm(1) == Approx(0.635183265474)); 208 REQUIRE(ct.getGradYlm(1)[0] == Approx(0.488602511903)); 209 REQUIRE(ct.getGradYlm(1)[1] == Approx(0)); 210 REQUIRE(ct.getGradYlm(1)[2] == Approx(0)); 211 212 REQUIRE(ct.getHessYlm(1)(0, 0) == Approx(0)); 213 REQUIRE(ct.getHessYlm(1)(0, 1) == Approx(0)); 214 REQUIRE(ct.getHessYlm(1)(0, 2) == Approx(0)); 215 REQUIRE(ct.getHessYlm(1)(1, 0) == Approx(0)); 216 REQUIRE(ct.getHessYlm(1)(1, 1) == Approx(0)); 217 REQUIRE(ct.getHessYlm(1)(1, 2) == Approx(0)); 218 REQUIRE(ct.getHessYlm(1)(2, 0) == Approx(0)); 219 REQUIRE(ct.getHessYlm(1)(2, 1) == Approx(0)); 220 REQUIRE(ct.getHessYlm(1)(2, 2) == Approx(0)); 221 222 223 REQUIRE(ct.getYlm(15) == Approx(3.12417199136)); 224 REQUIRE(ct.getGradYlm(15)[0] == Approx(2.40320922412)); 225 REQUIRE(ct.getGradYlm(15)[1] == Approx(5.20695331894)); 226 REQUIRE(ct.getGradYlm(15)[2] == Approx(0)); 227 228 REQUIRE(ct.getHessYlm(15)(0, 0) == Approx(0)); 229 REQUIRE(ct.getHessYlm(15)(0, 1) == Approx(4.00534870687)); 230 REQUIRE(ct.getHessYlm(15)(0, 2) == Approx(0)); 231 REQUIRE(ct.getHessYlm(15)(1, 0) == Approx(4.00534870687)); 232 REQUIRE(ct.getHessYlm(15)(1, 1) == Approx(4.33912776578)); 233 REQUIRE(ct.getHessYlm(15)(1, 2) == Approx(0)); 234 REQUIRE(ct.getHessYlm(15)(2, 0) == Approx(0)); 235 REQUIRE(ct.getHessYlm(15)(2, 1) == Approx(0)); 236 REQUIRE(ct.getHessYlm(15)(2, 2) == Approx(0)); 237 238 239 REQUIRE(ct.getYlm(32) == Approx(-5.07677948596)); 240 REQUIRE(ct.getGradYlm(32)[0] == Approx(-7.81042997841)); 241 REQUIRE(ct.getGradYlm(32)[1] == Approx(-4.23064957164)); 242 REQUIRE(ct.getGradYlm(32)[2] == Approx(10.1535589719)); 243 244 REQUIRE(ct.getHessYlm(32)(0, 0) == Approx(-6.00802306031)); 245 REQUIRE(ct.getHessYlm(32)(0, 1) == Approx(-6.50869164867)); 246 REQUIRE(ct.getHessYlm(32)(0, 2) == Approx(15.6208599568)); 247 REQUIRE(ct.getHessYlm(32)(1, 0) == Approx(-6.50869164867)); 248 REQUIRE(ct.getHessYlm(32)(1, 1) == Approx(0)); 249 REQUIRE(ct.getHessYlm(32)(1, 2) == Approx(8.46129914327)); 250 REQUIRE(ct.getHessYlm(32)(2, 0) == Approx(15.6208599568)); 251 REQUIRE(ct.getHessYlm(32)(2, 1) == Approx(8.46129914327)); 252 REQUIRE(ct.getHessYlm(32)(2, 2) == Approx(0)); 253 254 255 REQUIRE(ct.getYlm(52) == Approx(-1.44809247474)); 256 REQUIRE(ct.getGradYlm(52)[0] == Approx(-1.11391728826)); 257 REQUIRE(ct.getGradYlm(52)[1] == Approx(-1.20674372895)); 258 REQUIRE(ct.getGradYlm(52)[2] == Approx(8.68855484841)); 259 260 REQUIRE(ct.getHessYlm(52)(0, 0) == Approx(0)); 261 REQUIRE(ct.getHessYlm(52)(0, 1) == Approx(-0.928264406882)); 262 REQUIRE(ct.getHessYlm(52)(0, 2) == Approx(6.68350372955)); 263 REQUIRE(ct.getHessYlm(52)(1, 0) == Approx(-0.928264406882)); 264 REQUIRE(ct.getHessYlm(52)(1, 1) == Approx(0)); 265 REQUIRE(ct.getHessYlm(52)(1, 2) == Approx(7.24046237368)); 266 REQUIRE(ct.getHessYlm(52)(2, 0) == Approx(6.68350372955)); 267 REQUIRE(ct.getHessYlm(52)(2, 1) == Approx(7.24046237368)); 268 REQUIRE(ct.getHessYlm(52)(2, 2) == Approx(-34.7542193937)); 269 270 271 REQUIRE(ct.getYlm(71) == Approx(-17.3423920977)); 272 REQUIRE(ct.getGradYlm(71)[0] == Approx(-53.3612064546)); 273 REQUIRE(ct.getGradYlm(71)[1] == Approx(-14.4519934148)); 274 REQUIRE(ct.getGradYlm(71)[2] == Approx(34.6847841955)); 275 276 REQUIRE(ct.getHessYlm(71)(0, 0) == Approx(-123.141245664)); 277 REQUIRE(ct.getHessYlm(71)(0, 1) == Approx(-44.4676720455)); 278 REQUIRE(ct.getHessYlm(71)(0, 2) == Approx(106.722412909)); 279 REQUIRE(ct.getHessYlm(71)(1, 0) == Approx(-44.4676720455)); 280 REQUIRE(ct.getHessYlm(71)(1, 1) == Approx(0)); 281 REQUIRE(ct.getHessYlm(71)(1, 2) == Approx(28.9039868295)); 282 REQUIRE(ct.getHessYlm(71)(2, 0) == Approx(106.722412909)); 283 REQUIRE(ct.getHessYlm(71)(2, 1) == Approx(28.9039868295)); 284 REQUIRE(ct.getHessYlm(71)(2, 2) == Approx(0)); 285 } 286 287 TEST_CASE("Cartesian Tensor evaluateWithThirdDeriv subset", "[numerics]") 288 { 289 CartesianTensor<double, TinyVector<double, 3>> ct(6); 290 291 TinyVector<double, 3> pt(1.3, 1.2, -0.5); 292 ct.evaluateWithThirdDeriv(pt); 293 294 //for (int i = 0; i < 35; i++) { 295 // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getGGGYlm(i) << std::endl; 296 //} 297 298 299 REQUIRE(ct.getYlm(0) == Approx(0.282094791774)); 300 301 302 REQUIRE(ct.getYlm(27) == Approx(-0.363846924275)); 303 REQUIRE(ct.getGradYlm(27)[0] == Approx(-0.279882249443)); 304 REQUIRE(ct.getGradYlm(27)[1] == Approx(0)); 305 REQUIRE(ct.getGradYlm(27)[2] == Approx(2.18308154565)); 306 307 REQUIRE(ct.getHessYlm(27)(0, 0) == Approx(0)); 308 REQUIRE(ct.getHessYlm(27)(0, 1) == Approx(0)); 309 REQUIRE(ct.getHessYlm(27)(0, 2) == Approx(1.67929349666)); 310 REQUIRE(ct.getHessYlm(27)(1, 0) == Approx(0)); 311 REQUIRE(ct.getHessYlm(27)(1, 1) == Approx(0)); 312 REQUIRE(ct.getHessYlm(27)(1, 2) == Approx(0)); 313 REQUIRE(ct.getHessYlm(27)(2, 0) == Approx(1.67929349666)); 314 REQUIRE(ct.getHessYlm(27)(2, 1) == Approx(0)); 315 REQUIRE(ct.getHessYlm(27)(2, 2) == Approx(-8.73232618261)); 316 317 318 REQUIRE(ct.getGGGYlm(27)[0](0, 0) == Approx(0)); 319 REQUIRE(ct.getGGGYlm(27)[0](0, 1) == Approx(0)); 320 REQUIRE(ct.getGGGYlm(27)[0](0, 2) == Approx(0)); 321 REQUIRE(ct.getGGGYlm(27)[0](1, 0) == Approx(0)); 322 REQUIRE(ct.getGGGYlm(27)[0](1, 1) == Approx(0)); 323 REQUIRE(ct.getGGGYlm(27)[0](1, 2) == Approx(0)); 324 REQUIRE(ct.getGGGYlm(27)[0](2, 0) == Approx(0)); 325 REQUIRE(ct.getGGGYlm(27)[0](2, 1) == Approx(0)); 326 REQUIRE(ct.getGGGYlm(27)[0](2, 2) == Approx(-6.71717398662)); 327 REQUIRE(ct.getGGGYlm(27)[1](0, 0) == Approx(0)); 328 REQUIRE(ct.getGGGYlm(27)[1](0, 1) == Approx(0)); 329 REQUIRE(ct.getGGGYlm(27)[1](0, 2) == Approx(0)); 330 REQUIRE(ct.getGGGYlm(27)[1](1, 0) == Approx(0)); 331 REQUIRE(ct.getGGGYlm(27)[1](1, 1) == Approx(0)); 332 REQUIRE(ct.getGGGYlm(27)[1](1, 2) == Approx(0)); 333 REQUIRE(ct.getGGGYlm(27)[1](2, 0) == Approx(0)); 334 REQUIRE(ct.getGGGYlm(27)[1](2, 1) == Approx(0)); 335 REQUIRE(ct.getGGGYlm(27)[1](2, 2) == Approx(0)); 336 REQUIRE(ct.getGGGYlm(27)[2](0, 0) == Approx(0)); 337 REQUIRE(ct.getGGGYlm(27)[2](0, 1) == Approx(0)); 338 REQUIRE(ct.getGGGYlm(27)[2](0, 2) == Approx(-6.71717398662)); 339 REQUIRE(ct.getGGGYlm(27)[2](1, 0) == Approx(0)); 340 REQUIRE(ct.getGGGYlm(27)[2](1, 1) == Approx(0)); 341 REQUIRE(ct.getGGGYlm(27)[2](1, 2) == Approx(0)); 342 REQUIRE(ct.getGGGYlm(27)[2](2, 0) == Approx(-6.71717398662)); 343 REQUIRE(ct.getGGGYlm(27)[2](2, 1) == Approx(0)); 344 REQUIRE(ct.getGGGYlm(27)[2](2, 2) == Approx(17.4646523652)); 345 346 347 REQUIRE(ct.getYlm(62) == Approx(-4.19700340252)); 348 REQUIRE(ct.getGradYlm(62)[0] == Approx(0)); 349 REQUIRE(ct.getGradYlm(62)[1] == Approx(-17.4875141772)); 350 REQUIRE(ct.getGradYlm(62)[2] == Approx(8.39400680505)); 351 352 REQUIRE(ct.getHessYlm(62)(0, 0) == Approx(0)); 353 REQUIRE(ct.getHessYlm(62)(0, 1) == Approx(0)); 354 REQUIRE(ct.getHessYlm(62)(0, 2) == Approx(0)); 355 REQUIRE(ct.getHessYlm(62)(1, 0) == Approx(0)); 356 REQUIRE(ct.getHessYlm(62)(1, 1) == Approx(-58.291713924)); 357 REQUIRE(ct.getHessYlm(62)(1, 2) == Approx(34.9750283544)); 358 REQUIRE(ct.getHessYlm(62)(2, 0) == Approx(0)); 359 REQUIRE(ct.getHessYlm(62)(2, 1) == Approx(34.9750283544)); 360 REQUIRE(ct.getHessYlm(62)(2, 2) == Approx(0)); 361 REQUIRE(ct.getGGGYlm(62)[0](0, 0) == Approx(0)); 362 REQUIRE(ct.getGGGYlm(62)[0](0, 1) == Approx(0)); 363 REQUIRE(ct.getGGGYlm(62)[0](0, 2) == Approx(0)); 364 REQUIRE(ct.getGGGYlm(62)[0](1, 0) == Approx(0)); 365 REQUIRE(ct.getGGGYlm(62)[0](1, 1) == Approx(0)); 366 REQUIRE(ct.getGGGYlm(62)[0](1, 2) == Approx(0)); 367 REQUIRE(ct.getGGGYlm(62)[0](2, 0) == Approx(0)); 368 REQUIRE(ct.getGGGYlm(62)[0](2, 1) == Approx(0)); 369 REQUIRE(ct.getGGGYlm(62)[0](2, 2) == Approx(0)); 370 REQUIRE(ct.getGGGYlm(62)[1](0, 0) == Approx(0)); 371 REQUIRE(ct.getGGGYlm(62)[1](0, 1) == Approx(0)); 372 REQUIRE(ct.getGGGYlm(62)[1](0, 2) == Approx(0)); 373 REQUIRE(ct.getGGGYlm(62)[1](1, 0) == Approx(0)); 374 REQUIRE(ct.getGGGYlm(62)[1](1, 1) == Approx(-145.72928481)); 375 REQUIRE(ct.getGGGYlm(62)[1](1, 2) == Approx(116.583427848)); 376 REQUIRE(ct.getGGGYlm(62)[1](2, 0) == Approx(0)); 377 REQUIRE(ct.getGGGYlm(62)[1](2, 1) == Approx(116.583427848)); 378 REQUIRE(ct.getGGGYlm(62)[1](2, 2) == Approx(0)); 379 REQUIRE(ct.getGGGYlm(62)[2](0, 0) == Approx(0)); 380 REQUIRE(ct.getGGGYlm(62)[2](0, 1) == Approx(0)); 381 REQUIRE(ct.getGGGYlm(62)[2](0, 2) == Approx(0)); 382 REQUIRE(ct.getGGGYlm(62)[2](1, 0) == Approx(0)); 383 REQUIRE(ct.getGGGYlm(62)[2](1, 1) == Approx(116.583427848)); 384 REQUIRE(ct.getGGGYlm(62)[2](1, 2) == Approx(0)); 385 REQUIRE(ct.getGGGYlm(62)[2](2, 0) == Approx(0)); 386 REQUIRE(ct.getGGGYlm(62)[2](2, 1) == Approx(0)); 387 REQUIRE(ct.getGGGYlm(62)[2](2, 2) == Approx(0)); 388 } 389 390 391 TEST_CASE("Cartesian Tensor evaluateThirdDerivOnly subset", "[numerics]") 392 { 393 CartesianTensor<double, TinyVector<double, 3>> ct(6); 394 395 TinyVector<double, 3> pt(1.3, 1.2, -0.5); 396 ct.evaluateThirdDerivOnly(pt); 397 398 REQUIRE(ct.getGGGYlm(14)[0](0, 0) == Approx(0)); 399 REQUIRE(ct.getGGGYlm(14)[0](0, 1) == Approx(0)); 400 REQUIRE(ct.getGGGYlm(14)[0](0, 2) == Approx(3.33779058906)); 401 REQUIRE(ct.getGGGYlm(14)[0](1, 0) == Approx(0)); 402 REQUIRE(ct.getGGGYlm(14)[0](1, 1) == Approx(0)); 403 REQUIRE(ct.getGGGYlm(14)[0](1, 2) == Approx(0)); 404 REQUIRE(ct.getGGGYlm(14)[0](2, 0) == Approx(3.33779058906)); 405 REQUIRE(ct.getGGGYlm(14)[0](2, 1) == Approx(0)); 406 REQUIRE(ct.getGGGYlm(14)[0](2, 2) == Approx(0)); 407 REQUIRE(ct.getGGGYlm(14)[1](0, 0) == Approx(0)); 408 REQUIRE(ct.getGGGYlm(14)[1](0, 1) == Approx(0)); 409 REQUIRE(ct.getGGGYlm(14)[1](0, 2) == Approx(0)); 410 REQUIRE(ct.getGGGYlm(14)[1](1, 0) == Approx(0)); 411 REQUIRE(ct.getGGGYlm(14)[1](1, 1) == Approx(0)); 412 REQUIRE(ct.getGGGYlm(14)[1](1, 2) == Approx(0)); 413 REQUIRE(ct.getGGGYlm(14)[1](2, 0) == Approx(0)); 414 REQUIRE(ct.getGGGYlm(14)[1](2, 1) == Approx(0)); 415 REQUIRE(ct.getGGGYlm(14)[1](2, 2) == Approx(0)); 416 REQUIRE(ct.getGGGYlm(14)[2](0, 0) == Approx(3.33779058906)); 417 REQUIRE(ct.getGGGYlm(14)[2](0, 1) == Approx(0)); 418 REQUIRE(ct.getGGGYlm(14)[2](0, 2) == Approx(0)); 419 REQUIRE(ct.getGGGYlm(14)[2](1, 0) == Approx(0)); 420 REQUIRE(ct.getGGGYlm(14)[2](1, 1) == Approx(0)); 421 REQUIRE(ct.getGGGYlm(14)[2](1, 2) == Approx(0)); 422 REQUIRE(ct.getGGGYlm(14)[2](2, 0) == Approx(0)); 423 REQUIRE(ct.getGGGYlm(14)[2](2, 1) == Approx(0)); 424 REQUIRE(ct.getGGGYlm(14)[2](2, 2) == Approx(0)); 425 426 427 REQUIRE(ct.getGGGYlm(33)[0](0, 0) == Approx(0)); 428 REQUIRE(ct.getGGGYlm(33)[0](0, 1) == Approx(0)); 429 REQUIRE(ct.getGGGYlm(33)[0](0, 2) == Approx(0)); 430 REQUIRE(ct.getGGGYlm(33)[0](1, 0) == Approx(0)); 431 REQUIRE(ct.getGGGYlm(33)[0](1, 1) == Approx(-5.00668588359)); 432 REQUIRE(ct.getGGGYlm(33)[0](1, 2) == Approx(12.0160461206)); 433 REQUIRE(ct.getGGGYlm(33)[0](2, 0) == Approx(0)); 434 REQUIRE(ct.getGGGYlm(33)[0](2, 1) == Approx(12.0160461206)); 435 REQUIRE(ct.getGGGYlm(33)[0](2, 2) == Approx(0)); 436 REQUIRE(ct.getGGGYlm(33)[1](0, 0) == Approx(0)); 437 REQUIRE(ct.getGGGYlm(33)[1](0, 1) == Approx(-5.00668588359)); 438 REQUIRE(ct.getGGGYlm(33)[1](0, 2) == Approx(12.0160461206)); 439 REQUIRE(ct.getGGGYlm(33)[1](1, 0) == Approx(-5.00668588359)); 440 REQUIRE(ct.getGGGYlm(33)[1](1, 1) == Approx(0)); 441 REQUIRE(ct.getGGGYlm(33)[1](1, 2) == Approx(13.0173832973)); 442 REQUIRE(ct.getGGGYlm(33)[1](2, 0) == Approx(12.0160461206)); 443 REQUIRE(ct.getGGGYlm(33)[1](2, 1) == Approx(13.0173832973)); 444 REQUIRE(ct.getGGGYlm(33)[1](2, 2) == Approx(0)); 445 REQUIRE(ct.getGGGYlm(33)[2](0, 0) == Approx(0)); 446 REQUIRE(ct.getGGGYlm(33)[2](0, 1) == Approx(12.0160461206)); 447 REQUIRE(ct.getGGGYlm(33)[2](0, 2) == Approx(0)); 448 REQUIRE(ct.getGGGYlm(33)[2](1, 0) == Approx(12.0160461206)); 449 REQUIRE(ct.getGGGYlm(33)[2](1, 1) == Approx(13.0173832973)); 450 REQUIRE(ct.getGGGYlm(33)[2](1, 2) == Approx(0)); 451 REQUIRE(ct.getGGGYlm(33)[2](2, 0) == Approx(0)); 452 REQUIRE(ct.getGGGYlm(33)[2](2, 1) == Approx(0)); 453 REQUIRE(ct.getGGGYlm(33)[2](2, 2) == Approx(0)); 454 455 456 REQUIRE(ct.getGGGYlm(80)[0](0, 0) == Approx(0)); 457 REQUIRE(ct.getGGGYlm(80)[0](0, 1) == Approx(0)); 458 REQUIRE(ct.getGGGYlm(80)[0](0, 2) == Approx(0)); 459 REQUIRE(ct.getGGGYlm(80)[0](1, 0) == Approx(0)); 460 REQUIRE(ct.getGGGYlm(80)[0](1, 1) == Approx(27.8256449422)); 461 REQUIRE(ct.getGGGYlm(80)[0](1, 2) == Approx(-66.7815478613)); 462 REQUIRE(ct.getGGGYlm(80)[0](2, 0) == Approx(0)); 463 REQUIRE(ct.getGGGYlm(80)[0](2, 1) == Approx(-66.7815478613)); 464 REQUIRE(ct.getGGGYlm(80)[0](2, 2) == Approx(53.425238289)); 465 REQUIRE(ct.getGGGYlm(80)[1](0, 0) == Approx(0)); 466 REQUIRE(ct.getGGGYlm(80)[1](0, 1) == Approx(27.8256449422)); 467 REQUIRE(ct.getGGGYlm(80)[1](0, 2) == Approx(-66.7815478613)); 468 REQUIRE(ct.getGGGYlm(80)[1](1, 0) == Approx(27.8256449422)); 469 REQUIRE(ct.getGGGYlm(80)[1](1, 1) == Approx(30.1444486874)); 470 REQUIRE(ct.getGGGYlm(80)[1](1, 2) == Approx(-144.6933537)); 471 REQUIRE(ct.getGGGYlm(80)[1](2, 0) == Approx(-66.7815478613)); 472 REQUIRE(ct.getGGGYlm(80)[1](2, 1) == Approx(-144.6933537)); 473 REQUIRE(ct.getGGGYlm(80)[1](2, 2) == Approx(173.632024439)); 474 REQUIRE(ct.getGGGYlm(80)[2](0, 0) == Approx(0)); 475 REQUIRE(ct.getGGGYlm(80)[2](0, 1) == Approx(-66.7815478613)); 476 REQUIRE(ct.getGGGYlm(80)[2](0, 2) == Approx(53.425238289)); 477 REQUIRE(ct.getGGGYlm(80)[2](1, 0) == Approx(-66.7815478613)); 478 REQUIRE(ct.getGGGYlm(80)[2](1, 1) == Approx(-144.6933537)); 479 REQUIRE(ct.getGGGYlm(80)[2](1, 2) == Approx(173.632024439)); 480 REQUIRE(ct.getGGGYlm(80)[2](2, 0) == Approx(53.425238289)); 481 REQUIRE(ct.getGGGYlm(80)[2](2, 1) == Approx(173.632024439)); 482 REQUIRE(ct.getGGGYlm(80)[2](2, 2) == Approx(0)); 483 } 484 } // namespace qmcplusplus 485