root / src / Space_GEDIIS_all.f90
Historique | Voir | Annoter | Télécharger (4,2 ko)
1 |
! SPACE_GEDIIS SIMPLY LOADS THE CURRENT VALUES OF Geom AND Grad INTO THE ARRAYS GeomSet AND GradSet |
---|---|
2 |
|
3 |
SUBROUTINE SPACE_GEDIIS_All(NGeomF,IGeom,MRESET,MSET,Geom,Grad,HEAT,NCoord,GeomSet,GradSet,ESET,FRST) |
4 |
|
5 |
!---------------------------------------------------------------------- |
6 |
! This routine was adapted from the public domain mopac6 diis.f |
7 |
! source file (c) 2009, Stewart Computational Chemistry. |
8 |
! <http://www.openmopac.net/Downloads/Downloads.html> |
9 |
! |
10 |
!---------------------------------------------------------------------- |
11 |
! Copyright 2003-2014 Ecole Normale Supérieure de Lyon, |
12 |
! Centre National de la Recherche Scientifique, |
13 |
! Université Claude Bernard Lyon 1. All rights reserved. |
14 |
! |
15 |
! This work is registered with the Agency for the Protection of Programs |
16 |
! as IDDN.FR.001.100009.000.S.P.2014.000.30625 |
17 |
! |
18 |
! Authors: P. Fleurat-Lessard, P. Dayal |
19 |
! Contact: optnpath@gmail.com |
20 |
! |
21 |
! This file is part of "Opt'n Path". |
22 |
! |
23 |
! "Opt'n Path" is free software: you can redistribute it and/or modify |
24 |
! it under the terms of the GNU Affero General Public License as |
25 |
! published by the Free Software Foundation, either version 3 of the License, |
26 |
! or (at your option) any later version. |
27 |
! |
28 |
! "Opt'n Path" is distributed in the hope that it will be useful, |
29 |
! but WITHOUT ANY WARRANTY; without even the implied warranty of |
30 |
! |
31 |
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
32 |
! GNU Affero General Public License for more details. |
33 |
! |
34 |
! You should have received a copy of the GNU Affero General Public License |
35 |
! along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>. |
36 |
! |
37 |
! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr, |
38 |
! for commercial licensing opportunities. |
39 |
!---------------------------------------------------------------------- |
40 |
|
41 |
IMPLICIT NONE |
42 |
integer, parameter :: KINT = kind(1) |
43 |
integer, parameter :: KREAL = kind(1.0d0) |
44 |
|
45 |
! MSET=mth iteration, MRESET=Maximum no. of iterations. |
46 |
INTEGER(KINT) :: NGeomF, IGeom |
47 |
INTEGER(KINT) :: NCoord, MRESET, MSET(NGeomF) |
48 |
! Geom=geometry with NCoord coordinates. GRAD=gradients. |
49 |
REAL(KREAL) :: Geom(NCoord), Grad(NCoord) |
50 |
REAL(KREAL) :: Heat |
51 |
LOGICAL :: FRST(NGeomF), Print=.FALSE. |
52 |
! GeomSet, GradSet : a long array to store. |
53 |
REAL(KREAL) :: GeomSet(NGeomF,MRESET*NCoord), GradSet(NGeomF,MRESET*NCoord), ESET(NGeomF,MRESET) |
54 |
! Geom and GRAD for all iterations. |
55 |
|
56 |
INTEGER(KINT) :: I, K, NMK, MI, NI |
57 |
INTEGER(KINT), SAVE :: NRESET |
58 |
|
59 |
! UPDATE PARAMETER AND GRADIENT SUBSPACE: |
60 |
IF (PRINT) WRITE(*,'(/,'' BEGIN SPACE_GEDIIS_ALL '')') |
61 |
IF(FRST(IGeom))THEN |
62 |
! Print *, 'Inside FRST(',IGeom,')=', FRST(IGeom) |
63 |
NRESET=MIN(NCoord/2,MRESET) |
64 |
IF (NCoord .LT. 5 ) THEN ! This condition is imposed for small NCoord, |
65 |
! particularly if NCoord is equal to 2 or 3. |
66 |
NRESET = NCoord-1 |
67 |
END IF |
68 |
FRST(IGeom)=.FALSE. |
69 |
MSET(IGeom)=0 |
70 |
ENDIF |
71 |
|
72 |
IF (PRINT) WRITE(*,'(/,'' SPACE_GEDIIS_ALL 1 '')') |
73 |
! purging the very first Geom and GRAD. |
74 |
if (print) WRITE(*,*) "DBG SPACE_GEDIIS MSET, NRESET", MSET,NRESET |
75 |
IF (MSET(IGeom) .EQ. NRESET) THEN |
76 |
DO I=1,MSET(IGeom)-1 |
77 |
MI = NCoord*(I-1) |
78 |
NI = NCoord*I |
79 |
ESET(IGeom,I)=ESET(IGeom,I+1) |
80 |
DO K=1,NCoord |
81 |
GeomSet(IGeom,MI+K) = GeomSet(IGeom,NI+K) |
82 |
GradSet(IGeom,MI+K) = GradSet(IGeom,NI+K) |
83 |
END DO |
84 |
END DO |
85 |
MSET(IGeom)=NRESET-1 |
86 |
ENDIF |
87 |
|
88 |
! STORE THE CURRENT POINT: |
89 |
IF (PRINT) WRITE(*,'(/,'' SPACE_GEDIIS_ALL 2 '')') |
90 |
DO K=1,NCoord |
91 |
NMK = NCoord*MSET(IGeom)+K ! MSET(IGeom) corresponds the mth iteration. |
92 |
IF (PRINT) WRITE(*,*) 'K,NMK,MSET(',IGeom,'),NCoord',K,NMK,MSET(IGeom),NCoord !, & |
93 |
! SIZE(GeomSet(IGeom,:)), SIZE(GradSet(IGeom,:)),SIZE(Geom),SIZE(GRAD) |
94 |
GeomSet(IGeom,NMK) = Geom(K) |
95 |
GradSet(IGeom,NMK) = Grad(K) |
96 |
END DO |
97 |
|
98 |
MSET(IGeom)=MSET(IGeom)+1 |
99 |
ESET(IGeom,MSET(IGeom))=HEAT |
100 |
|
101 |
IF (PRINT) WRITE (*,*) "MSET(",IGeom,")=", MSET(IGeom) |
102 |
IF (PRINT) WRITE(*,'(/,'' END SPACE_GEDIIS_ALL '')') |
103 |
|
104 |
END SUBROUTINE SPACE_GEDIIS_All |