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

Virtual move Monte Carlo #1969

Draft
wants to merge 48 commits into
base: trunk-minor
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a9e1195
Python class for virtual cluster move updater
tcmoore3 Sep 10, 2024
198f109
Add virtual move updater class
tcmoore3 Sep 10, 2024
23b1375
Fix missing instruction error on mac for jit builds
tcmoore3 Sep 10, 2024
960b595
Add random number identifier
tcmoore3 Sep 10, 2024
dffcf96
Changes
tcmoore3 Sep 10, 2024
19830d6
More additions
tcmoore3 Sep 11, 2024
3ad099c
More changes
tcmoore3 Sep 11, 2024
ac59cfe
VMMC updater compiles
tcmoore3 Sep 12, 2024
c1a04d8
VMMC updater runs and does cluster moves
tcmoore3 Sep 12, 2024
f0f7a15
Skip to next seed when inactive particle selected
tcmoore3 Sep 25, 2024
e601b0c
Add vmmc counters
tcmoore3 Sep 26, 2024
de3225c
Add average cluster size and ficticious_beta
tcmoore3 Sep 30, 2024
b78383b
Start implementing rotation moves
tcmoore3 Oct 1, 2024
ccb2b0d
Seems to be working
tcmoore3 Oct 4, 2024
bd909a8
Fix some bugs found during stress testing: things seem right.
tcmoore3 Oct 7, 2024
508be04
Some cleanup
tcmoore3 Oct 8, 2024
5219167
Update counters
tcmoore3 Oct 14, 2024
2db0293
Make beta_ficticious a variant
tcmoore3 Oct 14, 2024
73b70ce
More counter updates
tcmoore3 Oct 14, 2024
0868941
Reduce allocations for temporary data containers and update python file
tcmoore3 Oct 14, 2024
bce2d14
Rename LinkerData to ClusterData
tcmoore3 Oct 14, 2024
e6ad05a
Add limits to the sizes of clusters that can be moved.
tcmoore3 Oct 14, 2024
28f3f41
Fix calculation of q_ij_forward
tcmoore3 Oct 14, 2024
a30777c
Update python class
tcmoore3 Oct 14, 2024
22111a5
Fix bug in rotation moves
tcmoore3 Oct 16, 2024
3e97fc3
Add stuff for selectively rebuilding the AABB tree
tcmoore3 Oct 18, 2024
697fd88
Check that linker is active now and after virtual move
tcmoore3 Oct 18, 2024
e268c6d
Try commenting out some stuff to fix error in mpi
tcmoore3 Oct 19, 2024
3b7c2ee
Add option to rebuild AABBTree when needed
tcmoore3 Oct 21, 2024
1eeedf9
Add static_linking_mode
tcmoore3 Oct 21, 2024
5e0fc96
Use the instance ID
tcmoore3 Oct 21, 2024
1f69356
Add option to draw a random beta_ficticious
tcmoore3 Nov 5, 2024
bc58b64
Rename a variable
tcmoore3 Nov 5, 2024
3d8694d
Always invalidate AABBTree at the end of update()
tcmoore3 Nov 5, 2024
80382e1
Enable virtual cluster moves for spheropolyhedra
tcmoore3 Nov 5, 2024
d052302
Enable virtual cluster moves for sphere unions
tcmoore3 Nov 5, 2024
5403695
Merge remote-tracking branch 'origin/trunk-minor' into feature-virtua…
tcmoore3 Dec 12, 2024
710ebcf
Update VMMC for v5 compatibility
tcmoore3 Dec 12, 2024
b593fc7
Update python documentation for vmmc updater
tcmoore3 Dec 13, 2024
4fe5cd1
Update docs and remove some experimental vmmc features
tcmoore3 Dec 16, 2024
ff3733e
Update virtual move counters and loggables
tcmoore3 Dec 16, 2024
5115443
Remove beta_ficticious from python constructor
tcmoore3 Dec 16, 2024
e4fb81a
Run clang-format
tcmoore3 Dec 16, 2024
925eeca
Scope the use of array handles for position and orientation
tcmoore3 Dec 16, 2024
81d4c47
Add buffer for when to rebuild aabbtree and remove always_build_tree …
tcmoore3 Dec 18, 2024
804db1b
Move buildAABBTree call from top of seed loop and scope array handles
tcmoore3 Dec 18, 2024
b1100d2
Fix logging category
tcmoore3 Dec 18, 2024
33c16cf
Do not wrap particles until rebuilding the tree
tcmoore3 Dec 18, 2024
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 hoomd/HOOMDMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ inline HOSTDEVICE void sincos(float x, float& s, float& c)
}

//! Compute both of sin of x and cos of x with double precision
#ifndef HOOMD_LLVMJIT_BUILD
inline HOSTDEVICE void sincos(double x, double& s, double& c)
{
#if defined(__HIP_DEVICE_COMPILE__)
Expand Down Expand Up @@ -330,6 +331,7 @@ inline HOSTDEVICE void sincospi(double x, double& s, double& c)
fast::sincos(M_PI * x, s, c);
#endif
}
#endif

//! Compute the pow of x,y with single precison via exp(log) refactoring - NOTE: UNDEFINED FOR
//! NEGATIVE BASES
Expand Down
1 change: 1 addition & 0 deletions hoomd/RNGIdentifiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct RNGIdentifier
static const uint8_t BussiThermostat = 45;
static const uint8_t ConstantPressure = 46;
static const uint8_t MPCDCellList = 47;
static const uint8_t UpdaterVMMC=48;
};

} // namespace hoomd
1 change: 1 addition & 0 deletions hoomd/hpmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ set(_hpmc_headers
UpdaterMuVT.h
UpdaterQuickCompress.h
UpdaterShape.h
UpdaterVirtualMoveMonteCarlo.h
XenoCollide2D.h
XenoCollide3D.h
XenoSweep3D.h
Expand Down
123 changes: 123 additions & 0 deletions hoomd/hpmc/HPMCCounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,129 @@ struct hpmc_clusters_counters_t
}
};

struct hpmc_virtual_moves_counters_t
{
unsigned long long int num_aabbtree_builds;

unsigned long long int translate_accept_count;
unsigned long long int translate_reject_count;
unsigned long long int translate_total_num_particles_in_moved_clusters;
unsigned long long int translate_reject_inactive_region;
unsigned long long int translate_reject_oversized_cluster;
unsigned long long int translate_reject_p_reverse_link_zero;
unsigned long long int translate_reject_q_reverse_link_zero;

unsigned long long int rotate_accept_count;
unsigned long long int rotate_reject_count;
unsigned long long int rotate_total_num_particles_in_moved_clusters;
unsigned long long int rotate_reject_inactive_region;
unsigned long long int rotate_reject_oversized_cluster;
unsigned long long int rotate_reject_p_reverse_link_zero;
unsigned long long int rotate_reject_q_reverse_link_zero;

//! Construct a zero set of counters
DEVICE hpmc_virtual_moves_counters_t()
{
num_aabbtree_builds = 0;

translate_accept_count = 0;
translate_reject_count = 0;
translate_total_num_particles_in_moved_clusters = 0;
translate_reject_inactive_region = 0;
translate_reject_oversized_cluster = 0;
translate_reject_p_reverse_link_zero = 0;
translate_reject_q_reverse_link_zero = 0;

rotate_accept_count = 0;
rotate_reject_count = 0;
rotate_total_num_particles_in_moved_clusters = 0;
rotate_reject_inactive_region = 0;
rotate_reject_oversized_cluster = 0;
rotate_reject_p_reverse_link_zero = 0;
rotate_reject_q_reverse_link_zero = 0;
}

std::pair<unsigned long long int, unsigned long long int> getTranslateCounts()
{
return std::make_pair(translate_accept_count, translate_reject_count);
}

std::pair<unsigned long long int, unsigned long long int> getRotateCounts()
{
return std::make_pair(rotate_accept_count, translate_reject_count);
}

std::array<unsigned long long int, 4> getRotateRejectCounts()
{
std::array<unsigned long long int, 4> counts = {rotate_reject_inactive_region,
rotate_reject_oversized_cluster,
rotate_reject_p_reverse_link_zero,
rotate_reject_q_reverse_link_zero};
return counts;
}

std::array<unsigned long long int, 4> getTranslateRejectCounts()
{
std::array<unsigned long long int, 4> counts = {translate_reject_inactive_region,
translate_reject_oversized_cluster,
translate_reject_p_reverse_link_zero,
translate_reject_q_reverse_link_zero};
return counts;
}

DEVICE unsigned long long int getTotalNumParticlesInClustersRotate()
{
return rotate_total_num_particles_in_moved_clusters;
}

DEVICE unsigned long long int getTotalNumParticlesInClustersTranslate()
{
return translate_total_num_particles_in_moved_clusters;
}

DEVICE unsigned long long int getNumAABBTreeBuilds()
{
return num_aabbtree_builds;
}
};

DEVICE inline hpmc_virtual_moves_counters_t operator-(const hpmc_virtual_moves_counters_t& a,
hpmc_virtual_moves_counters_t& b)
{
hpmc_virtual_moves_counters_t result;
result.num_aabbtree_builds = a.num_aabbtree_builds - b.num_aabbtree_builds;

result.rotate_accept_count = a.rotate_accept_count - b.rotate_accept_count;
result.rotate_reject_count = a.rotate_reject_count - b.rotate_reject_count;
result.rotate_total_num_particles_in_moved_clusters
= a.rotate_total_num_particles_in_moved_clusters
+ b.rotate_total_num_particles_in_moved_clusters;
result.rotate_reject_inactive_region
= a.rotate_reject_inactive_region + b.rotate_reject_inactive_region;
result.rotate_reject_oversized_cluster
= a.rotate_reject_oversized_cluster + b.rotate_reject_oversized_cluster;
result.rotate_reject_p_reverse_link_zero
= a.rotate_reject_p_reverse_link_zero + b.rotate_reject_p_reverse_link_zero;
result.rotate_reject_q_reverse_link_zero
= a.rotate_reject_q_reverse_link_zero + b.rotate_reject_q_reverse_link_zero;

result.translate_accept_count = a.translate_accept_count - b.translate_accept_count;
result.translate_reject_count = a.translate_reject_count - b.translate_reject_count;
result.translate_total_num_particles_in_moved_clusters
= a.translate_total_num_particles_in_moved_clusters
+ b.translate_total_num_particles_in_moved_clusters;
result.translate_reject_inactive_region
= a.translate_reject_inactive_region + b.translate_reject_inactive_region;
result.translate_reject_oversized_cluster
= a.translate_reject_oversized_cluster + b.translate_reject_oversized_cluster;
result.translate_reject_p_reverse_link_zero
= a.translate_reject_p_reverse_link_zero + b.translate_reject_p_reverse_link_zero;
result.translate_reject_q_reverse_link_zero
= a.translate_reject_q_reverse_link_zero + b.translate_reject_q_reverse_link_zero;

return result;
}

DEVICE inline hpmc_muvt_counters_t operator-(const hpmc_muvt_counters_t& a,
const hpmc_muvt_counters_t& b)
{
Expand Down
6 changes: 6 additions & 0 deletions hoomd/hpmc/IntegratorHPMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ class PYBIND11_EXPORT IntegratorHPMC : public Integrator
return m_pair_energy_search_radius;
}

Scalar getNominalWidth()
{
return m_nominal_width;
}


protected:
unsigned int m_translation_move_probability; //!< Fraction of moves that are translation moves.
unsigned int m_nselect; //!< Number of particles to select for trial moves
Expand Down
11 changes: 9 additions & 2 deletions hoomd/hpmc/IntegratorHPMCMono.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ template<class Shape> class IntegratorHPMCMono : public IntegratorHPMC
std::shared_ptr<PairPotential> selected_pair = nullptr);

//! Build the AABB tree (if needed)
const hoomd::detail::AABBTree& buildAABBTree();
hoomd::detail::AABBTree& buildAABBTree();

//! Make list of image indices for boxes to check in small-box mode
const std::vector<vec3<Scalar>>& updateImageList();
Expand Down Expand Up @@ -328,6 +328,11 @@ template<class Shape> class IntegratorHPMCMono : public IntegratorHPMC
return type_shapes;
}

std::vector<LongReal> getShapeCircumsphereRadius()
{
return m_shape_circumsphere_radius;
}

protected:
std::vector<param_type, hoomd::detail::managed_allocator<param_type>>
m_params; //!< Parameters for each particle type on GPU
Expand Down Expand Up @@ -847,6 +852,7 @@ template<class Shape> void IntegratorHPMCMono<Shape>::update(uint64_t timestep)
} // end loop over all particles
} // end loop over nselect


{
ArrayHandle<Scalar4> h_postype(m_pdata->getPositions(),
access_location::host,
Expand Down Expand Up @@ -1591,7 +1597,8 @@ template<class Shape> void IntegratorHPMCMono<Shape>::growAABBList(unsigned int

\returns A reference to the tree.
*/
template<class Shape> const hoomd::detail::AABBTree& IntegratorHPMCMono<Shape>::buildAABBTree()
template <class Shape>
hoomd::detail::AABBTree& IntegratorHPMCMono<Shape>::buildAABBTree()
{
if (m_aabb_tree_invalid)
{
Expand Down
Loading
Loading