示例#1
0
static int get_hall_number( double origin_shift[3],
			    double conv_lattice[3][3],
			    Centering * centering,
			    SPGCONST Cell * primitive,
			    SPGCONST Symmetry * symmetry,
			    const double symprec )
{
  int pg_num, attempt, hall_number=0;
  double tolerance;
  Symmetry * sym_reduced;

  tolerance = symprec;
  pg_num = ptg_get_pointgroup_number( symmetry );
  if ( pg_num > -1 ) {
    hall_number = get_hall_number_local( origin_shift,
					 conv_lattice,
					 centering,
					 primitive,
					 symmetry,
					 symprec );
    if ( hall_number > 0 ) { goto ret; }
  }

  /* Reduce tolerance and search hall symbol again when hall symbol */
  /* could not be found by the given tolerance. */
  /* The situation this happens is that symmetry operations found */
  /* don't match any of hall symbol database due to tricky */
  /* displacements of atoms from the exact points. */
  for ( attempt = 0; attempt < 100; attempt++ ) {
    tolerance *= REDUCE_RATE;
    sym_reduced = sym_reduce_operation( primitive, symmetry, tolerance );
    pg_num = ptg_get_pointgroup_number( sym_reduced );
    if ( pg_num > -1 ) {
      hall_number = get_hall_number_local( origin_shift,
					   conv_lattice,
					   centering,
					   primitive,
					   sym_reduced,
					   symprec );
      if ( hall_number > 0 ) {
	sym_free_symmetry( sym_reduced );
	warning_print("spglib: Tolerance to find Hall symbol was changed to %f\n", tolerance);
	goto ret;
      }
    }
    sym_free_symmetry( sym_reduced );
  }

  warning_print("spglib: Iterative attempt to find Hall symbol was failed.");

 ret:
  return hall_number;
}
示例#2
0
static Centering get_transformation_matrix( double trans_mat[3][3],
					    SPGCONST Symmetry * symmetry )
{
  int pg_num;
  double correction_mat[3][3];
  Centering centering;
  Pointgroup pointgroup;

  pg_num = ptg_get_pointgroup_number( symmetry );
  pointgroup = ptg_get_pointgroup( pg_num );
  ptg_get_transformation_matrix( &pointgroup, symmetry );

  /* Centering is not determined only from symmetry operations */
  /* sometimes. Therefore centering and transformation matrix are */
  /* related. */
  centering = lat_get_centering( correction_mat,
				 pointgroup.transform_mat,
				 pointgroup.laue );
  mat_multiply_matrix_id3( trans_mat,
			   pointgroup.transform_mat,
			   correction_mat );

  debug_print("correction matrix\n");
  debug_print_matrix_d3( correction_mat );

  return centering;
}
示例#3
0
static int get_hall_number_local_iteration(double origin_shift[3],
        double conv_lattice[3][3],
        SPGCONST Cell * primitive,
        SPGCONST Symmetry * symmetry,
        const double symprec)
{
    int attempt, pg_num, hall_number=0;
    double tolerance;
    Symmetry * sym_reduced;

    debug_print("get_hall_number_local_iteration:\n");

    tolerance = symprec;
    for (attempt = 0; attempt < 100; attempt++) {
        tolerance *= REDUCE_RATE;
        debug_print("  Attempt %d tolerance = %f\n", attempt, tolerance);
        sym_reduced = sym_reduce_operation(primitive, symmetry, tolerance);
        pg_num = ptg_get_pointgroup_number(sym_reduced);

        if (pg_num > -1) {
            hall_number = get_hall_number_local(origin_shift,
                                                conv_lattice,
                                                primitive,
                                                sym_reduced,
                                                symprec);
            if (hall_number > 0) {
                sym_free_symmetry(sym_reduced);
                break;
            }
        }
        sym_free_symmetry(sym_reduced);
    }

#ifdef SPGWARNING
    if (hall_number == 0) {
        warning_print("spglib: Iterative attempt with sym_reduce_operation to find Hall symbol failed.\n");
    }
#endif

    return hall_number;
}
示例#4
0
static int get_hall_number(double origin_shift[3],
                           double conv_lattice[3][3],
                           SPGCONST Cell * primitive,
                           SPGCONST Symmetry * symmetry,
                           const double symprec)
{
    int pg_num, hall_number=0;

    debug_print("get_hall_number:\n");

    pg_num = ptg_get_pointgroup_number(symmetry);
    if (pg_num > -1) {
        hall_number = get_hall_number_local(origin_shift,
                                            conv_lattice,
                                            primitive,
                                            symmetry,
                                            symprec);
        if (hall_number > 0) {
            goto ret;
        }
    }

    /* Reduce tolerance and search hall symbol again when hall symbol */
    /* could not be found by the given tolerance. */
    /* The situation this happens is that symmetry operations found */
    /* don't match any of hall symbol database due to tricky */
    /* displacements of atoms from the exact points. */
    hall_number = get_hall_number_local_iteration(origin_shift,
                  conv_lattice,
                  primitive,
                  symmetry,
                  symprec);

ret:
    return hall_number;
}