Skip to content

Commit

Permalink
Merge pull request #585 from HEXRD/pgnum
Browse files Browse the repository at this point in the history
Add property for point group number to material
  • Loading branch information
psavery authored Dec 5, 2023
2 parents 828cb49 + c691fa1 commit de3149a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hexrd/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,9 @@ def is_writable_file(path):
'td': '2dm',
'oh': '3dgh'
}
# The above dict must be in the correct order for this to work
SYM_PG_to_PGNUM = {pg: i + 1 for i, pg in enumerate(SYM_GL_PG)}
SYM_PGNUM_to_PG = {v: k for k, v in SYM_PG_to_PGNUM.items()}

# Set the __version__ variable
try:
Expand Down
5 changes: 5 additions & 0 deletions hexrd/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,11 @@ def _set_sgnum(self, v):

sgnum = property(_get_sgnum, _set_sgnum, None,
"Space group number")

@property
def pgnum(self):
return self.unitcell.pgnum

# property: beamEnergy

def _get_beamEnergy(self):
Expand Down
8 changes: 8 additions & 0 deletions hexrd/unitcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,14 @@ def sgnum(self, val):
self.CalcDensity()
self.calc_absorption_length()

@property
def pgnum(self):
return constants.SYM_PG_to_PGNUM[self.point_group]

@property
def point_group(self):
return self._pointGroup

@property
def atom_pos(self):
return self._atom_pos
Expand Down

0 comments on commit de3149a

Please sign in to comment.