2004-02-15 18:29:15 +08:00
|
|
|
!
|
|
|
|
! Copyright (C) 2002 CP90 group
|
|
|
|
! This file is distributed under the terms of the
|
|
|
|
! GNU General Public License. See the file `License'
|
|
|
|
! in the root directory of the present distribution,
|
|
|
|
! or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
!
|
|
|
|
|
|
|
|
#include "../include/machine.h"
|
|
|
|
|
|
|
|
!
|
|
|
|
!=======================================================================
|
|
|
|
!
|
|
|
|
program main
|
|
|
|
!
|
|
|
|
!=======================================================================
|
|
|
|
!*** Molecular Dynamics using Density-Functional Theory ****
|
|
|
|
!*** this is a Car-Parrinello program using Vanderbilt pseudopotentials
|
|
|
|
!***********************************************************************
|
|
|
|
!*** based on version 11 of cpv code including ggapw 07/04/99
|
|
|
|
!*** copyright Alfredo Pasquarello 10/04/1996
|
|
|
|
!*** parallelized and converted to f90 by Paolo Giannozzi (2000),
|
|
|
|
!*** using parallel FFT written for PWSCF by Stefano de Gironcoli
|
|
|
|
!*** PBE added by Michele Lazzeri (2000)
|
|
|
|
!*** variable-cell dynamics by Andrea Trave (1998-2000)
|
|
|
|
!***********************************************************************
|
|
|
|
!*** appropriate citation for use of this code:
|
|
|
|
!*** Car-Parrinello method R. Car and M. Parrinello, PRL 55, 2471 (1985)
|
|
|
|
!*** current implementation A. Pasquarello, K. Laasonen, R. Car,
|
|
|
|
!*** C. Lee, and D. Vanderbilt, PRL 69, 1982 (1992);
|
|
|
|
!*** K. Laasonen, A. Pasquarello, R. Car,
|
|
|
|
!*** C. Lee, and D. Vanderbilt, PRB 47, 10142 (1993).
|
|
|
|
!*** implementation gga A. Dal Corso, A. Pasquarello, A. Baldereschi,
|
|
|
|
!*** and R. Car, PRB 53, 1180 (1996).
|
|
|
|
!***********************************************************************
|
|
|
|
!***
|
|
|
|
!*** f90 version, with dynamical allocation of memory
|
|
|
|
!*** Variables that do not change during the dynamics are in modules
|
|
|
|
!*** (with some exceptions) All other variables are passed as arguments
|
|
|
|
!***********************************************************************
|
|
|
|
!***
|
|
|
|
!*** fft : uses machine's own complex fft routines, two real fft at the time
|
|
|
|
!*** ggen: g's only for positive halfspace (g>)
|
|
|
|
!*** all routines : keep equal c(g) and [c(-g)]*
|
|
|
|
!***
|
|
|
|
!***********************************************************************
|
|
|
|
! general variables:
|
|
|
|
! delt = delta t
|
|
|
|
! emass = electron mass (fictitious)
|
|
|
|
! dt2bye = 2*delt/emass
|
|
|
|
!***********************************************************************
|
|
|
|
!
|
2004-02-17 17:53:14 +08:00
|
|
|
use input_cp, only: read_input_file, iosys_pseudo
|
2004-02-16 17:53:00 +08:00
|
|
|
use io_global, ONLY: io_global_start
|
2004-02-15 18:29:15 +08:00
|
|
|
use mp_global, ONLY: mp_global_start
|
|
|
|
use mp, ONLY: mp_end
|
2004-02-16 17:53:00 +08:00
|
|
|
use para_mod, ONLY: me, mygroup, nproc
|
2004-02-17 17:53:14 +08:00
|
|
|
use io_files, only: psfile, pseudo_dir
|
|
|
|
use ions_base, only: ipp, nsp
|
2004-03-15 08:08:26 +08:00
|
|
|
use control_flags, only: lneb
|
2004-02-15 18:29:15 +08:00
|
|
|
!
|
|
|
|
implicit none
|
|
|
|
!
|
|
|
|
! program starts here
|
|
|
|
!
|
|
|
|
! Initialize processors IDs
|
|
|
|
call startup()
|
|
|
|
call io_global_start( (me-1), 0 )
|
|
|
|
call mp_global_start(0, (me-1), mygroup, nproc )
|
|
|
|
|
2004-03-29 05:36:28 +08:00
|
|
|
CALL init_clocks( .TRUE. )
|
|
|
|
CALL start_clock( 'FPMD' )
|
|
|
|
|
2004-02-17 17:53:14 +08:00
|
|
|
!
|
|
|
|
! readin the input file
|
|
|
|
!
|
|
|
|
|
2004-02-15 18:29:15 +08:00
|
|
|
call read_input_file( lneb )
|
2004-02-17 17:53:14 +08:00
|
|
|
|
|
|
|
!
|
|
|
|
! copy pseudopotential input parameter into internal variables
|
2004-02-19 01:00:32 +08:00
|
|
|
! and read in pseudopotentials and wavefunctions files
|
2004-02-17 17:53:14 +08:00
|
|
|
!
|
|
|
|
|
|
|
|
call iosys_pseudo( psfile, pseudo_dir, ipp, nsp )
|
|
|
|
|
2004-03-12 01:03:51 +08:00
|
|
|
IF( lneb ) THEN
|
|
|
|
call neb_loop( 1 )
|
|
|
|
ELSE
|
|
|
|
call cpr_loop( 1 )
|
|
|
|
END IF
|
2004-02-15 18:29:15 +08:00
|
|
|
|
2004-03-29 05:36:28 +08:00
|
|
|
CALL print_clock( 'FPMD' )
|
|
|
|
CALL stop_clock( 'FPMD' )
|
|
|
|
|
2004-02-15 18:29:15 +08:00
|
|
|
call mp_end()
|
|
|
|
|
|
|
|
stop
|
2004-02-16 17:53:00 +08:00
|
|
|
end program
|
|
|
|
|
|
|
|
|
2004-02-19 01:00:32 +08:00
|
|
|
SUBROUTINE cpr_loop( nloop )
|
|
|
|
USE input_parameters, ONLY: nat, tprnfor
|
|
|
|
USE input_parameters, ONLY: ion_positions, rd_pos
|
|
|
|
IMPLICIT NONE
|
|
|
|
INTEGER, INTENT(IN) :: nloop
|
|
|
|
INTEGER :: iloop
|
|
|
|
REAL(kind=8), ALLOCATABLE :: tau( :, : )
|
|
|
|
REAL(kind=8), ALLOCATABLE :: fion( :, : )
|
|
|
|
REAL(kind=8) :: etot
|
|
|
|
|
|
|
|
IF( nat > 0 ) THEN
|
|
|
|
ALLOCATE( tau( 3, nat ), fion( 3, nat ) )
|
|
|
|
ELSE
|
|
|
|
CALL errore( ' cpr_loop ', ' nat less or equal 0 ', 1 )
|
|
|
|
END IF
|
|
|
|
|
|
|
|
! ... set tprnfor = .true. to get atomic forces
|
|
|
|
! ... even if the atoms do not move
|
|
|
|
|
|
|
|
! ... set ion_positions = 'from_input'
|
|
|
|
! ... and rd_pos = +your_positions+
|
|
|
|
! ... to force cprmain to compute forces for
|
|
|
|
! ... +your_position+ configuration
|
|
|
|
|
|
|
|
DO iloop = 1, nloop
|
|
|
|
call cprmain( tau(1,1), fion(1,1), etot)
|
|
|
|
call memstat( 1 )
|
|
|
|
END DO
|
|
|
|
|
|
|
|
DEALLOCATE( tau, fion )
|
|
|
|
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE
|
2004-03-12 01:03:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
SUBROUTINE neb_loop( iloop )
|
|
|
|
|
|
|
|
USE kinds
|
|
|
|
USE io_global, ONLY: ionode, stdout
|
|
|
|
USE neb_variables, ONLY: conv_neb
|
|
|
|
USE neb_variables, ONLY: neb_deallocation
|
|
|
|
USE neb_routines, ONLY: initialize_neb, search_mep, iosys_neb
|
|
|
|
USE io_routines, ONLY: write_output
|
2004-03-15 08:08:26 +08:00
|
|
|
USE ions_base, ONLY: deallocate_ions_base
|
2004-03-12 01:03:51 +08:00
|
|
|
|
|
|
|
IMPLICIT NONE
|
|
|
|
|
|
|
|
INTEGER :: iloop
|
|
|
|
|
|
|
|
! ... stdout is connected to a file ( specific for each image )
|
|
|
|
! ... via unit 17
|
|
|
|
|
|
|
|
IF( ionode ) THEN
|
|
|
|
!
|
|
|
|
stdout = 17
|
|
|
|
!
|
|
|
|
END IF
|
|
|
|
|
|
|
|
CALL iosys_neb()
|
|
|
|
|
|
|
|
CALL initialize_neb( 'FP' )
|
|
|
|
!
|
|
|
|
! ... this routine does all the NEB job
|
|
|
|
!
|
|
|
|
CALL search_mep()
|
|
|
|
!
|
|
|
|
! ... output is written
|
|
|
|
!
|
|
|
|
CALL write_output()
|
2004-03-15 08:08:26 +08:00
|
|
|
|
|
|
|
CALL deallocate_ions_base()
|
2004-03-12 01:03:51 +08:00
|
|
|
!
|
|
|
|
! ... stdout is reconnected to standard output
|
|
|
|
!
|
|
|
|
stdout = 6
|
|
|
|
!
|
|
|
|
|
|
|
|
RETURN
|
|
|
|
END SUBROUTINE neb_loop
|