1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
|
C Copyright (c) 2003-2010 University of Florida
C
C This program is free software; you can redistribute it and/or modify
C it under the terms of the GNU General Public License as published by
C the Free Software Foundation; either version 2 of the License, or
C (at your option) any later version.
C This program is distributed in the hope that it will be useful,
C but WITHOUT ANY WARRANTY; without even the implied warranty of
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
C GNU General Public License for more details.
C The GNU General Public License is included in this distribution
C in the file COPYRIGHT.
SUBROUTINE NLO__CHECK_NHO_ALL_X_CENTERS
+
+ ( NATOM,
+ BONDSIZE,NBOSIZE,
+ NHCEN,NHATOM,
+ MXNHBA,MXNBA,
+ ATHCEN,ATNHB,ATHVAL,ATHOFF,
+ RYD2HYB,
+ ATHIDX,INDEX,
+ NHB,NHA,
+ WBOND,WSTAR,
+ SAH,
+ PH,PHSUB,
+ BOMAT,
+ MXCHOOSE,NCHOOSE,CHOOSE,
+ IVEC,
+ XVEC,XMAT,
+
+ FAILED,
+ NBOND,
+ NHYB,
+ BDNCEN,
+ BDCEN,
+ BDNBAS,
+ BDBAS,
+ BDOCC,
+ W,H,
+ PHDEP )
+
C------------------------------------------------------------------------
C OPERATION : NLO__CHECK_NHO_ALL_X_CENTERS
C MODULE : Natural Localized Orbitals
C MODULE-ID : NLO
C DESCRIPTION : This routine checks, if bond forming pre-NHO orbitals
C can be constructed over NHCEN atomic hybrid centers
C from the present hybrid occupation matrix PH. The
C occupation matrix PH may already have been depleted of
C several large eigenvalues corresponding to occupied
C bond orbitals.
C
C The procedure loops over all distinct! NHCEN atomic
C hybrid center combinations and tries each out for
C possible bond forming pre-NHO construction. If, at
C any stage of this process, a failure in the bond
C forming pre-NHO generation is issued by the calling
C subroutines, the routine returns immediately.
C
C Since 2-center bonds play such a fundamental role,
C the routine considers this special case in a different
C way. Rather than looping by brute force over all
C atomic pairs indiscriminantly, the loop is only over
C those atomic pairs which were found to have the
C largest atomic bond orders. By imposing that order
C for the 2-center bond search we eliminate all possible
C 'surprise' bonds between two centers that might pop
C up during the brute force search, preventing 2-center
C bonds to be formed where they actually should be. The
C 'surprise' bonds can form when the weight criterion
C for bond formation is low and they prevent true bond
C formation later on because they remove the bond
C content from the occupation matrix.
C
C
C Input:
C
C NATOM = total # of atomic centers
C BONDSIZE = maximum # of atomic centers that
C are allowed to form a bond.
C NBOSIZE = maximum # of NHOs that will
C participate in forming a NBO.
C NHCEN = current # of atomic hybrid centers
C to be checked for NHCEN centered
C bond construction.
C NHATOM = current total # of atomic hybrid
C centers left for checking.
C MXNHBA = maximum # of Hybrid NAOs per atom.
C MXNBA = overall maximum between the
C maximum # of Hybrid, Core and
C Rydberg NAOs per atom.
C ATHCEN (I) = current hybrid atomic labels
C (indices) for I-th atomic hybrid
C center within the set of NHATOM
C atomic hybrid centers.
C ATNHB (A) = # of Hybrid NAOs on hybrid atom A.
C ATHVAL (A) = # of Valence NAOs on hybrid atom A.
C ATHOFF (A) = index offset for Hybrid NAOs for
C hybrid atom A. This index is equal
C to the total number of Hybrid NAOs
C on all hybrid atoms preceeding
C hybrid atom A.
C RYD2HYB = is true, if the Rydberg NAO space
C should be included next to the
C Valence NAO space for natural
C hybrid orbital (NHO) construction.
C If false, only the Valence NAO
C space will be used.
C ATHIDX (I) = will contain NHCEN atomic labels
C out of the pool of the NHATOM
C atomic labels present in array
C ATHCEN.
C INDEX (I) = simple index array that will hold
C index numbers from 1 to NHCEN in
C strictly increasing order.
C NHB = total # of Hybrid NAOs.
C NHA = total # of hybrid atoms.
C WBOND = lowest weight above which a
C NHCEN-centered bond formation
C is accepted.
C WSTAR = highest weight below which a
C NHCEN-centered antibond formation
C is accepted.
C SAH = will contain the atomic hybrid
C overlap matrices between pre-NHOs.
C PH = current (possibly frequently large
C eigenvalue depleted) NHB x NHB
C hybrid occupation matrix.
C PHSUB = will contain the submatrix of
C the occupation matrix PH
C corresponding to a specific
C NHCEN atomic hybrid center
C combination.
C BOMAT (A,B) = simplified bond order matrix
C containing info if atoms A and B
C are considered to be bonded or not
C MXCHOOSE = maximum # of bonds selected to
C be chosen. The maximum is build
C from all # of chosen bonds for all
C bondsizes.
C NCHOOSE = # of bonds to be chosen for bonds
C of size NHCEN. Four cases:
C 1) = 9999 => skip search for bonds
C of size NHCEN.
C 2) = 0 => complete search for all
C possible bonds of size NHCEN
C will be performed.
C 3) = -n => only n bonds of size
C NHCEN will be searched between
C those atomic indices as
C provided by the CHOOSE array.
C 4) = +n => same as case 3) but
C followed by a complete search
C for all possible remaining
C bonds of size NHCEN.
C Priority level: 1) > 3) > 4) > 2).
C CHOOSE (I,N) = contains the I-th atomic index of
C the N-th chosen bond of size NHCEN.
C The order of the atomic indices
C is arbitrary.
C IVEC = int scratch array of vector type
C XVEC = flp scratch array of vector type
C XMAT = flp scratch array of matrix type
C
C
C
C Output:
C
C FAILED = is true, if any problems were
C found such that the present
C and subordinate routines cannot
C proceed.
C NBOND = current total # of bonds.
C NHYB (A) = current total # of pre-NHO's on
C each hybrid atom A.
C BDNCEN (J) = # of atomic centers for J-th bond.
C BDCEN (I,J) = I-th atomic center index for
C J-th bond.
C BDNBAS (J) = # of basis functions (NHOs) for
C J-th bond.
C BDBAS (I,J) = I-th global basis (NHO) index for
C J-th bond.
C BDOCC (J) = # of occupied levels for J-th bond.
C W = pre-NHO weight vector to accumulate
C the weights for WSW procedure.
C H (I,J) = MXNBA x NHB matrix containing the
C current found set of pre-NHOs for
C each hybrid atom. I is the local
C atomic index labeling the atomic
C hybrid NAOs from which the NHOs are
C constructed. J is the global NHO
C index running over all NHB space
C pre-NHOs in that order, with all
C pre-NHOs belonging to a specific
C atomic center being grouped
C together.
C PHDEP = used for accumulation of the
C depleted occupation matrix PH.
C
C
C AUTHOR : Norbert Flocke
C------------------------------------------------------------------------
C
C
C ...include files and declare variables.
C
C
IMPLICIT NONE
LOGICAL ABSOLUT
LOGICAL ACCEPT
LOGICAL CHOOSED
LOGICAL FAILED
LOGICAL INCRESE
LOGICAL NLO__ACCEPT_ATOMS_BOND_SEARCH
LOGICAL RYD2HYB
INTEGER BONDSIZE,NBOSIZE
INTEGER I,K,N
INTEGER IXPOS
INTEGER MXCHOOSE
INTEGER MXNHBA,MXNBA
INTEGER NATOM
INTEGER NBOND
INTEGER NCHOOSE
INTEGER NHCEN
INTEGER NHATOM
INTEGER NHB,NHA
INTEGER ATNHB (1:NHA )
INTEGER ATHCEN (1:NHATOM)
INTEGER ATHIDX (1:NHCEN )
INTEGER ATHOFF (1:NHA )
INTEGER ATHVAL (1:NHA )
INTEGER BDNBAS (1:NHB )
INTEGER BDNCEN (1:NHB )
INTEGER BDOCC (1:NHB )
INTEGER INDEX (1:NHCEN )
INTEGER IVEC (1:2*NHB+NHA)
INTEGER NHYB (1:NHA )
INTEGER BDBAS (1:NBOSIZE,1:NHB)
INTEGER BDCEN (1:NBOSIZE,1:NHB)
INTEGER CHOOSE (1:BONDSIZE,1:MXCHOOSE)
DOUBLE PRECISION WBOND,WSTAR
DOUBLE PRECISION W (1:NHB)
DOUBLE PRECISION XVEC (1:2*NHB)
DOUBLE PRECISION BOMAT (1:NATOM ,1:NATOM )
DOUBLE PRECISION H (1:MXNBA ,1:NHB )
DOUBLE PRECISION PH (1:NHB ,1:NHB )
DOUBLE PRECISION PHDEP (1:NHB ,1:NHB )
DOUBLE PRECISION PHSUB (1:NHB ,1:NHB )
DOUBLE PRECISION SAH (1:MXNHBA,1:MXNHBA)
DOUBLE PRECISION XMAT (1:NHB ,1:NHB )
C
C
C------------------------------------------------------------------------
C
C
C ...if bonds of size NHCEN should be skipped, return.
C
C
IF (NCHOOSE.EQ.9999) THEN
RETURN
END IF
C
C
C ...if bonds of size NHCEN have been choosen, do these
C first.
C
C
CHOOSED = .FALSE.
N = IABS (NCHOOSE)
IF (N.GT.0) THEN
ABSOLUT = .FALSE.
INCRESE = .TRUE.
DO K = 1,N
ACCEPT = NLO__ACCEPT_ATOMS_BOND_SEARCH
+
+ ( NATOM,
+ BONDSIZE,
+ NHCEN,NHA,
+ CHOOSE (1,K),ATHVAL,
+ NHYB,
+ BOMAT,
+ CHOOSED,
+ MXCHOOSE,NCHOOSE,CHOOSE,
+ IVEC )
+
+
IF (ACCEPT) THEN
CALL NLO__SORT_INT_VECTOR_ELEMENTS
+
+ ( NHCEN,NHCEN,
+ 1,NHCEN,
+ ABSOLUT,INCRESE,
+ 0,
+ CHOOSE (1,K),
+
+ IVEC )
+
+
DO I = 1,NHCEN
ATHIDX (I) = CHOOSE (IVEC (I),K)
END DO
CALL NLO__CHECK_NHO_X_CENTERS
+
+ ( NHCEN,
+ NBOSIZE,
+ MXNHBA,MXNBA,
+ ATHIDX,ATNHB,ATHVAL,ATHOFF,
+ RYD2HYB,
+ NHB,NHA,
+ WBOND,WSTAR,
+ SAH,
+ PH,PHSUB,
+ IVEC (1),IVEC (NHB+1),IVEC (2*NHB+1),
+ XVEC (1),
+ XVEC (NHB+1),XMAT,
+
+ FAILED,
+ NBOND,
+ NHYB,
+ BDNCEN,
+ BDCEN,
+ BDNBAS,
+ BDBAS,
+ BDOCC,
+ W,H,
+ PHDEP )
+
+
IF (FAILED) THEN
RETURN
END IF
END IF
END DO
IF (NCHOOSE.LT.0) THEN
RETURN
END IF
CHOOSED = .TRUE.
END IF
C
C
C ...the complete search for all bonds of size NHCEN.
C Handle special situation for 1-center bonds.
C
C
IF (NHCEN.EQ.1) THEN
DO K = 1,NHATOM
ATHIDX (1) = ATHCEN (K)
CALL NLO__CHECK_NHO_X_CENTERS
+
+ ( 1,
+ NBOSIZE,
+ MXNHBA,MXNBA,
+ ATHIDX,ATNHB,ATHVAL,ATHOFF,
+ RYD2HYB,
+ NHB,NHA,
+ WBOND,WSTAR,
+ SAH,
+ PH,PHSUB,
+ IVEC (1),IVEC (NHB+1),IVEC (2*NHB+1),
+ XVEC (1),
+ XVEC (NHB+1),XMAT,
+
+ FAILED,
+ NBOND,
+ NHYB,
+ BDNCEN,
+ BDCEN,
+ BDNBAS,
+ BDBAS,
+ BDOCC,
+ W,H,
+ PHDEP )
+
+
IF (FAILED) THEN
RETURN
END IF
END DO
RETURN
END IF
C
C
C ...the general case for bond with >= 2 centers. Set
C initial atomic hybrid center index combination:
C 1 2 3 4 5 ...
C
C
ABSOLUT = .FALSE.
INCRESE = .TRUE.
DO I = 1,NHCEN
IVEC (I) = ATHCEN (I)
INDEX (I) = I
END DO
ACCEPT = NLO__ACCEPT_ATOMS_BOND_SEARCH
+
+ ( NATOM,
+ BONDSIZE,
+ NHCEN,NHA,
+ IVEC,ATHVAL,
+ NHYB,
+ BOMAT,
+ CHOOSED,
+ MXCHOOSE,NCHOOSE,CHOOSE,
+ IVEC (NHCEN+1) )
+
+
IF (ACCEPT) THEN
CALL NLO__SORT_INT_VECTOR_ELEMENTS
+
+ ( NHCEN,NHCEN,
+ 1,NHCEN,
+ ABSOLUT,INCRESE,
+ 0,
+ IVEC,
+
+ IVEC (NHCEN+1) )
+
+
DO I = 1,NHCEN
ATHIDX (I) = IVEC (IVEC (NHCEN+I))
END DO
CALL NLO__CHECK_NHO_X_CENTERS
+
+ ( NHCEN,
+ NBOSIZE,
+ MXNHBA,MXNBA,
+ ATHIDX,ATNHB,ATHVAL,ATHOFF,
+ RYD2HYB,
+ NHB,NHA,
+ WBOND,WSTAR,
+ SAH,
+ PH,PHSUB,
+ IVEC (1),IVEC (NHB+1),IVEC (2*NHB+1),
+ XVEC (1),
+ XVEC (NHB+1),XMAT,
+
+ FAILED,
+ NBOND,
+ NHYB,
+ BDNCEN,
+ BDCEN,
+ BDNBAS,
+ BDBAS,
+ BDOCC,
+ W,H,
+ PHDEP )
+
+
IF (FAILED) THEN
RETURN
END IF
END IF
K = 0
C
C
C ...find all combinations of the NHCEN index numbers
C such that each index number is greater than the
C preceeding one. If we encounter an index combination
C that gives us a hybrid atom combination involving
C at least one atom with an already complete bond forming
C pre-NHO set, that index combination is not accepted
C for x-center bond search, and we move to the next
C possible one. The same, if the index combination
C indicates isolated (not bonded) atoms, as judged by
C the simplified bond order matrix.
C
C
1000 IXPOS = NHCEN - K
INDEX (IXPOS) = INDEX (IXPOS) + 1
IF (INDEX (IXPOS) .LE. (NHATOM-K)) THEN
DO I = 1,K
INDEX (IXPOS+I) = INDEX (IXPOS) + I
END DO
DO I = 1,NHCEN
IVEC (I) = ATHCEN (INDEX (I))
END DO
ACCEPT = NLO__ACCEPT_ATOMS_BOND_SEARCH
+
+ ( NATOM,
+ BONDSIZE,
+ NHCEN,NHA,
+ IVEC,ATHVAL,
+ NHYB,
+ BOMAT,
+ CHOOSED,
+ MXCHOOSE,NCHOOSE,CHOOSE,
+ IVEC (NHCEN+1) )
+
+
C
C
C ...if the current atomic index pattern is found to
C be accepted, reorder the atomic indices such that
C indices i,j,k,... will be ordered in ascending
C order i<j<k<...to allow easy construction of the
C corresponding density submatrix. Note, that the
C atomic index vector ATHIDX is being overwritten
C by this reordering.
C
C
IF (ACCEPT) THEN
CALL NLO__SORT_INT_VECTOR_ELEMENTS
+
+ ( NHCEN,NHCEN,
+ 1,NHCEN,
+ ABSOLUT,INCRESE,
+ 0,
+ IVEC,
+
+ IVEC (NHCEN+1) )
+
+
DO I = 1,NHCEN
ATHIDX (I) = IVEC (IVEC (NHCEN+I))
END DO
CALL NLO__CHECK_NHO_X_CENTERS
+
+ ( NHCEN,
+ NBOSIZE,
+ MXNHBA,MXNBA,
+ ATHIDX,ATNHB,ATHVAL,ATHOFF,
+ RYD2HYB,
+ NHB,NHA,
+ WBOND,WSTAR,
+ SAH,
+ PH,PHSUB,
+ IVEC (1),IVEC (NHB+1),IVEC (2*NHB+1),
+ XVEC (1),
+ XVEC (NHB+1),XMAT,
+
+ FAILED,
+ NBOND,
+ NHYB,
+ BDNCEN,
+ BDCEN,
+ BDNBAS,
+ BDBAS,
+ BDOCC,
+ W,H,
+ PHDEP )
+
+
IF (FAILED) THEN
RETURN
END IF
END IF
K = 0
ELSE
K = K + 1
IF (K .GT. (NHCEN-1)) THEN
RETURN
END IF
END IF
GOTO 1000
C
C
C ...ready!
C
C
END
|