BioStructures.jl icon indicating copy to clipboard operation
BioStructures.jl copied to clipboard

3-vector for coordinates?

Open timholy opened this issue 1 year ago • 1 comments

Most of the structs in this package are now quite efficient, but I see one more potential opportunity: Atom's coords field is a Vector{Float64}. Assuming this will always be a 3-vector, one option would be to create a Coordinates type. MIToS does this already, although their array type is immutable. Is this kind of change something worth considering? Would it need to be mutable? I'm thinking of methods like applytransform!.

timholy avatar Aug 19 '24 14:08 timholy

Yes we should think about doing something like this. Coordinates will always be a 3-vector.

We would want to be able to change the coordinates of an atom but could make Atom itself mutable and keep the coordinates immutable, assigning new coordinates via coords!/x!/y!/z!. In that case SVector{3, Float64} might be sufficient. If making Atom mutable gives slowdowns we could try MVector too.

jgreener64 avatar Aug 19 '24 19:08 jgreener64