Changeset 3198 for trunk/imports
- Timestamp:
- Dec 20, 2017 1:32:15 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/imports/G2phase_CIF.py ¶
r3197 r3198 123 123 sg = cf[blknm].get("_symmetry_space_group_name_H-M",'') 124 124 if not sg: sg = cf[blknm].get("_space_group_name_H-M_alt",'') 125 #how about checking for super/magnetic ones as well? - reject 'X'? 125 126 sg = sg.replace('_','') 126 127 if sg: choice[-1] += ', (' + sg.strip() + ')' … … 128 129 title= 'Select a phase from one the CIF data_ blocks below',size=(600,100)) 129 130 self.errors = 'Error during reading of selected block' 131 #process selected phase 130 132 if selblk is None: 131 133 returnstat = False # no block selected or available 132 else: 134 else: #do space group symbol & phase type first 133 135 blknm = str_blklist[selblk] 134 136 blk = cf[str_blklist[selblk]] 135 137 E = True 136 138 Super = False 139 magnetic = False 137 140 moddim = int(blk.get("_cell_modulation_dimension",'0')) 138 if moddim: 139 Super = True 141 if moddim: #incommensurate 140 142 if moddim > 1: 141 143 msg = 'more than 3+1 super symmetry is not allowed in GSAS-II' 142 144 self.errors = msg 143 self.warnings += msg145 self.warnings += '\n'+msg 144 146 return False 145 147 if blk.get('_cell_subsystems_number'): 146 148 msg = 'Composite super structures not allowed in GSAS-II' 147 149 self.errors = msg 148 self.warnings += msg150 self.warnings += '\n'+msg 149 151 return False 150 152 sspgrp = blk.get("_space_group_ssg_name",'') 153 if not sspgrp: #might be incommensurate magnetic 154 MSSpGrp = blk.get("_space_group.magn_ssg_name_BNS",'') 155 if not MSSpGrp: 156 MSSpGrp = blk.get("_space_group.magn_ssg_name",'') 157 if not MSSpGrp: 158 msg = 'No incommensurate space group name was found in the CIF.' 159 self.errors = msg 160 self.warnings += '\n'+msg 161 return False 162 if 'X' in MSSpGrp: 163 msg = 'Ad hoc incommensurate magnetic space group '+MSSpGrp+' is not allowed in GSAS-II' 164 self.warnings += '\n'+msg 165 self.errors = msg 166 return False 167 magnetic = True 151 168 if 'X' in sspgrp: 152 self.warnings += '\nAd hoc incommensurate space group '+sspgrp+' is not allowed in GSAS-II' 153 self.errors = 'Ad hoc incommensurate space groups not allowed in GSAS-II' 169 msg = 'Ad hoc incommensurate space group '+sspgrp+' is not allowed in GSAS-II' 170 self.warnings += '\n'+msg 171 self.errors = msg 154 172 return False 155 magnetic = False 156 self.Phase['General']['Type'] = 'nuclear' 157 SpGrp = blk.get("_symmetry_space_group_name_H-M",'') 158 if not SpGrp: 159 SpGrp = blk.get("_space_group_name_H-M_alt",'') 160 if not SpGrp: 161 MSpGrp = blk.get("_space_group.magn_name_BNS",'') 162 if not MSpGrp: 163 MSpGrp = blk.get("_space_group_magn.name_BNS",'') 173 Super = True 174 if magnetic: 175 sspgrp = MSSpGrp.split('(') 176 SpGrp = sspgrp[0].replace("1'",'') 177 SpGrp = G2spc.StandardizeSpcName(SpGrp) 178 else: 179 sspgrp = sspgrp.split('(') 180 SpGrp = sspgrp[0] 181 SpGrp = G2spc.StandardizeSpcName(SpGrp) 182 self.Phase['General']['Type'] = 'nuclear' 183 SuperSg = '('+sspgrp[1].replace('\\','') 184 SuperVec = [[0,0,.1],False,4] 185 else: #not incommensurate 186 SpGrp = blk.get("_symmetry_space_group_name_H-M",'') 187 if not SpGrp: 188 SpGrp = blk.get("_space_group_name_H-M_alt",'') 189 if not SpGrp: #try magnetic 190 MSpGrp = blk.get("_space_group.magn_name_BNS",'') 164 191 if not MSpGrp: 165 self.warnings += 'No magnetic BNS space group name was found in the CIF.' 166 self.errors = msg 167 self.warnings += msg 168 return False 169 SpGrp = MSpGrp.replace("'",'') 170 SpGrp = SpGrp[:2]+SpGrp[2:].replace('_','') #get rid of screw '_' 171 if '_' in SpGrp[1]: SpGrp = SpGrp.split('_')[0]+SpGrp[3:] 172 SpGrp = G2spc.StandardizeSpcName(SpGrp) 173 magnetic = True 174 self.MPhase['General']['Type'] = 'magnetic' 175 self.MPhase['General']['AtomPtrs'] = [3,1,10,12] 176 if Super: 177 sspgrp = blk.get("_space_group_ssg_name",'') 178 sspgrp = sspgrp.split('(') 179 SpGrp = sspgrp[0] 180 SuperSg = '('+sspgrp[1].replace('\\','') 181 Super = True 182 SuperVec = [[0,0,.1],False,4] 183 SpGrp = SpGrp.replace('_','') 184 # try normalizing the space group, to see if we can pick the space group out of a table 185 if Super: 186 SpGrp = G2spc.StandardizeSpcName(SpGrp) 187 if not SpGrp: 188 msg = 'GSAS-II failed to find space group symbol; not a valid cif file' 189 self.errors = msg 190 self.warnings += msg 191 return False 192 if not SpGrp: 193 msg = 'GSAS-II failed to find space group symbol; not a valid cif file' 194 self.errors = msg 195 self.warnings += msg 196 return False 192 MSpGrp = blk.get("_space_group_magn.name_BNS",'') 193 if not MSpGrp: 194 msg = 'No magnetic BNS space group name was found in the CIF.' 195 self.errors = msg 196 self.warnings += '\n'+msg 197 return False 198 SpGrp = MSpGrp.replace("'",'') 199 SpGrp = SpGrp[:2]+SpGrp[2:].replace('_','') #get rid of screw '_' 200 if '_' in SpGrp[1]: SpGrp = SpGrp.split('_')[0]+SpGrp[3:] 201 SpGrp = G2spc.StandardizeSpcName(SpGrp) 202 magnetic = True 203 self.MPhase['General']['Type'] = 'magnetic' 204 self.MPhase['General']['AtomPtrs'] = [3,1,10,12] 205 else: 206 SpGrp = SpGrp.replace('_','') 207 self.Phase['General']['Type'] = 'nuclear' 208 #process space group symbol 197 209 E,SGData = G2spc.SpcGroup(SpGrp) 198 210 if E and SpGrp: … … 214 226 SGData = G2obj.P1SGData # P 1 215 227 self.Phase['General']['SGData'] = SGData 216 if magnetic: 228 229 if magnetic and not Super: 217 230 SGData['SGFixed'] = True 218 231 try: … … 220 233 sgcenloop = blk.GetLoop('_space_group_symop_magn_centering.id') 221 234 opid = sgoploop.GetItemPosition('_space_group_symop_magn_operation.xyz')[1] 222 centid = sgcenloop.GetItemPosition('_space_group_symop_magn_centering.xyz')[1] 223 235 centid = sgcenloop.GetItemPosition('_space_group_symop_magn_centering.xyz')[1] 224 236 except KeyError: #old mag cif names 225 237 sgoploop = blk.GetLoop('_space_group_symop.magn_id') … … 246 258 # self.MPhase['General']['SGData']['GenSym'] = GenSym 247 259 # self.MPhase['General']['SGData']['GenFlg'] = GenFlg 260 248 261 if Super: 249 262 E,SSGData = G2spc.SSpcGroup(SGData,SuperSg) … … 255 268 E,SSGData = G2spc.SSpcGroup(SGData,SuperSg) 256 269 self.Phase['General']['SSGData'] = SSGData 270 257 271 # cell parameters 258 272 cell = [] … … 269 283 cif.get_number_with_esd(waveDict['_cell_wave_vector_y'][0].replace('?','0'))[0], 270 284 cif.get_number_with_esd(waveDict['_cell_wave_vector_z'][0].replace('?','0'))[0]],False,4] 285 271 286 # read in atoms 272 287 self.errors = 'Error during reading of atoms'
Note: See TracChangeset
for help on using the changeset viewer.