Beispiel #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;
}
Beispiel #2
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;
}
Beispiel #3
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;
}