Skip to content
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

add biased voronoi cells feature #593

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
344d6de
add container_periodic_poly function
yuanzhou0827 Mar 6, 2020
6d85975
make header files consistently
yuanzhou0827 Mar 6, 2020
5969de0
revert to the original for testing
yuanzhou0827 Mar 6, 2020
618d3e1
only polydisperse
yuanzhou0827 Mar 7, 2020
40e899c
unsigned is not applied double or float.
yuanzhou0827 Mar 7, 2020
ef32aef
reduce the if_else loops
yuanzhou0827 Mar 7, 2020
e80cea0
default values can only be set in header file, and give the container…
yuanzhou0827 Mar 7, 2020
f5a8687
the way for a point to call a function is ->
yuanzhou0827 Mar 7, 2020
133ff92
use container_periodic_poly only
yuanzhou0827 Mar 8, 2020
fb13e75
add container_periodic_poly function
yuanzhou0827 Mar 6, 2020
c78a6c1
make header files consistently
yuanzhou0827 Mar 6, 2020
71feecd
revert to the original for testing
yuanzhou0827 Mar 6, 2020
9228ab4
only polydisperse
yuanzhou0827 Mar 7, 2020
a4b1323
unsigned is not applied double or float.
yuanzhou0827 Mar 7, 2020
db1a753
reduce the if_else loops
yuanzhou0827 Mar 7, 2020
3c9523b
default values can only be set in header file, and give the container…
yuanzhou0827 Mar 7, 2020
785f4e6
the way for a point to call a function is ->
yuanzhou0827 Mar 7, 2020
689665b
use container_periodic_poly only
yuanzhou0827 Mar 8, 2020
370158a
Intermediate commit with fixes
yuanzhou0827 Mar 12, 2020
98009ba
Merge branch 'bias_vor' of https://github.com/glotzerlab/freud into b…
yuanzhou0827 Mar 16, 2020
ab3f73f
resolve the variable type problem
yuanzhou0827 Mar 18, 2020
0ce8d91
wrap long lines
yuanzhou0827 Mar 18, 2020
cd65474
variable type
yuanzhou0827 Mar 18, 2020
f17ab2a
variable type correction
yuanzhou0827 Mar 19, 2020
d1de530
finalize the format
yuanzhou0827 Mar 19, 2020
56458a8
flake8 formatted
yuanzhou0827 Mar 19, 2020
376ff30
docstring added
yuanzhou0827 Mar 19, 2020
030d95f
Merge remote-tracking branch 'origin/master' into bias_vor
bdice Nov 6, 2020
e165531
Apply suggestions from code review
bdice Nov 6, 2020
75a6551
Apply suggestions from code review
bdice Nov 6, 2020
2fb9d47
Use nullptr.
bdice Nov 6, 2020
affde15
Update comments and clang-format.
bdice Nov 6, 2020
c1d032a
Merge branch 'master' into bias_vor
bdice Nov 21, 2021
ddf0e9e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 21, 2021
d4e5e6c
Merge branch 'master' into bias_vor
yuanzhou0827 Jan 27, 2022
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
Prev Previous commit
Next Next commit
use container_periodic_poly only
yuanzhou0827 committed Mar 12, 2020
commit 689665b249a5c47cbd08b86ec39f548841c29985
59 changes: 36 additions & 23 deletions cpp/locality/Voronoi.cc
Original file line number Diff line number Diff line change
@@ -40,38 +40,51 @@ void Voronoi::compute(const freud::locality::NeighborQuery* nq, const double* ra
// having to create a pre_container. This saves time because the
// pre_container cannot be used to set up container_periodic (only
// non-periodic containers are compatible).
// Also, we enable the weighted voronoi diagram if the weights of different
// points are provided; otherwise, the default is unbiased voronoi shapes
// calculations.
float block_scale = std::pow(n_points / (voro::optimal_particles * box.getVolume()), 1.0 / 3.0);
int voro_blocks_x = int(box.getLx() * block_scale + 1);
int voro_blocks_y = int(box.getLy() * block_scale + 1);
int voro_blocks_z = int(box.getLz() * block_scale + 1);

voro::container_periodic_base *container;

if (radii != NULL)
{
container = new voro::container_periodic_poly(boxLatticeVectors[0].x, boxLatticeVectors[1].x, boxLatticeVectors[1].y,
// voro::container_periodic_poly *container;
voro::container_periodic_poly container(boxLatticeVectors[0].x, boxLatticeVectors[1].x, boxLatticeVectors[1].y,
boxLatticeVectors[2].x, boxLatticeVectors[2].y, boxLatticeVectors[2].z,
voro_blocks_x, voro_blocks_y, voro_blocks_z, 3);
for (size_t query_point_id = 0; query_point_id < n_points; query_point_id++)
{
vec3<double> query_point((*nq)[query_point_id]);
container->put(query_point_id, query_point.x, query_point.y, query_point.z, radii[query_point_id]);
}
}
else
for (size_t query_point_id = 0; query_point_id < n_points; query_point_id++)
{
container = new voro::container_periodic(boxLatticeVectors[0].x, boxLatticeVectors[1].x, boxLatticeVectors[1].y,
boxLatticeVectors[2].x, boxLatticeVectors[2].y, boxLatticeVectors[2].z,
voro_blocks_x, voro_blocks_y, voro_blocks_z, 3);
for (size_t query_point_id = 0; query_point_id < n_points; query_point_id++)
{
vec3<double> query_point((*nq)[query_point_id]);
container->put(query_point_id, query_point.x, query_point.y, query_point.z);
vec3<double> query_point((*nq)[query_point_id]);
yuanzhou0827 marked this conversation as resolved.
Show resolved Hide resolved
double radius = (radii != NULL) ? radii[query_point_id] : 0.0;
yuanzhou0827 marked this conversation as resolved.
Show resolved Hide resolved
container.put(query_point_id, query_point.x, query_point.y, query_point.z, radius);
}
}

// if (radii != NULL)
// {
// container = new voro::container_periodic_poly(boxLatticeVectors[0].x, boxLatticeVectors[1].x, boxLatticeVectors[1].y,
// boxLatticeVectors[2].x, boxLatticeVectors[2].y, boxLatticeVectors[2].z,
// voro_blocks_x, voro_blocks_y, voro_blocks_z, 3);
// voro::container_periodic_poly* container_poly(dynamic_cast<voro::container_periodic_poly*>(container));
// for (size_t query_point_id = 0; query_point_id < n_points; query_point_id++)
// {
// vec3<double> query_point((*nq)[query_point_id]);
// container_poly->put(query_point_id, query_point.x, query_point.y, query_point.z, radii[query_point_id]);
// }
// }
// else
// {
// container = new voro::container_periodic(boxLatticeVectors[0].x, boxLatticeVectors[1].x, boxLatticeVectors[1].y,
// boxLatticeVectors[2].x, boxLatticeVectors[2].y, boxLatticeVectors[2].z,
// voro_blocks_x, voro_blocks_y, voro_blocks_z, 3);
// for (size_t query_point_id = 0; query_point_id < n_points; query_point_id++)
// {
// vec3<double> query_point((*nq)[query_point_id]);
// container->put(query_point_id, query_point.x, query_point.y, query_point.z);
// }
// }

voro::voronoicell_neighbor cell;
voro::c_loop_all_periodic voronoi_loop(*container);
voro::c_loop_all_periodic voronoi_loop(container);
std::vector<double> face_areas;
std::vector<int> face_vertices;
std::vector<int> neighbors;
@@ -83,7 +96,7 @@ void Voronoi::compute(const freud::locality::NeighborQuery* nq, const double* ra
{
do
{
container->compute_cell(cell, voronoi_loop);
container.compute_cell(cell, voronoi_loop);

// Get id and position of current particle
const int query_point_id(voronoi_loop.pid());
@@ -195,7 +208,7 @@ void Voronoi::compute(const freud::locality::NeighborQuery* nq, const double* ra
}
});

delete container;
// delete container;
}

}; }; // end namespace freud::locality