~dikan.va/siesta/thtr-func-self-test-example-Jks

« back to all changes in this revision

Viewing changes to Src/siesta.F

  • Committer: Vladimir Dikan
  • Date: 2019-07-29 20:25:51 UTC
  • Revision ID: vdikan@icmab.es-20190729202551-9mnvxxjneg04g6me
siesta.F: two-step MD loop expansion

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
      ! If performing MD with `virtual` step: initialize
86
86
      if ( want_virtual_step_md ) then ! do perform two-step MD
87
87
 
88
 
         do while ((istep.le.fincoor) .and. (.not. relaxd))
89
 
            do substep = BASE_STEP, VIRTUAL_STEP
90
 
               if ( td_elec_dyn ) then
91
 
                  call siesta_tddft( istep )
92
 
               else
93
 
                  call siesta_forces( istep )
94
 
               end if
95
 
 
96
 
               ! Call to init "Virtual" step data here -
97
 
               ! after call to `siesta_forces` on the first step
98
 
               if (istep==inicoor) call init_virtual_step_md()
99
 
 
100
 
               if (substep .eq. BASE_STEP) then
101
 
                  call base_md_step_logic()
102
 
                  call store_state_before_move()
103
 
                  ! ** Call siesta_move here to record proper step values
104
 
                  if (SIESTA_worker) call siesta_move( istep, relaxd )
105
 
#ifdef SIESTA__PEXSI
106
 
                  call broadcast(relaxd,comm=true_MPI_Comm_World)
107
 
#endif
108
 
                  call store_state_after_move()
109
 
                  call make_virtual_md_move()
110
 
 
111
 
                  if (.not. relaxd) then
112
 
                     istep = istep + 1
113
 
                  endif
114
 
#ifdef SIESTA__PEXSI
115
 
                  if (ionode) call memory_snapshot("after geometry step")
116
 
#endif
117
 
               else
118
 
                  call virtual_md_step_logic()
119
 
                  call re_store_state_after_move()
120
 
               endif
121
 
            enddo
122
 
         enddo
 
88
         if ( td_elec_dyn )
 
89
     $        call die("No TDDFT with thermal transport...")
 
90
 
 
91
         call init_virtual_step_md()  ! allocate xa,va,fa aux arrays
 
92
 
 
93
         DO WHILE ((istep.le.fincoor) .and. (.not. relaxd))
 
94
 
 
95
              substep = BASE_STEP
 
96
              
 
97
              call siesta_forces( istep )
 
98
  
 
99
              call base_md_step_logic() ! Perform whatever needs to be done now
 
100
              call store_state_before_move() ! Save xa, fa, va
 
101
 
 
102
              ! ** Call siesta_move here to record proper step values
 
103
              if (SIESTA_worker) call siesta_move( istep, relaxd )
 
104
 
 
105
              call store_state_after_move() ! Store future base coords
 
106
              call make_virtual_md_move() ! Generate xa for virtual step
 
107
 
 
108
 
 
109
              substep = VIRTUAL_STEP
 
110
              call siesta_forces( istep )
 
111
 
 
112
              call virtual_md_step_logic()
 
113
              call re_store_state_after_move()  ! Restore xa to xa_future, fa to fa_saved
 
114
 
 
115
              if (.not. relaxd) then
 
116
                 istep = istep + 1
 
117
              endif
 
118
 
 
119
#ifdef SIESTA__PEXSI
 
120
              call broadcast(relaxd,comm=true_MPI_Comm_World)
 
121
#endif
 
122
 
 
123
            
 
124
         ENDDO ! while loop
123
125
 
124
126
      else ! Skip `Virtual` step - generic SIESTA cycle
125
127
 
126
 
      DO WHILE ((istep.le.fincoor) .AND. (.not. relaxd))
127
 
 
128
 
         if ( td_elec_dyn ) then
129
 
            call siesta_tddft( istep )
130
 
         else
131
 
            call siesta_forces( istep )
132
 
         end if
133
 
 
134
 
        if (SIESTA_worker) call siesta_move( istep, relaxd )
135
 
#ifdef SIESTA__PEXSI
136
 
        call broadcast(relaxd,comm=true_MPI_Comm_World)
137
 
#endif
138
 
        if (.not. relaxd) then
139
 
          istep = istep + 1
140
 
        endif
141
 
#ifdef SIESTA__PEXSI
142
 
        if (ionode) call memory_snapshot("after geometry step")
143
 
#endif
144
 
 
145
 
      ENDDO
 
128
         DO WHILE ((istep.le.fincoor) .AND. (.not. relaxd))
 
129
 
 
130
            if ( td_elec_dyn ) then
 
131
               call siesta_tddft( istep )
 
132
            else
 
133
               call siesta_forces( istep )
 
134
            end if
 
135
 
 
136
            if (SIESTA_worker) call siesta_move( istep, relaxd )
 
137
#ifdef SIESTA__PEXSI
 
138
            call broadcast(relaxd,comm=true_MPI_Comm_World)
 
139
#endif
 
140
            if (.not. relaxd) then
 
141
               istep = istep + 1
 
142
            endif
 
143
#ifdef SIESTA__PEXSI
 
144
            if (ionode) call memory_snapshot("after geometry step")
 
145
#endif
 
146
 
 
147
         ENDDO
 
148
         
146
149
      endif ! One/two-step MD
147
150
 
148
151
C     End of coordinate-relaxation loop