Giter Site home page Giter Site logo

Comments (9)

greschd avatar greschd commented on July 28, 2024 1

SimpleNamespace

I don't know what this is, I trust your decision here :-)

It's basically the same as the AiiDA AttributeDict, except without recursively modifying mappings: see the docs.

What about naming? Should the default be at top-level qe_tools.CONSTANTS? Or qe_tools.constants.DEFAULT?

Maybe let's go with qe_tools.CONSTANTS as a pointer to qe_tools.constants.DEFAULT?

Hm, I think it would make sense to keep the qe_tools.constants.DEFAULT private (e.g., make it qe_tools._constants) for now - so it's fine even if we never need to introduce the versioning.

from qe-tools.

greschd avatar greschd commented on July 28, 2024

Should we address this before 2.0? As far as I can see, this comment by @giovannipizzi is the latest suggestion.

Questions on this:

  • Is ry_to_ev and ry_si the only inconsistency, or are there others? Probably we should just check all the constants are consistent? Or should we just do whatever QE does, even if it's inconsistent there?
  • Do the constants tend to change between QE versions? We could use the QE-versioning code we have now to distinguish these.

I don't think there's much of a point in tracking also the CODATA values - they are defined in scipy.constants.

from qe-tools.

giovannipizzi avatar giovannipizzi commented on July 28, 2024

I am not sure - I guess we need to check inconsistencies, and double check with QE.
Considering the scope of this library, I would indeed track them with the QE version - we'll probably need to do some git blaming in GitLab to see if/when constants were changed in QE...

from qe-tools.

greschd avatar greschd commented on July 28, 2024

Fun!

For the release candidate, at the very least I think we should nail down the interface. How about we have a get_constants(qe_version: Optional[str]) -> Dict[str, float] function for the general case, and then simply

DEFAULT = get_constants()

for the latest ones?

from qe-tools.

giovannipizzi avatar giovannipizzi commented on July 28, 2024

seems reasonable!

from qe-tools.

giovannipizzi avatar giovannipizzi commented on July 28, 2024

Anyway, maybe we should just create a default interface, but in the end it might not be needed to create multiple versions?

Here is the blame: https://gitlab.com/QEF/q-e/-/blame/qe-6.5/Modules/constants.f90
and the history: https://gitlab.com/QEF/q-e/-/commits/qe-6.5/Modules/constants.f90
No "real" change (apart for additions of new constants, often derivatives with just a 10^X factor, or, minor irrelevant code changes to that file) happened in the past 12 years, where some constant precision was increased: https://gitlab.com/QEF/q-e/-/commit/a82ffc4c2948ac82c7978898e1ac4b7e99abdf2e

So maybe I wouldn't worry too much about this issue.

The only action I'd take are:

  • make sure the constants we use are identical to the ones internal to QE; write this in a comment, saying that we checked it and when, and they haven't changed in the past 12 years
  • if not complex, make it easy to have multiple versions in the future. But if it makes everything more complex, let it go...

Then, ensure in aiida-qe we use constants from here for consistency

from qe-tools.

greschd avatar greschd commented on July 28, 2024

So.. we just pack the constants into a SimpleNamespace to make sure we can make multiple instances if needed?

What about naming? Should the default be at top-level qe_tools.CONSTANTS? Or qe_tools.constants.DEFAULT? The latter makes more sense if there are different versions, but since there probably won't be I'm not sure which option is better.

from qe-tools.

giovannipizzi avatar giovannipizzi commented on July 28, 2024

SimpleNamespace

I don't know what this is, I trust your decision here :-)

What about naming? Should the default be at top-level qe_tools.CONSTANTS? Or qe_tools.constants.DEFAULT?

Maybe let's go with qe_tools.CONSTANTS as a pointer to qe_tools.constants.DEFAULT?

from qe-tools.

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.