Skip to main content

hoomd_microstate/boundary/
open.rs

1// Copyright (c) 2024-2026 The Regents of the University of Michigan.
2// Part of hoomd-rs, released under the BSD 3-Clause License.
3
4//! Implement Open
5
6use arrayvec::ArrayVec;
7use serde::{Deserialize, Serialize};
8
9use super::{Error, GenerateGhosts, MAX_GHOSTS, Wrap};
10
11/// Allow bodies and sites to exist anywhere in space.
12///
13/// Every point lies inside `Open` boundary conditions, bodies and sites
14/// are never wrapped, and there are no ghost sites.
15#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Open;
17
18impl<P> Wrap<P> for Open {
19    #[inline]
20    fn wrap(&self, properties: P) -> Result<P, Error> {
21        Ok(properties)
22    }
23}
24
25impl<S> GenerateGhosts<S> for Open
26where
27    S: Default,
28{
29    #[inline]
30    fn maximum_interaction_range(&self) -> f64 {
31        f64::INFINITY
32    }
33
34    #[inline]
35    fn generate_ghosts(&self, _site_properties: &S) -> ArrayVec<S, MAX_GHOSTS> {
36        ArrayVec::new()
37    }
38}