def atoms(xray_structure, short_sfac): if (short_sfac): celcon = calculate_cell_content(xray_structure).keys() lines = [] l = lines.append i = 0 for scatterer in xray_structure.scatterers(): i += 1 lbl = scatterer.scattering_type + str(i) if (short_sfac): sfac = celcon.index(scatterer.scattering_type) + 1 else: sfac = i coor = [] for x in scatterer.site: coor.append(NOFIX(x)) coor = dot6fdot_list(coor) sof = NOFIX(scatterer.weight()) if (not scatterer.flags.use_u_aniso()): l("%-4s %d %s %s %s" % (lbl, sfac, coor, dot6gdot(sof), dot6gdot(NOFIX(scatterer.u_iso)))) else: u = adptbx.u_star_as_u_cif(xray_structure.unit_cell(), scatterer.u_star) u_fix = [] for c in u: u_fix.append(NOFIX(c)) u = u_fix l("%-4s %d %s %s %s =" % (lbl, sfac, coor, dot6gdot(sof), dot6gdot_list(u[:2]))) l(" %s" % dot6gdot_list((u[2], u[5], u[4], u[3]))) return lines
def atoms(lapp, sfac_indices, xray_structure, encoded_sites): spis = xray_structure.special_position_indices() if (encoded_sites is None): enc_dict = {} else: assert len(encoded_sites) == spis.size() enc_dict = dict(zip(spis, encoded_sites)) ss = xray_structure.space_group_info().structure_seminvariants() if (ss.number_of_continuous_allowed_origin_shifts() == 0): caosh_flags = None caosh_i_sc = None else: assert ss.continuous_shifts_are_principal() caosh_flags = ss.principal_continuous_shift_flags() reg = xray_structure.scattering_type_registry() w_max = None for i_sc,sc in enumerate(xray_structure.scatterers()): gaussian = reg.gaussian(sc.scattering_type) w = abs(sc.weight() * gaussian.at_stol(0)) if (w_max is None or w_max < w): w_max = w caosh_i_sc = i_sc assert w_max is not None for i_sc,sc in enumerate(xray_structure.scatterers()): st = sc.scattering_type lbl = "%s%02d" % (st, i_sc+1) sfac = sfac_indices[st] enc_site = enc_dict.get(i_sc) coor = [] if (caosh_i_sc is None or i_sc != caosh_i_sc): if (enc_site is None): for x in sc.site: coor.append(NOFIX(x)) else: coor = enc_site else: if (enc_site is None): for x,f in zip(sc.site, caosh_flags): if (f): fix = FIX else: fix = NOFIX coor.append(fix(x)) else: for x,f in zip(enc_site, caosh_flags): if (f): coor.append(FIX(x)) else: coor.append(x) coor = dot6fdot_list(coor) sof = FIX(sc.weight()) if (not sc.flags.use_u_aniso()): lapp("%-4s %d %s %s %s" % (lbl, sfac, coor, dot6gdot(sof), dot6gdot(NOFIX(sc.u_iso)))) else: u = adptbx.u_star_as_u_cif(xray_structure.unit_cell(), sc.u_star) u_fix = [] for c in u: u_fix.append(NOFIX(c)) u = u_fix lapp("%-4s %d %s %s %s =" % (lbl, sfac, coor, dot6gdot(sof), dot6gdot_list(u[:2]))) lapp(" %s" % dot6gdot_list((u[2], u[5], u[4], u[3])))