Closed lohedges closed 2 years ago
Looking at the source code for AtomVelocities
, it looks like the class hasn't been fleshed out. There is no cpp
file with implementation details, as there is for AtomCoords.
AtomVelocities
does have a toVector
function. This is defined in atomproperty.hpp
. Most AtomProperty
-derived classes use the default implementation from atomproperty.hpp
. AtomCoords
is different, as it required lots of special cases, so ended up being a concrete manual specialisation of AtomProperty<Vector>
.
The error message is saying that there isn't an automatic converter defined to convert a QVector<Velocity3D>
from a C++ class to a Python class. This is because I'd forgotten to add the converter in SireMol_containers.cpp
.
I have added more converters including the Velocity3D converter into the feat_2023_0
version of this file. You can merge this across, or just add the one-line addition to the devel
version, e.g.
register_list< QVector<Velocity3D> >();
(remembering to #include "SireMol/atomvelocities.h"
at the top of this file so that Velocity3D
is defined)
Brilliant, thanks for this. I'll add this to devel
tomorrow and test.
Ideally all array-like atom properties would behave in the same way, i.e. you could call
.toVector()
to return a Python list (or evennumpy
array) in an appropriate default unit. This works for thecoordinates
property, but doesn't forvelocity
.For example, using BioSimSpace to load:
Presumably the
SireMol::AtomCoords
type is handling the totoVector()
conversion. There is aSiremol::AtomVelocities
type, but casting the velocity above to this type makes no difference.