@@ -529,11 +529,6 @@ def openView(self):
529529 message = 'Error loading plot settings. Incompatible model.'
530530 self .statusBar ().showMessage (message , 5000 )
531531
532- def viewMaterialProps (self , id ):
533- msg_box = QMessageBox ()
534- msg_box .setText ("Testing mat prop box for mat {}" .format (id ))
535- msg_box .exec_ ()
536-
537532 def openStatePoint (self ):
538533 # check for an alread-open statepoint
539534 if self .model .statepoint :
@@ -1233,3 +1228,25 @@ def exportTallyData(self):
12331228 # show export tool dialog
12341229 self .showExportDialog ()
12351230
1231+ def viewMaterialProps (self , id ):
1232+ """display material properties in message box"""
1233+ mat = openmc .lib .materials [id ]
1234+ if mat .name :
1235+ msg_str = "Material {} ({}) Properties\n \n " .format (id , mat .name )
1236+ else :
1237+ msg_str = "Material {} Properties\n \n " .format (id )
1238+
1239+ # get density and temperature
1240+ dens_g = mat .get_density (units = 'g/cm3' )
1241+ dens_a = mat .get_density (units = 'atom/b-cm' )
1242+ msg_str += "Density: {:.3f} g/cm3 ({:.3e} atom/b-cm)\n " .format (dens_g , dens_a )
1243+ msg_str += "Temperature: {} K\n \n " .format (mat .temperature )
1244+
1245+ # get nuclides and their densities
1246+ msg_str += "Nuclide densities [atom/b-cm]:\n "
1247+ for nuc , dens in zip (mat .nuclides , mat .densities ):
1248+ msg_str += '{}: {:5.3e}\n ' .format (nuc , dens )
1249+
1250+ msg_box = QMessageBox ()
1251+ msg_box .setText (msg_str )
1252+ msg_box .exec_ ()
0 commit comments