New Path Integral Molecular Dynamics code

This commit is contained in:
Aadhityan A 2025-04-30 09:42:08 +00:00 committed by Lorenzo Paulatto
parent 7d822af1f1
commit ec4b62ac4c
41 changed files with 6296 additions and 4 deletions

View File

@ -695,6 +695,7 @@ add_subdirectory(TDDFPT)
add_subdirectory(XSpectra)
add_subdirectory(QEHeat)
add_subdirectory(KCW)
add_subdirectory(PIOUD)
add_subdirectory(GUI)
if(QE_ENABLE_DOC)
add_subdirectory(Doc)

View File

@ -34,6 +34,7 @@ default :
@echo ' couple Library interface for coupling to external codes'
@echo ' epw Electron-Phonon Coupling with Wannier functions'
@echo ' kcw KCW code: implementation of Koopmans functionals in primitive cell'
@echo ' pioud Path Integral Molecular Dynamics with PIOUD algorithm'
@echo ' gui Graphical User Interface'
@echo ' all same as "make pwall cp ld1 tddfpt xspectra hp"'
@echo ' '
@ -142,6 +143,10 @@ kcw : pwlibs lrmods pp w90lib
if test -d KCW ; then \
( cd KCW ; $(MAKE) all || exit 1 ) ; fi
kcw : pw pwlibs
if test -d PIOUD ; then \
( cd PIOUD ; $(MAKE) all || exit 1 ) ; fi
gui : bindir
@if test -d GUI/PWgui ; then \
cd GUI/PWgui ; \
@ -163,7 +168,7 @@ gui : bindir
pwall : pw neb ph pp pwcond acfdt
all : pwall cp ld1 tddfpt hp xspectra gwl kcw
all : pwall cp ld1 tddfpt hp xspectra gwl kcw pioud
###########################################################
# Auxiliary targets used by main targets:

58
PIOUD/CMakeLists.txt Normal file
View File

@ -0,0 +1,58 @@
set(src_pioud
src/compute_scf_pioud.f90
src/engine_to_trpmd_pos.f90
src/engine_to_trpmd_nat_alat.f90
src/fcp_opt_routines.f90
src/fcp_variables.f90
src/trpmd_base.f90
src/ring_formats.f90
src/pw_gen_inputs.f90
src/ring_input_parameters_module.f90
src/trpmd_io_routines.f90
src/ring_io_units_module.f90
src/pimd_variables.f90
src/ring_variables.f90
src/pimd_subrout.f90
src/pimd_utils.f90
src/set_defaults.f90
src/stop_run_path.f90
)
qe_add_library(qe_pioud ${src_pioud})
target_link_libraries(qe_pioud
PRIVATE
qe_pw
qe_lr_modules
qe_modules
qe_fftx
qe_upflib
qe_xclib)
###########################################################
# pioud.x
###########################################################
set(src_pioud_x src/pioud.f90)
qe_enable_cuda_fortran("${src_pioud_x}")
qe_add_executable(qe_pioud_exe ${src_pioud_x})
set_target_properties(qe_pioud_exe
PROPERTIES
OUTPUT_NAME pioud.x)
target_link_libraries(qe_pioud_exe
PRIVATE
qe_pw
qe_lax
qe_modules
qe_pioud
qe_xclib)
###########################################################
qe_install_targets(
qe_pioud
qe_pioud_exe)
add_custom_target(pioud
DEPENDS
qe_pioud_exe
COMMENT
"Path Integral Molecular Dynamics with PIOUD algorithm")

18
PIOUD/Makefile Normal file
View File

@ -0,0 +1,18 @@
# Makefile for PIOUD
sinclude ../make.inc
default: all
all:
if test -d src ; then \
( cd src ; $(MAKE) || exit 1 ) ; fi
clean : examples_clean
if test -d src ; then \
( cd src ; $(MAKE) clean ) ; fi
examples_clean:
if test -d examples ; then \
( cd examples ; ./clean_all ) ; fi
distclean: clean doc_clean

5
PIOUD/examples/clean_all Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
\rm pw_?.in >& /dev/null
\rm -rf *.out >& /dev/null
\rm -rf */results* >& /dev/null

View File

@ -0,0 +1,145 @@
#!/bin/sh
set -x
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`
export GMON_OUT_PREFIX=gmon.out
# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi
$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use pioud.x to calculate an NVT"
$ECHO "graphene Path Integral Molecular Dynamics simulation"
$ECHO
$ECHO "!!! Beware: pioud.x DOES NOT READ FROM STANDARD INPUT"
$ECHO "!!! run as 'pioud.x -inp input_file_name > output_file_name'"
$ECHO
TMP_DIR=out
# set the needed environment variables
. ../../../environment_variables
# required executables and pseudopotentials
BIN_LIST="pioud.x"
$ECHO
$ECHO " executables directory: $BIN_DIR"
$ECHO " pseudo directory: $PSEUDO_DIR"
$ECHO " temporary directory: $TMP_DIR"
$ECHO " checking that needed directories and files exist...\c"
# check for directories
for DIR in "$BIN_DIR" "$PSEUDO_DIR" ; do
if test ! -d $DIR ; then
$ECHO
$ECHO "ERROR: $DIR not existent or not a directory"
$ECHO "Aborting"
exit 1
fi
done
for DIR in "$TMP_DIR" "$EXAMPLE_DIR/results_parallel" ; do
if test ! -d $DIR ; then
mkdir $DIR
fi
done
cd $EXAMPLE_DIR/results_parallel
# check for executables
for FILE in $BIN_LIST ; do
if test ! -x $BIN_DIR/$FILE ; then
$ECHO
$ECHO "ERROR: $BIN_DIR/$FILE not existent or not executable"
$ECHO "Aborting"
exit 1
fi
done
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
# how to run executables
# PIOUD_COMMAND="$PARA_PREFIX $BIN_DIR/pioud.x $PARA_POSTFIX"
PIOUD_COMMAND="mpirun -n 4 $BIN_DIR/pioud.x -ni 4"
# PIOUD_COMMAND="mpirun -n 4 $BIN_DIR/pioud.x -ni 2"
# PIOUD_COMMAND="mpirun -n 1 $BIN_DIR/pioud.x"
$ECHO
$ECHO " running Born-Oppenheimer PIOUD as: $PIOUD_COMMAND"
$ECHO
# clean TMP_DIR
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/diamond*
$ECHO " done"
# clean current result DIR
# $ECHO " cleaning $EXAMPLE_DIR/results_parallel...\c"
# rm -rf $EXAMPLE_DIR/results_parallel
# $ECHO " done"
nbeadMD=4
# NEB calculation. Automatic choice of the climbing image.
cat > diamond.in << EOF
BEGIN
BEGIN_PIMD_INPUT
&dynamics
restart_pimd=.false.
nbeadMD=$nbeadMD
nunitcells=1 !! Just for atomic potentials not DFT.
nblocks=4 !! not used check - only used for first run. restart not working -check
nstep_block=4 !! not used check - only used for first run. restart not working -check
iprint=1 !! Freqncy of output print
run='pioud' !! verlet,ceriotti,pioud
delt=0.004 !! for pioud, 41.32231 which is 1 fs in a.u., must be divided for sqrt(m_1) #time step
tempMD=300.d0 !! temprature in Kelvin
gammaMD=0.21d0 !! Damping parameter in(1/fs)
delta_force=1.d-4 !! Just for atomic potentials not DFT.
delta_harm=5.d-3 !! Just for atomic potentials not DFT.
/
END_PIMD_INPUT
BEGIN_ENGINE_INPUT
&CONTROL
prefix = "diamond"
outdir = "$TMP_DIR",
pseudo_dir = "$PSEUDO_DIR",
tstress = .true.
/
&SYSTEM
ibrav = 2 ,
nosym_evc= .true.
a=3.56,
nat = 2,
ntyp = 1,
nspin=1,
ecutwfc = 25.0,
ecutrho = 120.0,
nbnd = 15,
occupations='smearing',
smearing='fd'
degauss=0.001,
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.3D0,
/
&IONS
/
ATOMIC_SPECIES
C 12.0107 C.pbe-van_bm.UPF
BEGIN_POSITIONS
ATOMIC_POSITIONS crystal
C 0.0 0.0 0.000000000
C 0.12 0.12 0.12
END_POSITIONS
K_POINTS automatic
4 4 4 0 0 0
END_ENGINE_INPUT
END
EOF
$ECHO " running Born-Oppenheimer pioud calculation... "
$PIOUD_COMMAND -inp diamond.in > diamond.out
check_failure $?
$ECHO " done"
# clean TMP_DIR
#$ECHO " cleaning $TMP_DIR...\c"
#rm -rf $TMP_DIR/pwscf*
#$ECHO " done"

View File

@ -0,0 +1,3 @@
#!/bin/sh
nohup ./run_example > output_file &

62
PIOUD/src/Makefile Normal file
View File

@ -0,0 +1,62 @@
# Makefile for PIOUD
include ../../make.inc
# location of needed modules and included files (if any)
MODFLAGS= $(BASEMOD_FLAGS) \
$(MOD_FLAG)../../PW/src \
$(MOD_FLAG)../../dft-d3/
PIOUDOBJS = \
pioud.o \
PIOUDLIBS = \
compute_scf_pioud.o \
engine_to_trpmd_pos.o \
engine_to_trpmd_nat_alat.o \
fcp_opt_routines.o \
fcp_variables.o \
trpmd_base.o \
ring_formats.o \
pw_gen_inputs.o \
ring_input_parameters_module.o \
trpmd_io_routines.o \
ring_io_units_module.o \
pimd_variables.o \
ring_variables.o \
pimd_subrout.o \
pimd_utils.o \
set_defaults.o \
stop_run_path.o
PWOBJS= ../../PW/src/libpw.a ../../KS_Solvers/libks_solvers.a ../../dft-d3/libdftd3qe.a
QEMODS = $(BASEMODS)
F90FLAGS += -pg
LDFLAGS += -pg
TLDEPS=pwlibs
TLDEPS=pwlibs
all : tldeps pioud.x
pioud.x : $(PIOUDOBJS) libpioud.a $(PWOBJS) $(QEMODS)
$(LD) $(LDFLAGS) -o $@ \
$(PIOUDOBJS) libpioud.a $(PWOBJS) $(QEMODS) $(QELIBS)
- ( cd ../../bin; ln -fs ../PIOUD/src/$@ . )
libpioud.a : $(PIOUDLIBS)
$(AR) $(ARFLAGS) $@ $?
$(RANLIB) $@
tldeps :
if test -n "$(TLDEPS)" ; then \
( cd ../.. ; $(MAKE) $(TLDEPS) || exit 1 ) ; fi
clean :
- /bin/rm -f *.x *.o *.a *~ *_tmp.f90 *.d *.mod *.i *.L
- /bin/rm -f ../../bin/pioud.x
include make.depend

View File

@ -0,0 +1,375 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!----------------------------------------------------------------------------
SUBROUTINE compute_scf_pioud( fii, lii, stat )
!----------------------------------------------------------------------------
!
! ... this subroutine is the main scf-driver for all the calculations
! ... ( called by Modules/trpmd_base.f90/born_oppenheimer() subroutine )
!
! ... for each image in the path, it performs the self-consistent loop
! ... computing the energy and the forces
!
!
USE starting_scf, ONLY : starting_wfc, starting_pot
USE kinds, ONLY : DP
USE constants, ONLY : e2
USE control_flags, ONLY : conv_elec, tstress
USE cell_base, ONLY : alat
USE ions_base, ONLY : tau, nat, ityp, zv
USE ener, ONLY : etot, ef
USE force_mod, ONLY : sigma, force
USE io_files, ONLY : prefix, tmp_dir, wfc_dir, iunupdate, &
exit_file, delete_if_present
USE ring_io_units_module, ONLY : iunpath
USE ring_formats, ONLY : scf_fmt, scf_fmt_para
USE ring_variables, ONLY : pos, pending_image, &
istep_path, num_of_images
USE pimd_variables, ONLY : forceMD, nbeadMD, stress_pes_md, pes
USE io_global, ONLY : stdout, ionode, ionode_id, meta_ionode
USE mp_images, ONLY : inter_image_comm, intra_image_comm, &
my_image_id, nimage, root_image
USE mp_world, ONLY : world_comm
USE mp, ONLY : mp_bcast, mp_barrier, mp_sum, mp_min
USE trpmd_io_routines, ONLY : new_image_init, get_new_image, &
stop_other_images
USE fcp_opt_routines, ONLY : fcp_neb_nelec, fcp_neb_ef
USE fcp_variables, ONLY : lfcpopt
USE klist, ONLY : nelec, tot_charge
USE extrapolation, ONLY : update_neb
USE xc_lib, ONLY : stop_exx, xclib_dft_is
use mp_world
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: fii, lii ! indexes to first and last images
LOGICAL, INTENT(OUT) :: stat
!
INTEGER :: fii_, lii_ ! local copies of fii and lii
INTEGER :: image, istat
REAL(DP) :: tcpu
CHARACTER (LEN=256) :: tmp_dir_saved
LOGICAL :: file_exists, opnd
!
CHARACTER(LEN=6), EXTERNAL :: int_to_char
!
!
fii_ = fii ! 1
lii_ = lii ! num_of_images aka nbeadMD
!
istat = 0
!
FLUSH( iunpath )
!
tmp_dir_saved = tmp_dir
!
pes = 0.D0
! grad_pes = 0.D0
forceMD = 0.D0
! stress_pes = 0.D0 ! --> allocated/deallocated in path_variable (path_allocation, path_deallocation) and declared...
stress_pes_md = 0.D0
fcp_neb_ef = 0.d0 ! needed ?
!--- lp
! IF ( nimage > 1 ) THEN
! !
! ! ... vectors pes and grad_pes are initialized to zero for all images on
! ! ... all nodes: this is needed for the final mp_sum()
! !
! IF ( my_image_id == root_image ) THEN
! !
! FORALL( image = fii:lii, .NOT.frozen(image) )
! !
! pes(image) = 0.D0
! grad_pes(:,image) = 0.D0
! stress_pes(:,image) = 0.D0
! !
! END FORALL
! !
! ELSE
! !
! pes(fii:lii) = 0.D0
! grad_pes(:,fii:lii) = 0.D0
! stress_pes(:,fii:lii) = 0.D0
! !
! END IF
! !
! IF ( lfcpopt ) THEN
! !
! IF ( my_image_id == root_image ) THEN
! !
! FORALL( image = fii:lii, .NOT.frozen(image) )
! !
! fcp_neb_ef(image) = 0.D0
! !
! END FORALL
! !
! ELSE
! !
! fcp_neb_ef(fii:lii) = 0.D0
! !
! END IF
! !
! END IF
! !
! END IF
!--- lp
!
! ... all processes are syncronized (needed to have a readable output)
!
CALL mp_barrier( world_comm )
!
! ... only the first cpu initializes the file needed by parallelization
! ... among images
!
IF ( meta_ionode ) CALL new_image_init( nimage, fii_, tmp_dir_saved )
!
image = fii_ + my_image_id
!
scf_loop: DO
!
! ... exit if available images are finished
!
IF ( image > lii_ ) EXIT scf_loop
!
pending_image = image
!
IF (xclib_dft_is('hybrid')) call stop_exx()
CALL do_scf( image, istat )
!
IF ( istat /= 0 ) GOTO 1
!
! ... the new image is obtained (by ionode only)
!
CALL get_new_image( nimage, image, tmp_dir_saved )
!
CALL mp_bcast( image, ionode_id, intra_image_comm )
!
END DO scf_loop
!
! ... after the first call to compute_scf the input values of startingpot
! ... and startingwfc are both set to 'file'
!
if (nat .gt. 3) then !!! <----my mod.
starting_pot = 'file' !!! <----my mod.
starting_wfc = 'file' !!! <----my mod.
end if !!! <----my mod.
!
! ... finalization of the job (this point is also reached in case of error
! ... condition)
!
1 CALL mp_barrier( world_comm )
!
IF ( nimage > 1 ) THEN
!
! ... pes and grad_pes are communicated among "image" pools
!
CALL mp_sum( pes, inter_image_comm ) !!! <----my mod.
! CALL mp_sum( grad_pes, inter_image_comm ) !!! <----my mod.
! CALL mp_sum( stress_pes, inter_image_comm ) !!! <----my mod.
CALL mp_sum( stress_pes_md, inter_image_comm )
CALL mp_sum( forceMD, inter_image_comm )
IF ( lfcpopt ) CALL mp_sum( fcp_neb_ef, inter_image_comm ) !!! <----my mod.
CALL mp_sum( istat, inter_image_comm ) !!! <----my mod.
!
END IF
!
! ... global status is computed here
!
IF ( istat == 0 ) THEN
!
stat = .TRUE.
!
pending_image = 0
!
ELSE
!
stat = .FALSE.
!
IF ( nimage > 1 ) THEN
!
CALL mp_min( pending_image, inter_image_comm )
!
IF ( meta_ionode ) CALL delete_if_present( exit_file )
!
END IF
!
IF ( meta_ionode ) THEN
!
! ... some image didn't converge: extrapolation is no longer
! ... possible, files are removed
!
WRITE( UNIT = iunpath, &
FMT = '(/,5X,"cleaning-up extrapolation files"/)' )
!
DO image = pending_image, lii
!
tmp_dir = TRIM( tmp_dir_saved ) // TRIM( prefix ) // "_" // &
TRIM( int_to_char( image ) ) // "/"
!
CALL delete_if_present( TRIM( tmp_dir ) // &
TRIM( prefix ) // '.update' )
!
END DO
!
END IF
!
END IF
!
tmp_dir = tmp_dir_saved
!
RETURN
!
CONTAINS
!
!-----------------------------------------------------------------------
SUBROUTINE do_scf( image, istat )
!-----------------------------------------------------------------------
!
USE input_parameters, ONLY : diago_thr_init
USE control_flags, ONLY : ethr
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: image
INTEGER, INTENT(INOUT) :: istat
!
REAL(DP), EXTERNAL :: get_clock
!
! ... self-consistency ( for non-frozen images only )
!
!
CALL clean_pw( .FALSE. )
!
tcpu = get_clock( 'PIOUD' )
!
IF ( nimage > 1 ) THEN
!
WRITE( UNIT = iunpath, FMT = scf_fmt_para ) my_image_id, tcpu, image
!
ELSE
!
WRITE( UNIT = iunpath, FMT = scf_fmt ) tcpu, image
!
END IF
!
tmp_dir = TRIM( tmp_dir_saved ) // TRIM( prefix ) // "_" // &
TRIM( int_to_char( image ) ) // "/"
wfc_dir = tmp_dir
!
! ... unit stdout is connected to the appropriate file
!
IF ( ionode ) THEN
!
INQUIRE( UNIT = stdout, OPENED = opnd )
IF ( opnd ) CLOSE( UNIT = stdout )
OPEN( UNIT = stdout, FILE = TRIM( tmp_dir ) // 'PW.out', &
STATUS = 'UNKNOWN', POSITION = 'APPEND' )
!
END IF
!
! ... tau is in alat units ( pos is in bohr )
!
tau = RESHAPE( pos(:,image), SHAPE( tau ) ) / alat
!
WRITE( stdout, '(/,5X,"coordinates at iteration ",I3,/)' ) istep_path
!
CALL output_tau( .FALSE., .FALSE. )
!
! ... initialization of the scf calculation
!
CALL start_clock('PWSCF')
CALL setup ()
!
IF ( lfcpopt ) THEN
nelec = fcp_neb_nelec(image)
tot_charge = SUM( zv(ityp(1:nat)) ) - nelec
ENDIF
!
CALL init_run()
!
! ... charge density and wavefunction extrapolation
!
CALL update_neb ()
!
! ... self-consistency loop
!
CALL electrons()
!
CALL punch( 'all' )
!
! ... scf convergence is checked here
!
IF ( .NOT.conv_elec ) THEN
!
istat = 1
!
WRITE( UNIT = iunpath, &
FMT = '(/,5X,"WARNING : scf convergence ", &
& "NOT achieved on image ",I3)' ) image
!
! ... in case of parallelization on images a stop signal
! ... is sent via the "EXIT" file
!
IF ( nimage > 1 ) CALL stop_other_images()
!
RETURN
!
END IF
!
! ... self-consistent forces
!
CALL forces()
!
IF(tstress) CALL stress(sigma)
!
! ... energy is converted from rydberg to hartree
!
pes(image) = etot / e2
!
! ... gradients are converted from rydberg/bohr to hartree/bohr
!
! grad_pes(:,image) = - RESHAPE( force, (/ dim1 /) ) / e2
forceMD(:,:,image) = force /e2
! stress_pes(:,image) = RESHAPE( sigma,(/ 9 /) )
! stress_pes(:,image) = (/sigma(1,1), sigma(2,2), sigma(3,3), sigma(1,2), sigma(1,3),sigma(2,3)/)
stress_pes_md(:,image) = (/sigma(1,1), sigma(2,2), sigma(3,3), sigma(1,2), sigma(1,3),sigma(2,3)/) / e2
! write(11000000+mpime,*)stress_pes_md
! write(10000000+mpime,*)stress_pes
!
ethr = diago_thr_init
!
CALL close_files(.FALSE.)
!
IF ( lfcpopt ) fcp_neb_ef(image) = ef
!
RETURN
!
END SUBROUTINE do_scf
!
END SUBROUTINE compute_scf_pioud

View File

@ -0,0 +1,30 @@
!
! Copyright (C) 2002-2009 Quantum ESPRESSO 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 .
!
!
!----------------------------------------------------------------------------
SUBROUTINE engine_to_path_nat_alat()
!-----------------------------------------------------------------------------
!
!
USE kinds, ONLY : DP
!
USE input_parameters, ONLY : nat
USE cell_base, ONLY : alat
USE ring_input_parameters_module, ONLY : nat_ => nat, alat_ => alat
!
!
IMPLICIT NONE
!
nat_ = nat
alat_ = alat
!
!
RETURN
!
END SUBROUTINE engine_to_path_nat_alat
!

View File

@ -0,0 +1,118 @@
!
! Copyright (C) 2002-2009 Quantum ESPRESSO 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 .
!
!
!----------------------------------------------------------------------------
SUBROUTINE engine_to_path_pos(idx)
!-----------------------------------------------------------------------------
!
! ... Copy atomic positions (tau) and atom types (ityp) read from file
! ... to array pos(:,idx) and typ(:), where idx is the index of image
! ... Translate positions by lattice vectors to make the path smooth,
! ... verify that typ is the same array for all images
!
USE kinds, ONLY : DP
!
USE ring_input_parameters_module, ONLY : input_images, minimum_image
USE ring_input_parameters_module, ONLY : nat, alat
USE ring_input_parameters_module, ONLY : pos, typ
USE ring_io_units_module, ONLY : iunpath
!
USE ions_base, ONLY : tau, ityp
USE cell_base, ONLY : bg, at
use mp_world
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: idx
!
INTEGER :: iat
REAL(DP), ALLOCATABLE :: pos0(:,:), pos1(:,:)
! atomic positions (in crystal units) of the previous and current image
!
! tau is already in the internal QE units
!
! is this really necessary? (GS)
if(.not.allocated(pos)) allocate(pos(3*nat,input_images))
pos(:,idx) = 0.0_dp
!
! ... note that this positions array is in Bohr
!
pos(1:3*nat,idx) = reshape( tau, (/ 3 * nat /) ) * alat
! write(14000+mpime,*)input_images,"input_images",minimum_image
!
! If requested, use the translational periodicity of the unit cell to ensure
! that the path is smooth (even if atoms in the input images do not move on
! a smooth path). It adopts a "minimum image criterion", which assumes that
! atoms do not be displaced by more than half the unit cell size from one
! input image to the next. If this happens, a periodic replica of that atom
! is chosen to avoid atomic "jumps". If not requested, just give a warning
! when an atom moves that much. -GS
!
ALLOCATE( pos0(3,nat), pos1(3,nat) )
!
! atomic positions in current image
pos1 = reshape( pos(:,idx), (/ 3, nat /) ) / alat
CALL cryst_to_cart( nat, pos1(1,1), bg, -1 )
! refold them within the unit cell around the origin
IF ( minimum_image ) pos1 = pos1(:,:) - anint(pos1(:,:))
!
IF ( idx > 1 ) THEN
!
! atomic positions in previous image
pos0 = reshape( pos(:,idx-1), (/ 3, nat /) ) / alat
CALL cryst_to_cart( nat, pos0(1,1), bg, -1 )
!
DO iat = 1,nat
!
! translate atom by a lattice vector if needed
! N.B.: this solves the problem only when |p1-p0|<1.0
!
IF ( minimum_image ) THEN
WHERE( (pos1(:,iat) - pos0(:,iat)) > 0.5_DP )
pos1(:,iat) = pos1(:,iat) - 1.0_DP
ENDWHERE
!
WHERE( (pos1(:,iat) - pos0(:,iat)) < -0.5_DP )
pos1(:,iat) = pos1(:,iat) + 1.0_DP
ENDWHERE
ELSE
IF ( ANY(ABS(pos1(:,iat) - pos0(:,iat)) > 0.5_DP) ) THEN
WRITE ( iunpath, '(/,5x,A,I5,A,I3,A,I3,/,5x,A)' ) "WARNING: atom", iat, &
" moved more than 1/2 alat from image", idx-1, " to image", idx, &
"You can set minimum_image to true to avoid jumps in the path"
ENDIF
ENDIF
ENDDO
ENDIF
!
IF ( minimum_image ) THEN
!
! update positions only if requested
CALL cryst_to_cart( nat, pos1(1,1), at, 1 )
pos(1:3*nat,idx) = reshape( pos1, (/ 3 * nat /) ) * alat
!
ENDIF
!
DEALLOCATE( pos0, pos1 )
!
! consistency check on atomic type, just to be sure... (GS)
!
IF ( idx == 1 ) THEN
! is this really necessary? (GS)
if(.not.allocated(typ)) allocate(typ(nat))
typ = ityp(:)
ELSE
IF ( ANY( typ .NE. ityp ) ) CALL errore("engine_to_path_pos", &
"inconsistency of atomic species", idx )
ENDIF
!
RETURN
!
END SUBROUTINE engine_to_path_pos
!

View File

@ -0,0 +1,147 @@
!
! Copyright (C) 2003-2006 Quantum ESPRESSO 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 .
!
!--------------------------------------------------------------------------
MODULE fcp_opt_routines
!---------------------------------------------------------------------------
!
! ... This module contains all subroutines and functions needed for
! ... the optimisation of the reaction path (NEB and SMD calculations)
!
! ... Written by Carlo Sbraccia ( 2003-2006 )
!
! ... MDIIS algorithm is implemented by Satomichi Nishihara ( 2016 )
!
USE kinds, ONLY : DP
USE constants, ONLY : eps8, eps16, e2, rytoev, fpi
USE ring_variables, ONLY : pos
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm
USE fcp_variables, ONLY : fcp_mu, fcp_relax, fcp_relax_step, &
fcp_mdiis_size, fcp_mdiis_step, &
fcp_tot_charge_first, fcp_tot_charge_last
USE mdiis, ONLY : mdiis_type, allocate_mdiis, deallocate_mdiis, update_by_mdiis
USE pimd_variables, ONLY : nbeadMD
!
IMPLICIT NONE
!
PRIVATE
!
REAL(DP), ALLOCATABLE :: fcp_neb_nelec(:)
REAL(DP), ALLOCATABLE :: fcp_neb_ef(:)
!
! ... variables for line-minimisation
REAL(DP), ALLOCATABLE :: force0(:)
REAL(DP), ALLOCATABLE :: nelec0(:)
LOGICAL, ALLOCATABLE :: firstcall(:)
!
! ... variables for MDIIS
LOGICAL :: init_mdiis
TYPE(mdiis_type) :: mdiist
!
PUBLIC :: fcp_neb_nelec, fcp_neb_ef, &
fcp_opt_allocation, fcp_opt_deallocation
!
CONTAINS
!
!----------------------------------------------------------------------
SUBROUTINE fcp_opt_allocation()
!----------------------------------------------------------------------
!
USE ions_base, ONLY : nat, ityp, zv
USE klist, ONLY : tot_charge, nelec
USE io_files, ONLY : prefix, tmp_dir
USE ring_variables, ONLY : restart
USE ener, ONLY : ef
!
IMPLICIT NONE
!
REAL(DP) :: ionic_charge, nelec_, first, last
INTEGER :: n, i, ierr
CHARACTER (LEN=256) :: tmp_dir_saved
!
CHARACTER(LEN=6), EXTERNAL :: int_to_char
!
ALLOCATE( fcp_neb_nelec( nbeadMD ) )
ALLOCATE( fcp_neb_ef ( nbeadMD ) )
!
IF ( TRIM(fcp_relax) == 'lm' ) THEN
!
ALLOCATE( force0 ( nbeadMD ) )
ALLOCATE( nelec0 ( nbeadMD ) )
ALLOCATE( firstcall ( nbeadMD ) )
!
force0 (:) = 0.0_DP
nelec0 (:) = 0.0_DP
firstcall (:) = .TRUE.
!
ELSE IF ( TRIM(fcp_relax) == 'mdiis' ) THEN
!
init_mdiis = .TRUE.
CALL allocate_mdiis(mdiist, fcp_mdiis_size, nbeadMD, fcp_mdiis_step, 1)
!
END IF
!
IF ( restart ) THEN
!
tmp_dir_saved = tmp_dir
!
DO i = 1, nbeadMD
!
tmp_dir = TRIM( tmp_dir_saved ) // TRIM( prefix ) // "_" // &
TRIM( int_to_char( i ) ) // "/"
!
CALL errore('fcp_opt_routines','XSD implementation pending',1)
!
fcp_neb_nelec(i) = nelec
fcp_neb_ef (i) = ef * e2 ! factor e2: hartree -> Ry.
!
END DO
!
tmp_dir = tmp_dir_saved
!
ELSE
!
ionic_charge = SUM(zv(ityp(1:nat)))
nelec_ = ionic_charge - tot_charge
!
n = nbeadMD
first = fcp_tot_charge_first
last = fcp_tot_charge_last
DO i = 1, n
fcp_neb_nelec(i) = nelec_ - (first * (n - i) + last * (i - 1) ) / (n - 1)
END DO
!
fcp_neb_ef(:) = 0.0_DP
!
END IF
!
END SUBROUTINE fcp_opt_allocation
!
!----------------------------------------------------------------------
SUBROUTINE fcp_opt_deallocation()
!----------------------------------------------------------------------
!
IMPLICIT NONE
!
IF ( ALLOCATED( fcp_neb_nelec ) ) DEALLOCATE( fcp_neb_nelec )
IF ( ALLOCATED( fcp_neb_ef ) ) DEALLOCATE( fcp_neb_ef )
IF ( ALLOCATED( force0 ) ) DEALLOCATE( force0 )
IF ( ALLOCATED( nelec0 ) ) DEALLOCATE( nelec0 )
IF ( ALLOCATED( firstcall ) ) DEALLOCATE( firstcall )
!
IF ( init_mdiis ) THEN
!
CALL deallocate_mdiis(mdiist)
!
END IF
!
END SUBROUTINE fcp_opt_deallocation
!
!
END MODULE fcp_opt_routines

View File

@ -0,0 +1,30 @@
!
! Copyright (C) 2002-2011 Quantum ESPRESSO 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 .
!
!------------------------------------------------------------------------------!
MODULE fcp_variables
!------------------------------------------------------------------------------!
!
USE kinds, ONLY : DP
!
IMPLICIT NONE
SAVE
!
LOGICAL :: lfcpopt = .FALSE.
LOGICAL :: lfcpdyn = .FALSE.
REAL(DP) :: fcp_mu = 0.0_DP
REAL(DP) :: fcp_mass = 10000.0_DP
REAL(DP) :: fcp_temperature = 0.0_DP
CHARACTER(LEN=8) :: fcp_relax = 'lm'
REAL(DP) :: fcp_relax_step = 0.5_DP
REAL(DP) :: fcp_relax_crit = 0.001_DP
INTEGER :: fcp_mdiis_size = 4
REAL(DP) :: fcp_mdiis_step = 0.2_DP
REAL(DP) :: fcp_tot_charge_first = 0.0_DP
REAL(DP) :: fcp_tot_charge_last = 0.0_DP
END MODULE fcp_variables

121
PIOUD/src/make.depend Normal file
View File

@ -0,0 +1,121 @@
compute_scf_pioud.o : ../../Modules/cell_base.o
compute_scf_pioud.o : ../../Modules/constants.o
compute_scf_pioud.o : ../../Modules/control_flags.o
compute_scf_pioud.o : ../../Modules/input_parameters.o
compute_scf_pioud.o : ../../Modules/io_files.o
compute_scf_pioud.o : ../../Modules/io_global.o
compute_scf_pioud.o : ../../Modules/ions_base.o
compute_scf_pioud.o : ../../Modules/kind.o
compute_scf_pioud.o : ../../Modules/mp_images.o
compute_scf_pioud.o : ../../Modules/mp_world.o
compute_scf_pioud.o : ../../PW/src/atomic_wfc_mod.o
compute_scf_pioud.o : ../../PW/src/pwcom.o
compute_scf_pioud.o : ../../PW/src/update_pot.o
compute_scf_pioud.o : ../../UtilXlib/mp.o
compute_scf_pioud.o : ../../XClib/xc_lib.o
compute_scf_pioud.o : ./fcp_opt_routines.o
compute_scf_pioud.o : ./fcp_variables.o
compute_scf_pioud.o : ./ring_formats.o
compute_scf_pioud.o : ./ring_io_units_module.o
compute_scf_pioud.o : ./ring_variables.o
compute_scf_pioud.o : ./pimd_variables.o
compute_scf_pioud.o : ./trpmd_io_routines.o
engine_to_trpmd_nat_alat.o : ../../Modules/cell_base.o
engine_to_trpmd_nat_alat.o : ../../Modules/input_parameters.o
engine_to_trpmd_nat_alat.o : ../../Modules/kind.o
engine_to_trpmd_nat_alat.o : ./ring_input_parameters_module.o
engine_to_trpmd_pos.o : ../../Modules/cell_base.o
engine_to_trpmd_pos.o : ../../Modules/ions_base.o
engine_to_trpmd_pos.o : ../../Modules/kind.o
engine_to_trpmd_pos.o : ./ring_input_parameters_module.o
engine_to_trpmd_pos.o : ./ring_io_units_module.o
fcp_opt_routines.o : ../../Modules/constants.o
fcp_opt_routines.o : ../../Modules/io_files.o
fcp_opt_routines.o : ../../Modules/io_global.o
fcp_opt_routines.o : ../../Modules/ions_base.o
fcp_opt_routines.o : ../../Modules/kind.o
fcp_opt_routines.o : ../../Modules/mdiis.o
fcp_opt_routines.o : ../../Modules/mp_world.o
fcp_opt_routines.o : ../../PW/src/pwcom.o
fcp_opt_routines.o : ../../UtilXlib/mp.o
fcp_opt_routines.o : ./fcp_variables.o
fcp_opt_routines.o : ./ring_variables.o
fcp_opt_routines.o : ./pimd_variables.o
fcp_variables.o : ../../Modules/kind.o
ring_input_parameters_module.o : ../../Modules/kind.o
path_read_namelists_module.o : ../../Modules/io_global.o
path_read_namelists_module.o : ../../Modules/kind.o
path_read_namelists_module.o : ../../Modules/mp_world.o
path_read_namelists_module.o : ../../UtilXlib/mp.o
path_read_namelists_module.o : ./ring_input_parameters_module.o
ring_variables.o : ../../Modules/kind.o
pimd_subrout.o : ../../UtilXlib/mp.o
pimd_subrout.o : ./ring_io_units_module.o
pimd_subrout.o : ./ring_variables.o
pimd_subrout.o : ./pimd_variables.o
pimd_utils.o : ../../Modules/cell_base.o
pimd_utils.o : ../../Modules/io_files.o
pimd_utils.o : ../../Modules/io_global.o
pimd_utils.o : ../../Modules/ions_base.o
pimd_utils.o : ../../Modules/kind.o
pimd_utils.o : ../../Modules/mp_world.o
pimd_utils.o : ../../UtilXlib/clib_wrappers.o
pimd_utils.o : ../../UtilXlib/mp.o
pimd_utils.o : ./ring_input_parameters_module.o
pimd_utils.o : ./ring_io_units_module.o
pimd_utils.o : ./ring_variables.o
pimd_utils.o : ./pimd_variables.o
pimd_variables.o : ../../Modules/kind.o
pioud.o : ../../Modules/check_stop.o
pioud.o : ../../Modules/command_line_options.o
pioud.o : ../../Modules/environment.o
pioud.o : ../../Modules/io_global.o
pioud.o : ../../Modules/mp_bands.o
pioud.o : ../../Modules/mp_global.o
pioud.o : ../../Modules/mp_pools.o
pioud.o : ../../Modules/mp_world.o
pioud.o : ../../Modules/read_input.o
pioud.o : ../../UtilXlib/mp.o
pioud.o : ./ring_input_parameters_module.o
pioud.o : ./ring_io_units_module.o
pioud.o : ./trpmd_base.o
pw_gen_inputs.o : ../../UtilXlib/mp.o
set_defaults.o : ../../Modules/io_global.o
stop_run_path.o : ../../Modules/environment.o
stop_run_path.o : ../../Modules/io_global.o
stop_run_path.o : ../../Modules/mp_global.o
stop_run_path.o : ./fcp_opt_routines.o
stop_run_path.o : ./fcp_variables.o
stop_run_path.o : ./ring_io_units_module.o
stop_run_path.o : ./ring_variables.o
trpmd_base.o : ../../Modules/basic_algebra_routines.o
trpmd_base.o : ../../Modules/constants.o
trpmd_base.o : ../../Modules/control_flags.o
trpmd_base.o : ../../Modules/io_files.o
trpmd_base.o : ../../Modules/io_global.o
trpmd_base.o : ../../Modules/ions_base.o
trpmd_base.o : ../../Modules/kind.o
trpmd_base.o : ../../Modules/mp_images.o
trpmd_base.o : ../../Modules/mp_world.o
trpmd_base.o : ../../UtilXlib/mp.o
trpmd_base.o : ./fcp_opt_routines.o
trpmd_base.o : ./fcp_variables.o
trpmd_base.o : ./ring_formats.o
trpmd_base.o : ./ring_input_parameters_module.o
trpmd_base.o : ./ring_io_units_module.o
trpmd_base.o : ./ring_variables.o
trpmd_base.o : ./pimd_variables.o
trpmd_base.o : ./trpmd_io_routines.o
trpmd_io_routines.o : ../../Modules/basic_algebra_routines.o
trpmd_io_routines.o : ../../Modules/constants.o
trpmd_io_routines.o : ../../Modules/io_files.o
trpmd_io_routines.o : ../../Modules/io_global.o
trpmd_io_routines.o : ../../Modules/ions_base.o
trpmd_io_routines.o : ../../Modules/kind.o
trpmd_io_routines.o : ../../Modules/mp_world.o
trpmd_io_routines.o : ../../UtilXlib/mp.o
trpmd_io_routines.o : ./fcp_opt_routines.o
trpmd_io_routines.o : ./fcp_variables.o
trpmd_io_routines.o : ./ring_formats.o
trpmd_io_routines.o : ./ring_io_units_module.o
trpmd_io_routines.o : ./ring_variables.o

73
PIOUD/src/makedeps.sh Executable file
View File

@ -0,0 +1,73 @@
#!/bin/sh
# compute dependencies for the PWscf directory tree
# make sure there is no locale setting creating unneeded differences.
LC_ALL=C
export LC_ALL
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
TOPDIR=$(cd ../../install/; pwd)
dirs=.
for dir in $dirs; do
# the following command removes a trailing slash
DIR=`echo ${dir%/}`
# the following would also work
#DIR=`echo $dir | sed "s,/$,,"`
# set inter-directory dependencies - only directories containing
# modules that are used, or files that are included, by routines
# in directory DIR should be listed in DEPENDS
DEPENDS=". ../../XClib ../../Modules ../../PW/src ../../PHonon/PH ../../iotk/src ../../FFTXlib ../../LAXlib ../../LR_Modules ../../UtilXlib ../../upflib ../../FoX/finclude/"
# generate dependencies file (only for directories that are present)
if test -d $DIR
then
cd $DIR
$TOPDIR/moduledep.sh $DEPENDS > make.depend
$TOPDIR/includedep.sh $DEPENDS >> make.depend
# handle special cases
sed '/@\/cineca\/prod\/hpm\/include\/f_hpm.h@/d' \
make.depend > make.depend.tmp
sed '/@iso_c_binding@/d;/@ifcore@/d;/@iso_fortran_env@/d' make.depend.tmp > make.depend
sed -i '/@fox_dom@/d;/@fox_wxml@/d;/@m_common_io@/d;/@fox_sax@/d;/@fox_common@/d' make.depend
if test "$DIR" = "Modules"
then
sed '/@mpi@/d' make.depend > make.depend.tmp
sed '/@elpa1@/d' make.depend.tmp > make.depend
fi
if test "$DIR" = "clib"
then
mv make.depend make.depend.tmp
sed 's/@fftw.c@/fftw.c/' make.depend.tmp > make.depend
fi
if test "$DIR" = "PW/src"
then
mv make.depend make.depend.tmp
sed '/@environ_base@/d' make.depend.tmp > make.depend
fi
rm -f make.depend.tmp
# check for missing dependencies
if grep @ make.depend
then
notfound=1
echo WARNING: dependencies not found in directory $DIR
else
echo directory $DIR : ok
fi
fi
done
if test "$notfound" = ""
then
echo all dependencies updated successfully
fi

2549
PIOUD/src/pimd_subrout.f90 Normal file

File diff suppressed because it is too large Load Diff

524
PIOUD/src/pimd_utils.f90 Normal file
View File

@ -0,0 +1,524 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
subroutine pimd_get_pot_from_pw(epMD)
! use ring_variables, only : pes
use pimd_variables, only : nbeadMD,pes
implicit none
real(8) :: epMD
if (nbeadMD.gt.1) then
epMD=sum(pes)/nbeadMD
else
epMD=pes(1)
end if
return
end subroutine pimd_get_pot_from_pw
subroutine pimd_pw_convert_pos(abc)
! use ring_input_parameters_module, only : pos
use ring_variables, only : pos
use pimd_variables, only : rpos,rcentroid,nbeadMD,natMD,ndimMD
USE ring_io_units_module, ONLY : iunpath
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm
implicit none
integer cc,k,iat,i
character*8 abc
real(8) rnd1,rnd2
real(8), allocatable :: rpostmp(:,:,:)
if (abc .eq. 'pw_to_md') then
do k=1,nbeadMD
cc=0
DO iat=1,natMD
DO i=1,ndimMD
cc=cc+1
rpos(i,iat,k)=pos(cc,k)
END DO
END DO
end do
allocate(rpostmp(ndimMD,natMD,nbeadMD))
rpostmp=rpos
!! I fix the gauge choosing/fixing the first atom of the necklace
do k=2,nbeadMD
call my_refold(k,rpostmp(:,:,k-1),rpostmp(:,:,k))
end do
if (nbeadMD.gt.1) then
rcentroid=0.0
do k=1,nbeadMD
DO iat=1,natMD
DO i=1,ndimMD
rcentroid(i,iat)=rcentroid(i,iat)+rpostmp(i,iat,k)
END DO
END DO
end do
rcentroid=rcentroid/nbeadMD
end if
deallocate(rpostmp)
else
do k=1,nbeadMD
cc=0
DO iat=1,natMD
DO i=1,ndimMD
cc=cc+1
pos(cc,k)=rpos(i,iat,k)
END DO
END DO
end do
!!! this prevents, in the classical case, that the second image is completely static
! if(nbeadMD.eq.1) then
! call random_number(rnd1)
! call random_number(rnd2)
! if (rnd2.ge.0.5) then
! pos(1,1)=pos(1,1)+rnd1*0.0005
! else
! pos(1,1)=pos(1,1)-rnd1*0.0005
! endif
! endif
! CALL mp_bcast( pos, meta_ionode_id, world_comm )
end if
return
end subroutine pimd_pw_convert_pos
subroutine pimd_restart_traj()
! use ring_input_parameters_module, only : pos
use ring_variables, only : pos
use pimd_variables, only : rpos,vel,nbeadMD,natMD,ndimMD
use pimd_variables, only : unit_dot_positions, unit_dot_velocities
USE ring_io_units_module, ONLY : iunpath
implicit none
integer cc,k,iat,i,iflagerr,ngen
real(8), allocatable :: vec_tmp(:)
allocate(vec_tmp(natMD*ndimMD))
!count the number of total available snapshots
ngen=0
rewind(unit_dot_positions)
rewind(unit_dot_velocities)
do while(.true.)
read(unit_dot_positions,*,iostat=iflagerr)
if(iflagerr/=0) exit
ngen=ngen+1
enddo
rewind(unit_dot_positions)
do i=1,ngen-nbeadMD
READ(unit_dot_positions,*)
READ(unit_dot_velocities,*)
end do
rpos=0.0
do k=1,nbeadMD
vec_tmp=0.0
read(unit_dot_positions,*) vec_tmp(:)
cc=0
DO iat=1,natMD
DO i=1,ndimMD
cc=cc+1
rpos(i,iat,k)=vec_tmp(cc)
END DO
END DO
end do
do k=1,nbeadMD
cc=0
DO iat=1,natMD
DO i=1,ndimMD
cc=cc+1
pos(cc,k)=rpos(i,iat,k)
END DO
END DO
end do
vel=0.0
do k=1,nbeadMD
vec_tmp=0.0
read(unit_dot_velocities,*) vec_tmp(:)
cc=0
DO iat=1,natMD
DO i=1,ndimMD
cc=cc+1
vel(i,iat,k)=vec_tmp(cc)
END DO
END DO
end do
close(unit_dot_positions)
close(unit_dot_velocities)
open(unit_dot_positions,file='positions.dat',position='APPEND',form='formatted')
open(unit_dot_velocities,file='velocities.dat',position='APPEND',form='formatted')
deallocate (vec_tmp)
return
end subroutine pimd_restart_traj
SUBROUTINE pimd_get_amas_and_nat
!
USE kinds, ONLY : DP
!
USE pimd_variables, ONLY : nbeadMD,ndimMD,mtot,&
natMD,amas,ion_name,fixcm,gMD
use ring_input_parameters_module, only : nat
!
USE ions_base, ONLY : amass, ityp, atm
!
IMPLICIT NONE
!
INTEGER :: iat
natMD=nat
if(fixcm) then
gMD=ndimMD*(natMD-1) ! # degrees of freedom
else
gMD=ndimMD*natMD
endif
! is this really necessary? (GS)
if(.not.allocated(amas)) allocate(amas(natMD))
if(.not.allocated(ion_name)) allocate(ion_name(natMD))
amas(:) = 0.0
mtot=0.0
DO iat=1,natMD
print *,"iat",iat,"natMD",natMD
write(*, *) "iat",iat,"natMD",natMD
amas(iat)=amass(ityp(iat))*10000.d0/5.48579909065d0
mtot=mtot+amas(iat)
ion_name(iat)=atm(ityp(iat))
END DO
RETURN
END SUBROUTINE pimd_get_amas_and_nat
SUBROUTINE pimd_mp_bcast
use ring_variables, only : nstep_path, num_of_images
use pimd_variables, only : nbeadMD,nblocks,nstep_block, forceMD,&
ndimMD,natMD
use ring_input_parameters_module, only : nat
USE io_global, ONLY : meta_ionode,meta_ionode_id
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm, mpime
implicit none
! integer :: nstep_path
! integer :: num_of_images
! logical :: first_last_opt
nstep_path = nblocks*nstep_block
natMD=nat
! write(*,*) nstep_path
! write(10000,*) "nstep_path",nstep_path, &
! nbeadMD,"nbeadMD",nblocks,"nblocks",nstep_block,"nstep_block"
num_of_images = nbeadMD
!if (nbeadMD.eq.1) num_of_images=2
! first_last_opt=.true.
! write(10001,*) "nstep_path",nstep_path, &
! nbeadMD,"nbeadMD",nblocks,"nblocks",nstep_block,"nstep_block"
CALL mp_bcast( nstep_path, meta_ionode_id, world_comm )
CALL mp_bcast( num_of_images, meta_ionode_id, world_comm )
! CALL mp_bcast( first_last_opt, meta_ionode_id, world_comm )
CALL mp_bcast( nbeadMD, meta_ionode_id, world_comm ) !Added Aadhityan #Do we need?
CALL mp_bcast( forceMD, meta_ionode_id, world_comm )
CALL mp_bcast( ndimMD, meta_ionode_id, world_comm )
CALL mp_bcast( natMD, meta_ionode_id, world_comm )
! CALL mp_bcast( forceMD, meta_ionode_id, world_comm )
! write(11000+mpime,*) nstep_path,nbeadMD,natMD
return
END SUBROUTINE pimd_mp_bcast
SUBROUTINE refold(idx,rpostmp)
USE kinds, ONLY : DP
USE ring_input_parameters_module, ONLY : alat
USE ring_io_units_module, ONLY : iunpath
USE pimd_variables, ONLY : natMD, ndimMD, nbeadMD, rpos
!
USE ions_base, ONLY : tau, ityp
USE cell_base, ONLY : bg, at
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: idx
!
INTEGER :: iat
REAL(DP), ALLOCATABLE :: pos0(:,:), pos1(:,:)
REAL(8) :: rpostmp(ndimMD,natMD)
! atomic positions (in crystal units) of the previous and current image
!
! tau is already in the internal QE units
rpostmp=0.0
rpostmp(:,:)=rpos(:,:,idx)
!
ALLOCATE( pos0(ndimMD,natMD), pos1(ndimMD,natMD) )
!
! atomic positions in current image
pos1(:,:) = rpos(:,:,idx) / alat
CALL cryst_to_cart( natMD, pos1(1,1), bg, -1 )
! refold them within the unit cell around the origin
pos1 = pos1(:,:) - anint(pos1(:,:))
!
IF ( idx > 1 ) THEN
!
! atomic positions in previous image
pos0(:,:) = rpos(:,:,idx-1) / alat
CALL cryst_to_cart( natMD, pos0(1,1), bg, -1 )
!
DO iat = 1,natMD
!
! translate atom by a lattice vector if needed
! N.B.: this solves the problem only when |p1-p0|<1.0
!
!IF ( ANY(ABS(pos1(:,iat) - pos0(:,iat)) > 0.5_DP) ) THEN
! WRITE ( iunpath, '(/,5x,A,I5,A,I3,A,I3,/,5x,A)' ) "WARNING: atom", iat, &
! " moved more than 1/2 alat from image", idx-1, " to image", idx, &
! "You can set minimum_image to true to avoid jumps in the path"
!ENDIF
WHERE( (pos1(:,iat) - pos0(:,iat)) > 0.5_DP )
pos1(:,iat) = pos1(:,iat) - 1.0_DP
ENDWHERE
!
WHERE( (pos1(:,iat) - pos0(:,iat)) < -0.5_DP )
pos1(:,iat) = pos1(:,iat) + 1.0_DP
ENDWHERE
ENDDO
ENDIF
IF ( idx .eq. 1 ) THEN
!
! atomic positions in previous image
pos0(:,:) = rpos(:,:,nbeadMD) / alat
CALL cryst_to_cart( natMD, pos0(1,1), bg, -1 )
!
DO iat = 1,natMD
!
! translate atom by a lattice vector if needed
! N.B.: this solves the problem only when |p1-p0|<1.0
!
!IF ( ANY(ABS(pos1(:,iat) - pos0(:,iat)) > 0.5_DP) ) THEN
! WRITE ( iunpath, '(/,5x,A,I5,A,I3,A,I3,/,5x,A)' ) "WARNING: atom", iat, &
! " moved more than 1/2 alat from image", nbeadMD, " to image", idx, &
! "You can set minimum_image to true to avoid jumps in the path"
!ENDIF
WHERE( (pos1(:,iat) - pos0(:,iat)) > 0.5_DP )
pos1(:,iat) = pos1(:,iat) - 1.0_DP
ENDWHERE
!
WHERE( (pos1(:,iat) - pos0(:,iat)) < -0.5_DP )
pos1(:,iat) = pos1(:,iat) + 1.0_DP
ENDWHERE
ENDDO
ENDIF
! update positions for the temp. vector rpostmp
CALL cryst_to_cart( natMD, pos1(1,1), at, 1 )
rpostmp(:,:) = pos1(:,:)*alat
DEALLOCATE( pos0, pos1 )
RETURN
!
END SUBROUTINE refold
!
SUBROUTINE my_mimage(vector_in,vector_out)
use cell_base, only : at
USE ring_input_parameters_module, ONLY : alat
implicit none
double precision, intent(in) :: vector_in(3)
double precision :: vector_out(3)
double precision :: dist_min
integer :: i1,i2,i3
dist_min = norm2(vector_in)
vector_out = vector_in
do i1 = -2 , 2
do i2 = -2 , 2
do i3 = -2 , 2
if(norm2(i1*at(:,1)*alat + i2*at(:,2)*alat + i3*at(:,3)*alat + vector_in(:)) .le. dist_min ) then
dist_min = norm2(i1*at(:,1)*alat + i2*at(:,2)*alat + i3*at(:,3)*alat + vector_in(:))
vector_out(:) = i1*at(:,1)*alat + i2*at(:,2)*alat + i3*at(:,3)*alat + vector_in(:)
end if
end do
end do
end do
END SUBROUTINE my_mimage
SUBROUTINE my_refold(idx,rpostmp0,rpostmp1)
USE kinds, ONLY : DP
USE ring_input_parameters_module, ONLY : alat
USE ring_io_units_module, ONLY : iunpath
USE pimd_variables, ONLY : natMD, ndimMD, nbeadMD, rpos
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: idx
!
INTEGER :: iat
REAL(DP), ALLOCATABLE :: pos0(:,:), pos1(:,:)
REAL(8) :: rpostmp0(ndimMD,natMD),rpostmp1(ndimMD,natMD),vector(ndimMD)
ALLOCATE( pos0(ndimMD,natMD), pos1(ndimMD,natMD) )
!
! atomic positions in current image
pos1(:,:) = rpostmp1(:,:)
pos0(:,:) = rpostmp0(:,:)
!
DO iat = 1,natMD
call my_mimage( pos1(:,iat) - pos0(:,iat) , vector)
pos1(:,iat) = pos0(:,iat) + vector(:)
ENDDO
! update positions for the temp. vector rpostmp
rpostmp1(:,:) = pos1(:,:)
DEALLOCATE( pos0, pos1 )
RETURN
!
END SUBROUTINE my_refold
SUBROUTINE verify_pioud_tmpdir()
!-----------------------------------------------------------------------
!
USE clib_wrappers, ONLY : f_mkdir
USE ring_input_parameters_module, ONLY : restart_mode
USE io_files, ONLY : prefix, check_tempdir, delete_if_present, tmp_dir
use pimd_variables, only : nbeadMD !Is it input_images in piioud.f90
USE mp_world, ONLY : world_comm, mpime, nproc
USE io_global, ONLY : meta_ionode
USE mp, ONLY : mp_barrier
!
IMPLICIT NONE
! !
INTEGER :: ios, image, proc, nofi
LOGICAL :: exst, parallelfs
CHARACTER (len=256) :: file_path, filename
CHARACTER(len=6), EXTERNAL :: int_to_char
!
!
file_path = trim( tmp_dir ) // trim( prefix )
!
!
IF ( restart_mode == 'from_scratch' ) THEN
!
! ... let us try to create the scratch directory
!
CALL check_tempdir ( tmp_dir, exst, parallelfs )
!
ENDIF
!
!
! ... if starting from scratch all temporary files are removed
! ... from tmp_dir ( only by the master node )
!
IF ( meta_ionode ) THEN
!
! ... files needed by parallelization among images are removed
!
CALL delete_if_present( trim( file_path ) // '.newimage' )
!
! ... file containing the broyden's history
!
IF ( restart_mode == 'from_scratch' ) THEN
!
CALL delete_if_present( trim( file_path ) // '.broyden' )
!
ENDIF
!
ENDIF ! end if ionode
!
!
DO image = 1, nbeadMD
!
file_path = trim( tmp_dir ) // trim( prefix ) //"_" // &
trim( int_to_char( image ) ) // '/'
!
CALL check_tempdir ( file_path, exst, parallelfs )
!
! ... if starting from scratch all temporary files are removed
! ... from tmp_dir ( by all the cpus in sequence )
!
IF ( restart_mode == 'from_scratch' ) THEN
!
DO proc = 0, nproc - 1
!
IF ( proc == mpime ) THEN
!
! ... extrapolation file is removed
!
CALL delete_if_present( trim( file_path ) // &
& trim( prefix ) // '.update' )
!
! ... standard output of the self-consistency is removed
!
CALL delete_if_present( trim( file_path ) // 'PW.out' )
!
ENDIF
!
CALL mp_barrier( world_comm )
!
ENDDO
!
ENDIF ! end restart_mode
!
ENDDO ! end do image
!
RETURN
!
END SUBROUTINE verify_pioud_tmpdir

View File

@ -0,0 +1,125 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!--------------------------------------------------------------------------
MODULE pimd_variables
!---------------------------------------------------------------------------
!
! ... This module contains all variables needed by PIOUD
!
USE kinds, ONLY : DP
!
IMPLICIT NONE
!
SAVE
!
! ... "general" variables :
!
LOGICAL :: &
verbose, &
averaged_cov, &
fixcm, &
yessecond, &
yesquantum, &
yesturboq, &
yesglobal, &
nh, &
restart_pimd
INTEGER :: &
ndimMD=0, &! dimension of the configuration space
nbeadMD=0 ! number of images
REAL(DP) :: &
delt, &
tempMD, &
gammaMD, &
delta_force, &
delta_harm
INTEGER :: &
nblocks, &! number of blocks for averages
nstep_block, &! number of steps for block
iprint, &! printing trajectories frequency
irun ! tipe of run: only 0,3 or 4
! irun = 0 - Classical MD with Nosé-Hoover thermostat
! irun = 3 - Classical/Quantum Langevin dyn. with Ceriotti integrator
! irun = 4 - Quantum Langevin dyn. with PIOUD integrator
INTEGER,PARAMETER :: verlet=0, ceriotti=3, pioud=4
!
! ... "general" real space arrays
INTEGER :: &
unit_dot_ep, &
unit_dot_ep2, &
unit_dot_epsr, &
unit_dot_eplr, &
unit_dot_ek, &
unit_dot_positions, &
unit_dot_positions_cen, &
unit_dot_forces, &
unit_dot_forces_cen, &
unit_dot_stress, &
unit_dot_stress_cen, &
unit_dot_velocities, &
unit_dot_velocities_cen, &
unit_dot_xyz, &
unit_dot_localtemp, &
unit_dot_sigma, &
unit_dot_out
integer,parameter :: nmax=7
integer,parameter :: mav=2000+nmax
real(dp), parameter :: pi=3.14159265358979d0, kbm1=315775.024d0 ! in K/Ha units
real(dp), parameter :: eps_cov = 1.d-10 ! cut off of lower eigenvalues for the inversion of the covariance matrix
real(dp), parameter :: ha2cm1 = 219474.63137d0
! Variables
integer :: natMD=0,nspecies,gMD,iblockMD
integer :: lfnl,lonl,ifl,nav,ikin,nunitcells
integer, dimension (:), allocatable :: ipot,indx
real(dp) :: alat
real(8) :: rcut
real(8) :: SMD,PSMD,QMD,sint,mtot,sigmavar
real(8) :: ekinq, ekinqp, epot_centroid,tfakeMD,deltahtilde,epot_old
real(8), dimension (:), allocatable :: amas,av,avp,anorm,anormp
real(8), dimension (:), allocatable :: dynmat_eig,tmes_bead,dynmatforce_eig
real(8), dimension (:), allocatable :: friction_mode,omega_mode,cost1,cost2,gamma_eigen
real(8), dimension (:), allocatable :: alpha_qmc,alphaqmc_eig
real(8), dimension (:,:), allocatable :: rcm,vcm,dynmat,cmatrix,dynmat_force0
real(8), dimension (:,:), allocatable :: el,rtilde,rcentroid,forcedyn
real(8), dimension (:,:,:), allocatable :: rpos,rpos_init,forceMD,vel,pimp,velocity
real(8), dimension (:,:,:), allocatable :: rtilde_mode, ptilde,forceMD_old,rpos_old
REAL(dp), ALLOCATABLE :: &
pes(:), &! the potential enrgy along the path
! pos(:,:), &! reaction path
! grad_pes(:,:), &! gradients acting on the path
stress_pes_md(:,:) !Stress
character(len=3), dimension(:), allocatable :: ion_name
! Myreweight and former TurboRVB variables
integer :: ieskin,iflagerr,info,nbead,nion
integer :: iscramax,rankMD
real(8) :: dt,cost,temp,ener_true,friction,dynmat_cutoff
real(8) :: normcorr,scalecov,sigma_true,tmes,friction_qmc
real(8), dimension(:,:), allocatable :: fk,mass_ion,fbead,kdyn,cov_pimd
real(8), dimension(:), allocatable :: psip,scalpar,kdyn_eig,cov,cov_old
logical :: write_cov
END MODULE pimd_variables

122
PIOUD/src/pioud.f90 Normal file
View File

@ -0,0 +1,122 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!----------------------------------------------------------------------------
PROGRAM pioud
!----------------------------------------------------------------------------
!
! ... PATH INTEGRAL MOLECULAR DYNAMICS CODE !!!
!
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE environment, ONLY : environment_start, environment_end
USE check_stop, ONLY : check_stop_init
USE mp, ONLY : mp_bcast
USE mp_global, ONLY : mp_startup
USE mp_world, ONLY : world_comm, mpime, root
USE mp_pools, ONLY : intra_pool_comm
USE mp_bands, ONLY : intra_bgrp_comm, inter_bgrp_comm
USE read_input, ONLY : read_input_file
USE command_line_options, ONLY : input_file_, ndiag_
USE trpmd_base, ONLY : initialize_polymer, explore_phasespace
USE ring_input_parameters_module, ONLY : input_images, allocate_path_input_ions, &
deallocate_path_input_ions
USE ring_io_units_module, ONLY : iunpath
IMPLICIT NONE
!
!include 'laxlib.fh'
!
CHARACTER(len=256) :: engine_prefix, parsing_file_name
INTEGER :: unit_tmp, i, iimage
INTEGER, EXTERNAL :: find_free_unit, input_images_getarg
CHARACTER(LEN=6), EXTERNAL :: int_to_char
CALL mp_startup ( start_images=.true.)
!
CALL environment_start ( 'PIOUD' ) !!! <----my mod.
!
! INPUT RELATED
!
engine_prefix = "pw_"
!
IF (meta_ionode) CALL plugin_arguments()
CALL plugin_arguments_bcast( meta_ionode_id, world_comm )
!
! ... open input file
!
IF ( input_file_ /= ' ') THEN
WRITE(iunpath,'(/,5X,"parsing_file_name: ",A)') trim(input_file_)
CALL pimd_gen_inputs( trim(input_file_), engine_prefix, & !!! <----my mod.
root, world_comm ) !!! <----my mod.
CALL pw_gen_inputs( trim(input_file_), engine_prefix, &
input_images, root, world_comm ) !!! Contains NEB. But can't get ridoff completly since it require to generate pw_1.in
!Remove Else or just put no input images.
ELSE
WRITE(iunpath,'(/,5X,"No input file found, assuming nothing to parse",/,&
& 5X,"Searching argument -input_images or --input_images")')
IF ( mpime == root ) input_images = input_images_getarg ( )
CALL mp_bcast(input_images,root, world_comm)
!
IF (input_images == 0) CALL errore('string_methods', &
'Neither a file to parse nor input files for each image found',1)
!
ENDIF
!
IF ( meta_ionode) THEN !!! <----my mod.
! unit_tmp = find_free_unit () !!! <----my mod.
open(newunit=unit_tmp,file="pimd.dat",status="old") !!! <----my mod.
CALL pimd_read_input(unit_tmp) !!! <----my mod.
close(unit=unit_tmp) !!! <----my mod.
END IF !!! <----my mod.
CALL pimd_mp_bcast !!! <----my mod.
!
do i=1,input_images
!
IF ( i > 1 ) CALL clean_pw(.true.)
parsing_file_name = trim(engine_prefix)//trim(int_to_char(i))//".in"
!
CALL read_input_file ( 'PW', parsing_file_name )
CALL iosys()
!
IF ( i == 1 ) THEN
CALL engine_to_path_nat_alat()
CALL allocate_path_input_ions(input_images)
END IF
CALL engine_to_path_pos(i)
!
enddo
CALL pimd_get_amas_and_nat
CALL verify_pioud_tmpdir()
CALL set_engine_output()
CALL check_stop_init()
CALL initialize_polymer()
CALL deallocate_path_input_ions()
CALL explore_phasespace()
CALL laxlib_end()
CALL pimd_deallocation !!! <----my mod.
if ( meta_ionode) call pimd_close_files !!! <----my mod.
CALL stop_run_path( .true. ) !!! <----my mod.
STOP
END PROGRAM pioud

111
PIOUD/src/pw_gen_inputs.f90 Normal file
View File

@ -0,0 +1,111 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!----------------------------------------------------------------------------
SUBROUTINE pw_gen_inputs(parse_file_name,engine_prefix,nimage,root,comm)
!
USE mp, ONLY : mp_rank
!
IMPLICIT NONE
!
CHARACTER(len=*), INTENT(in) :: parse_file_name
CHARACTER(len=*), INTENT(in) :: engine_prefix
INTEGER, INTENT(out) :: nimage
INTEGER, INTENT(in) :: root
INTEGER, INTENT(in) :: comm
!
CHARACTER(len=512) :: dummy
INTEGER :: i, j
INTEGER :: parse_unit
INTEGER, ALLOCATABLE :: unit_tmp(:)
INTEGER :: unit_tmp_i
CHARACTER(len=10) :: a_tmp
INTEGER :: myrank
INTEGER, EXTERNAL :: find_free_unit
nimage=1
!
myrank = mp_rank(comm)
parse_unit = find_free_unit()
OPEN(unit=parse_unit,file=trim(parse_file_name),status="old")
!
! ------------------------------------------------
! ENGINE INPUT PART
! ------------------------------------------------
ALLOCATE(unit_tmp(1:nimage))
unit_tmp(:) = 0
!WRITE(9999,*) "Reading images", nimage
! DO i=1,nimage
! unit_tmp(i) = find_free_unit()
! ENDDO
DO i=1,nimage
IF(i>=1.and.i<10) THEN
WRITE(a_tmp,'(i1)') i
ELSEIF(i>=10.and.i<100) THEN
WRITE(a_tmp,'(i2)') i
ELSEIF(i>=100.and.i<1000) THEN
WRITE(a_tmp,'(i3)')
ENDIF
OPEN(newunit=unit_tmp_i,file=trim(engine_prefix)//trim(a_tmp)//".in")
unit_tmp(i) = unit_tmp_i
REWIND(parse_unit)
dummy=""
DO WHILE (len_trim(dummy)<1)
READ(parse_unit,fmt='(A512)',END=10) dummy
ENDDO
IF(trim(ADJUSTL(dummy)) == "BEGIN") THEN
DO WHILE (trim(ADJUSTL(dummy)) /= "END")
dummy=""
DO WHILE (len_trim(dummy)<1)
READ(parse_unit,fmt='(A512)',END=10) dummy
ENDDO
IF(trim(ADJUSTL(dummy)) == "BEGIN_ENGINE_INPUT") THEN
dummy=""
DO WHILE (len_trim(dummy)<1)
READ(parse_unit,fmt='(A512)',END=10) dummy
ENDDO
DO WHILE (trim(ADJUSTL(dummy)) /= "BEGIN_POSITIONS")
IF(myrank==root) WRITE(unit_tmp_i,'(A)') trim(dummy)
READ(parse_unit,'(A512)') dummy
ENDDO
IF(trim(ADJUSTL(dummy)) == "BEGIN_POSITIONS") THEN
READ(parse_unit,'(A512)') dummy
DO WHILE (trim(ADJUSTL(dummy)) /= "END_POSITIONS")
IF(myrank==root) WRITE(unit_tmp_i,'(A)') trim(ADJUSTL(dummy))
READ(parse_unit,'(A512)') dummy
ENDDO
READ(parse_unit,'(A512)') dummy
DO WHILE (trim(ADJUSTL(dummy)) /= "END_ENGINE_INPUT")
IF(myrank==root) WRITE(unit_tmp_i,'(A)') trim(ADJUSTL(dummy))
READ(parse_unit,'(A512)') dummy
ENDDO
ENDIF
!
ENDIF
ENDDO
ENDIF
CLOSE(unit_tmp_i)
ENDDO
DEALLOCATE(unit_tmp)
CLOSE(parse_unit)
!
10 CONTINUE
!
END SUBROUTINE pw_gen_inputs

View File

@ -0,0 +1,52 @@
!
! Copyright (C) 2003-2005 Quantum ESPRESSO 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 .
!
!----------------------------------------------------------------------------
MODULE ring_formats
!----------------------------------------------------------------------------
!
! ... this module contains the I/O formats used by all "path"-routines
!
! ... Written by Carlo Sbraccia ( 2003-2005 )
!
CHARACTER (LEN=*), PARAMETER :: &
lattice_vectors = "(3(2X,F14.10),/,3(2X,F14.10),/,3(2X,F14.10))"
!
CHARACTER (LEN=*), PARAMETER :: &
restart_first = "(3(2X,F18.12),3(2X,F18.12),3(2X,I1))", &
restart_others = "(3(2X,F18.12),3(2X,F18.12))"
!
CHARACTER (LEN=*), PARAMETER :: &
quick_min = "(9(2X,F18.12))", &
energy = "(2X,F18.10)"
!
CHARACTER (LEN=*), PARAMETER :: &
dat_fmt = "(3(2X,F16.10))", &
int_fmt = "(2(2X,F16.10))", &
xyz_fmt = "(A2,3(2X,F14.10))", &
axsf_fmt = "(A2,6(2X,F14.10))"
!
CHARACTER (LEN=*), PARAMETER :: &
scf_iter_fmt = "(/,5X,30('-'),(1X,'iteration ',I4,1X),30('-'),/)", &
scf_fmt = "(5X,'tcpu = ',F8.1," // &
& "' self-consistency for image ', I3)", &
scf_fmt_para = "(5X,'cpu = ',I2,' tcpu = ',F8.1," // &
& "' self-consistency for image ', I3)"
!
CHARACTER (LEN=*), PARAMETER :: &
run_info = "(5X,'image',8X,'energy (eV)',/)" !!! <----my mod. 8X,'error (eV/A)',8X,'frozen',/)"
!
CHARACTER (LEN=*), PARAMETER :: &
run_output = "(5X,I5,4X,F15.7,10X,F10.6,12X,L1)"
!
CHARACTER (LEN=*), PARAMETER :: &
summary_fmt = "(5X,A,T35,' = ',3X,A)"
!
CHARACTER (LEN=*), PARAMETER :: &
final_fmt = "(/,5X,75('-'),/)"
!
END MODULE ring_formats

View File

@ -0,0 +1,96 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!=----------------------------------------------------------------------------=!
!
MODULE ring_input_parameters_module
!
!=----------------------------------------------------------------------------=!
!
! ... Written by Carlo Sbraccia ( 2003-2006 )
! this module contains
! 1) the definition of other input parameters taken from NEB
! 2) routines that allocate/deallocate data needed in input
! Based upon original NEB implementation ( C.S. 17/10/2003 )
!
USE kinds, ONLY : DP
!
IMPLICIT NONE
!
SAVE
!
INTEGER :: nat = 1
REAL(DP) :: alat
!
CHARACTER(len=80) :: restart_mode
! specify how to start/restart the simulation
CHARACTER(len=80) :: restart_mode_allowed(3)
DATA restart_mode_allowed / 'from_scratch', 'restart', 'reset_counters' /
!
INTEGER :: nstep_path
INTEGER :: input_images = 1
INTEGER :: num_of_images = 0
LOGICAL :: minimum_image = .false.
!
CHARACTER(len=80) :: opt_scheme = 'quick-min'
CHARACTER(len=80) :: opt_scheme_allowed(5)
DATA opt_scheme_allowed / 'quick-min', 'broyden', 'broyden2', 'sd', 'langevin' /
!
NAMELIST / PATH / &
restart_mode, &
nstep_path, num_of_images, &
opt_scheme, &
minimum_image
!
! ATOMIC_POSITIONS
!
REAL(DP), ALLOCATABLE :: pos(:,:)
INTEGER, ALLOCATABLE :: typ(:)
!
! ----------------------------------------------------------------------
CONTAINS
SUBROUTINE allocate_path_input_ions( num_of_images )
!
INTEGER, INTENT(in) :: num_of_images
!
IF ( allocated( pos ) ) DEALLOCATE( pos )
IF ( allocated( typ ) ) DEALLOCATE( typ )
!
ALLOCATE( pos( 3*nat, num_of_images ) )
ALLOCATE( typ( nat ) )
!
pos(:,:) = 0.0
!
RETURN
!
END SUBROUTINE allocate_path_input_ions
!
SUBROUTINE deallocate_path_input_ions()
!
IF ( allocated( pos ) ) DEALLOCATE( pos )
IF ( allocated( typ ) ) DEALLOCATE( typ )
!
RETURN
!
END SUBROUTINE deallocate_path_input_ions
!
!=----------------------------------------------------------------------------=!
!
END MODULE ring_input_parameters_module
!
!=----------------------------------------------------------------------------=!

View File

@ -0,0 +1,36 @@
!
! Copyright (C) 2010 Quantum ESPRESSO 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 .
!
!----------------------------------------------------------------------------
MODULE ring_io_units_module
!----------------------------------------------------------------------------
!
! ... this module contains the I/O units and files used by "path"-routines
!
! ... Written by Carlo Sbraccia ( 2003-2006 )
IMPLICIT NONE
!
!
SAVE
!
INTEGER :: iunpath = 6
INTEGER :: iunnewimage = 28 ! unit for parallelization among images
!
INTEGER, EXTERNAL :: find_free_unit
!
CONTAINS
!
SUBROUTINE set_io_units()
!
IMPLICIT NONE
iunnewimage = find_free_unit()
!
END SUBROUTINE set_io_units
!
END MODULE ring_io_units_module

View File

@ -0,0 +1,72 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
MODULE ring_variables
!---------------------------------------------------------------------------
!
! ... This module contains all variables taken from NEB path optimisations
!
!
! ... Written by Carlo Sbraccia ( 2003-2006 )
USE kinds, ONLY : DP
!
IMPLICIT NONE
!
SAVE
LOGICAL :: restart
LOGICAL :: &
tune_load_balance ! if .TRUE. the load balance for image
! parallelisation is tuned at
! runtime
INTEGER :: &
dim1, &! dimension of the configuration space
num_of_images, &! number of images
pending_image ! last image for which scf has not been
! achieved
REAL(DP) :: &
path_length ! length of the path
INTEGER :: &
istep_path, &! iteration in the optimization procedure
nstep_path ! maximum number of iterations
REAL(DP), ALLOCATABLE :: &
pos(:,:) ! reaction path
CONTAINS
!
!----------------------------------------------------------------------
SUBROUTINE path_allocation()
!----------------------------------------------------------------------
!
IMPLICIT NONE
!
ALLOCATE( pos( dim1, num_of_images ) )
!
END SUBROUTINE path_allocation
!----------------------------------------------------------------------
SUBROUTINE path_deallocation()
!----------------------------------------------------------------------
IMPLICIT NONE
IF ( ALLOCATED( pos ) ) DEALLOCATE( pos )
END SUBROUTINE path_deallocation
END MODULE ring_variables

View File

@ -0,0 +1,22 @@
! Copyright (C) 2010-2013 Quantum ESPRESSO 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 .
!
!
!----------------------------------------------------------------------------
SUBROUTINE set_engine_output()
!-----------------------------------------------------------------------------
!
USE io_global, ONLY : stdout, ionode
!
! ... assign a unit number different from 6 to stdout,
! ... or else the output NEB routines will be redirected as well!
! ... only processors performing I/O need to be redirected
!
if(ionode) stdout = 66
!
END SUBROUTINE set_engine_output
!

View File

@ -0,0 +1,54 @@
!
! Copyright (C) 2001-2009 Quantum ESPRESSO 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 .
!
!----------------------------------------------------------------------------
SUBROUTINE stop_run_path( lflag )
!----------------------------------------------------------------------------
!
! ... Close all files and synchronize processes before stopping.
! ... Called at the end of the run with flag = .TRUE. (removes 'restart')
! ... or during execution with flag = .FALSE. (does not remove 'restart')
!
USE io_global, ONLY : ionode, stdout
USE mp_global, ONLY : mp_global_end
USE environment, ONLY : environment_end
USE ring_variables, ONLY : path_deallocation
USE ring_io_units_module, ONLY : iunpath
USE fcp_opt_routines, ONLY : fcp_opt_deallocation
USE fcp_variables, ONLY : lfcpopt
!
IMPLICIT NONE
!
LOGICAL, INTENT(IN) :: lflag
LOGICAL :: exst, opnd, flag2
!
!
CALL close_files(lflag)
!
! as environment_end writes final info on stdout
! stdout has to be redirected to iunpath (neb output)
!
stdout=iunpath
!
CALL environment_end( 'PIOUD' ) !!! <----my mod.
!
CALL clean_pw( .TRUE. )
!
CALL path_deallocation()
IF ( lfcpopt ) CALL fcp_opt_deallocation()
!
CALL mp_global_end()
!
IF ( .not. lflag ) THEN
!
STOP 1
!
END IF
!
END SUBROUTINE stop_run_path
!
!----------------------------------------------------------------------------

394
PIOUD/src/trpmd_base.f90 Normal file
View File

@ -0,0 +1,394 @@
!
! Copyright (C) 2025 Quantum ESPRESSO 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 .
!
! Written by Aadhityan A, Lorenzo Paulatto, Michele Casula, Tommaso Morresi
!
!---------------------------------------------------------------------------
MODULE trpmd_base
!---------------------------------------------------------------------------
!
! ... This module contains most of the subroutines and functions needed by
! ... the implementation of "PIOUD" method into Quantum ESPRESSO
!
! ... Other relevant files are:
!
! ... ring_variables.f90
! ... trpmd_io_routines.f90
! ... ring_formats.f90
! ... compute_scf_pioud.f90
!
USE kinds, ONLY : DP
USE constants, ONLY : eps32, pi, autoev, bohr_radius_angs, eV_to_kelvin
USE ring_io_units_module, ONLY : iunpath
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm
!
USE basic_algebra_routines
!
PRIVATE
!
PUBLIC :: initialize_polymer
PUBLIC :: explore_phasespace
!
CONTAINS
!
! ... module procedures
!
!-----------------------------------------------------------------------
SUBROUTINE initialize_polymer()
!-----------------------------------------------------------------------
!
USE control_flags, ONLY : conv_elec
USE ions_base, ONLY : amass, ityp
USE io_files, ONLY : prefix, tmp_dir
USE mp_images, ONLY : nimage
USE ring_input_parameters_module, ONLY : pos_ => pos, &
input_images, nstep_path_ => nstep_path
USE ring_input_parameters_module, ONLY : restart_mode
USE ring_input_parameters_module, ONLY : nat
USE ring_variables, ONLY : pos, istep_path, nstep_path, &
dim1, &
path_length, &
tune_load_balance, &
pending_image
USE ring_variables, ONLY : path_allocation
USE fcp_variables, ONLY : lfcpopt
USE fcp_opt_routines, ONLY : fcp_opt_allocation
use pimd_variables, ONLY : nbeadMD, pes
use mp_world
!
IMPLICIT NONE
!
INTEGER :: i, fii, lii
!
! ... istep_path is initialised to 1
!
istep_path = 0 !!! <----my mod.
pending_image = 0
conv_elec = .TRUE.
!
! ... the dimension of all "path" arrays (dim1) is set here
! ... ( it corresponds to the dimension of the configurational space )
!
!
dim1 = 3*nat
!
!
! IF ( nimage > 1 ) THEN
! !
! ! ... the automatic tuning of the load balance in
! ! ... image-parallelisation is switched off by default
! !
! tune_load_balance = .FALSE.
! !
! ! ... in the case of image-parallelisation the number of images
! ! ... to be optimised must be larger than nimage
! !
! IF ( first_last_opt ) THEN
! !
! fii = 1
! lii = num_of_images
! !
! ELSE
! !
! fii = 2
! lii = num_of_images - 1
! !
! END IF
! !
! IF ( nimage > ( lii - fii + 1 ) ) &
! CALL errore( 'initialize_polymer', 'nimage is ' // &
! & 'larger than the available number of images', 1 )
! !
! END IF
! num_of_images=nbeadMD
! write(12000+mpime,*) nbeadMD,nimage
if( nimage > nbeadMD ) &
CALL errore( 'initialize_polymer', 'nimage is ' // &
& 'more computing images than polymer images', 1 )
fii = 1
lii = nbeadMD
!
! ... dynamical allocation of arrays
!
CALL path_allocation()
if ( lfcpopt ) CALL fcp_opt_allocation()
!
! use_masses = .TRUE.
! IF ( use_masses ) THEN
! !
! ! ... mass weighted coordinates are used
! !
! DO i = 1, nat
! !
! mass(3*i-2) = amass(ityp(i))
! mass(3*i-1) = amass(ityp(i))
! mass(3*i-0) = amass(ityp(i))
! !
! END DO
! !
! ELSE
! !
! mass = 1.0_DP
!
! END IF
!
! ... initialization of the allocatable arrays
!
!pos(:,1:input_images) = pos_(1:dim1,1:input_images)
pos(:,1) = pos_(:,1)
!
pes = 0.0_DP
! grad_pes = 0.0_DP
! grad = 0.0_DP
! error = 0.0_DP
! frozen = .FALSE.
!
! k = k_min
!
CALL initial_guess()
!
! posold(:,:) = pos(:,:)
!
! ... the actual number of degrees of freedom is computed
!
! deg_of_freedom = 0
! !
! DO i = 1, nat
! !
! deg_of_freedom = deg_of_freedom + 3
! !
! END DO
!
RETURN
!
END SUBROUTINE initialize_polymer
!
!--------------------------------------------------------------------
SUBROUTINE initial_guess()
!--------------------------------------------------------------------
USE ring_input_parameters_module, ONLY : input_images
USE ring_variables, ONLY : pos, dim1, path_length ! num_of_images,
USE ring_io_units_module, ONLY : iunpath
USE pimd_variables, ONLY : nbeadMD
!
IMPLICIT NONE
!
REAL(DP) :: s
INTEGER :: i, j
LOGICAL :: tooclose
REAL(DP), ALLOCATABLE :: pos_n(:,:), dr(:,:), image_spacing(:)
!
!
CALL mp_bcast( pos(:,1), meta_ionode_id, world_comm )
if( nbeadMD > 1) then !!! <----my mod.
do i=2,nbeadMD !!! <----my mod.
pos(:,i) = pos(:,1) !!! <----my mod.
end do !!! <----my mod.
end if !!! <----my mod.
path_length = 0._dp !
RETURN
!
END SUBROUTINE initial_guess
!
! ... shared routines
!
!------------------------------------------------------------------------
SUBROUTINE born_oppenheimer_pes( stat )
!------------------------------------------------------------------------
!
USE ring_variables, ONLY : pending_image, istep_path !pes, num_of_images
USE pimd_variables, ONLY : nbeadMD, pes
!
IMPLICIT NONE
!
LOGICAL, INTENT(OUT) :: stat
!
INTEGER :: fii, lii
!
fii = 1
lii = nbeadMD
!
IF ( pending_image /= 0 ) fii = pending_image
!
CALL compute_scf_pioud( fii, lii, stat )
!
IF ( .NOT. stat ) RETURN
!
! Emin = MINVAL( pes(1:num_of_images) )
! Emax = MAXVAL( pes(1:num_of_images) )
! Emax_index = MAXLOC( pes(1:num_of_images), 1 )
!
RETURN
!
END SUBROUTINE born_oppenheimer_pes
!
!-----------------------------------------------------------------------
SUBROUTINE explore_phasespace()
!-----------------------------------------------------------------------
!
USE ring_variables, ONLY : pos, nstep_path ! ,lneb, lsmd
USE ring_variables, ONLY : istep_path, &
pending_image !, conv_path &
!pes !CI_scheme
! Emax_index
USE trpmd_io_routines, ONLY : write_output
USE ring_formats, ONLY : scf_iter_fmt
USE fcp_variables, ONLY : lfcpopt
use mp_world
!
USE pimd_variables, ONLY : forceMD,rpos,unit_dot_out,irun,restart_pimd,nblocks,nstep_block !!! <----my mod.
!
IMPLICIT NONE
!
LOGICAL :: stat
REAL(DP) :: fcp_err_max = 0.0_DP
REAL(DP) :: potenergy !!! <----my mod.
!
REAL(DP), EXTERNAL :: get_clock
!
! conv_path = .FALSE.
!
CALL explore_phasespace_init()
!
! write(13000+mpime,*)istep_path,nstep_path,pending_image
IF ( istep_path == nstep_path ) THEN
!
CALL write_output()
!
pending_image = 0
!
RETURN
!
END IF
! write(13000+mpime,*)istep_path,nstep_path,pending_image
!IF ( meta_ionode )
CALL pimd_allocation !!! <----my mod.
IF ( meta_ionode .and. restart_pimd) CALL pimd_restart_traj !!! <----my mod.
CALL mp_bcast( pos, meta_ionode_id, world_comm ) !!! <----my mod.
! write(13000+mpime,*)istep_path,nstep_path,pending_image
if ( meta_ionode) then
write(*,*)
write(*,*) '-------- computes initial forces and energy --------------'
end if
CALL born_oppenheimer_pes( stat ) !!! <----my mod.
if ( meta_ionode) then
write(*,*) '----------------------------------------------------------'
write(*,*)
end if
IF (meta_ionode) CALL pimd_get_pot_from_pw(potenergy) !!! <----my mod.
! IF (meta_ionode) CALL pimd_get_force_from_pw(forceMD) !!! <----my mod.
IF (meta_ionode) CALL pimd_pw_convert_pos('pw_to_md') !!! <----my mod.
IF (meta_ionode) CALL pimdnvt_init(potenergy)!,forceMD) !!! <----my mod.
!
! ... path optimisation loop
!
! write(13000+mpime,*)istep_path,nstep_path,pending_image
optimisation: DO
!
! ... new positions are saved on file: it has to be done here
! ... because, in the event of an unexpected crash the new positions
! ... would be lost. At this stage the forces and the energies are
! ... not yet known (but are not necessary for restarting); the
! ... restart file is written again as soon as the energies and
! ... forces have been computed.
!
!
IF ( meta_ionode ) &
WRITE( UNIT = iunpath, FMT = scf_iter_fmt ) istep_path + 1
!
! ... energies and gradients acting on each image of the path (in real
! ... space) are computed calling a driver for the scf calculations
!
!
IF (meta_ionode .and. irun.eq.0) THEN !!! <----my mod.
call pimd_pw_convert_pos('pw_to_md') !!! <----my mod.
CALL vel_verlet_1half_irun0(istep_path) !!! <----my mod.
call pimd_pw_convert_pos('md_to_pw') !!! <----my mod.
ELSE IF ( meta_ionode .and. irun.eq.3) THEN !!! <----my mod.
call pimd_pw_convert_pos('pw_to_md') !!! <----my mod.
CALL prop_ceriotti_1half_irun3(istep_path) !!! <----my mod.
call pimd_pw_convert_pos('md_to_pw') !!! <----my mod.
END IF !!! <----my mod.
CALL mp_bcast( pos, meta_ionode_id, world_comm ) !!! <----my mod.
CALL born_oppenheimer_pes( stat )
IF (meta_ionode) CALL pimd_get_pot_from_pw(potenergy) !!! <----my mod.
! IF (meta_ionode) CALL pimd_get_force_from_pw(forceMD) !!! <----my mod.
!
! IF ( .NOT. stat ) THEN
! !
! conv_path = .FALSE.
! !
! EXIT optimisation
! !
! END IF
!
! ... istep_path is updated after a self-consistency step has been
! ... completed
!
istep_path = istep_path + 1
!
! ... information is written on the standard output
!
CALL write_output()
!
! ... the restart file is written
!
IF (meta_ionode) call pimd_pw_convert_pos('pw_to_md') !!! <----my mod.
IF (meta_ionode) CALL pimdnvt(potenergy)!,forceMD,) !!! <----my mod.
IF (meta_ionode) call pimd_pw_convert_pos('md_to_pw') !!! <----my mod.
CALL mp_bcast( pos, meta_ionode_id, world_comm )
IF ( istep_path .eq. nstep_path) THEN !!! <----my mod.
EXIT optimisation !!! <----my mod.
END IF !!! <----my mod.
!
END DO optimisation
!
RETURN
!
END SUBROUTINE explore_phasespace
!
!------------------------------------------------------------------------
SUBROUTINE explore_phasespace_init()
!------------------------------------------------------------------------
!
USE ring_variables, ONLY : pending_image
!
IMPLICIT NONE
!
IF ( pending_image /= 0 ) RETURN
!
RETURN
!
END SUBROUTINE explore_phasespace_init
!
END MODULE trpmd_base

View File

@ -0,0 +1,300 @@
!
! Copyright (C) 2002-2006 Quantum ESPRESSO 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 .
!
!
!----------------------------------------------------------------------------
MODULE trpmd_io_routines
!----------------------------------------------------------------------------
!
! ... This module contains all subroutines used for I/O in path
! ... optimisations
!
! ... Written by Carlo Sbraccia ( 2003-2006 )
!
USE kinds, ONLY : DP
USE constants, ONLY : pi, autoev, bohr_radius_angs, eV_to_kelvin, rytoev
USE io_global, ONLY : meta_ionode, meta_ionode_id
USE mp, ONLY : mp_bcast
USE mp_world, ONLY : world_comm
!
USE basic_algebra_routines
!
IMPLICIT NONE
!
PRIVATE
!
PUBLIC :: write_output
PUBLIC :: new_image_init, get_new_image, stop_other_images
!
CONTAINS
!
!-----------------------------------------------------------------------
SUBROUTINE write_output()
!-----------------------------------------------------------------------
!
USE ring_io_units_module, ONLY : iunpath
USE ring_variables, ONLY : path_length, & !num_of_images,
pos !pes
USE ring_formats, ONLY : run_info, run_output
USE ions_base, ONLY : zv, ityp, nat
USE fcp_variables, ONLY : lfcpopt, fcp_mu
USE fcp_opt_routines, ONLY : fcp_neb_ef, fcp_neb_nelec
use pimd_variables, ONLY: pes, nbeadMD
!
IMPLICIT NONE
!
! ... local variables
!
INTEGER :: image
REAL (DP) :: inter_image_distance
!
!
IF ( .NOT. meta_ionode ) RETURN
!
!!! WRITE( UNIT = iunpath, & !!! <----my mod.
!!! FMT = '(/,5X,"activation energy (->) = ",F10.6," eV")' ) & !!! <----my mod.
!!! activation_energy !!! <----my mod.
!!! WRITE( UNIT = iunpath, & !!! <----my mod.
!!! FMT = '(5X,"activation energy (<-) = ",F10.6," eV",/)' ) & !!! <----my mod.
!!! activation_energy + ( pes(1) - pes(num_of_images) ) * autoev !!! <----my mod.
!
WRITE( UNIT = iunpath, FMT = run_info )
!
path_length = 0.0_DP
!
DO image = 1, nbeadMD
!
IF ( image > 1 ) &
path_length = path_length + &
norm( pos(:,image) - pos(:,image-1) )
!
WRITE( UNIT = iunpath, FMT = run_output ) &
image, pes(image) * autoev!!!, error(image), frozen(image) !!! <----my mod.
!
END DO
!
IF ( lfcpopt ) THEN
WRITE(iunpath,'(/,5X,"image",2X,"Fermi energy (eV)",11X, &
& "error (V)",4X,"tot_charge",/)')
DO image = 1, nbeadMD
!
WRITE(iunpath,'(5X,I5,9X,F10.6,10X,F10.6,4X,F10.6)') &
image, fcp_neb_ef(image)*rytoev, &
(fcp_mu-fcp_neb_ef(image))*rytoev, &
SUM( zv(ityp(1:nat)) ) - fcp_neb_nelec(image)
!
END DO
END IF
!
inter_image_distance = path_length / DBLE( nbeadMD - 1 )
!
END SUBROUTINE write_output
!
!-----------------------------------------------------------------------
SUBROUTINE new_image_init( nimage, fii, outdir )
!-----------------------------------------------------------------------
!
! ... this subroutine initializes the file needed for the
! ... parallelization among images
!
USE ring_io_units_module, ONLY : iunnewimage
USE io_files, ONLY : prefix
USE ring_variables, ONLY : tune_load_balance
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: nimage, fii
CHARACTER(LEN=*), INTENT(IN) :: outdir
!
!
IF ( nimage == 1 .OR. .NOT.tune_load_balance ) RETURN
!
OPEN( UNIT = iunnewimage, FILE = TRIM( outdir ) // &
& TRIM( prefix ) // '.newimage' , STATUS = 'UNKNOWN' )
!
WRITE( iunnewimage, * ) fii + nimage
!
CLOSE( UNIT = iunnewimage, STATUS = 'KEEP' )
!
RETURN
!
END SUBROUTINE new_image_init
!
!-----------------------------------------------------------------------
SUBROUTINE get_new_image( nimage, image, outdir )
!-----------------------------------------------------------------------
!
! ... this subroutine is used to get the new image to work on
! ... the "prefix.LOCK" file is needed to avoid (when present) that
! ... other jobs try to read/write on file "prefix.newimage"
!
USE io_files, ONLY : iunnewimage, iunlock, prefix
USE io_global, ONLY : ionode
USE ring_variables, ONLY : tune_load_balance
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: nimage
INTEGER, INTENT(INOUT) :: image
CHARACTER(LEN=*), INTENT(IN) :: outdir
!
INTEGER :: ioerr
CHARACTER(LEN=256) :: filename
LOGICAL :: opened
!
!
IF ( .NOT.ionode ) RETURN
!
IF ( nimage > 1 ) THEN
!
IF ( tune_load_balance ) THEN
!
filename = TRIM( outdir ) // TRIM( prefix ) // '.LOCK'
!
open_loop: DO
!
OPEN( UNIT = iunlock, FILE = TRIM( filename ), &
& IOSTAT = ioerr, STATUS = 'NEW' )
!
IF ( ioerr > 0 ) CYCLE open_loop
!
INQUIRE( UNIT = iunnewimage, OPENED = opened )
!
IF ( .NOT. opened ) THEN
!
OPEN( UNIT = iunnewimage, FILE = TRIM( outdir ) // &
& TRIM( prefix ) // '.newimage' , STATUS = 'OLD' )
!
READ( iunnewimage, * ) image
!
CLOSE( UNIT = iunnewimage, STATUS = 'DELETE' )
!
OPEN( UNIT = iunnewimage, FILE = TRIM( outdir ) // &
& TRIM( prefix ) // '.newimage' , STATUS = 'NEW' )
!
WRITE( iunnewimage, * ) image + 1
!
CLOSE( UNIT = iunnewimage, STATUS = 'KEEP' )
!
EXIT open_loop
!
END IF
!
END DO open_loop
!
CLOSE( UNIT = iunlock, STATUS = 'DELETE' )
!
ELSE
!
image = image + nimage
!
END IF
!
ELSE
!
image = image + 1
!
END IF
!
RETURN
!
END SUBROUTINE get_new_image
!
!-----------------------------------------------------------------------
SUBROUTINE stop_other_images()
!-----------------------------------------------------------------------
!
! ... this subroutine is used to send a stop signal to other images
! ... this is done by creating the exit_file on the working directory
!
USE io_files, ONLY : iunexit, exit_file
USE io_global, ONLY : ionode
!
IMPLICIT NONE
!
!
IF ( .NOT. ionode ) RETURN
!
OPEN( UNIT = iunexit, FILE = TRIM( exit_file ) )
CLOSE( UNIT = iunexit, STATUS = 'KEEP' )
!
RETURN
!
END SUBROUTINE stop_other_images
!
END MODULE trpmd_io_routines
FUNCTION input_images_getarg( ) RESULT(input_images)
!-----------------------------------------------------------------------------
!
! check for command-line option "-input_images N" or "--input_images N",
! return N (0 if not found)
!
USE kinds, ONLY : DP
!
IMPLICIT NONE
!
INTEGER :: input_images
CHARACTER(len=256) :: myname
INTEGER :: iiarg, nargs, i, i0
!
nargs = command_argument_count()
input_images = 0
!
DO iiarg = 1, nargs
!
CALL get_command_argument( iiarg, myname)
!
IF ( TRIM( myname ) == '-input_images' .OR. &
TRIM( myname ) == '--input_images' ) THEN
!
CALL get_command_argument( ( iiarg + 1 ) , myname )
!
READ(myname,*) input_images
RETURN
!
END IF
!
ENDDO
!
RETURN
!
END FUNCTION input_images_getarg
!----------------------------------------------------------------------------
SUBROUTINE close_io_units(myunit)
!-----------------------------------------------------------------------------
!
IMPLICIT NONE
!
INTEGER, intent(in) :: myunit
!
LOGICAL :: opnd
!
INQUIRE( UNIT = myunit, OPENED = opnd )
IF ( opnd ) CLOSE( UNIT = myunit )
!
END SUBROUTINE close_io_units
!
!----------------------------------------------------------------------------
SUBROUTINE open_io_units(myunit,file_name,lappend)
!-----------------------------------------------------------------------------
!
IMPLICIT NONE
!
INTEGER, intent(in) :: myunit
CHARACTER(LEN=256), intent(in) :: file_name
LOGICAL, intent(in) :: lappend
!
LOGICAL :: opnd
!
INQUIRE( UNIT = myunit, OPENED = opnd )
IF ( opnd ) CLOSE( UNIT = myunit )
OPEN( UNIT = myunit, FILE = TRIM(file_name), &
STATUS = 'UNKNOWN', POSITION = 'APPEND' )
!
END SUBROUTINE open_io_units

1
external/fox vendored

@ -1 +0,0 @@
Subproject commit 3453648e6837658b747b895bb7bef4b1ed2eac40

1
external/qe-gipaw vendored

@ -1 +0,0 @@
Subproject commit 490046d300ec23444504bfad0562baa1c71f9345

View File

@ -41,7 +41,7 @@ pseudo :
@./check_pseudo.sh kcw_
@./check_pseudo.sh oscdft_
run-tests : run-tests-pw run-tests-cp run-tests-ph run-tests-pp run-tests-hp run-tests-tddfpt run-tests-kcw
run-tests : run-tests-pw run-tests-cp run-tests-ph run-tests-pp run-tests-hp run-tests-tddfpt run-tests-kcw run-tests-pioud
run-tests-cp : prolog pseudo
env QE_USE_MPI=$(NPROCS) ${TESTCODE_DIR}/bin/testcode.py --verbose --category=cp_all
@ -52,6 +52,9 @@ run-tests-pw : prolog pseudo
run-tests-ph : prolog pseudo
env QE_USE_MPI=$(NPROCS) ${TESTCODE_DIR}/bin/testcode.py --verbose --category=ph_all
run-tests-pioud : prolog pseudo
env QE_USE_MPI=$(NPROCS) ${TESTCODE_DIR}/bin/testcode.py --verbose --category=pioud_all
run-tests-epw : prolog pseudo
env QE_USE_MPI=$(NPROCS) ${TESTCODE_DIR}/bin/testcode.py --verbose --category=epw_all

75
test-suite/extract-pioud.sh Executable file
View File

@ -0,0 +1,75 @@
# fname=benchmark.out.git.inp=diamond_pimd.in #Is it the output file wile running or reference utput
# temperature=`awk '/^[[:space:]]*[0-9]/' 'benchmark.out.git.inp=diamond_pimd.in' | awk '{print $8}' | awk 'NR > 1'`
# if test "$temperature" != ""; then
# echo temprature
# echo $temperature
# fi
fname=$1
# echo "$fname"
line=$(grep -E "^[[:space:]]*[2-3]+[[:space:]]+[2-3]" $fname)
block=$(echo "$line" | awk '{print $1}')
nmove=$(echo "$line" | awk '{print $2}')
H=$(echo "$line" | awk '{print $3}')
H_Nose=$(echo "$line" | awk '{print $4}')
E_pot=$(echo "$line" | awk '{print $5}')
E_kin=$(echo "$line" | awk '{print $6}')
Temp_Ha=$(echo "$line" | awk '{print $7}')
Temp_K=$(echo "$line" | awk '{print $8}')
quantum_kin_virial=$(echo "$line" | awk '{print $9}')
quantum_kin_primitive=$(echo "$line" | awk '{print $10}')
# echo "line= $line"
# echo "block = $block"
# echo "nmove = $nmove"
# echo "H = $H"
# echo "H_Nose = $H_Nose"
# echo "E_pot = $E_pot"
# echo "E_kin = $E_kin"
# echo "Temp_Ha = $Temp_Ha"
# echo "Temp_K = $Temp_K"
# echo "quantum_kin_virial = $quantum_kin_virial"
# echo "quantum_kin_primitive = $quantum_kin_primitive"
if test "$block" != ""; then
echo block
echo $block
fi
if test "$nmove" != ""; then
echo nmove
echo $nmove
fi
if test "$H" != ""; then
echo H
echo $H
fi
if test "$H_Nose" != ""; then
echo H_Nose
echo $H_Nose
fi
if test "$E_pot" != ""; then
echo E_pot
echo $E_pot
fi
if test "$E_kin" != ""; then
echo E_kin
echo $E_kin
fi
if test "$Temp_K" != ""; then
echo Temp_K
echo $Temp_K
fi
if test "$Temp_Ha" != ""; then
echo Temp_Ha
echo $Temp_Ha
fi

View File

@ -1,6 +1,11 @@
# Note: unless a specific oreder of execution is desired,
# there is no need to have for each set of tests a field below
[pioud/]
program = PIOUD
inputs_args = ('diamond_ceriotti.in',''),('diamond_pimd.in',''), ('diamond_verlet.in','')
[pw_atom/]
program = PW
inputs_args = ('atom.in', ''), ('atom-lsda.in',''), ('atom-occ1.in',''), ('atom-occ2.in',''), ('atom-pbe.in',''), ('atom-sigmapbe.in', '')
@ -312,6 +317,9 @@ inputs_args = ('scf_vdw.in', '1'), ('ppacf_fock.in', '2')
program = IMAGE
inputs_args = ('si.scf.in', '1'), ('si.ph.in', '2')
[pioud_*/]
program = PIOUD
[pw_*/]
program = PW
@ -355,6 +363,7 @@ inputs_args = ('view.in', '3 view.oscdft.in pw.in'), ('normalize.in', '3 normali
[categories]
pioud_all = pioud*??
pw_all = pw_*??
cp_all = cp_*??
ph_all = ph_*??

View File

@ -0,0 +1,131 @@
Program PIOUD v.7.4.1 starts on 23Apr2025 at 14:51:57
This program is part of the open-source Quantum ESPRESSO suite
for quantum simulation of materials; please cite
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
"P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
"P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
URL http://www.quantum-espresso.org",
in publications or presentations arising from this work. More details at
http://www.quantum-espresso.org/quote
Parallel version (MPI), running on 1 processors
MPI processes distributed on 1 nodes
1832 MiB available memory on the printing compute node when the environment starts
parsing_file_name: diamond_ceriotti.in
----------------------------------------------------------
*** Ab Initio PIMD Program ***
Classical/Quantum (N,V,T) or (N,V,E) molecular dynamics
with Path Integral Langevin approach
----------------------------------------------------------
This code can be cited as follows:
Mouhat, F., Sorella, S., Vuilleumier, R., Saitta, A. M., & Casula, M. JCTC, 13(6), 2400-2417. (2017).
Reading input from pw_1.in
iat 1 natMD 2
iat 1 natMD 2
iat 2 natMD 2
iat 2 natMD 2
-------- computes initial forces and energy --------------
tcpu = 0.0 self-consistency for image 1
tcpu = 0.6 self-consistency for image 2
tcpu = 1.3 self-consistency for image 3
tcpu = 1.9 self-consistency for image 4
----------------------------------------------------------
**********************************************************
initial potential energy: -11.3766660903163
initial kinetic energy: 1.140052165746966E-002
initial potential energy per atom = -5.688333045
quantities after initialization
1)block 2)nmove 3)H 4)H_Nosé 5)E_pot 6)E_kin 7)Temp(Ha) 8)Temp(K) 9)quantum_kin_virial 10)quantum_kin_primitive
0 0 -11.36527 -11.36527 -11.37667 0.1140052E-01 0.9500435E-03 300.0000 0.7125326E-03 0.2850130E-02
***********************************************************
**************** start of dynamics ************************
------------------------------ iteration 1 ------------------------------
tcpu = 2.4 self-consistency for image 1
tcpu = 3.0 self-consistency for image 2
tcpu = 3.6 self-consistency for image 3
tcpu = 4.1 self-consistency for image 4
image energy (eV)
1 -309.5748551
2 -309.5748550
3 -309.5748550
4 -309.5748551
1 1 -11.37667 0.000000 -11.37667 0.1092744E-01 0.9106197E-03 287.5510 0.2850130E-02 0.2850130E-02
**********************************************************
------------------------------ iteration 2 ------------------------------
tcpu = 4.7 self-consistency for image 1
tcpu = 5.2 self-consistency for image 2
tcpu = 5.7 self-consistency for image 3
tcpu = 6.3 self-consistency for image 4
image energy (eV)
1 -309.5748548
2 -309.5748546
3 -309.5748546
4 -309.5748547
1 2 -11.37667 0.000000 -11.37667 0.1097388E-01 0.9144899E-03 288.7731 0.2850134E-02 0.2850130E-02
**********************************************************
------------------------------ iteration 3 ------------------------------
tcpu = 6.8 self-consistency for image 1
tcpu = 7.3 self-consistency for image 2
tcpu = 7.9 self-consistency for image 3
tcpu = 8.4 self-consistency for image 4
image energy (eV)
1 -309.5748543
2 -309.5748537
3 -309.5748541
4 -309.5748543
2 1 -11.37667 0.000000 -11.37667 0.1016270E-01 0.8468917E-03 267.4272 0.2850147E-02 0.2850128E-02
**********************************************************
------------------------------ iteration 4 ------------------------------
tcpu = 9.0 self-consistency for image 1
tcpu = 9.5 self-consistency for image 2
tcpu = 10.1 self-consistency for image 3
tcpu = 10.7 self-consistency for image 4
image energy (eV)
1 -309.5748536
2 -309.5748523
3 -309.5748533
4 -309.5748538
2 2 -11.37667 0.000000 -11.37667 0.9631887E-02 0.8026572E-03 253.4591 0.2850167E-02 0.2850125E-02
**********************************************************
PIOUD : 10.79s CPU 11.26s WALL
This run was terminated on: 14:52: 9 23Apr2025
=------------------------------------------------------------------------------=
JOB DONE.
=------------------------------------------------------------------------------=

View File

@ -0,0 +1,127 @@
Program PIOUD v.7.4.1 starts on 23Apr2025 at 14:52: 9
This program is part of the open-source Quantum ESPRESSO suite
for quantum simulation of materials; please cite
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
"P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
"P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
URL http://www.quantum-espresso.org",
in publications or presentations arising from this work. More details at
http://www.quantum-espresso.org/quote
Parallel version (MPI), running on 1 processors
MPI processes distributed on 1 nodes
1800 MiB available memory on the printing compute node when the environment starts
parsing_file_name: diamond_pimd.in
----------------------------------------------------------
*** Ab Initio PIMD Program ***
Classical/Quantum (N,V,T) or (N,V,E) molecular dynamics
with Path Integral Langevin approach
----------------------------------------------------------
This code can be cited as follows:
Mouhat, F., Sorella, S., Vuilleumier, R., Saitta, A. M., & Casula, M. JCTC, 13(6), 2400-2417. (2017).
Reading input from pw_1.in
iat 1 natMD 2
iat 1 natMD 2
iat 2 natMD 2
iat 2 natMD 2
Mass particles (unit m_e)
Eigenvalues elastic quantum term
1 -5.551115123125783E-017
2 0.533554935053700
3 0.533554935053700
-------- computes initial forces and energy --------------
tcpu = 0.0 self-consistency for image 1
tcpu = 0.6 self-consistency for image 2
tcpu = 1.2 self-consistency for image 3
----------------------------------------------------------
**********************************************************
initial potential energy: -11.3766660903451
initial kinetic energy: 8.550391243102241E-003
initial potential energy per atom = -5.688333045
quantities after initialization
1)block 2)nmove 3)H 4)H_Nosé 5)E_pot 6)E_kin 7)Temp(Ha) 8)Temp(K) 9)quantum_kin_virial 10)quantum_kin_primitive
0 0 -11.36812 -11.36812 -11.37667 0.8550391E-02 0.9500435E-03 300.0000 0.9500435E-03 0.2850130E-02
***********************************************************
**************** start of dynamics ************************
------------------------------ iteration 1 ------------------------------
tcpu = 1.7 self-consistency for image 1
tcpu = 2.3 self-consistency for image 2
tcpu = 2.8 self-consistency for image 3
image energy (eV)
1 -309.5748552
2 -309.5748552
3 -309.5748552
1 1 -11.36812 0.000000 -11.37667 0.8550391E-02 0.9500435E-03 300.0000 0.2850130E-02 0.8550391E-02
**********************************************************
------------------------------ iteration 2 ------------------------------
tcpu = 3.4 self-consistency for image 1
tcpu = 3.9 self-consistency for image 2
tcpu = 4.5 self-consistency for image 3
image energy (eV)
1 -309.5691173
2 -309.5731167
3 -309.5728277
1 2 -11.36621 0.000000 -11.37655 0.1034317E-01 0.1149241E-02 362.9015 0.2948520E-02 0.8446101E-02
**********************************************************
------------------------------ iteration 3 ------------------------------
tcpu = 5.0 self-consistency for image 1
tcpu = 5.6 self-consistency for image 2
tcpu = 6.2 self-consistency for image 3
image energy (eV)
1 -309.5543116
2 -309.5683392
3 -309.5668642
2 1 -11.36786 0.000000 -11.37624 0.8375561E-02 0.9306179E-03 293.8659 0.3220121E-02 0.8147471E-02
**********************************************************
------------------------------ iteration 4 ------------------------------
tcpu = 6.7 self-consistency for image 1
tcpu = 7.3 self-consistency for image 2
tcpu = 7.9 self-consistency for image 3
image energy (eV)
1 -309.5444770
2 -309.5642984
3 -309.5631919
2 2 -11.36616 0.000000 -11.37602 0.9865541E-02 0.1096171E-02 346.1435 0.3394915E-02 0.7843596E-02
**********************************************************
PIOUD : 8.04s CPU 8.43s WALL
This run was terminated on: 14:52:18 23Apr2025
=------------------------------------------------------------------------------=
JOB DONE.
=------------------------------------------------------------------------------=

View File

@ -0,0 +1,104 @@
Program PIOUD v.7.4.1 starts on 23Apr2025 at 14:52:19
This program is part of the open-source Quantum ESPRESSO suite
for quantum simulation of materials; please cite
"P. Giannozzi et al., J. Phys.:Condens. Matter 21 395502 (2009);
"P. Giannozzi et al., J. Phys.:Condens. Matter 29 465901 (2017);
"P. Giannozzi et al., J. Chem. Phys. 152 154105 (2020);
URL http://www.quantum-espresso.org",
in publications or presentations arising from this work. More details at
http://www.quantum-espresso.org/quote
Parallel version (MPI), running on 1 processors
MPI processes distributed on 1 nodes
1739 MiB available memory on the printing compute node when the environment starts
parsing_file_name: diamond_verlet.in
----------------------------------------------------------
*** Ab Initio PIMD Program ***
Classical/Quantum (N,V,T) or (N,V,E) molecular dynamics
with Path Integral Langevin approach
----------------------------------------------------------
This code can be cited as follows:
Mouhat, F., Sorella, S., Vuilleumier, R., Saitta, A. M., & Casula, M. JCTC, 13(6), 2400-2417. (2017).
Reading input from pw_1.in
iat 1 natMD 2
iat 1 natMD 2
iat 2 natMD 2
iat 2 natMD 2
-------- computes initial forces and energy --------------
tcpu = 0.0 self-consistency for image 1
----------------------------------------------------------
**********************************************************
initial potential energy: -11.3766660904009
initial kinetic energy: 2.850130414367414E-003
initial potential energy per atom = -5.688333045
quantities after initialization
1)block 2)nmove 3)H 4)H_Nosé 5)E_pot 6)E_kin 7)Temp(Ha) 8)Temp(K)
0 0 -11.37382 -11.37382 -11.37667 0.2850130E-02 0.9500435E-03 300.0000
***********************************************************
**************** start of dynamics ************************
------------------------------ iteration 1 ------------------------------
tcpu = 0.7 self-consistency for image 1
image energy (eV)
1 -309.5748551
1 1 -11.37382 0.000000 -11.37667 0.2850129E-02 0.9500428E-03 299.9998
**********************************************************
------------------------------ iteration 2 ------------------------------
tcpu = 1.2 self-consistency for image 1
image energy (eV)
1 -309.5748550
1 2 -11.37382 0.000000 -11.37667 0.2850123E-02 0.9500410E-03 299.9992
**********************************************************
------------------------------ iteration 3 ------------------------------
tcpu = 1.8 self-consistency for image 1
image energy (eV)
1 -309.5748547
2 1 -11.37382 0.000000 -11.37667 0.2850114E-02 0.9500378E-03 299.9982
**********************************************************
------------------------------ iteration 4 ------------------------------
tcpu = 2.3 self-consistency for image 1
image energy (eV)
1 -309.5748544
2 2 -11.37382 0.000000 -11.37667 0.2850100E-02 0.9500335E-03 299.9968
**********************************************************
PIOUD : 2.69s CPU 2.87s WALL
This run was terminated on: 14:52:21 23Apr2025
=------------------------------------------------------------------------------=
JOB DONE.
=------------------------------------------------------------------------------=

View File

@ -0,0 +1,53 @@
BEGIN
BEGIN_PIMD_INPUT
&dynamics
restart_pimd=.false.
nbeadMD=4
nunitcells=1
nblocks=2 !! not used check - only used for first run. restart not working -check
nstep_block=2 !! not used check - only used for first run. restart not working -check
iprint=1 !! Freqncy of output print
run='ceriotti' !! verlet,ceriotti,pioud
delt=0.004 !! in fs #time step
tempMD=300.d0 !! temprature in Kelvin
gammaMD=0.21d0 !! Damping parameter in(1/fs)
delta_force=1.d-4 !! Just for atomic potentials not DFT.
delta_harm=5.d-3 !! Just for atomic potentials not DFT.
/
END_PIMD_INPUT
BEGIN_ENGINE_INPUT
&CONTROL
prefix = "diamond"
tstress = .true.
/
&SYSTEM
ibrav = 2 ,
nosym_evc= .true.
a=3.56,
nat = 2,
ntyp = 1,
nspin=1,
ecutwfc = 25.0,
ecutrho = 120.0,
nbnd = 15,
occupations='smearing',
smearing='fd'
degauss=0.001,
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.3D0,
/
&IONS
/
ATOMIC_SPECIES
C 12.0107 C.pbe-van_bm.UPF
BEGIN_POSITIONS
ATOMIC_POSITIONS crystal
C 0.0 0.0 0.000000000
C 0.25 0.25 0.25
END_POSITIONS
K_POINTS automatic
4 4 4 0 0 0
END_ENGINE_INPUT
END

View File

@ -0,0 +1,53 @@
BEGIN
BEGIN_PIMD_INPUT
&dynamics
restart_pimd=.false.
nbeadMD=3
nunitcells=1
nblocks=2 !! not used check - only used for first run. restart not working -check
nstep_block=2 !! not used check - only used for first run. restart not working -check
iprint=1 !! Freqncy of output print
run='pioud' !! verlet,ceriotti,pioud
delt=0.004 !! in fs #time step
tempMD=300.d0 !! temprature in Kelvin
gammaMD=0.21d0 !! Damping parameter in(1/fs)
delta_force=1.d-4 !! Just for atomic potentials not DFT.
delta_harm=5.d-3 !! Just for atomic potentials not DFT.
/
END_PIMD_INPUT
BEGIN_ENGINE_INPUT
&CONTROL
prefix = "diamond"
tstress = .true.
/
&SYSTEM
ibrav = 2 ,
nosym_evc= .true.
a=3.56,
nat = 2,
ntyp = 1,
nspin=1,
ecutwfc = 25.0,
ecutrho = 120.0,
nbnd = 15,
occupations='smearing',
smearing='fd'
degauss=0.001,
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.3D0,
/
&IONS
/
ATOMIC_SPECIES
C 12.0107 C.pbe-van_bm.UPF
BEGIN_POSITIONS
ATOMIC_POSITIONS crystal
C 0.0 0.0 0.000000000
C 0.25 0.25 0.25
END_POSITIONS
K_POINTS automatic
4 4 4 0 0 0
END_ENGINE_INPUT
END

View File

@ -0,0 +1,53 @@
BEGIN
BEGIN_PIMD_INPUT
&dynamics
restart_pimd=.false.
nbeadMD=1
nunitcells=1
nblocks=2 !! not used check - only used for first run. restart not working -check
nstep_block=2 !! not used check - only used for first run. restart not working -check
iprint=1 !! Freqncy of output print
run='verlet' !! verlet,ceriotti,pioud
delt=0.004 !! in fs #time step
tempMD=300.d0 !! temprature in Kelvin
gammaMD=0.21d0 !! Damping parameter in(1/fs)
delta_force=1.d-4 !! Just for atomic potentials not DFT.
delta_harm=5.d-3 !! Just for atomic potentials not DFT.
/
END_PIMD_INPUT
BEGIN_ENGINE_INPUT
&CONTROL
prefix = "diamond"
tstress = .true.
/
&SYSTEM
ibrav = 2 ,
nosym_evc= .true.
a=3.56,
nat = 2,
ntyp = 1,
nspin=1,
ecutwfc = 25.0,
ecutrho = 120.0,
nbnd = 15,
occupations='smearing',
smearing='fd'
degauss=0.001,
/
&ELECTRONS
conv_thr = 1.D-8,
mixing_beta = 0.3D0,
/
&IONS
/
ATOMIC_SPECIES
C 12.0107 C.pbe-van_bm.UPF
BEGIN_POSITIONS
ATOMIC_POSITIONS crystal
C 0.0 0.0 0.000000000
C 0.25 0.25 0.25
END_POSITIONS
K_POINTS automatic
4 4 4 0 0 0
END_ENGINE_INPUT
END

27
test-suite/run-pioud.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
#
#For serial
set -x
# echo "Running PIOUD (serial)... $@"
# ${ESPRESSO_ROOT}/bin/pioud.x ${PARA_SUFFIX} -in $1 > $2 2> $3
# rm -f pw_?.in
NIMAGE=1
#For parallel
if [[ "$QE_USE_MPI" != "" ]]; then
if grep -Eq "nbeadMD *= *[2-9]" $1; then
NIMAGE=2
fi
export PARA_PREFIX="mpirun -np $QE_USE_MPI"
export PARA_SUFFIX=" -nimage $NIMAGE"
else
unset PARA_PREFIX
unset PARA_SUFFIX
fi
echo "Running PIOUD..."
${PARA_PREFIX} ${ESPRESSO_ROOT}/bin/pioud.x ${PARA_SUFFIX} -in $1 > $2 2> $3
rm -f pw_?.in

View File

@ -1,3 +1,14 @@
[PIOUD]
exe = XXXXXX/test-suite/run-pioud.sh
extract_program = XXXXXX/test-suite/extract-pioud.sh
inputs_args = ('*.in', '')
run_cmd_template = tc.program tc.input tc.output tc.error tc.args
tolerance = ( (8.0e-4, 1.0e-4, 'Temp_K'),
(8.0e+0, 1.0e+1, 'Temp_Ha'),
(8.0e-4, 1.0e-4, 'E_kin'))
skip_program = grep
skip_args = 'not present in this version\|libxc needed for this functional'
[PW]
exe = XXXXXX/test-suite/run-pw.sh
extract_program = XXXXXX/test-suite/extract-pw.sh