Index-based geometric measurements implementation - #56
Conversation
lbabetto
left a comment
There was a problem hiding this comment.
No particular issues from my side, only 2 points I'd like to raise:
- Is there a specific reason why we're "abstracting" these functions in the
math.pymodule? For example, thedistancefunction simply returns thenp.linalg.normof the difference between the two arrays, and then thedistanceclass method ingeometry.pyjust returns the imported function acting on the vectors extracted from the indices (also possibly generating confusion between class method and helper function). Why not simply returningnp.linalg.norm(self.coordinates[i] - self.coordinates[j]? - Assuming these functions are purely for internal use and we have a reason to put them in a separate
math.pymodule, should we do some validation on the function inputs to avoid passing something other than 3D arrays if we plan to reuse these functions for future implementations?
Good point, thanks for raising this. The original idea behind introducing Also, keeping them in a separate module would make them easier to reuse in the future, since they conceptually operate on coordinates rather than being strictly tied to the That said, I agree there is currently some ambiguity: I see two possible options:
Happy to go with whichever direction you think fits better. My slight preference would be option 2 for clarity and future reuse, but no strong opinion. |
|
My personal preference is simplicity, so until we need to implement something complex enough to warrant a standalone module, I'd be for keeping everything in geometry.py for the time being. Even if angle and dihedral calculations may not be immediate for everyone, IMO a brief comment explaining that we're essentially just doing a couple of dot products should be enough to get most present and future developers up to speed :) Guess we need a tie-breaker @AresValley! |
Implementation of
distance,angle, anddihedralcalculations based on atom indices, using the cartesian coordinates stored in theMolecularGeometryclass.