Git Product home page Git Product logo

Comments (4)

dwhswenson avatar dwhswenson commented on August 21, 2024

Do we intend to wrap the periodic box as its own class? Or do we just have the thing that contains it know how to serialize/deserialize that attribute? I don't immediately see a need for a separate class in this case.

How do we want to handle rounding issues in floats/float arrays? I see a few possibilities:

  1. Equality/hashing of these attributes is based on the serialized form:
    serialized = original.to_serialized()
    deserialized = from_serialized(serialized)
    reserialized = deserialized.to_serialized()
    serialized == reserialized  # this is true, so use it for the internal equality check
    # note that we do not require exact equality of deserialized == original
  2. Equality/hashing based on UUID. If we don't create a wrapper class for boxes, then we only need the UUID in the molecular system container class.
  3. Use a binary format for serialization.

This issue will be closely tied to #87; it might be best to combine them into one.

from openfe.

richardjgowers avatar richardjgowers commented on August 21, 2024

Yeah the box is essentially an "item" in the state (see #85) as this can change the energy of the system. Because there's only 6 values which completely define a box (for a triclinic cell which covers most/all? cases) we can just dump 6 doubles (aka 6x8 bytes) of raw bits. This should mean we can get perfect reproduction, I think this is option 3 below.

Yeah serialisation and hashing might end up one and the same.

from openfe.

dwhswenson avatar dwhswenson commented on August 21, 2024

Still not clear whether this is actually a separate class to create (possibly more a discussion for #85) -- does it have any functionality other than holding data? If not, then it seems like just an attribute of something else (probably the solvent container, otherwise the overall molecular system container).

If we're good with serialization here being non-human-readable, then I assume we'll just do ndarray.tobytes()?

I've always stored the full 3x3 array just for clarity (I don't think the extra few bytes is a major storage issue here). Relevant information for OpenMM: http://docs.openmm.org/latest/userguide/theory/05_other_features.html#periodic-boundary-conditions. Note the hard requirement on that set of inequalities -- this can be an issue with rounding (solved by passing input vectors through openmm.app.internal.unitcell.reducePeriodicBoxVectors before going to OpenMM; this is a common problem when setting up from a low-precision format like XTC).

from openfe.

richardjgowers avatar richardjgowers commented on August 21, 2024

This is part of the gufe.ChemicalSystem.__hash__, went for box.to_bytes() to get its hash

from openfe.

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.