Code design for QMD simulations

@MichaelRedenti , you will receive diverse opinions here that will help you decide on your approach.

But very quickly, as things stand with Fortran currently where every derived type (struct / class) is an extensible type, you will find the OOP approach to be helpful

  1. if inheritance and polymorphism are important in your overall simulation framework,
  2. with the notion of a namespace / packaging or an assembly since the language itself, like C, does not include such a facility intrinsically,
  3. to have a near one-to-one correspondence with your current code in C, at least conceptually.

If you instead went with a Fortran module-oriented object-based approach, you may gain some in performance on account of avoiding dynamic dispatch at run-time but at a slight cost of having to generally do object composition vs inheritance.

Either way, you are asking the right questions; moreover, you are absolutely on the right track in considering Fortran for your QMD simulations. You will find a lot of discussion around marketing of Fortran at this Discourse - in your case, if I may paraphrase a TV commercial - “you will like the way your QMD simulations code is gonna look in Fortran, I guarantee it”!!

2 Likes