ACEsuit / ACEfit.jl

Generic Codes for Fitting ACE models
MIT License
7 stars 7 forks source link

Functionality for outputting ACE "descriptor" #28

Closed braxtonowens closed 2 years ago

braxtonowens commented 2 years ago

Along with training interatomic potentials, "physics-inspired atomic descriptors can be used to rationalize the relationship between atom configurations and material properties" Physics-Inspired Structural Representations for Molecules and Materials

Ideally, like the Dscribe python library, where given an ASE ATOMS object containing positional and atom-type information, a per-atom ACE description an be generated.

cortner commented 2 years ago

@wcwitt I think you've worked with per-atom descriptors. I'm still on holiday and without working laptop. Would you be willing to help? Maybe we can get more input on the kind of interfaces we should provide...

wcwitt commented 2 years ago

This is possible, although we don't have a good tutorial yet. Do you want to use ASE atoms specifically, or would a pure Julia example be sufficient?

wcwitt commented 2 years ago

@braxtonowens, that last question was for you. Is the ASE atoms part important, or would you be happy providing an xyz file, for example?

braxtonowens commented 2 years ago

Oh sorry, xyz files are fine.

braxtonowens commented 2 years ago

@wcwitt Just checking if there have been any developments regarding the extraction of a per-site description. As mentioned here: https://github.com/ACEsuit/ACE1.jl/discussions/37; A temporary script to do this with ACE1.jl would suffice. Thanks.

wcwitt commented 2 years ago

Sorry - ACEfit is still not quite ready for use, but I’ll try to send you a temporary script tomorrow that does what you need

wcwitt commented 2 years ago

@braxtonowens, can you try this and let me know how it goes? It runs for me but I haven't tested it carefully - we may need to iterate a few times.

One-liner to set up the environment:

using Pkg; Pkg.activate("."); pkg"registry add https://github.com/JuliaRegistries/General"; pkg"registry add https://github.com/JuliaMolSim/MolSim.git"; pkg"add ACE1pack, ACE1, JuLIP, IPFitting, ASE"

Dataset: Si_tiny.zip

Script:

using ACE1pack

dataset = JuLIP.read_extxyz("Si_tiny.xyz");

basis = ace_basis(species = [:Si],
      N = 3,        # correlation order = body-order - 1
      maxdeg = 12,  # polynomial degree
      r0 = 2.3,     # estimate for NN distance
      rin = 0.1,
      rcut = 5.5,
      pin = 2)      # no need to change

descriptors = []
for atoms in dataset

    # compute average descriptor for each structure
    descriptor = zeros(length(basis))
    for i in 1:length(atoms)
        descriptor += site_energy(basis, atoms, i)
    end
    descriptor /= length(atoms)

    push!(descriptors, descriptor)
end
braxtonowens commented 2 years ago

Thanks for the script. I tested this on my machine and for a singular file it seems to work. I however attempted to run this on two separate remote ubuntu servers hosted at BYU and they both resulted in seg faults at the line dataset = JuLIP.read_extxyz("my_aluminum.xyz");

image

I will continue testing with my own machine, I just thought I would let you know. If you would like any more feedback let me know.

wcwitt commented 2 years ago

That's not good - does my example run on those machines, and if so would you be willing to send me your file that fails?

braxtonowens commented 2 years ago

Sorry, it just turned out that the segmentation fault was caused from an incorrect path being passed to JuLIP.read_extxyz()

I believe I got what I wanted. Thanks for the help! Let me know If you guys get any other algorithms finished soon like LODE or MACE.

wcwitt commented 2 years ago

Great! Please do let me know if you have any more difficulty, as I will eventually turn this into an example for the website