Statistiques
| Révision :

root / src / WriteMixed_Gaussian.f90 @ 12

Historique | Voir | Annoter | Télécharger (4,16 ko)

1 12 pfleura2
SUBROUTINE WriteMixed_Gaussian(na,atome,NCart,ind_zmat,val_zmat)
2 12 pfleura2
!----------------------------------------------------------------------
3 12 pfleura2
!  Copyright 2003-2014 Ecole Normale Supérieure de Lyon,
4 12 pfleura2
!  Centre National de la Recherche Scientifique,
5 12 pfleura2
!  Université Claude Bernard Lyon 1. All rights reserved.
6 12 pfleura2
!
7 12 pfleura2
!  This work is registered with the Agency for the Protection of Programs
8 12 pfleura2
!  as IDDN.FR.001.100009.000.S.P.2014.000.30625
9 12 pfleura2
!
10 12 pfleura2
!  Authors: P. Fleurat-Lessard, P. Dayal
11 12 pfleura2
!  Contact: optnpath@gmail.com
12 12 pfleura2
!
13 12 pfleura2
! This file is part of "Opt'n Path".
14 12 pfleura2
!
15 12 pfleura2
!  "Opt'n Path" is free software: you can redistribute it and/or modify
16 12 pfleura2
!  it under the terms of the GNU Affero General Public License as
17 12 pfleura2
!  published by the Free Software Foundation, either version 3 of the License,
18 12 pfleura2
!  or (at your option) any later version.
19 12 pfleura2
!
20 12 pfleura2
!  "Opt'n Path" is distributed in the hope that it will be useful,
21 12 pfleura2
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
22 12 pfleura2
!
23 12 pfleura2
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 12 pfleura2
!  GNU Affero General Public License for more details.
25 12 pfleura2
!
26 12 pfleura2
!  You should have received a copy of the GNU Affero General Public License
27 12 pfleura2
!  along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>.
28 12 pfleura2
!
29 12 pfleura2
! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr,
30 12 pfleura2
! for commercial licensing opportunities.
31 12 pfleura2
!----------------------------------------------------------------------
32 12 pfleura2
33 12 pfleura2
  Use Path_module, only :   Nom
34 12 pfleura2
  Use Io_module
35 12 pfleura2
36 12 pfleura2
  IMPLICIT NONE
37 12 pfleura2
! Parameters of the subroutine
38 12 pfleura2
! na: number of atoms in the system
39 12 pfleura2
  integer(KINT), INTENT(IN) ::  na
40 12 pfleura2
! atome: Mass number of the atoms of the system
41 12 pfleura2
  integer(KINT), INTENT(IN) ::  atome(na)
42 12 pfleura2
! nCart: number of atoms described in cartesian
43 12 pfleura2
  integer(KINT), INTENT(IN) ::  NCart
44 12 pfleura2
! ind_zmat: for "zmat" atoms contains the indices of reference atoms
45 12 pfleura2
  integer(KINT), INTENT(IN) ::  ind_zmat(Na,5)
46 12 pfleura2
! val_zmat: for "zmat" atoms contains the values from reference atoms
47 12 pfleura2
  real(KREAL), INTENT(IN)   :: val_zmat(Na,3)
48 12 pfleura2
49 12 pfleura2
  character(6) :: at1, at2, at3, at4, d, a, dh
50 12 pfleura2
  Character(6) :: x,y,z
51 12 pfleura2
  character(SCHARS), ALLOCATABLE :: tab(:) ! 3*na
52 12 pfleura2
  character(LCHARS) :: ligne
53 12 pfleura2
54 12 pfleura2
  INTEGER(KINT) :: i,n1,n2,n3,n4, NZmat,ITab
55 12 pfleura2
56 12 pfleura2
  ALLOCATE(tab(3*na))
57 12 pfleura2
58 12 pfleura2
! We first write the Cartesian atoms
59 12 pfleura2
60 12 pfleura2
  DO I=1,NCart
61 12 pfleura2
! Name of the atom
62 12 pfleura2
     n1=ind_zmat(i,1)
63 12 pfleura2
     write(at1,11) nom(atome(n1)),n1
64 12 pfleura2
     Call CleanString(at1,' ')
65 12 pfleura2
! x
66 12 pfleura2
     write(x,11) 'x',i
67 12 pfleura2
     Call CleanString(x,' ')
68 12 pfleura2
69 12 pfleura2
     write(tab(3*i-2),'(A,1X,F12.8)') trim(x),val_zmat(i,1)
70 12 pfleura2
! y
71 12 pfleura2
     write(y,11) 'y',i
72 12 pfleura2
     Call CleanString(y,' ')
73 12 pfleura2
     write(tab(3*i-1),'(A,1X,F12.8)') trim(y),val_zmat(i,2)
74 12 pfleura2
! z
75 12 pfleura2
     write(z,11) 'z',i
76 12 pfleura2
     Call CleanString(z,' ')
77 12 pfleura2
     write(tab(3*i),'(A,1X,F12.8)') trim(z),val_zmat(i,3)
78 12 pfleura2
! write the line
79 12 pfleura2
     write(ligne,'(1X,A,1X,A,1X,A,1X,A)') Trim(at1),x,y,z
80 12 pfleura2
     write(IOOUT,*) TRIM(ligne)
81 12 pfleura2
  END DO
82 12 pfleura2
83 12 pfleura2
  NZmat=na-NCart
84 12 pfleura2
  ITab=3*NCart+1
85 12 pfleura2
86 12 pfleura2
  DO i=NCart+1,NZmat
87 12 pfleura2
     IF (i .GE. 1)  THEN
88 12 pfleura2
        n1=ind_zmat(i,1)
89 12 pfleura2
        write(at1,11) nom(atome(n1)),n1
90 12 pfleura2
11      format(a2,i3)
91 12 pfleura2
        Call CleanString(at1,' ')
92 12 pfleura2
        write(ligne,4) at1
93 12 pfleura2
     END IF
94 12 pfleura2
     IF (i .GE. 2)  THEN
95 12 pfleura2
        n2=ind_zmat(i,2)
96 12 pfleura2
        write(at2,11) nom(atome(n2)),n2
97 12 pfleura2
        Call CleanString(At2,' ')
98 12 pfleura2
        write(d,11) 'R',i-1
99 12 pfleura2
        Call CleanString(D,' ')
100 12 pfleura2
        write(ligne,4) at1,at2,d
101 12 pfleura2
        write(tab(ITab),12) d,val_zmat(i,1)
102 12 pfleura2
        ITab=ITab+1
103 12 pfleura2
12      format(a8,f8.4)
104 12 pfleura2
     END IF
105 12 pfleura2
     IF (i .GE. 3)  THEN
106 12 pfleura2
        n3=ind_zmat(i,3)
107 12 pfleura2
        write(at3,11) nom(atome(n3)),n3
108 12 pfleura2
        Call CleanString(At3,' ')
109 12 pfleura2
        write(a,11) 'A',na+i-3
110 12 pfleura2
        Call CleanString(A,' ')
111 12 pfleura2
        write(ligne,4) at1,at2,d,at3,a
112 12 pfleura2
        write(tab(ITab),13) a,val_zmat(i,2)
113 12 pfleura2
        ITab=ITab+1
114 12 pfleura2
13      format(a8,f8.3)
115 12 pfleura2
     END IF
116 12 pfleura2
     IF (i .GE. 4)  THEN
117 12 pfleura2
        n4=ind_zmat(i,4)
118 12 pfleura2
        write(at4,11) nom(atome(n4)),n4
119 12 pfleura2
        Call CleanString(At4,' ')
120 12 pfleura2
        write(dh,11) 'DH',na+na+i-6
121 12 pfleura2
        Call CleanString(dh,' ')
122 12 pfleura2
        write(ligne,4) at1,at2,d,at3,a,at4,dh
123 12 pfleura2
4       format(7a6)
124 12 pfleura2
        write(tab(ITab),13) dh,val_zmat(i,3)
125 12 pfleura2
        ITab=ITab+1
126 12 pfleura2
     END IF
127 12 pfleura2
     write(IOOUT,*) TRIM(ligne)
128 12 pfleura2
     END DO
129 12 pfleura2
130 12 pfleura2
     write(IOOUT,*)
131 12 pfleura2
     DO i=1,ITab
132 12 pfleura2
        write(IOOUT,*) TRIM(tab(i))
133 12 pfleura2
     END DO
134 12 pfleura2
     write(IOOUT,*)
135 12 pfleura2
136 12 pfleura2
     DEALLOCATE(Tab)
137 12 pfleura2
138 12 pfleura2
   END SUBROUTINE WriteMixed_Gaussian