@@ -202,11 +202,7 @@ def setLatPar(self, a=None, b=None, c=None,
202202 # bases normalized to unit reciprocal vectors
203203 self .normbase = self .base * [[ar ], [br ], [cr ]]
204204 self .recnormbase = self .recbase / [ar , br , cr ]
205- self .isotropicunit = numpy .dot (self .recnormbase .T , self .recnormbase )
206- # ensure there are no round-off deviations on the diagonal
207- self .isotropicunit [0 , 0 ] = 1
208- self .isotropicunit [1 , 1 ] = 1
209- self .isotropicunit [2 , 2 ] = 1
205+ self .isotropicunit = _isotropicunit (self .recnormbase )
210206 return
211207
212208
@@ -263,6 +259,7 @@ def setLatBase(self, base):
263259 # bases normalized to unit reciprocal vectors
264260 self .normbase = self .base * [[ar ], [br ], [cr ]]
265261 self .recnormbase = self .recbase / [ar , br , cr ]
262+ self .isotropicunit = _isotropicunit (self .recnormbase )
266263 # update metrics tensor
267264 self .metrics = numpy .array ([
268265 [ a * a , a * b * cg , a * c * cb ],
@@ -482,6 +479,22 @@ def unitvolume(self):
482479
483480# End of class Lattice
484481
482+ # Local Helper Functions -----------------------------------------------------
483+
484+ def _isotropicunit (recnormbase ):
485+ """Calculate matrix for unit isotropic displacement parameters.
486+
487+ recnormbase -- inverse of normalized base vectors of the lattice.
488+
489+ Return numpy array.
490+ """
491+ isounit = numpy .dot (recnormbase .T , recnormbase )
492+ # ensure there are no round-off deviations on the diagonal
493+ isounit [0 , 0 ] = 1
494+ isounit [1 , 1 ] = 1
495+ isounit [2 , 2 ] = 1
496+ return isounit
497+
485498# Module Constants -----------------------------------------------------------
486499
487500cartesian = Lattice ()
0 commit comments