Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ subroutine init(dt)
! L-J parameters
real(DP), allocatable :: LJ_rmin(:), LJ_eps(:)
! Initial temperature (read from namelist nhcopt)
real(DP), save :: temp0 = -1
real(DP), save :: temp0 = -1.0_DP
! User-defined masses in relative atomic units
real(DP), allocatable :: masses(:)
integer :: iw, iat, natom_xyz, iost
Expand Down Expand Up @@ -435,9 +435,7 @@ subroutine init(dt)
call plumed_init(natom, irest, dt0, nrest)
end if

if (temp0 < 0) then
temp0 = temp
end if
! Print initial and target temperature information
write (stdout, *) 'Initial temperature [K] =', temp0
if (inose /= 0) write (stdout, *) 'Target temperature [K] =', temp

Expand All @@ -463,7 +461,7 @@ subroutine init(dt)
if (inose == 1) then
call nhc_init()
else if (inose == 2) then
call gle_init(dt * 0.5D0 / nabin / nstep_ref) !nabin is set to 1 unless ipimd=1
call gle_init(dt * 0.5D0 / nabin / nstep_ref) ! nabin is set to 1 unless ipimd=1
else if (inose == 3) then
call pile_init(dt * 0.5D0, tau0_langevin)
else if (inose == 4) then
Expand All @@ -484,9 +482,11 @@ subroutine init(dt)
! what about massive thermostat?
end if

! Set initial velocities according to the Maxwell-Boltzmann distribution
! Set initial velocities according to the Maxwell--Boltzmann distribution
if (irest == 0 .and. chveloc == '') then
call vinit(temp0, am, vx, vy, vz)
write (*, '(a,1x,f8.2,1x,a)') "Initial velocities generated from Maxwell--Boltzmann distribution based at temperature", &
temp0, "K"
end if

! Read velocities from file (optional)
Expand Down Expand Up @@ -599,6 +599,12 @@ subroutine check_inputsanity()
write (stderr, *) 'Velocities will be taken from restart file because irest=1.'
end if

if (irest == 0 .and. chveloc == '' .and. temp0 < 0) then
write (*, '(a)') 'ERROR: Initial temperature (temp0) was not set and no file with initial velocities were provided.'
write (*, '(a,/)') 'FIX: Set parameter temp0 >= 0 or provide initial velocities.'
error = 1
end if

if (pot /= '_cp2k_') then
if (nproc > nwalk) then
write (*, *) 'ERROR: Nproc greater than nwalk. That does not make sense.'
Expand All @@ -620,7 +626,7 @@ subroutine check_inputsanity()
error = 1
end if
if (ipimd == 1 .and. nwalk <= 1) then
write (*, *) 'Number of walkers for PIMD (nwalk) mus be >= 1!'
write (*, *) 'Number of walkers for PIMD (nwalk) must be >= 1!'
write (*, *) 'Either set ipimd=0 for classical simulation'
write (*, *) 'or set nwalk > 1'
error = 1
Expand Down
1 change: 1 addition & 0 deletions tests/ABINITIO-FAIL/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ irest=0,
&nhcopt
inose=0,
temp=0.0,
temp0=0.0
/
1 change: 1 addition & 0 deletions tests/ABINITIO/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ kb_sbc=0.1d0,
inose=1,
nchain=4,
temp=298.15,
temp0=298.15,
rem_comrot=.false.
tau0=0.001D0
/
3 changes: 2 additions & 1 deletion tests/ANALYZE_EXT/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ nrest=10,
/

&nhcopt
temp=200.
inose=1
temp=200.0,
temp0=200.0,
tau0=0.001D0
/
13 changes: 7 additions & 6 deletions tests/CMD/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# TESTING nyosh = 1
# TESTING iknow
&nhcopt
inose=1, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
temp=298.15, ! initial temperature for Maxwell-Boltzmann sampling [au]
inose=1, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
temp=298.15, ! Target temperature of thermostat [K]
temp0=298.15, ! Initial temperature for Maxwell--Boltzmann sampling [K]
tau0=0.0015
nrespnose=3
nyosh=1 ! Turn off Suzuki-Yoshida integration scheme (NOT RECOMMENDED!)
Expand All @@ -21,11 +22,11 @@ irest=0,
idebug=1
iknow=1

pot='_mmwater_'
mdtype='MD', ! classical MD
pot='_mmwater_'
mdtype='MD', ! classical MD

dt=20., ! number of steps and timestep
irandom=131313, ! random seed
dt=20., ! number of steps and timestep
irandom=131313, ! random seed

nwrite=1,
nwritex=1,
Expand Down
1 change: 1 addition & 0 deletions tests/DOUBLEWELL/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ idebug=1,
&thermostat
therm='none',
temp=298.15,
temp0=298.15
/

&system
Expand Down
3 changes: 2 additions & 1 deletion tests/GLE-CANONICAL/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ nwritef=1,
&nhcopt
inose=4,
rem_comrot=.false.
temp=300.,
temp=300.0,
temp0=300.0,
gle_test=.true.
/
3 changes: 2 additions & 1 deletion tests/H2O_CVRQD/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ nstep=2

&nhcopt
inose=0, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
temp=100
temp=100.0,
temp0=100.0,
rem_comrot=.true. ! this is a default value, remove rotations at the beginning
/
3 changes: 2 additions & 1 deletion tests/H2O_SCHWENKE/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nwritef=1, ! write forces

&nhcopt
inose=0, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
temp=0
temp=0.0,
temp0=0.0,
rem_comrot=.true. ! this is a default value, remove rotations at the beginning
/
1 change: 1 addition & 0 deletions tests/H2O_SCHWENKE_PIMD/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ nwritef=1, ! write forces
&nhcopt
inose=1,
temp=298.15,
temp0=298.15,
tau0=0.0015
nrespnose=3
nyosh=7
Expand Down
1 change: 1 addition & 0 deletions tests/HARMON/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dist2=1
&nhcopt
inose=1,
temp=50.15,
temp0=50.15,
tau0=0.0015
nrespnose=3
nyosh=7
Expand Down
1 change: 1 addition & 0 deletions tests/INIT/ABIN_ERROR5.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR in init.F90: Invalid input parameters
1 change: 1 addition & 0 deletions tests/INIT/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ idebug=1,
&nhcopt
inose=0,
temp=298.15,
temp0=298.15,
tau0=0.001D0
/
1 change: 1 addition & 0 deletions tests/INIT/input.in.nhc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dt=20.,

&nhcopt
temp=0.1
temp0=0.1,
inose=1,
nchain=150
nrespnose=1
Expand Down
1 change: 1 addition & 0 deletions tests/INIT/input.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dt=20.,

&nhcopt
inose=0,
temp0=0.0
/

! Invalid SH parameters
Expand Down
22 changes: 22 additions & 0 deletions tests/INIT/input.in.vels
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
&general
irest=0,
nstep=1,
pot='_mmwater_'
mdtype='MD',

dt=20.,
irandom=53478953,

nwrite=1,
nwritex=1,
nrest=1,
nwritev=1,
nwritef=1,
idebug=1,
/

&nhcopt
inose=0,
temp=298.15,
tau0=0.001D0
/
8 changes: 8 additions & 0 deletions tests/INIT/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ mv ERROR ABIN_ERROR3

$ABINEXE -x mini.xyz -i input.in.nhc > abin.out 2>&1 || true
mv ERROR ABIN_ERROR4

# Testing that ABIN does not run
# if temp0 is not set and initial velocities file is not
# present and irest=0

$ABINEXE -x mini.xyz -i input.in.vels > abin.out 2>&1 || true
mv ERROR ABIN_ERROR5

3 changes: 2 additions & 1 deletion tests/LANGEVIN/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ nwritef=1,

&thermostat
therm='langevine',
temp=300.0
temp=300.0,
temp0=300.0,
tau0_langevin=0.001
/
1 change: 1 addition & 0 deletions tests/MINI/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ gammthr=1.3

&nhcopt
inose=0,
temp0=0.0
/
3 changes: 2 additions & 1 deletion tests/MM/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ nwritef=1

&nhcopt
inose=0,
temp=100,
temp=100.0,
temp0=100.0,
/

&qmmm
Expand Down
1 change: 1 addition & 0 deletions tests/MORSE/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ d0_morse=0.363965D0
&nhcopt
inose=1,
temp=300.0,
temp0=300.0,
tau0=0.001
/
1 change: 1 addition & 0 deletions tests/MTS/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ idebug=1,
&nhcopt
inose=1,
temp=298.15,
temp0=298.15,
tau0=0.001D0
/

Expand Down
1 change: 1 addition & 0 deletions tests/MTS/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ idebug=1,
&nhcopt
inose=1,
temp=298.15,
temp0=298.15,
tau0=0.001D0
/

Expand Down
1 change: 1 addition & 0 deletions tests/NHC-GLOBAL/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ therm='nhc',
imasst=0,
nyosh=3,
temp=298.15,
temp0=298.15,
tau0=0.001D0
/
3 changes: 2 additions & 1 deletion tests/PIGLE/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ nrest=1,

&thermostat
therm='gle',
temp=200,
temp=200.0,
temp0=200.0,
rem_comrot=.false.
gle_test=.true.
/
3 changes: 2 additions & 1 deletion tests/PIGLE2/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ nrest=1,

&nhcopt
inose=2,
temp=200,
temp=200.0,
temp0=200.0,
rem_comrot=.false.

! Unlike in the PIGLE test, we're running a normal PIGLE here,
Expand Down
3 changes: 2 additions & 1 deletion tests/PIGLET/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nrest=1,

&nhcopt
inose=2,
temp=300,
temp=300.0,
temp0=300.0,
gle_test=.true.
/
3 changes: 2 additions & 1 deletion tests/PIGLET/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nrest=1,

&nhcopt
inose=2,
temp=300,
temp=300.0,
temp0=300.0,
gle_test=.true.
/
3 changes: 2 additions & 1 deletion tests/PIGLET2/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nrest=1,

&nhcopt
inose=2,
temp=300,
temp=300.0,
temp0=300.0,
gle_test=.false.
/
3 changes: 2 additions & 1 deletion tests/PIGLET2/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nrest=1,

&nhcopt
inose=2,
temp=300,
temp=300.0,
temp0=300.0,
gle_test=.false.
/
1 change: 1 addition & 0 deletions tests/PILE/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ idebug=2
&nhcopt
inose=3, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
temp=298.15,
temp0=298.15,
tau0_langevin=0.001, ! Relaxation time of the Langevin thermostat in picoseconds
rem_comrot=.false.
/
1 change: 1 addition & 0 deletions tests/PILE/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ nrest=1,
&nhcopt
inose=3, ! Thermostating: Nose-Hoover 1, microcanonical 0, GLE 2, LE 3
temp=298.15,
temp0=298.15,
tau0_langevin=0.001, ! Relaxation time of the Langevin thermostat in picoseconds
/
1 change: 1 addition & 0 deletions tests/PLUMED/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ dist2=2,
&nhcopt
inose=1,
temp=300.0,
temp0=300.0,
tau0=0.001D0
/
1 change: 1 addition & 0 deletions tests/PLUMED/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ dist2=2,
&nhcopt
inose=1,
temp=300.0,
temp0=300.0,
tau0=0.001D0
/
3 changes: 2 additions & 1 deletion tests/QMMM/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ irest=0, ! should we restart from restart.xyz? (ignoring mini.dat), NOT working
&nhcopt
inose=1, ! Thermostating: Nose-Hoover 1, microcanonical 0,GLE 2, LE 3
nchain=4, ! number of nose-hoover chains
temp=298.15, ! initial temperature for Maxwell-Boltzmann sampling [au]
temp=298.15, ! Target temperature for thermostat [K]
temp0=298.15, ! Initial temperature for Maxwell--Boltzmann sampling [K]
rem_comrot=.false.
tau0=0.001D0
/
Expand Down
1 change: 1 addition & 0 deletions tests/QT/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ nwritef=1,
inose=2,
rem_comrot=.false.
temp=100.15,
temp0=100.15,
gle_test=.true.
/
1 change: 1 addition & 0 deletions tests/QT2/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nwritef=1,
inose=2,
rem_comrot=.false.
temp=100.15,
temp0=100.15,
! Unlike in the PIGLE test, we're running a normal PIGLE here,
! where propagator matrices S and T are computed from A and C
! matrices read from GLE-A and GLE-C files.
Expand Down
Loading
Loading