Closed xiki-tempula closed 1 year ago
Thanks for this, I'll see what's gone wrong. It should be checking the property version when comparing the cache, which presumably should have changed for the coordinates.
Very strange, the isSame
method is stating that em
and the original vac
system are the same, even though their coordinates differ. Will see what's gone wrong.
print(vac.isSame(em))
c0 = vac[0]._sire_object.property("coordinates")
c1 = em[0]._sire_object.property("coordinates")
print(c0, c1, c0==c1)
True
AtomCoords( size=12
0: ( 20.0425 Å, 20.021 Å, 18.6058 Å )
1: ( 21.0784 Å, 19.4265 Å, 19.3263 Å )
2: ( 21.0356 Å, 19.4053 Å, 20.7204 Å )
3: ( 19.9571 Å, 19.9787 Å, 21.3939 Å )
4: ( 18.9212 Å, 20.5732 Å, 20.6733 Å )
...
7: ( 21.9187 Å, 18.9804 Å, 18.8023 Å )
8: ( 21.8422 Å, 18.9424 Å, 21.2813 Å )
9: ( 19.9239 Å, 19.9619 Å, 22.4796 Å )
10: ( 18.0813 Å, 21.0197 Å, 21.1973 Å )
11: ( 18.1577 Å, 21.0576 Å, 18.7179 Å )
) AtomCoords( size=12
0: ( 19.8388 Å, 20.121 Å, 18.991 Å )
1: ( 20.9963 Å, 19.4713 Å, 19.3411 Å )
2: ( 21.0444 Å, 19.4 Å, 20.7361 Å )
3: ( 19.9218 Å, 20.0011 Å, 21.2999 Å )
4: ( 19.1853 Å, 20.4414 Å, 20.2389 Å )
...
7: ( 21.7403 Å, 19.0832 Å, 18.6506 Å )
8: ( 21.7989 Å, 18.9668 Å, 21.2687 Å )
9: ( 19.6797 Å, 20.1008 Å, 22.3547 Å )
10: ( 18.2391 Å, 20.959 Å, 20.3712 Å )
11: ( 18.608 Å, 20.7949 Å, 19.143 Å )
)
False
Will figure out why the comparison is failing in this case, since it's working in the unit tests.
Something really weird is going on with the properties of the pickled molecule. If I look at the properties that are compared in the isSame
function I see the following. This is system properties, followed by all molecule level properties:
import BioSImSpace.Sandpit.Exscientia as BSS
mol = pickle.load(open('mol.p', 'rb'))
vac = mol.toSystem()
vac.isSame(vac)
['space']
['space']
[]
[]
True
The system properties are present, but the molecular ones aren't. Looking at the molecule directly, they do exist:
vac[0]._sire_object.propertyKeys()
Out[17]:
['LJ',
'gb_screening',
'atomtype',
'forcefield',
'was_perturbable',
'bond',
'name',
'angle',
'treechain',
'molecule',
'gb_radii',
'connectivity',
'improper',
'intrascale',
'element',
'ambertype',
'dihedral',
'charge',
'coordinates',
'mass']
I see the same thing if I save the vac
system to file and re-load. But, if I try another system from file:
s = BSS.IO.readMolecules("amber/ala/*")[0].toSystem()
s.isSame(s)
['fileformat']
['fileformat']
['gb_screening', 'LJ', 'atomtype', 'forcefield', 'parameters', 'bond', 'angle', 'treechain', 'gb_radii', 'improper', 'connectivity', 'intrascale', 'element', 'ambertype', 'space', 'gb_radius_set', 'dihedral', 'fileformat', 'charge', 'coordinates', 'mass']
['gb_screening', 'LJ', 'atomtype', 'forcefield', 'parameters', 'bond', 'angle', 'treechain', 'gb_radii', 'improper', 'connectivity', 'intrascale', 'element', 'ambertype', 'space', 'gb_radius_set', 'dihedral', 'fileformat', 'charge', 'coordinates', 'mass']
True
The logic is the same in both cases, so I'm not sure why the properties are disappearing.
My initial assumption was that you had a pure solvent system, since by default isSame
skips comparing water molecules for speed.
Will keep debugging.
I've found the issue. For some reason, when comparing properties molecule-by-molecule, they are being extracted as Residue
objects, not Molecule
, so they don't have any properties. I'm not yet sure why, since we're calling getMolecules
on a system, which should return Molecules
.
Okay, it's because the search logic is broken for some reason:
print(vac.search("not water").molecules()[0])
<BioSimSpace.Residue: name='LIG', molecule=4363, index=0, nAtoms=12>
This should return a molecule, since I've explicitly called .molecules()
on the search result.
Describe the bug I think the new caching might be a bit broken in that if you do an energy minimisation, the coordiante is not being updated when you write it down in the same format.
To Reproduce
Expected behavior I would imagine that the coordinate after em
equil/amber.rst7
will be different from the coordinate before the emem/amber.rst7
. The same system writing down as amber RST7em.rst7
will be the same as the Gro fileem.gro
But the
equil/amber.rst7
Is the same as the coordinate before em.
And is the same as the
em.rst7
But this is different from
em.gro
Which would be the correct energy minimised structure.
Input files mol.p.zip
(please complete the following information):
Additional context Add any other context about the problem here.