forked from lijiext/lammps
added ptm namespace
This commit is contained in:
parent
37201beda5
commit
6e546ef5af
|
@ -2,6 +2,7 @@
|
|||
#include "ptm_constants.h"
|
||||
#include "ptm_initialize_data.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
#define NUM_ALLOY_TYPES 3
|
||||
static uint32_t typedata[NUM_ALLOY_TYPES][3] = {
|
||||
|
@ -99,3 +100,5 @@ int32_t find_alloy_type(const refdata_t* ref, int8_t* mapping, int32_t* numbers)
|
|||
return PTM_ALLOY_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
|
||||
#include "ptm_initialize_data.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int32_t find_alloy_type(const refdata_t* ref, int8_t* mapping, int32_t* numbers);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "ptm_graph_tools.h"
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
static bool weinberg_coloured(int num_nodes, int num_edges, int8_t common[PTM_MAX_NBRS][PTM_MAX_NBRS], int8_t* colours, int8_t* best_code, int8_t* canonical_labelling, int a, int b)
|
||||
{
|
||||
|
@ -165,3 +166,5 @@ int canonical_form_coloured(int num_facets, int8_t facets[][3], int num_nodes, i
|
|||
return PTM_NO_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int canonical_form_coloured(int num_facets, int8_t facets[][3], int num_nodes, int8_t* degree, int8_t* colours, int8_t* canonical_labelling, int8_t* best_code, uint64_t* p_hash);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "ptm_convex_hull_incremental.h"
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
#define VISIBLE 1
|
||||
#define INVISIBLE 2
|
||||
|
@ -361,3 +362,5 @@ int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch,
|
|||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <stdbool.h>
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -23,5 +24,7 @@ typedef struct
|
|||
void add_facet(const double (*points)[3], int a, int b, int c, int8_t* facet, double* plane_normal, double* barycentre);
|
||||
int get_convex_hull(int num_points, const double (*points)[3], convexhull_t* ch, int8_t simplex[][3]);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "ptm_deformation_gradient.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
void calculate_deformation_gradient(int num_points, const double (*ideal_points)[3], int8_t* mapping, double (*normalized)[3], const double (*penrose)[3], double* F, double* res)
|
||||
{
|
||||
|
@ -35,3 +36,5 @@ void calculate_deformation_gradient(int num_points, const double (*ideal_points)
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <stdint.h>
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
void calculate_deformation_gradient(int num_points, const double (*ideal_points)[3], int8_t* mapping, double (*normalized)[3], const double (*penrose)[3], double* F, double* res);
|
||||
|
||||
//sc
|
||||
|
@ -137,6 +139,8 @@ const double penrose_dhex[PTM_NUM_POINTS_DHEX][3] = {
|
|||
{ 0, 2 * kdcub, -2 * kdcub },
|
||||
{ 2 * kdcub, 0, -2 * kdcub },
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ptm {
|
||||
|
||||
#define NUM_CUBIC_MAPPINGS 24
|
||||
#define NUM_ICO_MAPPINGS 60
|
||||
#define NUM_HEX_MAPPINGS 6
|
||||
|
@ -175,6 +177,7 @@ const int8_t mapping_dhex[NUM_DHEX_MAPPINGS][PTM_MAX_POINTS] = {
|
|||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
{0, 1, 3, 4, 2, 6, 7, 5, 11, 13, 12, 14, 16, 15, 8, 9, 10},
|
||||
{0, 1, 4, 2, 3, 7, 5, 6, 14, 15, 16, 8, 10, 9, 11, 13, 12} };
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "ptm_graph_data.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int8_t automorphisms[65][17] = {
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16},
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, -1, -1},
|
||||
|
@ -2057,3 +2059,5 @@ graph_t graphs_dhex[NUM_DHEX_GRAPHS] = {
|
|||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdint.h>
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -33,5 +34,7 @@ extern graph_t graphs_bcc[NUM_BCC_GRAPHS];
|
|||
extern graph_t graphs_dcub[NUM_DCUB_GRAPHS];
|
||||
extern graph_t graphs_dhex[NUM_DHEX_GRAPHS];
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "ptm_constants.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
bool build_facet_map(int num_facets, int8_t facets[][3], int8_t common[PTM_MAX_NBRS][PTM_MAX_NBRS])
|
||||
{
|
||||
memset(common, -1, sizeof(int8_t) * PTM_MAX_NBRS * PTM_MAX_NBRS);
|
||||
|
@ -50,3 +52,5 @@ int graph_degree(int num_facets, int8_t facets[][3], int num_nodes, int8_t* degr
|
|||
return max_degree;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
#include <stdint.h>
|
||||
#include "ptm_constants.h"
|
||||
|
||||
namespace ptm {
|
||||
|
||||
bool build_facet_map(int num_facets, int8_t facets[][3], int8_t common[PTM_MAX_NBRS][PTM_MAX_NBRS]);
|
||||
int graph_degree(int num_facets, int8_t facets[][3], int num_nodes, int8_t* degree);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ static double calculate_lattice_constant(int type, double interatomic_distance)
|
|||
|
||||
static int rotate_into_fundamental_zone(int type, double* q)
|
||||
{
|
||||
if (type == PTM_MATCH_SC) return rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_FCC) return rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_BCC) return rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_ICO) return rotate_quaternion_into_icosahedral_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_HCP) return rotate_quaternion_into_hcp_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_DCUB) return rotate_quaternion_into_diamond_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_DHEX) return rotate_quaternion_into_diamond_hexagonal_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_SC) return ptm::rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_FCC) return ptm::rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_BCC) return ptm::rotate_quaternion_into_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_ICO) return ptm::rotate_quaternion_into_icosahedral_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_HCP) return ptm::rotate_quaternion_into_hcp_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_DCUB) return ptm::rotate_quaternion_into_diamond_cubic_fundamental_zone(q);
|
||||
if (type == PTM_MATCH_DHEX) return ptm::rotate_quaternion_into_diamond_hexagonal_fundamental_zone(q);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ static void order_points(ptm_local_handle_t local_handle, int num_points, double
|
|||
if (topological_ordering)
|
||||
{
|
||||
double normalized_points[PTM_MAX_INPUT_POINTS][3];
|
||||
normalize_vertices(num_points, unpermuted_points, normalized_points);
|
||||
int ret = calculate_neighbour_ordering((void*)local_handle, num_points, (const double (*)[3])normalized_points, ordering);
|
||||
ptm::normalize_vertices(num_points, unpermuted_points, normalized_points);
|
||||
int ret = ptm::calculate_neighbour_ordering((void*)local_handle, num_points, (const double (*)[3])normalized_points, ordering);
|
||||
if (ret != 0)
|
||||
topological_ordering = false;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ static void order_points(ptm_local_handle_t local_handle, int num_points, double
|
|||
}
|
||||
}
|
||||
|
||||
static void output_data(result_t* res, int num_points, int32_t* unpermuted_numbers, double (*points)[3], int32_t* numbers, int8_t* ordering,
|
||||
static void output_data(ptm::result_t* res, int num_points, int32_t* unpermuted_numbers, double (*points)[3], int32_t* numbers, int8_t* ordering,
|
||||
int32_t* p_type, int32_t* p_alloy_type, double* p_scale, double* p_rmsd, double* q, double* F, double* F_res,
|
||||
double* U, double* P, int8_t* mapping, double* p_interatomic_distance, double* p_lattice_constant)
|
||||
{
|
||||
|
@ -82,13 +82,13 @@ static void output_data(result_t* res, int num_points, int32_t* unpermuted_numbe
|
|||
if (mapping != NULL)
|
||||
memset(mapping, -1, num_points * sizeof(int8_t));
|
||||
|
||||
const refdata_t* ref = res->ref_struct;
|
||||
const ptm::refdata_t* ref = res->ref_struct;
|
||||
if (ref == NULL)
|
||||
return;
|
||||
|
||||
*p_type = ref->type;
|
||||
if (p_alloy_type != NULL && unpermuted_numbers != NULL)
|
||||
*p_alloy_type = find_alloy_type(ref, res->mapping, numbers);
|
||||
*p_alloy_type = ptm::find_alloy_type(ref, res->mapping, numbers);
|
||||
|
||||
int bi = rotate_into_fundamental_zone(ref->type, res->q);
|
||||
int8_t temp[PTM_MAX_POINTS];
|
||||
|
@ -101,17 +101,17 @@ static void output_data(result_t* res, int num_points, int32_t* unpermuted_numbe
|
|||
{
|
||||
double scaled_points[PTM_MAX_INPUT_POINTS][3];
|
||||
|
||||
subtract_barycentre(ref->num_nbrs + 1, points, scaled_points);
|
||||
ptm::subtract_barycentre(ref->num_nbrs + 1, points, scaled_points);
|
||||
for (int i = 0;i<ref->num_nbrs + 1;i++)
|
||||
{
|
||||
scaled_points[i][0] *= res->scale;
|
||||
scaled_points[i][1] *= res->scale;
|
||||
scaled_points[i][2] *= res->scale;
|
||||
}
|
||||
calculate_deformation_gradient(ref->num_nbrs + 1, ref->points, res->mapping, scaled_points, ref->penrose, F, F_res);
|
||||
ptm::calculate_deformation_gradient(ref->num_nbrs + 1, ref->points, res->mapping, scaled_points, ref->penrose, F, F_res);
|
||||
|
||||
if (P != NULL && U != NULL)
|
||||
polar_decomposition_3x3(F, false, U, P);
|
||||
ptm::polar_decomposition_3x3(F, false, U, P);
|
||||
}
|
||||
|
||||
if (mapping != NULL)
|
||||
|
@ -156,7 +156,7 @@ int ptm_index( ptm_local_handle_t local_handle, int32_t flags,
|
|||
assert(num_points >= PTM_NUM_POINTS_DCUB);
|
||||
|
||||
int ret = 0;
|
||||
result_t res;
|
||||
ptm::result_t res;
|
||||
res.ref_struct = NULL;
|
||||
res.rmsd = INFINITY;
|
||||
|
||||
|
@ -168,32 +168,32 @@ int ptm_index( ptm_local_handle_t local_handle, int32_t flags,
|
|||
double dpoints[PTM_MAX_POINTS][3];
|
||||
int32_t dnumbers[PTM_MAX_POINTS];
|
||||
|
||||
convexhull_t ch;
|
||||
ptm::convexhull_t ch;
|
||||
double ch_points[PTM_MAX_INPUT_POINTS][3];
|
||||
|
||||
if (flags & (PTM_CHECK_SC | PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_ICO | PTM_CHECK_BCC))
|
||||
{
|
||||
int num_lpoints = std::min(std::min(PTM_MAX_POINTS, 20), num_points);
|
||||
order_points(local_handle, num_lpoints, unpermuted_points, unpermuted_numbers, topological_ordering, ordering, points, numbers);
|
||||
normalize_vertices(num_lpoints, points, ch_points);
|
||||
ptm::normalize_vertices(num_lpoints, points, ch_points);
|
||||
ch.ok = false;
|
||||
|
||||
if (flags & PTM_CHECK_SC)
|
||||
ret = match_general(&structure_sc, ch_points, points, &ch, &res);
|
||||
ret = match_general(&ptm::structure_sc, ch_points, points, &ch, &res);
|
||||
|
||||
if (flags & (PTM_CHECK_FCC | PTM_CHECK_HCP | PTM_CHECK_ICO))
|
||||
ret = match_fcc_hcp_ico(ch_points, points, flags, &ch, &res);
|
||||
|
||||
if (flags & PTM_CHECK_BCC)
|
||||
ret = match_general(&structure_bcc, ch_points, points, &ch, &res);
|
||||
ret = match_general(&ptm::structure_bcc, ch_points, points, &ch, &res);
|
||||
}
|
||||
|
||||
if (flags & (PTM_CHECK_DCUB | PTM_CHECK_DHEX))
|
||||
{
|
||||
ret = calculate_diamond_neighbour_ordering(num_points, unpermuted_points, unpermuted_numbers, dordering, dpoints, dnumbers);
|
||||
ret = ptm::calculate_diamond_neighbour_ordering(num_points, unpermuted_points, unpermuted_numbers, dordering, dpoints, dnumbers);
|
||||
if (ret == 0)
|
||||
{
|
||||
normalize_vertices(PTM_NUM_NBRS_DCUB + 1, dpoints, ch_points);
|
||||
ptm::normalize_vertices(PTM_NUM_NBRS_DCUB + 1, dpoints, ch_points);
|
||||
ch.ok = false;
|
||||
|
||||
ret = match_dcub_dhex(ch_points, dpoints, flags, &ch, &res);
|
||||
|
|
|
@ -14,20 +14,20 @@ static void make_facets_clockwise(int num_facets, int8_t (*facets)[3], const dou
|
|||
double origin[3] = {0, 0, 0};
|
||||
|
||||
for (int i = 0;i<num_facets;i++)
|
||||
add_facet(points, facets[i][0], facets[i][1], facets[i][2], facets[i], plane_normal, origin);
|
||||
ptm::add_facet(points, facets[i][0], facets[i][1], facets[i][2], facets[i], plane_normal, origin);
|
||||
}
|
||||
|
||||
static int initialize_graphs(const refdata_t* s, int8_t* colours)
|
||||
static int initialize_graphs(const ptm::refdata_t* s, int8_t* colours)
|
||||
{
|
||||
for (int i = 0;i<s->num_graphs;i++)
|
||||
{
|
||||
int8_t code[2 * PTM_MAX_EDGES];
|
||||
int8_t degree[PTM_MAX_NBRS];
|
||||
int _max_degree = graph_degree(s->num_facets, s->graphs[i].facets, s->num_nbrs, degree);
|
||||
int _max_degree = ptm::graph_degree(s->num_facets, s->graphs[i].facets, s->num_nbrs, degree);
|
||||
assert(_max_degree <= s->max_degree);
|
||||
|
||||
make_facets_clockwise(s->num_facets, s->graphs[i].facets, &s->points[1]);
|
||||
int ret = canonical_form_coloured(s->num_facets, s->graphs[i].facets, s->num_nbrs, degree, colours, s->graphs[i].canonical_labelling, (int8_t*)&code[0], &s->graphs[i].hash);
|
||||
int ret = ptm::canonical_form_coloured(s->num_facets, s->graphs[i].facets, s->num_nbrs, degree, colours, s->graphs[i].canonical_labelling, (int8_t*)&code[0], &s->graphs[i].hash);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ int ptm_initialize_global()
|
|||
int8_t colours[PTM_MAX_POINTS] = {0};
|
||||
int8_t dcolours[PTM_MAX_POINTS] = {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
int ret = initialize_graphs(&structure_sc, colours);
|
||||
ret |= initialize_graphs(&structure_fcc, colours);
|
||||
ret |= initialize_graphs(&structure_hcp, colours);
|
||||
ret |= initialize_graphs(&structure_ico, colours);
|
||||
ret |= initialize_graphs(&structure_bcc, colours);
|
||||
ret |= initialize_graphs(&structure_dcub, dcolours);
|
||||
ret |= initialize_graphs(&structure_dhex, dcolours);
|
||||
int ret = initialize_graphs(&ptm::structure_sc, colours);
|
||||
ret |= initialize_graphs(&ptm::structure_fcc, colours);
|
||||
ret |= initialize_graphs(&ptm::structure_hcp, colours);
|
||||
ret |= initialize_graphs(&ptm::structure_ico, colours);
|
||||
ret |= initialize_graphs(&ptm::structure_bcc, colours);
|
||||
ret |= initialize_graphs(&ptm::structure_dcub, dcolours);
|
||||
ret |= initialize_graphs(&ptm::structure_dhex, dcolours);
|
||||
|
||||
if (ret == PTM_NO_ERROR)
|
||||
ptm_initialized = true;
|
||||
|
@ -61,11 +61,11 @@ int ptm_initialize_global()
|
|||
ptm_local_handle_t ptm_initialize_local()
|
||||
{
|
||||
assert(ptm_initialized);
|
||||
return (ptm_local_handle_t)voronoi_initialize_local();
|
||||
return (ptm_local_handle_t)ptm::voronoi_initialize_local();
|
||||
}
|
||||
|
||||
void ptm_uninitialize_local(ptm_local_handle_t ptr)
|
||||
{
|
||||
voronoi_uninitialize_local(ptr);
|
||||
ptm::voronoi_uninitialize_local(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "ptm_convex_hull_incremental.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int type;
|
||||
|
@ -35,6 +37,7 @@ const refdata_t structure_bcc = { PTM_MATCH_BCC, 14, 24, 8, NUM_BCC_GRAPHS, N
|
|||
const refdata_t structure_dcub = { PTM_MATCH_DCUB, 16, 28, 8, NUM_DCUB_GRAPHS, NUM_DCUB_MAPPINGS, graphs_dcub, ptm_template_dcub, penrose_dcub, mapping_dcub };
|
||||
const refdata_t structure_dhex = { PTM_MATCH_DHEX, 16, 28, 8, NUM_DHEX_GRAPHS, NUM_DHEX_MAPPINGS, graphs_dhex, ptm_template_dhex, penrose_dhex, mapping_dhex };
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#include <algorithm>
|
||||
#include "ptm_constants.h"
|
||||
#include "ptm_voronoi_cell.h"
|
||||
using namespace voro;
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ static bool sorthelper_compare(sorthelper_t const& a, sorthelper_t const& b)
|
|||
}
|
||||
|
||||
//todo: change voronoi code to return errors rather than exiting
|
||||
static int calculate_voronoi_face_areas(int num_points, const double (*_points)[3], double* normsq, double max_norm, voronoicell_neighbor* v, std::vector<int>& nbr_indices, std::vector<double>& face_areas)
|
||||
static int calculate_voronoi_face_areas(int num_points, const double (*_points)[3], double* normsq, double max_norm, ptm_voro::voronoicell_neighbor* v, std::vector<int>& nbr_indices, std::vector<double>& face_areas)
|
||||
{
|
||||
const double k = 1000 * max_norm; //todo: reduce this constant
|
||||
v->init(-k,k,-k,k,-k,k);
|
||||
|
@ -53,7 +53,7 @@ int calculate_neighbour_ordering(void* _voronoi_handle, int num_points, const do
|
|||
{
|
||||
assert(num_points <= PTM_MAX_INPUT_POINTS);
|
||||
|
||||
voronoicell_neighbor* voronoi_handle = (voronoicell_neighbor*)_voronoi_handle;
|
||||
ptm_voro::voronoicell_neighbor* voronoi_handle = (ptm_voro::voronoicell_neighbor*)_voronoi_handle;
|
||||
|
||||
double max_norm = 0;
|
||||
double points[PTM_MAX_INPUT_POINTS][3];
|
||||
|
@ -116,13 +116,13 @@ int calculate_neighbour_ordering(void* _voronoi_handle, int num_points, const do
|
|||
|
||||
void* voronoi_initialize_local()
|
||||
{
|
||||
voronoicell_neighbor* ptr = new voronoicell_neighbor;
|
||||
ptm_voro::voronoicell_neighbor* ptr = new ptm_voro::voronoicell_neighbor;
|
||||
return (void*)ptr;
|
||||
}
|
||||
|
||||
void voronoi_uninitialize_local(void* _ptr)
|
||||
{
|
||||
voronoicell_neighbor* ptr = (voronoicell_neighbor*)_ptr;
|
||||
ptm_voro::voronoicell_neighbor* ptr = (ptm_voro::voronoicell_neighbor*)_ptr;
|
||||
delete ptr;
|
||||
}
|
||||
|
||||
|
@ -201,3 +201,5 @@ int calculate_diamond_neighbour_ordering( int num_points, double (*unpermuted_po
|
|||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef PTM_NEIGHBOUR_ORDERING_H
|
||||
#define PTM_NEIGHBOUR_ORDERING_H
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int calculate_neighbour_ordering(void* voronoi_handle, int num_points, const double (*_points)[3], int8_t* ordering);
|
||||
|
||||
int calculate_diamond_neighbour_ordering( int num_points, double (*unpermuted_points)[3], int32_t* unpermuted_numbers,
|
||||
|
@ -9,5 +11,7 @@ int calculate_diamond_neighbour_ordering( int num_points, double (*unpermuted_po
|
|||
void* voronoi_initialize_local();
|
||||
void voronoi_uninitialize_local(void* ptr);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <cmath>
|
||||
|
||||
namespace ptm {
|
||||
|
||||
void subtract_barycentre(int num, double (*points)[3], double (*normalized)[3])
|
||||
{
|
||||
|
@ -53,3 +54,5 @@ double normalize_vertices(int num, double (*points)[3], double (*normalized)[3])
|
|||
return scale;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#ifndef PTM_NORMALIZE_VERTICES_H
|
||||
#define PTM_NORMALIZE_VERTICES_H
|
||||
|
||||
namespace ptm {
|
||||
|
||||
void subtract_barycentre(int num, double (*points)[3], double (*normalized)[3]);
|
||||
double normalize_vertices(int num, double (*points)[3], double (*normalized)[3]);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
#include "ptm_quat.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
static void matmul_3x3(double* A, double* x, double* b)
|
||||
{
|
||||
b[0] = A[0] * x[0] + A[1] * x[3] + A[2] * x[6];
|
||||
|
@ -335,3 +337,5 @@ int FastCalcRMSDAndRotation(double *A, double E0, double *p_nrmsdsq, double *q,
|
|||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,13 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int polar_decomposition_3x3(double* _A, bool right_sided, double* U, double* P);
|
||||
void InnerProduct(double *A, int num, const double (*coords1)[3], double (*coords2)[3], int8_t* permutation);
|
||||
int FastCalcRMSDAndRotation(double *A, double E0, double *p_nrmsdsq, double *q, double* U);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <cfloat>
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
#define SIGN(x) (x >= 0 ? 1 : -1)
|
||||
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
||||
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
|
||||
|
@ -394,3 +396,5 @@ double quat_disorientation_icosahedral(double* q0, double* q1)
|
|||
return acos(quat_quick_disorientation_icosahedral(q0, q1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef PTM_QUAT_H
|
||||
#define PTM_QUAT_H
|
||||
|
||||
namespace ptm {
|
||||
|
||||
int rotate_quaternion_into_cubic_fundamental_zone(double* q);
|
||||
int rotate_quaternion_into_diamond_cubic_fundamental_zone(double* q);
|
||||
int rotate_quaternion_into_icosahedral_fundamental_zone(double* q);
|
||||
|
@ -25,8 +27,7 @@ double quat_disorientation_diamond_hexagonal(double* q0, double* q1);
|
|||
double quat_quick_disorientation_icosahedral(double* q0, double* q1);
|
||||
double quat_disorientation_icosahedral(double* q0, double* q1);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "ptm_constants.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
static double calc_rmsd(int num_points, const double (*ideal_points)[3], double (*normalized)[3], int8_t* mapping,
|
||||
double G1, double G2, double E0, double* q, double* p_scale)
|
||||
{
|
||||
|
@ -292,3 +294,5 @@ int match_dcub_dhex(double (*ch_points)[3], double (*points)[3], int32_t flags,
|
|||
return PTM_NO_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include "ptm_initialize_data.h"
|
||||
#include "ptm_constants.h"
|
||||
|
||||
|
||||
namespace ptm {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double rmsd;
|
||||
|
@ -17,5 +20,7 @@ int match_general(const refdata_t* s, double (*ch_points)[3], double (*points)[3
|
|||
int match_fcc_hcp_ico(double (*ch_points)[3], double (*points)[3], int32_t flags, convexhull_t* ch, result_t* res);
|
||||
int match_dcub_dhex(double (*ch_points)[3], double (*points)[3], int32_t flags, convexhull_t* ch, result_t* res);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "ptm_voronoi_config.h"
|
||||
#include "ptm_voronoi_cell.h"
|
||||
|
||||
namespace voro {
|
||||
namespace ptm_voro {
|
||||
|
||||
inline void voro_fatal_error(const char *p,int status) {
|
||||
fprintf(stderr,"voro++: %s\n",p);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "ptm_voronoi_config.h"
|
||||
|
||||
namespace voro {
|
||||
namespace ptm_voro {
|
||||
|
||||
/** \brief A class representing a single Voronoi cell.
|
||||
*
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef PTM_VOROPP_CONFIG_HH
|
||||
#define PTM_VOROPP_CONFIG_HH
|
||||
|
||||
namespace voro {
|
||||
namespace ptm_voro {
|
||||
|
||||
// These constants set the initial memory allocation for the Voronoi cell
|
||||
/** The initial memory allocation for the number of vertices. */
|
||||
|
|
Loading…
Reference in New Issue