Statistiques
| Révision :

root / src / CalcBMat_mixed.f90 @ 3

Historique | Voir | Annoter | Télécharger (2,89 ko)

1
subroutine CalcBMat_mixed (natoms, xyzatm, indzmat, dzdc)
2

    
3
  use Io_module
4
  use Path_module, only : MW, NCart
5

    
6
  IMPLICIT NONE
7

    
8

    
9
  integer(KINT), INTENT(IN) :: natoms, indzmat(natoms,5)
10
  real(KREAL), INTENT(IN)   :: xyzatm(3,natoms)
11
  real(KREAL), INTENT(OUT)   :: dzdc(3*natoms,3*natoms)
12

    
13

    
14
!!!!!!!!!!!!!!!!!!!!!
15
!
16
! This routine computes the derivatives of the internal coordinates
17
! with respect to the cartesian coordinates.
18
! This is what is called the B matrix in Baker coordinates :
19
! B(i,j)=dz_i/dx_j
20
!
21
! it uses the same routines as Calc_baker
22
!
23
! Here, it is used for mixed Cart+Z-mat system
24
!
25
!!!!!!!!!!!!!!!!!!!!!!
26
!
27
! Input:
28
! natoms: number of atoms
29
! xyzatm(3,natoms): cartesian geometry
30
! indzmat(natoms,5): index of the Z-matrix definition
31
! atmass(natoms): mass of the atoms
32
! atome(natoms): ??
33
!
34
! Output:
35
! dzdc(3*natoms,3*natoms): B matrix
36
!
37
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38

    
39

    
40
  INTERFACE
41
     function valid(string) result (isValid)
42
       CHARACTER(*), intent(in) :: string
43
       logical                  :: isValid
44
     END function VALID
45
  END INTERFACE
46

    
47
  LOGICAL :: debug
48
  INTEGER(KINT) :: i,j,k,iat, istart
49
  INTEGER(KINT) :: iat1, iat2, iat3, iat4
50

    
51

    
52

    
53
  ! ======================================================================
54

    
55
  debug=valid('CalcBMat').OR.valid('CalcBMat_mixed')
56

    
57
  if (debug) Call Header('Entering CalcBMat_mixed')
58
  if (debug) THEN
59
     WRITE(*,*) 'DBG CalcBMat_mixed Xyzatm '
60
     DO iat=1,natoms
61
        write(*,'(1X,I5,3(1X,F15.6))') iat, xyzatm(1:3,iat)
62
     END DO
63
     WRITE(*,*) 'DBG CalcBMat_mixed IndZmat'
64
     DO iat=1,natoms
65
        write(*,'(6(1X,I5))') iat, indzmat(iat,1:4)
66
     END DO
67
  END IF
68

    
69
  dzdc=0.d0
70
  do i = 1, NCart
71
     iat=indzmat(i,1)
72
     do j=1,3
73
        k=(iat-1)*3+j
74
        dzdc(k,k)=1.d0
75
     END DO
76
  END DO
77

    
78
    IF (NCart.EQ.1) THEN
79
       if (natoms.ge.2) THEN
80
          iat1=indzmat(2,1)
81
          iat2=indzmat(2,2)
82
          Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,4))
83
         END IF
84
    END IF
85
    IF (NCart.LE.2) THEN
86
       if (natoms.ge.3) THEN
87
          iat1=indzmat(3,1)
88
          iat2=indzmat(3,2)
89
          iat3=indzmat(3,3)
90
          Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,7))
91
          CALL CONSTRAINTS_BONDANGLE_DER(Natoms,iAt1,iAT2,iAt3, xyzatm, dzdc(1,8))
92
       END IF
93
    END IF
94

    
95
    IStart=max(NCart+1,4)
96
    k=(IStart-1)*3+1
97
  DO I=IStart, Natoms
98
     iat1=indzmat(i,1)
99
     iat2=indzmat(i,2)
100
     iat3=indzmat(i,3)
101
     iat4=indzmat(i,4)
102
     Call CONSTRAINTS_BONDLENGTH_DER(Natoms,iat1,iAT2, xyzatm, dzdc(1,k))
103
     k=k+1
104
     CALL CONSTRAINTS_BONDANGLE_DER(Natoms,iAt1,iAT2,iAt3, xyzatm, dzdc(1,k))
105
     k=k+1
106
     CALL CONSTRAINTS_TORSION_DER2(Natoms,iat1,iat2,iat3,iat4, xyzatm, dzdc(1,k)) 
107
     k=k+1
108
  END DO
109
             
110

    
111

    
112

    
113

    
114
  if (debug) Call Header('CalcBMat_mixed over')
115

    
116
  ! ======================================================================
117

    
118
end subroutine CalcBMat_mixed