Skip to content

Commit

Permalink
Corrected integrator, output first positions, corrected array size
Browse files Browse the repository at this point in the history
  • Loading branch information
comecattin committed Jun 10, 2024
1 parent 31686fb commit a245f06
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ program md_simulation
call read_config(input_file, n_atoms, n_steps, dt, box_length, tolerance, max_iter)

! Allocate the arrays
allocate(positions(3, n_atoms))
allocate(velocities(3, n_atoms))
allocate(forces(3, n_atoms))
allocate(positions(n_atoms, 3))
allocate(velocities(n_atoms, 3))
allocate(forces(n_atoms, 3))
allocate(charges(n_atoms))


Expand All @@ -48,6 +48,8 @@ program md_simulation
call system('rm ' //trim(output_file_energies))
end if

call output_positions_water(0, positions, n_atoms, output_file)

! Perform the molecular dynamics simulation
do step = 1, n_steps
print *, 'Step: ', step
Expand All @@ -57,8 +59,8 @@ program md_simulation
call compute_forces_water(positions, charges, forces, n_atoms, box_length)

! Integrate positions and velocities
!call integrate(positions, velocities, forces, dt, n_atoms, box_length)
call integrate_constraints(positions, velocities, forces, charges, n_atoms, dt, box_length, tolerance, max_iter)
call integrate(positions, velocities, forces, dt, n_atoms, box_length)
!call integrate_constraints(positions, velocities, forces, charges, n_atoms, dt, box_length, tolerance, max_iter)

! Compute the energies
call compute_energies(positions, velocities, charges, n_atoms, ke, pe, te)
Expand Down

0 comments on commit a245f06

Please sign in to comment.