root / src / CalcBMat_mixed.f90 @ 3
Historique | Voir | Annoter | Télécharger (2,89 ko)
| 1 | 2 | pfleura2 | subroutine CalcBMat_mixed (natoms, xyzatm, indzmat, dzdc) |
|---|---|---|---|
| 2 | 1 | pfleura2 | |
| 3 | 1 | pfleura2 | use Io_module |
| 4 | 1 | pfleura2 | use Path_module, only : MW, NCart |
| 5 | 1 | pfleura2 | |
| 6 | 1 | pfleura2 | IMPLICIT NONE |
| 7 | 1 | pfleura2 | |
| 8 | 1 | pfleura2 | |
| 9 | 2 | pfleura2 | integer(KINT), INTENT(IN) :: natoms, indzmat(natoms,5) |
| 10 | 2 | pfleura2 | real(KREAL), INTENT(IN) :: xyzatm(3,natoms) |
| 11 | 2 | pfleura2 | real(KREAL), INTENT(OUT) :: dzdc(3*natoms,3*natoms) |
| 12 | 1 | pfleura2 | |
| 13 | 1 | pfleura2 | |
| 14 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!! |
| 15 | 1 | pfleura2 | ! |
| 16 | 1 | pfleura2 | ! This routine computes the derivatives of the internal coordinates |
| 17 | 1 | pfleura2 | ! with respect to the cartesian coordinates. |
| 18 | 1 | pfleura2 | ! This is what is called the B matrix in Baker coordinates : |
| 19 | 1 | pfleura2 | ! B(i,j)=dz_i/dx_j |
| 20 | 1 | pfleura2 | ! |
| 21 | 1 | pfleura2 | ! it uses the same routines as Calc_baker |
| 22 | 1 | pfleura2 | ! |
| 23 | 1 | pfleura2 | ! Here, it is used for mixed Cart+Z-mat system |
| 24 | 1 | pfleura2 | ! |
| 25 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!!! |
| 26 | 1 | pfleura2 | ! |
| 27 | 1 | pfleura2 | ! Input: |
| 28 | 1 | pfleura2 | ! natoms: number of atoms |
| 29 | 1 | pfleura2 | ! xyzatm(3,natoms): cartesian geometry |
| 30 | 1 | pfleura2 | ! indzmat(natoms,5): index of the Z-matrix definition |
| 31 | 1 | pfleura2 | ! atmass(natoms): mass of the atoms |
| 32 | 1 | pfleura2 | ! atome(natoms): ?? |
| 33 | 1 | pfleura2 | ! |
| 34 | 1 | pfleura2 | ! Output: |
| 35 | 1 | pfleura2 | ! dzdc(3*natoms,3*natoms): B matrix |
| 36 | 1 | pfleura2 | ! |
| 37 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 38 | 1 | pfleura2 | |
| 39 | 1 | pfleura2 | |
| 40 | 1 | pfleura2 | INTERFACE |
| 41 | 1 | pfleura2 | function valid(string) result (isValid) |
| 42 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
| 43 | 1 | pfleura2 | logical :: isValid |
| 44 | 1 | pfleura2 | END function VALID |
| 45 | 1 | pfleura2 | END INTERFACE |
| 46 | 1 | pfleura2 | |
| 47 | 1 | pfleura2 | LOGICAL :: debug |
| 48 | 1 | pfleura2 | INTEGER(KINT) :: i,j,k,iat, istart |
| 49 | 1 | pfleura2 | INTEGER(KINT) :: iat1, iat2, iat3, iat4 |
| 50 | 1 | pfleura2 | |
| 51 | 1 | pfleura2 | |
| 52 | 1 | pfleura2 | |
| 53 | 1 | pfleura2 | ! ====================================================================== |
| 54 | 1 | pfleura2 | |
| 55 | 1 | pfleura2 | debug=valid('CalcBMat').OR.valid('CalcBMat_mixed')
|
| 56 | 1 | pfleura2 | |
| 57 | 1 | pfleura2 | if (debug) Call Header('Entering CalcBMat_mixed')
|
| 58 | 1 | pfleura2 | if (debug) THEN |
| 59 | 1 | pfleura2 | WRITE(*,*) 'DBG CalcBMat_mixed Xyzatm ' |
| 60 | 1 | pfleura2 | DO iat=1,natoms |
| 61 | 1 | pfleura2 | write(*,'(1X,I5,3(1X,F15.6))') iat, xyzatm(1:3,iat) |
| 62 | 1 | pfleura2 | END DO |
| 63 | 1 | pfleura2 | WRITE(*,*) 'DBG CalcBMat_mixed IndZmat' |
| 64 | 1 | pfleura2 | DO iat=1,natoms |
| 65 | 1 | pfleura2 | write(*,'(6(1X,I5))') iat, indzmat(iat,1:4) |
| 66 | 1 | pfleura2 | END DO |
| 67 | 1 | pfleura2 | END IF |
| 68 | 1 | pfleura2 | |
| 69 | 1 | pfleura2 | dzdc=0.d0 |
| 70 | 1 | pfleura2 | do i = 1, NCart |
| 71 | 1 | pfleura2 | iat=indzmat(i,1) |
| 72 | 1 | pfleura2 | do j=1,3 |
| 73 | 1 | pfleura2 | k=(iat-1)*3+j |
| 74 | 1 | pfleura2 | dzdc(k,k)=1.d0 |
| 75 | 1 | pfleura2 | END DO |
| 76 | 1 | pfleura2 | END DO |
| 77 | 1 | pfleura2 | |
| 78 | 1 | pfleura2 | IF (NCart.EQ.1) THEN |
| 79 | 1 | pfleura2 | if (natoms.ge.2) THEN |
| 80 | 1 | pfleura2 | iat1=indzmat(2,1) |
| 81 | 1 | pfleura2 | iat2=indzmat(2,2) |
| 82 | 1 | pfleura2 | Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,4)) |
| 83 | 1 | pfleura2 | END IF |
| 84 | 1 | pfleura2 | END IF |
| 85 | 1 | pfleura2 | IF (NCart.LE.2) THEN |
| 86 | 1 | pfleura2 | if (natoms.ge.3) THEN |
| 87 | 1 | pfleura2 | iat1=indzmat(3,1) |
| 88 | 1 | pfleura2 | iat2=indzmat(3,2) |
| 89 | 1 | pfleura2 | iat3=indzmat(3,3) |
| 90 | 1 | pfleura2 | Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,7)) |
| 91 | 1 | pfleura2 | CALL CONSTRAINTS_BONDANGLE_DER(Natoms,iAt1,iAT2,iAt3, xyzatm, dzdc(1,8)) |
| 92 | 1 | pfleura2 | END IF |
| 93 | 1 | pfleura2 | END IF |
| 94 | 1 | pfleura2 | |
| 95 | 1 | pfleura2 | IStart=max(NCart+1,4) |
| 96 | 1 | pfleura2 | k=(IStart-1)*3+1 |
| 97 | 1 | pfleura2 | DO I=IStart, Natoms |
| 98 | 1 | pfleura2 | iat1=indzmat(i,1) |
| 99 | 1 | pfleura2 | iat2=indzmat(i,2) |
| 100 | 1 | pfleura2 | iat3=indzmat(i,3) |
| 101 | 1 | pfleura2 | iat4=indzmat(i,4) |
| 102 | 1 | pfleura2 | Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,k)) |
| 103 | 1 | pfleura2 | k=k+1 |
| 104 | 1 | pfleura2 | CALL CONSTRAINTS_BONDANGLE_DER(Natoms,iAt1,iAT2,iAt3, xyzatm, dzdc(1,k)) |
| 105 | 1 | pfleura2 | k=k+1 |
| 106 | 1 | pfleura2 | CALL CONSTRAINTS_TORSION_DER2(Natoms,iat1,iat2,iat3,iat4, xyzatm, dzdc(1,k)) |
| 107 | 1 | pfleura2 | k=k+1 |
| 108 | 1 | pfleura2 | END DO |
| 109 | 1 | pfleura2 | |
| 110 | 1 | pfleura2 | |
| 111 | 1 | pfleura2 | |
| 112 | 1 | pfleura2 | |
| 113 | 1 | pfleura2 | |
| 114 | 1 | pfleura2 | if (debug) Call Header('CalcBMat_mixed over')
|
| 115 | 1 | pfleura2 | |
| 116 | 1 | pfleura2 | ! ====================================================================== |
| 117 | 1 | pfleura2 | |
| 118 | 1 | pfleura2 | end subroutine CalcBMat_mixed |