﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
1400	Volume.surface_level_for_enclosed_volume only correct for orthogonal cell angles	Tristan Croll	Tom Goddard	"At the moment, `Volume.surface_level_for_enclosed_volume()` starts:

{{{
  def surface_level_for_enclosed_volume(self, volume, tolerance = 1e-3,
                                        max_bisections = 30, rank_method = False):

    sx,sy,sz = self.data.step
    cell_volume = float(sx)*sy*sz
}}}

That's only going to be correct if the cell angles are all 90 degrees. Probably won't make much difference in many cases, but there will be situations where it starts to deviate quite a lot from the true volume. I believe the following should cover any sane case (that is, where each voxel is still a parallelepiped):

{{{
def voxel_volume(volume):
    import numpy
    from math import sqrt
    a,b,c = v.data.step
    angles = numpy.radians(v.data.cell_angles)
    cos_alpha, cos_beta, cos_gamma = numpy.cos(angles)
    return a*b*c*sqrt(1-cos_alpha**2-cos_beta**2-cos_gamma**2
        + 2*cos_alpha*cos_beta*cos_gamma)
}}}

Would be even better for my purposes if this was implemented as a property of `Volume`."	defect	closed	moderate		Volume Data		fixed						all	ChimeraX
