Giter VIP home page Giter VIP logo

Comments (8)

kexul avatar kexul commented on July 3, 2024

This error occurs in both the 2022 and 2023 versions.

from biosimspace.

lohedges avatar lohedges commented on July 3, 2024

I've not had a chance to test, but assume the error is occurring since the objects have the same MolNum. To get a unique number, you could create a copy of one, e.g.

print(morph + pro.copy())

I guess the issue here is that MolNum identifiers are unique to a Sire session, so there can be a clash if you pickle/unpickle and object. I think we will need to implement a copy of unpickling, or similar, although this could lead to other issues.

from biosimspace.

kexul avatar kexul commented on July 3, 2024

Hi @lohedges , many thanks for your quick reply!

I've tried using the .copy() function, but the MolNum remains unchanged.
image

from biosimspace.

lohedges avatar lohedges commented on July 3, 2024

Ah, I think it only works with the .copy done at the Molecule level, not at the System. Try extracting the molecules and doing a copy of one before recombining to make a new system.

from biosimspace.

kexul avatar kexul commented on July 3, 2024

Thanks, pro[0].copy() works! 🎉 🎉

from biosimspace.

lohedges avatar lohedges commented on July 3, 2024

Great. I'll update the System copy method to copy each of the molecules in it, then recombine them.

from biosimspace.

lohedges avatar lohedges commented on July 3, 2024

Just a quick update on this, since we might need to have a rethink on how we constrain and compare molecules in BioSimSpace. In Sire, there is the concept of a molecule number and version. This means you can have different versions of the same molecule number, i.e. if you edit it. The combined version and number is guaranteed to be unique.

For BioSimSpace, I have needed to place some additional restrictions on molecule (and residue and atom) numbering within a System due to the requirements of SOMD, i.e. it assumes unique and ascending numbering, even though this isn't a requirement of SIre itself. For example, SOMD completely re-orders the atoms in a system on load, so we need to use some unique identifiers, e.g. atom number, to re-map updated coordinates from a trajectory file.

For the above, doing a .copy() doesn't really make sense in terms of the behaviour of Sire, so we are thinking of changing this to .renumber(). We had discussed implicitly doing this on unpickling, but this could cause other issues, e.g. if you wanted to unpickle a System and Molecule, then check that the Molecule was in the System.

When we eventually re-write SOMD I will make sure that it is designed in a way that doesn't require invalid assumptions about a Sire system. This will hopefully avoid issues like this.

Just to note that we realised that your issue could also be resolved by changing the order of the read and pickle in your second script, i.e. if you unpickle first, then load the perturbable system, i.e.:

import pickle
import BioSimSpace as BSS
with open('pro.pkl', 'rb') as f:
    pro = pickle.load(f)
morph = BSS.IO.readPerturbableSystem('morph0.prm7', 'morph0.rst7', 'morph1.prm7', 'morph1.rst7')
print(morph + pro)

This is because the molecule in morph is correctly assigned a unique number on read.

from biosimspace.

kexul avatar kexul commented on July 3, 2024

Thank @lohedges for the detailed information 🤗

Just to note that we realised that your issue could also be resolved by changing the order of the read and pickle in your second script, i.e. if you unpickle first, then load the perturbable system, i.e.:

Thanks! that's good to know.

from biosimspace.

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.