Esempio n. 1
0
def write_cns_input(crystal_symmetry, anomalous_flag, d_min):
  cns_input = make_cns_input.xray_unit_cell(crystal_symmetry.unit_cell())
  cns_input += make_cns_input.xray_symmetry(crystal_symmetry.space_group())
  cns_input += make_cns_input.xray_anomalous(anomalous_flag)
  cns_input += make_cns_input.xray_generate(10000, d_min)
  l = cns_input.append
  l("xray")
  l("  declare name=cns_m domain=reciprocal type=integer end")
  l("  declare name=cns_e domain=reciprocal type=integer end")
  l("  declare name=cns_c domain=reciprocal type=integer end")
  l("  declare name=cns_a domain=reciprocal type=integer end")
  l("  declare name=cns_p domain=reciprocal type=real    end")
  l("  do (cns_m = mult) (all)")
  l("  do (cns_e = epsilon) (all)")
  l("  do (cns_c = 0) (all)")
  l("  do (cns_c = 1) (centric)")
  l("  do (cns_a = 0) (all)")
  l("  do (cns_a = 1) (acentric)")
  l("  do (cns_p = -1) (all)")
  l("  do (cns_p = centric_phase) (centric)")
  l("  write reflections output=\"tmp_cns_input.hkl\" end")
  l("end")
  l("stop")
  f = open("tmp_cns_input.cns", "w")
  for l in cns_input:
    print >> f, l
  f.close()
Esempio n. 2
0
def write_cns_input(crystal_symmetry, anomalous_flag, d_min):
  cns_input = make_cns_input.xray_unit_cell(crystal_symmetry.unit_cell())
  cns_input += make_cns_input.xray_symmetry(crystal_symmetry.space_group())
  cns_input += make_cns_input.xray_anomalous(anomalous_flag)
  cns_input += make_cns_input.xray_generate(10000, d_min)
  l = cns_input.append
  l("xray")
  l("  declare name=cns_m domain=reciprocal type=integer end")
  l("  declare name=cns_e domain=reciprocal type=integer end")
  l("  declare name=cns_c domain=reciprocal type=integer end")
  l("  declare name=cns_a domain=reciprocal type=integer end")
  l("  declare name=cns_p domain=reciprocal type=real    end")
  l("  do (cns_m = mult) (all)")
  l("  do (cns_e = epsilon) (all)")
  l("  do (cns_c = 0) (all)")
  l("  do (cns_c = 1) (centric)")
  l("  do (cns_a = 0) (all)")
  l("  do (cns_a = 1) (acentric)")
  l("  do (cns_p = -1) (all)")
  l("  do (cns_p = centric_phase) (centric)")
  l("  write reflections output=\"tmp_cns_input.hkl\" end")
  l("end")
  l("stop")
  f = open("tmp_cns_input.cns", "w")
  for l in cns_input:
    print(l, file=f)
  f.close()
Esempio n. 3
0
def write_cns_input(fcalc_array, hl, test_merge=False):
    assert fcalc_array.data().size() == hl.size()
    cns_input = make_cns_input.xray_unit_cell(fcalc_array.unit_cell())
    cns_input += make_cns_input.xray_symmetry(fcalc_array.space_group())
    cns_input += make_cns_input.xray_anomalous(fcalc_array.anomalous_flag())
    l = cns_input.append
    l("xray")
    l("  declare name=fcalc domain=reciprocal type=complex end")
    l("  declare name=pa domain=reciprocal type=real end")
    l("  declare name=pb domain=reciprocal type=real end")
    l("  declare name=pc domain=reciprocal type=real end")
    l("  declare name=pd domain=reciprocal type=real end")
    l("  group type hl")
    l("    object pa")
    l("    object pb")
    l("    object pc")
    l("    object pd")
    l("  end")
    l("  reflection")
    for i, h in enumerate(fcalc_array.indices()):
        l(("    index %d %d %d" % h) +
          (" fcalc=%.6g %.6g\n" % abs_arg(fcalc_array.data()[i], deg=True)) +
          ("    pa=%.6g pb=%.6g pc=%.6g pd=%.6g" % hl[i]))
    l("  end")
    if (not test_merge):
        l("  declare name=pi domain=reciprocal type=complex end")
        l("  do (pi=get_fom[phistep=5,CEN360=false](pa,pb,pc,pd)) (all)")
        l("  write reflections output=\"tmp_sg.hkl\" end")
        l("  expand")
        l("  do (pi=get_fom[phistep=5,CEN360=false](pa,pb,pc,pd)) (all)")
        l("  write reflections output=\"tmp_p1.hkl\" end")
    else:
        l("  anomalous=false")
        l("  write reflections output=\"tmp_merged.hkl\" end")
    l("end")
    l("stop")
    f = open("tmp.cns", "w")
    for l in cns_input:
        print(l, file=f)
    f.close()
Esempio n. 4
0
def write_cns_input(fcalc_array, hl, test_merge=False):
  assert fcalc_array.data().size() == hl.size()
  cns_input = make_cns_input.xray_unit_cell(fcalc_array.unit_cell())
  cns_input += make_cns_input.xray_symmetry(fcalc_array.space_group())
  cns_input += make_cns_input.xray_anomalous(fcalc_array.anomalous_flag())
  l = cns_input.append
  l("xray")
  l("  declare name=fcalc domain=reciprocal type=complex end")
  l("  declare name=pa domain=reciprocal type=real end")
  l("  declare name=pb domain=reciprocal type=real end")
  l("  declare name=pc domain=reciprocal type=real end")
  l("  declare name=pd domain=reciprocal type=real end")
  l("  group type hl")
  l("    object pa")
  l("    object pb")
  l("    object pc")
  l("    object pd")
  l("  end")
  l("  reflection")
  for i,h in enumerate(fcalc_array.indices()):
    l(  ("    index %d %d %d" % h)
      + (" fcalc=%.6g %.6g\n" % abs_arg(fcalc_array.data()[i], deg=True))
      + ("    pa=%.6g pb=%.6g pc=%.6g pd=%.6g" % hl[i]))
  l("  end")
  if (not test_merge):
    l("  declare name=pi domain=reciprocal type=complex end")
    l("  do (pi=get_fom[phistep=5,CEN360=false](pa,pb,pc,pd)) (all)")
    l("  write reflections output=\"tmp_sg.hkl\" end")
    l("  expand")
    l("  do (pi=get_fom[phistep=5,CEN360=false](pa,pb,pc,pd)) (all)")
    l("  write reflections output=\"tmp_p1.hkl\" end")
  else:
    l("  anomalous=false")
    l("  write reflections output=\"tmp_merged.hkl\" end")
  l("end")
  l("stop")
  f = open("tmp.cns", "w")
  for l in cns_input:
    print >> f, l
  f.close()