Conversation
sherryblair
left a comment
There was a problem hiding this comment.
I think it looks good overall, I added one suggestion
| numpy.ndarray | ||
| The reciprocal cell, calculated as 2π * inverse of the | ||
| transposed cell matrix. | ||
| """ |
There was a problem hiding this comment.
maybe we should add an error message incase the matrix has no inverse?
if self.rank < 3:
raise ValueError("Reciprocal lattice undefined for rank < 3.")
|
The Also, while we are changing it. We need to implement it in a way that removes one drawback that original cell object had, and that was forcing 3D structure. Let's give it some thought to see if we can make it a bit flexible for 1D, 2D, 3D. If it turns out hectic, we back out and keep 3D. A point to note: the cell.rank attribute in original |
| """ | ||
| if self.rank() < 3: | ||
| raise ValueError("Reciprocal lattice undefined for rank < 3.") | ||
| return 2 * np.pi * np.linalg.inv(self.lattice_vectors.T) |
There was a problem hiding this comment.
I think there should be some kind of mask to do reciprocal in reduced dimension. See the original ase.Cell class for reference.
There was a problem hiding this comment.
@jimnel Check this snippet from original ase.Cell for reciprocal
def reciprocal(self) -> 'Cell':
"""Get reciprocal lattice as a Cell object.
The reciprocal cell is defined such that
cell.reciprocal() @ cell.T == np.diag(cell.mask())
within machine precision.
Does not include factor of 2 pi."""
icell = Cell(np.linalg.pinv(self).transpose())
icell[~self.mask()] = 0.0 # type: ignore[index]
return icell|
@rajarshitiwari |
This resolves #12
ase.Cell.aseis removed fromqse.