8000 style: Change a few styles by LecrisUT · Pull Request #438 · spglib/spglib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

style: Change a few styles #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BasedOnStyle: Google
IndentWidth: 4
IncludeBlocks: Preserve
QualifierAlignment: Right
IndentPPDirectives: BeforeHash
8 changes: 4 additions & 4 deletions python/_spglib.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT,
// Define macro to make sure symbol is exported
// When compiling define API for export
#if defined(_MSC_VER)
// On windows the API must be explicitly marked for export/import
#define EXPORT __declspec(dllexport)
// On windows the API must be explicitly marked for export/import
#define EXPORT __declspec(dllexport)
#else
// On Unix this is not necessary
#define EXPORT __attribute__((visibility("default")))
// On Unix this is not necessary
#define EXPORT __attribute__((visibility("default")))
#endif

EXPORT PyObject *PyInit__spglib(void) {
Expand Down
4 changes: 2 additions & 2 deletions src/arithmetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static int arithmetic_crystal_classes[231] = {
59, 61, 62, 62, 63, 63, 64, 62, 64, 65, 65, 66, 66, 67, 65, 65, 67, 68,
69, 70, 68, 69, 70, 71, 71, 71, 71, 72, 72, 72, 72, 73, 73};

static const char arithmetic_crystal_class_symbols[74][7] = {
static char const arithmetic_crystal_class_symbols[74][7] = {
" ", /* 0 */
"1P ", /* 1 */
"-1P ", /* 2 */
Expand Down Expand Up @@ -131,7 +131,7 @@ static const char arithmetic_crystal_class_symbols[74][7] = {
"m-3mI " /* 73 */
};

int arth_get_symbol(char symbol[7], const int spgroup_number) {
int arth_get_symbol(char symbol[7], int const spgroup_number) {
int i, arth_number;

if (spgroup_number < 1 || spgroup_number > 230) {
Expand Down
2 changes: 1 addition & 1 deletion src/arithmetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
#ifndef __arithmetic_H__
#define __arithmetic_H__

int arth_get_symbol(char symbol[7], const int spgroup_number);
int arth_get_symbol(char symbol[7], int const spgroup_number);

#endif
4 changes: 2 additions & 2 deletions src/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "spglib.h"

#ifdef SPG_TESTING
#define SPG_API_TEST SPG_API
#define SPG_API_TEST SPG_API
#else
#define SPG_API_TEST
#define SPG_API_TEST
#endif

#endif // SPGLIB_BASE_H
110 changes: 55 additions & 55 deletions src/cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@
#define REDUCE_RATE 0.95
#define NUM_ATTEMPT 100

static Cell *trim_cell(int *mapping_table, const double trimmed_lattice[3][3],
const Cell *cell, const double symprec);
static Cell *trim_cell(int *mapping_table, double const trimmed_lattice[3][3],
Cell const *cell, double const symprec);
static void set_positions_and_tensors(Cell *trimmed_cell,
const VecDBL *position,
const SiteTensorType tensor_rank,
const double *tensors,
const int *mapping_table,
const int *overlap_table);
static VecDBL *translate_atoms_in_trimmed_lattice(const Cell *cell,
const int tmat_p_i[3][3]);
static int *get_overlap_table(const VecDBL *position, const int cell_size,
const int *cell_types, const Cell *trimmed_cell,
const double symprec);
VecDBL const *position,
SiteTensorType const tensor_rank,
double const *tensors,
int const *mapping_table,
int const *overlap_table);
static VecDBL *translate_atoms_in_trimmed_lattice(Cell const *cell,
int const tmat_p_i[3][3]);
static int *get_overlap_table(VecDBL const *position, int const cell_size,
int const *cell_types, Cell const *trimmed_cell,
double const symprec);

// @brief Allocate Cell. NULL is returned if failed
// @param size number of atoms
// @param tensor_rank rank of site tensors for magnetic symmetry. Set -1 if
// not used.
Cell *cel_alloc_cell(const int size, const SiteTensorType tensor_rank) {
Cell *cel_alloc_cell(int const size, SiteTensorType const tensor_rank) {
Cell *cell;

cell = NULL;
Expand Down Expand Up @@ -140,8 +140,8 @@ void cel_free_cell(Cell *cell) {
}
}

void cel_set_cell(Cell *cell, const double lattice[3][3],
const double position[][3], const int types[]) {
void cel_set_cell(Cell *cell, double const lattice[3][3],
double const position[][3], int const types[]) {
int i, j;
mat_copy_matrix_d3(cell->lattice, lattice);
for (i = 0; i < cell->size; i++) {
Expand All @@ -153,9 +153,9 @@ void cel_set_cell(Cell *cell, const double lattice[3][3],
}

/* aperiodic_axis = -1 for none; = 0 1 2 for a b c */
void cel_set_layer_cell(Cell *cell, const double lattice[3][3],
const double position[][3], const int types[],
const int aperiodic_axis) {
void cel_set_layer_cell(Cell *cell, double const lattice[3][3],
double const position[][3], int const types[],
int const aperiodic_axis) {
int i, j;
mat_copy_matrix_d3(cell->lattice, lattice);
for (i = 0; i < cell->size; i++) {
Expand All @@ -172,9 +172,9 @@ void cel_set_layer_cell(Cell *cell, const double lattice[3][3],
cell->aperiodic_axis = aperiodic_axis;
}

void cel_set_cell_with_tensors(Cell *cell, const double lattice[3][3],
const double position[][3], const int types[],
const double *tensors) {
void cel_set_cell_with_tensors(Cell *cell, double const lattice[3][3],
double const position[][3], int const types[],
double const *tensors) {
int i, j;

cel_set_cell(cell, lattice, position, types);
Expand All @@ -189,7 +189,7 @@ void cel_set_cell_with_tensors(Cell *cell, const double lattice[3][3],
}
}

Cell *cel_copy_cell(const Cell *cell) {
Cell *cel_copy_cell(Cell const *cell) {
Cell *cell_new;

cell_new = NULL;
Expand All @@ -211,8 +211,8 @@ Cell *cel_copy_cell(const Cell *cell) {
return cell_new;
}

int cel_is_overlap(const double a[3], const double b[3],
const double lattice[3][3], const double symprec) {
int cel_is_overlap(double const a[3], double const b[3],
double const lattice[3][3], double const symprec) {
int i;
double v_diff[3];

Expand All @@ -229,10 +229,10 @@ int cel_is_overlap(const double a[3], const double b[3],
}
}

int cel_is_overlap_with_same_type(const double a[3], const double b[3],
const int type_a, const int type_b,
const double lattice[3][3],
const double symprec) {
int cel_is_overlap_with_same_type(double const a[3], double const b[3],
int const type_a, int const type_b,
double const lattice[3][3],
double const symprec) {
if (type_a == type_b) {
return cel_is_overlap(a, b, lattice, symprec);
} else {
Expand All @@ -242,7 +242,7 @@ int cel_is_overlap_with_same_type(const double a[3], const double b[3],

/* 1: At least one overlap of a pair of atoms was found. */
/* 0: No overlap of atoms was found. */
int cel_any_overlap(const Cell *cell, const double symprec) {
int cel_any_overlap(Cell const *cell, double const symprec) {
int i, j;

for (i = 0; i < cell->size; i++) {
Expand All @@ -258,7 +258,7 @@ int cel_any_overlap(const Cell *cell, const double symprec) {

/* 1: At least one overlap of a pair of atoms with same type was found. */
/* 0: No overlap of atoms was found. */
int cel_any_overlap_with_same_type(const Cell *cell, const double symprec) {
int cel_any_overlap_with_same_type(Cell const *cell, double const symprec) {
int i, j;

for (i = 0; i < cell->size; i++) {
Expand All @@ -275,9 +275,9 @@ int cel_any_overlap_with_same_type(const Cell *cell, const double symprec) {

/* Modified from cel_is_overlap */
/* Periodic boundary condition only applied on 2 directions */
int cel_layer_is_overlap(const double a[3], const double b[3],
const double lattice[3][3], const int periodic_axes[2],
const double symprec) {
int cel_layer_is_overlap(double const a[3], double const b[3],
double const lattice[3][3], int const periodic_axes[2],
double const symprec) {
double v_diff[3];

v_diff[0] = a[0] - b[0];
Expand All @@ -295,11 +295,11 @@ int cel_layer_is_overlap(const double a[3], const double b[3],
}
}

int cel_layer_is_overlap_with_same_type(const double a[3], const double b[3],
const int type_a, const int type_b,
const double lattice[3][3],
const int periodic_axes[2],
const double symprec) {
int cel_layer_is_overlap_with_same_type(double const a[3], double const b[3],
int const type_a, int const type_b,
double const lattice[3][3],
int const periodic_axes[2],
double const symprec) {
if (type_a == type_b) {
return cel_layer_is_overlap(a, b, lattice, periodic_axes, symprec);
} else {
Expand All @@ -309,9 +309,9 @@ int cel_layer_is_overlap_with_same_type(const double a[3], const double b[3],

/* 1: At least one overlap of a pair of atoms with same type was found. */
/* 0: No overlap of atoms was found. */
int cel_layer_any_overlap_with_same_type(const Cell *cell,
const int periodic_axes[2],
const double symprec) {
int cel_layer_any_overlap_with_same_type(Cell const *cell,
int const periodic_axes[2],
double const symprec) {
int i, j;

for (i = 0; i < cell->size; i++) {
Expand All @@ -334,14 +334,14 @@ int cel_layer_any_overlap_with_same_type(const Cell *cell,
/// `trimmed_lattice` is created.
/// @param[in] symprec tolerance parameter.
/// @return smaller cell having basis vectors of `trimmed_lattice`.
Cell *cel_trim_cell(int *mapping_table, const double trimmed_lattice[3][3],
const Cell *cell, const double symprec) {
Cell *cel_trim_cell(int *mapping_table, double const trimmed_lattice[3][3],
Cell const *cell, double const symprec) {
return trim_cell(mapping_table, trimmed_lattice, cell, symprec);
}

/* Return NULL if failed */
static Cell *trim_cell(int *mapping_table, const double trimmed_lattice[3][3],
const Cell *cell, const double symprec) {
static Cell *trim_cell(int *mapping_table, double const trimmed_lattice[3][3],
Cell const *cell, double const symprec) {
int i, index_atom, ratio;
Cell *trimmed_cell;
VecDBL *position;
Expand Down Expand Up @@ -432,11 +432,11 @@ static Cell *trim_cell(int *mapping_table, const double trimmed_lattice[3][3],
/// @brief Set trimmed_cell->position and trimmed_cell->tensors by averaging
/// over overlapped atoms
static void set_positions_and_tensors(Cell *trimmed_cell,
const VecDBL *position,
const SiteTensorType tensor_rank,
const double *tensors,
const int *mapping_table,
const int *overlap_table) {
VecDBL const *position,
SiteTensorType const tensor_rank,
double const *tensors,
int const *mapping_table,
int const *overlap_table) {
int i, j, k, l, multi, atom_idx;

for (i = 0; i < trimmed_cell->size; i++) {
Expand Down Expand Up @@ -505,8 +505,8 @@ static void set_positions_and_tensors(Cell *trimmed_cell,
}

/* Return NULL if failed */
static VecDBL *translate_atoms_in_trimmed_lattice(const Cell *cell,
const int tmat_p_i[3][3]) {
static VecDBL *translate_atoms_in_trimmed_lattice(Cell const *cell,
int const tmat_p_i[3][3]) {
int i, j;
VecDBL *position;

Expand Down Expand Up @@ -541,9 +541,9 @@ static VecDBL *translate_atoms_in_trimmed_lattice(const Cell *cell,
/// @return array (cell_size, ) If `position[i]` and `position[j]` with `i` <=
/// `j` are equivalent, `overlap_table[i]` = `overlap_table[j]` = `i`. Return
/// NULL if failed.
static int *get_overlap_table(const VecDBL *position, const int cell_size,
const int *cell_types, const Cell *trimmed_cell,
const double symprec) {
static int *get_overlap_table(VecDBL const *position, int const cell_size,
int const *cell_types, Cell const *trimmed_cell,
double const symprec) {
int i, j, attempt, num_overlap, ratio, lattice_rank;
double trim_tolerance;
int *overlap_table;
Expand Down
66 changes: 33 additions & 33 deletions src/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,39 +63,39 @@ typedef struct {
double *tensors;
} Cell;

SPG_API_TEST Cell *cel_alloc_cell(const int size,
const SiteTensorType tensor_rank);
SPG_API_TEST Cell *cel_alloc_cell(int const size,
SiteTensorType const tensor_rank);
SPG_API_TEST void cel_free_cell(Cell *cell);
void cel_set_cell(Cell *cell, const double lattice[3][3],
const double position[][3], const int types[]);
SPG_API_TEST void cel_set_layer_cell(Cell *cell, const double lattice[3][3],
const double position[][3],
const int types[],
const int aperiodic_axis);
void cel_set_cell_with_tensors(Cell *cell, const double lattice[3][3],
const double position[][3], const int types[],
const double *tensors);
Cell *cel_copy_cell(const Cell *cell);
int cel_is_overlap(const double a[3], const double b[3],
const double lattice[3][3], const double symprec);
int cel_is_overlap_with_same_type(const double a[3], const double b[3],
const int type_a, const int type_b,
const double lattice[3][3],
const double symprec);
int cel_any_overlap(const Cell *cell, const double symprec);
int cel_any_overlap_with_same_type(const Cell *cell, const double symprec);
Cell *cel_trim_cell(int *mapping_table, const double trimmed_lattice[3][3],
const Cell *cell, const double symprec);
int cel_layer_is_overlap(const double a[3], const double b[3],
const double lattice[3][3], const int periodic_axes[2],
const double symprec);
int cel_layer_is_overlap_with_same_type(const double a[3], const double b[3],
const int type_a, const int type_b,
const double lattice[3][3],
const int periodic_axes[2],
const double symprec);
int cel_layer_any_overlap_with_same_type(const Cell *cell,
const int periodic_axes[2],
const double symprec);
void cel_set_cell(Cell *cell, double const lattice[3][3],
double const position[][3], int const types[]);
SPG_API_TEST void cel_set_layer_cell(Cell *cell, double const lattice[3][3],
double const position[][3],
int const types[],
int const aperiodic_axis);
void cel_set_cell_with_tensors(Cell *cell, double const lattice[3][3],
double const position[][3], int const types[],
double const *tensors);
Cell *cel_copy_cell(Cell const *cell);
int cel_is_overlap(double const a[3], double const b[3],
double const lattice[3][3], double const symprec);
int cel_is_overlap_with_same_type(double const a[3], double const b[3],
int const type_a, int const type_b,
double const lattice[3][3],
double const symprec);
int cel_any_overlap(Cell const *cell, double const symprec);
int cel_any_overlap_with_same_type(Cell const *cell, double const symprec);
Cell *cel_trim_cell(int *mapping_table, double const trimmed_lattice[3][3],
Cell const *cell, double const symprec);
int cel_layer_is_overlap(double const a[3], double const b[3],
double const lattice[3][3], int const periodic_axes[2],
double const symprec);
int cel_layer_is_overlap_with_same_type(double const a[3], double const b[3],
int const type_a, int const type_b,
double const lattice[3][3],
int const periodic_axes[2],
double const symprec);
int cel_layer_any_overlap_with_same_type(Cell const *cell,
int const periodic_axes[2],
double const symprec);

#endif
Loading
0