コード例 #1
0
ファイル: sginfo.c プロジェクト: alinelena/aten
static void PutMaple(const T_SgInfo *SgInfo, FILE *fpout)
{
  int           iList, f, i;
  int           nTrV, iTrV, nLoopInv, iLoopInv;
  const int     *TrV;
  T_RTMx        SMx;
  const T_RTMx  *lsmx;
  int           iMatrix;
  char          buf0[8], buf1[8], buf2[8];


  iMatrix = 0;

  nLoopInv = Sg_nLoopInv(SgInfo);

  nTrV = SgInfo->LatticeInfo->nTrVector;
   TrV = SgInfo->LatticeInfo->TrVector;

  for (iTrV = 0; iTrV < nTrV; iTrV++, TrV += 3)
  {
    for (iLoopInv = 0; iLoopInv < nLoopInv; iLoopInv++)
    {
      if (iLoopInv == 0) f =  1;
      else               f = -1;

      lsmx = SgInfo->ListSeitzMx;

      if (nLoopInv > 1 || nTrV > 1)
        putc('#', fpout);

      if (nTrV > 1)
        fprintf(fpout, " +(%s %s %s)",
          FormatFraction(TrV[0], STBF, 0, buf0, sizeof buf0 / sizeof (*buf0)),
          FormatFraction(TrV[1], STBF, 0, buf1, sizeof buf1 / sizeof (*buf1)),
          FormatFraction(TrV[2], STBF, 0, buf2, sizeof buf2 / sizeof (*buf2)));

      if (nLoopInv > 1)
        fprintf(fpout, " Inversion-Flag = %d", iLoopInv);

      if (nLoopInv > 1 || nTrV > 1)
        putc('\n', fpout);

      for (iList = 0; iList < SgInfo->nList; iList++, lsmx++)
      {
        for (i = 0; i < 9; i++)
          SMx.s.R[i] =              f * lsmx->s.R[i];

        for (i = 0; i < 3; i++)
          SMx.s.T[i] = iModPositive(f * lsmx->s.T[i] + TrV[i], STBF);

        fprintf(fpout, "m%d", ++iMatrix);
        PrintMapleRTMx(&SMx, 1, STBF, NULL, fpout);
      }
    }
  }

  putc('\n', fpout);
}
コード例 #2
0
ファイル: sginfo.c プロジェクト: alinelena/aten
static void PutSchakal(const T_SgInfo *SgInfo, FILE *fpout)
{
  int           iList, nMx, i;
  int           nTrV, iTrV;
  const int     *TrV;
  T_RTMx        SMx;
  const T_RTMx  *lsmx;
  const char    *xyz;


  if (Sg_nLoopInv(SgInfo) == 2)
    fprintf(fpout, "DU -x,-y,-z\n");

  nTrV = SgInfo->LatticeInfo->nTrVector;
   TrV = SgInfo->LatticeInfo->TrVector;

  if (nTrV > 1)
  {
    fprintf(fpout, "DU");

    InitRotMx(SMx.s.R, 1);

    TrV += 3;

    for (iTrV = 1; iTrV < nTrV; iTrV++, TrV += 3)
    {
      for (i = 0; i < 3; i++)
        SMx.s.T[i] = TrV[i];

          xyz = RTMx2XYZ(&SMx, 1, STBF, 0, 0, 1, ",", NULL, 0);
      if (xyz)
      {
        if (iTrV > 1)
          fprintf(fpout, " ;");

        fprintf(fpout, " %s", xyz);
      }
      else
      {
        putc('\n', fpout);
        goto ReturnError;
      }
    }

    putc('\n', fpout);
  }

  nMx = 0;

  lsmx = &SgInfo->ListSeitzMx[1];

  for (iList = 1; iList < SgInfo->nList; iList++, lsmx++)
  {
        xyz = RTMx2XYZ(lsmx, 1, STBF, 0, 0, 1, ",", NULL, 0);
    if (xyz)
    {
      if (nMx % 4 == 0)
      {
        if (nMx) putc('\n', fpout);
        fprintf(fpout, "SY %s", xyz);
      }
      else
        fprintf(fpout, " ; %s", xyz);
    }
    else
    {
      putc('\n', fpout);
      goto ReturnError;
    }

    nMx++;
  }

  if (nMx)
    putc('\n', fpout);

  putc('\n', fpout);

  return;

  ReturnError:

  SetSgError("Internal Error: PutSchakal()");
  return;
}
コード例 #3
0
ファイル: sginfo.c プロジェクト: alinelena/aten
static void PutSpaceSymFile(const T_SgInfo *SgInfo, FILE *fpout)
{
  unsigned int       SgID;
  int                iList, SuppressMx, f, i;
  int                nTrV, iTrV, nLoopInv, iLoopInv;
  const int          *TrV;
  const T_RTMx       *lsmx;
  const T_TabSgName  *tsgn;


      tsgn = SgInfo->TabSgName;
  if (tsgn && tsgn->SgLabels == NULL) tsgn = NULL;

  SgID = 0;

  if (tsgn != NULL)
    SgID = SgID_Number(tsgn);

  fprintf(fpout, "%u '", SgID);

  if (tsgn != NULL)
    PrintFullHM_SgName(tsgn, 0, fpout);
  else if (SgInfo->HallSymbol[0])
    fprintf(fpout, "%s", SgInfo->HallSymbol);
  else
    fprintf(fpout, "Unknown");

  putc('\'', fpout);
  putc('\n', fpout);

  nLoopInv = Sg_nLoopInv(SgInfo);

  nTrV = SgInfo->LatticeInfo->nTrVector;
   TrV = SgInfo->LatticeInfo->TrVector;

      iList = SgInfo->OrderL;
  if (iList > 1)
  {
    iList--;
    SuppressMx = 1;
  }
  else
    SuppressMx = 0;

  fprintf(fpout, "%d\n", iList);

  for (iTrV = 0; iTrV < nTrV; iTrV++, TrV += 3)
  {
    for (iLoopInv = 0; iLoopInv < nLoopInv; iLoopInv++)
    {
      if (iLoopInv == 0) f =  1;
      else               f = -1;

      lsmx = SgInfo->ListSeitzMx;

      for (iList = 0; iList < SgInfo->nList; iList++, lsmx++)
      {
        if (SuppressMx == 0)
        {
          for (i = 0; i < 3; i++)
            fprintf(fpout, " %12.8f %12.8f %12.8f %12.8f\n",
              (double) f * lsmx->s.R[3 * i + 0],
              (double) f * lsmx->s.R[3 * i + 1],
              (double) f * lsmx->s.R[3 * i + 2],
              (double) iModPositive(f * lsmx->s.T[i] + TrV[i], STBF) / STBF);

          putc(':',  fpout);
          putc('\n', fpout);
        }

        SuppressMx = 0;
      }
    }
  }
}
コード例 #4
0
ファイル: sginfo.c プロジェクト: alinelena/aten
static void PutAllXYZ(const T_SgInfo *SgInfo, FILE *fpout)
{
  int           iList, f, i;
  int           nTrV, iTrV, nLoopInv, iLoopInv;
  const int     *TrV;
  T_RTMx        SMx;
  const T_RTMx  *lsmx;
  const char    *xyz;
  char          buf0[8], buf1[8], buf2[8];


  nLoopInv = Sg_nLoopInv(SgInfo);

  nTrV = SgInfo->LatticeInfo->nTrVector;
   TrV = SgInfo->LatticeInfo->TrVector;

  for (iTrV = 0; iTrV < nTrV; iTrV++, TrV += 3)
  {
    for (iLoopInv = 0; iLoopInv < nLoopInv; iLoopInv++)
    {
      if (iLoopInv == 0) f =  1;
      else               f = -1;

      lsmx = SgInfo->ListSeitzMx;

      if (nLoopInv > 1 || nTrV > 1)
        putc('#', fpout);

      if (nTrV > 1)
        fprintf(fpout, " +(%s %s %s)",
          FormatFraction(TrV[0], STBF, 0, buf0, sizeof buf0 / sizeof (*buf0)),
          FormatFraction(TrV[1], STBF, 0, buf1, sizeof buf1 / sizeof (*buf1)),
          FormatFraction(TrV[2], STBF, 0, buf2, sizeof buf2 / sizeof (*buf2)));

      if (nLoopInv > 1)
        fprintf(fpout, " Inversion-Flag = %d", iLoopInv);

      if (nLoopInv > 1 || nTrV > 1)
        putc('\n', fpout);

      for (iList = 0; iList < SgInfo->nList; iList++, lsmx++)
      {
        for (i = 0; i < 9; i++)
          SMx.s.R[i] =              f * lsmx->s.R[i];

        for (i = 0; i < 3; i++)
          SMx.s.T[i] = iModPositive(f * lsmx->s.T[i] + TrV[i], STBF);

            xyz = RTMx2XYZ(&SMx, 1, STBF, 0, 0, 1, ", ", NULL, 0);
        if (xyz)
          fprintf(fpout, "%s\n", xyz);
        else
        {
          SetSgError("Internal Error: PutAllXYZ()");
          return;
        }
      }
    }
  }

  putc('\n', fpout);
}
コード例 #5
0
ファイル: sginfo.c プロジェクト: alinelena/aten
static int Find_si(T_SgInfo *SgInfo)
{
  static const int Tab_si_Vector[] =
    {
       1,  0,  0,   0, /*  h      */
       0,  1,  0,   1, /*  k      */
       0,  0,  1,   2, /*  l      */
       1,  1,  0,   0, /*  h+k    */
       1, -1,  0,   0, /*  h-k    */
       0,  1,  1,   1, /*  k+l    */
       0,  1, -1,   1, /*  k-l    */
       1,  0,  1,   1, /*  h+l    */
       1,  0, -1,   1, /*  h-l    */
       1,  1,  1,   0, /*  h+k+l  */
       1,  1, -1,   0, /*  h+k-l  */
       1, -1,  1,   0, /*  h-k+l  */
      -1,  1,  1,   0, /* -h+k+l  */
       2,  1, -1,   0, /*  2h+k-l */
       2, -1,  1,   0, /*  2h-k+l */
      -1,  2,  1,   0, /* -h+2k+l */
       1,  2, -1,   0, /*  h+2k-l */
      -1,  1,  2,   0, /* -h+k+2l */
       1, -1,  2,   0  /*  h-k+2l */
    };

  static int nTab_si_Vector
     = sizeof Tab_si_Vector / sizeof (*Tab_si_Vector) / 4;

  int        deterCCMx_LP, CCMx_PL[9];
  int        i, itabsiv;
  int        nLoopInv, iLoopInv, n_si_v, i_si_v;
  int        n, m, l;
  int        IsFine;
  int        item[3];
  int        R_I[9], si_Buf[9];
  int        iList;
  T_RTMx     *lsmx;
  const int  *tabsiv;


  if (SgInfo->LatticeInfo->Code != 'P')
  {
    deterCCMx_LP = deterRotMx(SgInfo->CCMx_LP);
                 InverseRotMx(SgInfo->CCMx_LP, CCMx_PL);

    if (deterCCMx_LP < 1)
      goto ReturnError;
  }

  nLoopInv = Sg_nLoopInv(SgInfo);

  SgInfo->n_si_Vector = n_si_v = 0;

  for (i = 0; i < 9; i++)
    SgInfo->si_Vector[i] = 0;

  for (i = 0; i < 3; i++)
  {
    SgInfo->si_Modulus[i] = 1;
    item[i] = 1;
  }

  tabsiv = Tab_si_Vector;

  for (itabsiv = 0; itabsiv < nTab_si_Vector; itabsiv++, tabsiv += 4)
  {
    IsFine = 1;
    m = -1;

    for (iList = 0; IsFine && iList < SgInfo->nList; iList++)
    {
      lsmx = &SgInfo->ListSeitzMx[iList];

      for (iLoopInv = 0; IsFine && iLoopInv < nLoopInv; iLoopInv++)
      {
        if (iLoopInv == 0)
          for (i = 0; i < 9; i++)
          {
            if (i % 4) R_I[i] =  lsmx->s.R[i];
            else       R_I[i] =  lsmx->s.R[i] - 1;
          }
        else
          for (i = 0; i < 9; i++)
          {
            if (i % 4) R_I[i] = -lsmx->s.R[i];
            else       R_I[i] = -lsmx->s.R[i] - 1;
          }

        if (SgInfo->LatticeInfo->Code != 'P')
        {
          if (PrimitiveRotMx(SgInfo->CCMx_LP, R_I, CCMx_PL,
                                deterCCMx_LP) < 0)
            return -1;
        }

        for (i = 0; IsFine && i < 3; i++)
        {
          n =  tabsiv[0] * R_I[i * 3 + 0];
          n += tabsiv[1] * R_I[i * 3 + 1];
          n += tabsiv[2] * R_I[i * 3 + 2];
          n = abs(n);

          if (n == 1)
            IsFine = 0;
          else if (m < 2)
            m = n;
          else if (n > 0 && n != m)
            IsFine = 0;
        }
      }
    }

    if (IsFine)
    {
#if DEBUG_Find_si
      fprintf(stdout, "H-Kt %2d %2d %2d   %d\n",
        tabsiv[0], tabsiv[1], tabsiv[2], m);
#endif

      l = tabsiv[3];

      while (item[l] > 1) /* just "if", see break's */
      {
        if (m == item[l]) break;

        if (m == 3 && (   SgInfo->XtalSystem != XS_Trigonal
                       || SgInfo->UniqueDirCode != '=')) break;

        if (m == 4 && (   SgInfo->XtalSystem == XS_Triclinic
                       || SgInfo->XtalSystem == XS_Monoclinic)) break;

        if (m == 2) break;

        /* if (m > 1 || m != 4) break; */

        n_si_v--;
        item[l] = 1;
        break;
      }

      if (item[l] == 1)
      {
        if (itabsiv > 12)
          n_si_v = 0;

        item[l] = m;
        SgInfo->si_Modulus[n_si_v] = m;

        n = n_si_v * 3;
        for (i = 0; i < 3; i++)
          SgInfo->si_Vector[n++] = tabsiv[i];

        n_si_v++;
      }
    }
  }

#if DEBUG_Find_si
  fprintf(stdout, "H-Kt\n");
#endif

  if (SgInfo->LatticeInfo->Code != 'P')
  {
#if DEBUG_Find_si
    for (i = 0; i < n_si_v; i++)
      fprintf(stdout, "H-Kp %2d %2d %2d   %d\n",
        SgInfo->si_Vector[i * 3 + 0],
        SgInfo->si_Vector[i * 3 + 1],
        SgInfo->si_Vector[i * 3 + 2],
        SgInfo->si_Modulus[i]);
    fprintf(stdout, "H-Kp\n");
#endif

    for (i_si_v = 0; i_si_v < n_si_v; i_si_v++)
    {
      for (i = 0; i < 3; i++)
      {
        si_Buf[i_si_v * 3 + i]
          =   SgInfo->si_Vector[i_si_v * 3 + 0] * CCMx_PL[i * 3 + 0]
            + SgInfo->si_Vector[i_si_v * 3 + 1] * CCMx_PL[i * 3 + 1]
            + SgInfo->si_Vector[i_si_v * 3 + 2] * CCMx_PL[i * 3 + 2];
      }
    }

    for (i = 0; i < i_si_v * 3; i++)
    {
      if (si_Buf[i] % deterCCMx_LP)
      {
        n = i / 3; n *= 3;
        fprintf(stdout, " %3d %3d %3d\n",
          si_Buf[n + 0], si_Buf[n + 1], si_Buf[n + 2]);
        goto ReturnError;
      }

      SgInfo->si_Vector[i] = si_Buf[i] / deterCCMx_LP;
    }
  }

  SgInfo->n_si_Vector = n_si_v;
  return n_si_v;

  ReturnError:

  SetSgError("Internal Error: Find_si()");
  return -1;
}
コード例 #6
0
ファイル: sgssvfy.c プロジェクト: stefsmeets/focus_package
static void MarkLegalOrigins(const T_SgInfo *SgInfo, int *TestField)
{
  int           O[3], V[3], mx, my, mz, i;
  int           IsFine, iList, iLoopInv, nLoopInv;
  int           BufMx[9];
  const T_RTMx  *lsmx;
  int           nTrV, iTrV;
  const int     *TrV;


  nLoopInv = Sg_nLoopInv(SgInfo);

  nTrV = SgInfo->LatticeInfo->nTrVector;

  for (O[0] = 0; O[0] < 12; O[0]++)
  for (O[1] = 0; O[1] < 12; O[1]++)
  for (O[2] = 0; O[2] < 12; O[2]++)
  {
    IsFine = 1;

    for (iList = 0; IsFine && iList < SgInfo->nList; iList++)
    {
      lsmx = &SgInfo->ListSeitzMx[iList];

      for (iLoopInv = 0; IsFine && iLoopInv < nLoopInv; iLoopInv++)
      {
        if (iLoopInv == 0)
          for (i = 0; i < 9; i++)
          {
            if (i % 4) BufMx[i] =  lsmx->s.R[i];
            else       BufMx[i] =  lsmx->s.R[i] - 1;
          }
        else
          for (i = 0; i < 9; i++)
          {
            if (i % 4) BufMx[i] = -lsmx->s.R[i];
            else       BufMx[i] = -lsmx->s.R[i] - 1;
          }

        RotMx_t_Vector(V, BufMx, O, 12);

        TrV = SgInfo->LatticeInfo->TrVector;

        for (iTrV = 0; iTrV < nTrV; iTrV++)
        {
          mx = (V[0] * (STBF / 12) + *TrV++) % STBF;
          my = (V[1] * (STBF / 12) + *TrV++) % STBF;
          mz = (V[2] * (STBF / 12) + *TrV++) % STBF;

          if (mx == 0 && my == 0 && mz == 0)
            break;
        }

        if (iTrV == nTrV) IsFine = 0;
      }
    }

    *TestField++ = IsFine;

#if DEBUG_MarkLegalOrigins
    if (IsFine != 0)
      Fprintf(stdout, " %2d %2d %2d\n", O[0], O[1], O[2]);
#endif
  }
}