-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement numerical forces for H2O Schwenke potential (#174)
* Add h2o_scan OH bond scans for various potentials --------- Co-authored-by: Daniel Hollas <[email protected]>
- Loading branch information
1 parent
2b6a0b3
commit b5383db
Showing
18 changed files
with
1,870 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
! To compile: | ||
! gfortran -c h2o_scan_cvrqd.f90 | ||
! gfortran -fopenmp -L./ -L../water_potentials/ libabin.a ../water_potentials/libwater.a h2o_scan_cvrqd.o -labin -lwater -lm -lstdc++ -o cvrqd_scan | ||
program cvrqd_scan | ||
use mod_force_h2o | ||
use mod_const, only: DP, ANG | ||
use mod_init, only: read_xyz_file | ||
implicit none | ||
|
||
integer, parameter :: NATOM = 3 | ||
integer, parameter :: NBEADS = 1 | ||
integer, parameter :: WATPOT = 1 | ||
|
||
! Displacement for H atom at each timestep | ||
real(DP) :: delta = 0.0005_DP | ||
integer, parameter :: NSTEPS = 5000 | ||
|
||
real(DP) :: x(3, 1), y(3, 1), z(3, 1) | ||
real(DP) :: fx(3, 1), fy(3, 1), fz(3, 1) | ||
real(DP) :: energy, rOH | ||
integer :: i, funit | ||
character(len=2) :: atom_names(3) | ||
character(len=256) :: fname | ||
!character(len=20) :: h2opot = 'cvrqd' | ||
|
||
atom_names = (/"O", "H", "H"/) | ||
|
||
fname = "water.xyz" | ||
open (newunit=funit, file=fname, action="read") | ||
call read_xyz_file(funit, fname, atom_names, natom, nbeads, x, y, z) | ||
close (funit) | ||
|
||
! Convert from Angstromgs to Bohr (atomic units) | ||
x(:, 1) = x(:, 1) * ANG | ||
y(:, 1) = y(:, 1) * ANG | ||
z(:, 1) = z(:, 1) * ANG | ||
|
||
! print for output | ||
print*,"Step ", "rOH ", "Energy" | ||
|
||
open (99, file="water_geometries.xyz", action="write") | ||
! steps for stretching OH bond | ||
do i = 1, NSTEPS | ||
! Calculate the initial OH bond length (rOH) from initial bond positions | ||
rOH = sqrt((x(2, 1) - x(1, 1))**2 + (y(2, 1) - y(1, 1))**2 + (z(2, 1) - z(1, 1))**2) | ||
|
||
! Modify the OH bond length by changing the position of a single hydrogen atom | ||
x(2, 1) = x(2, 1) + delta | ||
|
||
! Call the force_water function to calculate forces and energy | ||
energy = 0.0D0 | ||
call force_h2o(x, y, z, fx, fy, fz, energy, natom, nbeads) | ||
|
||
! Print the current OH bond length and energy | ||
print '(I4,F16.8,E18.8)', i, rOH, energy | ||
|
||
! Print XYZ geometry | ||
write (99, '(I1)') NATOM | ||
write (99, *) | ||
write (99, '(A,F12.6,F12.6,F12.6)') "O ", x(1, 1) / ANG, y(1, 1) / ANG, z(1, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(2, 1) / ANG, y(2, 1) / ANG, z(2, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(3, 1) / ANG, y(3, 1) / ANG, z(3, 1) / ANG | ||
end do | ||
|
||
! close file | ||
close (99) | ||
end program |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Time[fs] E-potential E-kinetic E-Total E-Total-Avg | ||
0.48 0.6381703173E-05 0.7149142696E-06 0.7096617443E-05 0.7096617443E-05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
3 | ||
net force: -0.35413E-04 -0.22257E-04 -0.10937E-06 torque force: -0.29376E-07 0.13497E-10 0.12718E-04 | ||
O -0.1752322176E-04 -0.2737840439E-02 -0.6114886375E-07 | ||
H -0.1019196611E-02 0.1357557850E-02 -0.2410618973E-07 | ||
H 0.1001307070E-02 0.1358025502E-02 -0.2411562662E-07 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
! To compile: | ||
! gfortran -c h2o_scan.f90 | ||
! gfortran -fopenmp -L./ -L../water_potentials/ libabin.a ../water_potentials/libwater.a h2o_scan.o -labin -lwater -lm -lstdc++ -o scan | ||
program scan | ||
!use mod_water | ||
use mod_const, only: DP, ANG | ||
use mod_init, only: read_xyz_file | ||
implicit none | ||
external :: force_water | ||
|
||
integer, parameter :: NATOM = 3 | ||
integer, parameter :: NBEADS = 1 | ||
integer, parameter :: WATPOT = 1 | ||
|
||
! Displacement for H atom at each timestep | ||
real(DP) :: delta = 0.0005_DP | ||
integer, parameter :: NSTEPS = 5000 | ||
|
||
real(DP) :: x(3, 1), y(3, 1), z(3, 1) | ||
real(DP) :: fx(3, 1), fy(3, 1), fz(3, 1) | ||
real(DP) :: energy, rOH | ||
integer :: i, funit | ||
character(len=2) :: atom_names(3) | ||
character(len=256) :: fname | ||
|
||
atom_names = (/"O", "H", "H"/) | ||
|
||
fname = "water.xyz" | ||
open (newunit=funit, file=fname, action="read") | ||
call read_xyz_file(funit, fname, atom_names, natom, nbeads, x, y, z) | ||
close (funit) | ||
|
||
! Convert from Angstromgs to Bohr (atomic units) | ||
x(:, 1) = x(:, 1) * ANG | ||
y(:, 1) = y(:, 1) * ANG | ||
z(:, 1) = z(:, 1) * ANG | ||
|
||
! print for output | ||
print*,"Step ", "rOH ", "Energy" | ||
|
||
open (99, file="water_geometries.xyz", action="write") | ||
! steps for stretching OH bond | ||
do i = 1, NSTEPS | ||
! Calculate the initial OH bond length (rOH) from initial bond positions | ||
rOH = sqrt((x(2, 1) - x(1, 1))**2 + (y(2, 1) - y(1, 1))**2 + (z(2, 1) - z(1, 1))**2) | ||
|
||
! Modify the OH bond length by changing the position of a single hydrogen atom | ||
x(2, 1) = x(2, 1) + delta | ||
|
||
! Call the force_water function to calculate forces and energy | ||
energy = 0.0D0 | ||
call force_water(x, y, z, fx, fy, fz, energy, natom, nbeads, watpot) | ||
|
||
! Print the current OH bond length and energy | ||
print '(I4,F16.8,E18.8)', i, rOH, energy | ||
|
||
! Print XYZ geometry | ||
write (99, '(I1)') NATOM | ||
write (99, *) | ||
write (99, '(A,F12.6,F12.6,F12.6)') "O ", x(1, 1) / ANG, y(1, 1) / ANG, z(1, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(2, 1) / ANG, y(2, 1) / ANG, z(2, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(3, 1) / ANG, y(3, 1) / ANG, z(3, 1) / ANG | ||
end do | ||
|
||
! close file | ||
close (99) | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
! To compile: | ||
! gfortran -c h2o_scan_schwenke.f90 | ||
! gfortran -fopenmp -L./ -L../water_potentials/ libabin.a ../water_potentials/libwater.a h2o_scan_schwenke.o -labin -lwater -lm -lstdc++ -o schwenke_scan | ||
program schwenke_scan | ||
use mod_force_h2o | ||
use mod_const, only: DP, ANG | ||
use mod_init, only: read_xyz_file | ||
implicit none | ||
|
||
integer, parameter :: NATOM = 3 | ||
integer, parameter :: NBEADS = 1 | ||
integer, parameter :: WATPOT = 1 | ||
|
||
! Displacement for H atom at each timestep | ||
real(DP) :: delta = 0.0005_DP | ||
integer, parameter :: NSTEPS = 5000 | ||
|
||
real(DP) :: x(3, 1), y(3, 1), z(3, 1) | ||
real(DP) :: fx(3, 1), fy(3, 1), fz(3, 1) | ||
real(DP) :: energy, rOH | ||
integer :: i, funit | ||
character(len=2) :: atom_names(3) | ||
character(len=256) :: fname | ||
|
||
atom_names = (/"O", "H", "H"/) | ||
|
||
fname = "water.xyz" | ||
open (newunit=funit, file=fname, action="read") | ||
call read_xyz_file(funit, fname, atom_names, natom, nbeads, x, y, z) | ||
close (funit) | ||
|
||
! Convert from Angstromgs to Bohr (atomic units) | ||
x(:, 1) = x(:, 1) * ANG | ||
y(:, 1) = y(:, 1) * ANG | ||
z(:, 1) = z(:, 1) * ANG | ||
|
||
! print for output | ||
print*,"Step ", "rOH ", "Energy" | ||
|
||
open (99, file="water_geometries.xyz", action="write") | ||
! steps for stretching OH bond | ||
do i = 1, NSTEPS | ||
! Calculate the initial OH bond length (rOH) from initial bond positions | ||
rOH = sqrt((x(2, 1) - x(1, 1))**2 + (y(2, 1) - y(1, 1))**2 + (z(2, 1) - z(1, 1))**2) | ||
|
||
! Modify the OH bond length by changing the position of a single hydrogen atom | ||
x(2, 1) = x(2, 1) + delta | ||
|
||
! Call the force_water function to calculate forces and energy | ||
energy = 0.0D0 | ||
call force_h2o(x, y, z, fx, fy, fz, energy, natom, nbeads) | ||
|
||
! Print the current OH bond length and energy | ||
print '(I4,F16.8,E18.8)', i, rOH, energy | ||
|
||
! Print XYZ geometry | ||
write (99, '(I1)') NATOM | ||
write (99, *) | ||
write (99, '(A,F12.6,F12.6,F12.6)') "O ", x(1, 1) / ANG, y(1, 1) / ANG, z(1, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(2, 1) / ANG, y(2, 1) / ANG, z(2, 1) / ANG | ||
write (99, '(A,F12.6,F12.6,F12.6)') "H ", x(3, 1) / ANG, y(3, 1) / ANG, z(3, 1) / ANG | ||
end do | ||
|
||
! close file | ||
close (99) | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
3 | ||
Time step: 1 Sim. Time [au] 20.00 | ||
O -0.61360661E-07 0.11798960E+00 -0.23219057E-09 | ||
H 0.75693652E+00 -0.47191813E+00 -0.14713543E-08 | ||
H -0.75693758E+00 -0.47191813E+00 -0.14713543E-08 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Time[fs] Temperature T-Average Conserved_quantity_of_thermostat | ||
0.48 0.05 0.05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Time[fs] E-potential E-primitive E-virial CumulAvg_prim CumulAvg_vir | ||
0.48 0.2032534245E-03 0.4240025844E-01 0.4610886063E-02 0.0000000000E+00 0.0000000000E+00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
3 | ||
net force: -0.34900E-04 -0.21872E-04 -0.23623E-06 torque force: -0.11636E-06 0.11789E-06 0.12688E-04 | ||
O 0.1406278399E-02 -0.7643573452E-04 -0.4539698562E-05 | ||
H -0.4915237113E-03 0.5916075151E-03 0.7610904203E-05 | ||
H -0.9183288214E-03 -0.5174496949E-03 -0.3070025751E-05 | ||
O 0.1029504537E-02 -0.3137513875E-03 -0.7261943491E-05 | ||
H -0.1096923748E-02 0.5550899357E-03 0.9241624504E-05 | ||
H 0.6388830400E-04 -0.2434761981E-03 -0.1999998591E-05 | ||
O 0.8080863472E-03 -0.1105513313E-02 -0.6980333922E-05 | ||
H -0.1174807221E-02 0.8695034946E-03 0.9433782651E-05 | ||
H 0.3633443635E-03 0.2338748312E-03 -0.2503661399E-05 | ||
O -0.1152977997E-02 0.1000189522E-03 0.6741341207E-05 | ||
H 0.4578461668E-03 -0.4920100495E-03 -0.2205022587E-05 | ||
H 0.6915218342E-03 0.3897813730E-03 -0.4534861083E-05 | ||
O -0.2491688014E-02 -0.9286233146E-03 -0.3212782834E-04 | ||
H 0.1887885553E-03 -0.4651981520E-03 -0.8959672607E-05 | ||
H 0.2299520787E-02 0.1391728496E-02 0.4103745521E-04 | ||
O -0.6996351407E-03 -0.1407817375E-02 0.2441041569E-04 | ||
H -0.4892135576E-03 0.4127463371E-03 -0.8007478791E-05 | ||
H 0.1185525436E-02 0.9929424867E-03 -0.1646446403E-04 | ||
O 0.1156527630E-03 -0.2174677061E-04 0.1258084470E-05 | ||
H -0.9827495886E-04 0.5499903011E-04 -0.1533251695E-05 | ||
H -0.2096749453E-04 -0.3547954388E-04 0.2731750706E-06 | ||
O -0.1569677876E-03 -0.6794758758E-03 0.1410986050E-04 | ||
H -0.2039187457E-03 0.2854735131E-03 -0.6374207251E-05 | ||
H 0.3574246109E-03 0.3917950652E-03 -0.7764241868E-05 | ||
O -0.4446000823E-04 0.1103340000E-03 -0.9740871998E-06 | ||
H 0.3852600226E-04 -0.7298840577E-04 0.7055280500E-06 | ||
H 0.2318156237E-05 -0.3957809077E-04 0.2724330799E-06 | ||
O -0.1330421239E-02 -0.7888721397E-03 0.7259842394E-05 | ||
H 0.4495847032E-03 -0.1294748862E-03 0.2919610472E-05 | ||
H 0.8773974682E-03 0.9161235934E-03 -0.1020951249E-04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
&general | ||
nstep=1, | ||
irest=0, | ||
idebug=0 | ||
iknow=0 | ||
|
||
pot='_h2o_' | ||
ipimd=1, | ||
nwalk=10, | ||
istage=1, | ||
nproc=1 | ||
|
||
dt=20., | ||
irandom=131313, | ||
|
||
nwrite=1, | ||
nwritex=1, | ||
nrest=1, | ||
nwritef=1, ! write forces | ||
/ | ||
|
||
&nhcopt | ||
inose=1, | ||
temp=298.15, | ||
tau0=0.0015 | ||
nrespnose=3 | ||
nyosh=7 | ||
rem_comrot=.false. | ||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
3 | ||
|
||
O 0.000 0.118 0.000 | ||
H 0.757 -0.472 0.000 | ||
H -0.757 -0.472 0.000 |
Oops, something went wrong.