Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom types for holding simulation state #107

Open
danielhollas opened this issue Apr 3, 2022 · 0 comments
Open

Custom types for holding simulation state #107

danielhollas opened this issue Apr 3, 2022 · 0 comments
Labels
refactor No functional changes, just refactoring or cleaning up the code.

Comments

@danielhollas
Copy link
Contributor

danielhollas commented Apr 3, 2022

Maybe something like this

  type :: energies
     ! Ab initio electronic energy
     real(DP) :: e_pot
     ! Harmonic energy of the PI bead necklace
     real(DP) :: e_pi
  end type

  type :: forces
     ! Ab initio forces
     real(DP), allocatable, dimension(:, :) :: fxc, fyc, fzc
     ! Harmonic PI forces
     real(DP), allocatable, dimension(:, :) :: fxq, fyq, fzq
     ! Difference forces between full and reference potential
     real(DP), allocatable, dimension(:, :) :: fxdiff, fydiff, fzdiff
  end type

  type :: positions
     real(DP), allocatable, dimension(:, :) ::x, y, z
  end type

  type :: momenta
     real(DP), allocatable, dimension(:, :) ::px, py, pz
  end type

  type :: electronic_structure
     ! Dipoles, Transition Dipoles
     ! NAC couplings?
     real(DP), allocatable, dimension(:) :: dip, tdip
  end type

  type mdstate
     type(energies) :: e
     type(forces) :: f
     type(momenta) :: p
     type(positions) :: q
     type(electronic_structure) :: elstruct
  end type

  type(mdstate) :: state, state_prev

For surfaceHopping, we could then easily hold the whole state from a previous step, and be able to just do

state_prev = prev

or vice versa in case we wanted to implement adaptive time step. See also https://stackoverflow.com/questions/19111471/fortran-derived-type-assignment

@danielhollas danielhollas added the refactor No functional changes, just refactoring or cleaning up the code. label Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor No functional changes, just refactoring or cleaning up the code.
Projects
None yet
Development

No branches or pull requests

1 participant