Giter Club home page Giter Club logo

Comments (8)

antoine-levitt avatar antoine-levitt commented on August 17, 2024 1

Let's close that and leave it at named tuples for the time being

from dftk.jl.

antoine-levitt avatar antoine-levitt commented on August 17, 2024

Possibly the fact that I'm having trouble figuring this out precisely means we should keep these concepts separate, and just have a struct for scfres like we have right now.

from dftk.jl.

mfherbst avatar mfherbst commented on August 17, 2024

Maybe the way to go is actually to have a state datastructure collecting the results we have obtained from a DFT run in one datastructure.

from dftk.jl.

antoine-levitt avatar antoine-levitt commented on August 17, 2024

We might want to revisit this.

psi, occ, rho, rho_diff for spin, orbital energies, fermi level, possibly a few other fields. I think the only sensible way to do it is to have all fields nullable, which isn't great but I don't see any other way. Usage: pass to energy_hamiltonian, to the terms, to the callbacks, return from the SCFs. We can have a constructor that takes psi and energies and computes the rest, which would simplify the code in the SCF. Let's discuss that sometime.

from dftk.jl.

mfherbst avatar mfherbst commented on August 17, 2024

So the only difference to the named tuple would be the constructor, do I get that right? In that case I would have a function to do that in a structured way. I really do not see why you do need a proper struct for that.
In my experience with structured objects for this sort of result state, it often happens that they get very quickly very clunky (because it is so convenient to stuff everything into it). So I really would be careful with it. But yes, let's talk about it.

from dftk.jl.

mfherbst avatar mfherbst commented on August 17, 2024

Actually now that I see a little the code of the new structure I see what you mean. It is really super annoying to pass basis and ρ around for everything.

from dftk.jl.

antoine-levitt avatar antoine-levitt commented on August 17, 2024

Right. The problem is that there are many uses we can do of such a structure:

  • Postprocessing
  • Compute an energy
  • Compute a Hamiltonian

Each of these use different parts (eg, at least without hybrids, we can compute a Hamiltonian just with just the density). Consistency is also tricky: if the struct contains psi, occupation and rho, does it mean that rho is constructed from psi and occupation? Or that psi and occupation are constructed from the hamiltonian associated to rho? That's why I was suggesting having all fields as nullable, and not imposing too strict a contract on them. Could go either way as to whether we want a struct or a named tuple. Structs have the advantage of readability: when you see state::ElectronicState, you just have to look at ElectronicState to see what's in there.

from dftk.jl.

antoine-levitt avatar antoine-levitt commented on August 17, 2024

Also in favor of state: gives a unified place for the documentation of these things, eg the storage format of psi

from dftk.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.