lanl / hippynn

python library for atomistic machine learning
https://lanl.github.io/hippynn/
Other
59 stars 22 forks source link

example of charge modeling #72

Open mofeilu opened 1 month ago

mofeilu commented 1 month ago

I am interested in using hippynn to do charge modeling, is there any working examples of training hip-nn to charges or dipole moments as in the paper "Discovering a Transferable Charge Assignment Model Using Machine Learning"?

In the example folder, I could see energy training case but no explicit charge training ones.

Thanks,

lubbersnick commented 4 weeks ago

Thanks @mofeilu !

I will try to add an example, but in the mean time the main relevant code would look something like this:

    # model inputs
    species = inputs.SpeciesNode(db_name="Z")
    positions = inputs.PositionsNode(db_name="R")

    # Model computations
    network = networks.Hipnn("HIPNN", (species, positions), module_kwargs=network_params)
    henergy = targets.HEnergyNode("HEnergy", network,db_name="E")
    hcharge = targets.HChargeNode("HCharge",network,db_name="Q")
    dipole = physics.Dipole("QDipole",hcharge,db_name="D")

Then the hcharge and dipole can be used in the loss function and etc. The db_name quantity specifies how the quantity is called in the database.