cesmix-mit / LAMMPS.jl

MIT License
32 stars 11 forks source link

Support Julia function being called as a pari potential #23

Open vchuravy opened 2 years ago

vchuravy commented 2 years ago

@dallasfoster asked for this on Slack.

Two avenues that I see immediatly

  1. Mimic pair_python
    • Benefits:
    • Usable outside LAMMPS.jl
    • Downsides:
    • Requires linking LAMMPS against libjulia
  2. Enhance the LAMMPS API to make it possible to register a custom pair after loading the libraries
    • Benefits:
    • pair_python seems to only support one Python potential at a time? We could potential support many Julia potentials
    • Potential for better integration with LAMMPS.jl
    • Maybe lower overheads
    • Downsides:
    • Users need to use LAMMPS.jl
    • Unproven path

From a cursory research for #2 it seems that we would need to expose a custom Pair class that takes raw function pointers and forwards the method implementations and then register that with PairCreatorMap which is a map from string to PairCreator which is a typedef Pair *(*PairCreator)(LAMMPS *).

cc: @rohskopf

vchuravy commented 2 weeks ago

28 makes quite a bit of progress on this.