Skip to content

Commit

Permalink
Addressed comments, added a couple extra explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Oct 12, 2024
1 parent 13348dc commit ef9f5eb
Show file tree
Hide file tree
Showing 24 changed files with 28 additions and 442 deletions.
13 changes: 7 additions & 6 deletions drivers/f90/LJ.f90
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ SUBROUTINE LJ_getall(rc, sigma, eps, natoms, atoms, cell_h, cell_ih, index_list,
pot = pot + pot_ij
DO k = 1, 3
DO l = k, 3
! only upper triangular part is returned
! Only the upper triangular elements calculated.
virial(k,l) = virial(k,l) + fij(k)*rij(l)
ENDDO
ENDDO
Expand All @@ -199,8 +199,8 @@ SUBROUTINE LJ_getall(rc, sigma, eps, natoms, atoms, cell_h, cell_ih, index_list,
start = index_list(i) + 1
ENDDO

! Works with a generic cell, even if usually it'll be upper-triuangular
volume = CELL_VOLUME(cell_h) !cell_h(1,1)*cell_h(2,2)*cell_h(3,3)
! Assuming an upper-triangular vector matrix for the simulation box.
volume = cell_h(1,1)*cell_h(2,2)*cell_h(3,3)
CALL LJ_longrange(rc, sigma, eps, natoms, volume, pot_lr, vir_lr)
pot = pot + pot_lr
DO k = 1, 3
Expand Down Expand Up @@ -272,7 +272,8 @@ SUBROUTINE LJMix_getall(n_type2, rc, sigma, eps, natoms, atoms, cell_h, cell_ih,
forces(n_list(j),:) = forces(n_list(j),:) - fij
pot = pot + pot_ij
DO k = 1, 3
DO l = k, 3 ! only upper-tri part is returned
DO l = k, 3
! Only the upper triangular elements calculated.
virial(k,l) = virial(k,l) + fij(k)*rij(l)
ENDDO
ENDDO
Expand All @@ -281,8 +282,8 @@ SUBROUTINE LJMix_getall(n_type2, rc, sigma, eps, natoms, atoms, cell_h, cell_ih,
start = index_list(i) + 1
ENDDO

! Works with a generic cell, even if usually it'll be upper-triuangular
volume = CELL_VOLUME(cell_h) ! cell_h(1,1)*cell_h(2,2)*cell_h(3,3)
! Assuming an upper-triangular vector matrix for the simulation box.
volume = cell_h(1,1)*cell_h(2,2)*cell_h(3,3)
CALL LJ_longrange(rc, sigma*(1-n_type2*0.4/natoms), eps*(1-n_type2*0.4/natoms), natoms, volume, pot_lr, vir_lr)
pot = pot + pot_lr
DO k = 1, 3
Expand Down
11 changes: 0 additions & 11 deletions drivers/f90/distance.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ MODULE DISTANCE

CONTAINS

DOUBLE PRECISION function CELL_VOLUME(m)

DOUBLE PRECISION m(3, 3)

CELL_VOLUME = DABS(m(1, 1) * (m(2, 2) * m(3, 3) - m(3, 2) * m(2, 3)) - &
m(1, 2) * (m(2, 1) * m(3, 3) - m(3, 1) * m(2, 3)) + &
m(1, 3) * (m(2, 1) * m(3, 2) - m(3, 1) * m(2, 2)) )

return
end

SUBROUTINE vector_separation(cell_h, cell_ih, ri, rj, rij, r2)
! Calculates the vector separating two atoms.
!
Expand Down
48 changes: 5 additions & 43 deletions drivers/f90/driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ PROGRAM DRIVER
USE SG
USE PSWATER
USE F90SOCKETS, ONLY : open_socket, writebuffer, readbuffer, f_sleep
USE DISTANCE, only: CELL_VOLUME
IMPLICIT NONE

! SOCKET VARIABLES
Expand Down Expand Up @@ -192,15 +191,13 @@ PROGRAM DRIVER
vstyle = 64
ELSEIF (trim(cmdbuffer) == "qtip4pf-c-json-delta") THEN
vstyle = 65
ELSEIF (trim(cmdbuffer) == "noo3-h2o") THEN
vstyle = 70
ELSEIF (trim(cmdbuffer) == "gas") THEN
vstyle = 0 ! ideal gas
ELSEIF (trim(cmdbuffer) == "dummy") THEN
vstyle = 99 ! returns non-zero but otherwise meaningless values
ELSE
WRITE(*,*) " Unrecognized potential type ", trim(cmdbuffer)
WRITE(*,*) " Use -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4pf-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|ljmix|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta|noo3-h2o] "
WRITE(*,*) " Use -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4pf-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|ljmix|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta] "
STOP "ENDED"
ENDIF
ELSEIF (ccmd == 4) THEN
Expand Down Expand Up @@ -388,7 +385,7 @@ PROGRAM DRIVER
enddo
ENDIF
isinit = .true.
ELSEIF (1 == vstyle) THEN
ELSEIF (vstyle == 1) THEN
IF (par_count /= 3) THEN
WRITE(*,*) "Error: parameters not initialized correctly."
WRITE(*,*) "For LJ potential use -o sigma,epsilon,cutoff "
Expand Down Expand Up @@ -522,8 +519,8 @@ PROGRAM DRIVER
! units and storage mode used in the driver.
cell_h = transpose(cell_h)
cell_ih = transpose(cell_ih)
! We compute for a generic cell, just in case (even though usually i-PI passes an upper triangular cell-vector matrix)
volume = CELL_VOLUME(cell_h) !cell_h(1,1)*cell_h(2,2)*cell_h(3,3)
! We assume an upper triangular cell-vector matrix
volume = cell_h(1,1)*cell_h(2,2)*cell_h(3,3)

CALL readbuffer(socket, cbuf) ! The number of atoms in the cell
IF (verbose > 1) WRITE(*,*) " !read!=> cbuf: ", cbuf
Expand Down Expand Up @@ -793,41 +790,6 @@ PROGRAM DRIVER
CALL LJ_getall(rc, 2.1d0, -12d-6, nat, atoms, cell_h, cell_ih, index_list, n_list, pot, forces, virial)
CALL LJ_getall(rc, 2.5d0, 1d-6, nat, atoms, cell_h, cell_ih, index_list, n_list, pot, forces, virial)
ENDIF
ELSEIF (70 == vstyle) THEN
! potential that can be applied on top of water molecules to add a orientation-dependent term to
! test non-equivariant terms in the potential
vpars(1) = cell_h(1,1)
vpars(2) = cell_h(2,2)
vpars(3) = cell_h(3,3)

pot = 0
forces = 0
DO i=1,nat,3
dip = 0.5 * (atoms(i+1,:) + atoms(i+2,:)) - atoms(i,:)
vpars(4) = sqrt(dip(1)**2+dip(2)**2+dip(3)**2)
vpars(1) = exp(dip(1)/vpars(4)*1.0)
vpars(2) = exp(dip(2)/vpars(4)*0.5)
vpars(3) = exp(dip(3)/vpars(4)*2.0)
pot = pot + 2e-2*(vpars(1)+vpars(2)+vpars(3))
vpars(1) = 2e-2*vpars(1)*1.0/vpars(4)**3
vpars(2) = 2e-2*vpars(2)*0.5/vpars(4)**3
vpars(3) = 2e-2*vpars(3)*2.0/vpars(4)**3
! gradients on O
vpars(4) = -vpars(1)*(dip(2)**2+dip(3)**2) + vpars(2)*dip(1)*dip(2) + vpars(3)*dip(3)*dip(1)
vpars(5) = -vpars(2)*(dip(1)**2+dip(3)**2) + vpars(1)*dip(1)*dip(2) + vpars(3)*dip(2)*dip(3)
vpars(6) = -vpars(3)*(dip(1)**2+dip(2)**2) + vpars(1)*dip(1)*dip(3) + vpars(2)*dip(3)*dip(2)
forces(i,1) = forces(i,1) - vpars(4)
forces(i,2) = forces(i,2) - vpars(5)
forces(i,3) = forces(i,3) - vpars(6)
! gradients from H are just from Newton's law
forces(i+1,1) = forces(i+1,1) + vpars(4)*0.5
forces(i+1,2) = forces(i+1,2) + vpars(5)*0.5
forces(i+1,3) = forces(i+1,3) + vpars(6)*0.5
forces(i+2,1) = forces(i+2,1) + vpars(4)*0.5
forces(i+2,2) = forces(i+2,2) + vpars(5)*0.5
forces(i+2,3) = forces(i+2,3) + vpars(6)*0.5
ENDDO

ELSEIF (vstyle == 11) THEN ! efield potential.
IF (mod(nat,3)/=0) THEN
WRITE(*,*) " Expecting water molecules O H H O H H O H H but got ", nat, "atoms"
Expand Down Expand Up @@ -1094,7 +1056,7 @@ PROGRAM DRIVER
SUBROUTINE helpmessage
! Help banner

WRITE(*,*) " SYNTAX: driver.x [-u] -a address [-p port] -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4p-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|ljmix|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta|noo3-h2o]"
WRITE(*,*) " SYNTAX: driver.x [-u] -a address [-p port] -m [dummy|gas|lj|sg|harm|harm3d|morse|morsedia|zundel|qtip4pf|pswater|lepsm1|lepsm2|qtip4p-efield|eckart|ch4hcbe|ljpolymer|MB|doublewell|doublewell_1D|water_dip_pol|harmonic_bath|meanfield_bath|ljmix|qtip4pf-sr|qtip4pf-c-1|qtip4pf-c-2|qtip4pf-c-json|qtip4pf-c-1-delta|qtip4pf-c-2-delta|qtip4pf-c-json-delta]"
WRITE(*,*) " -o 'comma_separated_parameters' [-S sockets_prefix] [-v] "
WRITE(*,*) ""
WRITE(*,*) " For LJ potential use -o sigma,epsilon,cutoff "
Expand Down
83 changes: 0 additions & 83 deletions drivers/py/pes/xtb.py

This file was deleted.

19 changes: 0 additions & 19 deletions examples/clients/xtb/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions examples/clients/xtb/ch4.xyz

This file was deleted.

46 changes: 0 additions & 46 deletions examples/clients/xtb/input.xml

This file was deleted.

7 changes: 0 additions & 7 deletions examples/clients/xtb/run.sh

This file was deleted.

21 changes: 0 additions & 21 deletions examples/features/o3_averaging/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions examples/features/o3_averaging/grid_liquid_water/input.xml

This file was deleted.

Loading

0 comments on commit ef9f5eb

Please sign in to comment.