From b97a34a6427cb09d9f6a6f2d9f72a1baf657694c Mon Sep 17 00:00:00 2001 From: Myeongseon Choi Date: Sun, 24 Nov 2024 01:15:42 +0900 Subject: [PATCH 1/2] impl testBonds in TestHarmonicBondForce.h --- Cargo.toml | 2 + src/context.rs | 20 +++ src/force/harmonic_angle_force.rs | 18 +++ src/force/harmonic_bond_force.rs | 78 ++++++++++ src/force/mod.rs | 15 ++ src/integrator/mod.rs | 6 + src/lib.rs | 234 +----------------------------- src/platform/mod.rs | 7 + src/state.rs | 23 +++ src/system.rs | 185 +++++++++++++++++++++++ src/virtual_site.rs | 17 +++ 11 files changed, 378 insertions(+), 227 deletions(-) create mode 100644 src/context.rs create mode 100644 src/force/harmonic_angle_force.rs create mode 100644 src/force/harmonic_bond_force.rs create mode 100644 src/force/mod.rs create mode 100644 src/integrator/mod.rs create mode 100644 src/platform/mod.rs create mode 100644 src/state.rs create mode 100644 src/system.rs create mode 100644 src/virtual_site.rs diff --git a/Cargo.toml b/Cargo.toml index bcc67e0..f965645 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +nalgebra = "0.33.2" +approx = "0.5" \ No newline at end of file diff --git a/src/context.rs b/src/context.rs new file mode 100644 index 0000000..94252bd --- /dev/null +++ b/src/context.rs @@ -0,0 +1,20 @@ +use crate::integrator::Integrator; +use crate::platform::Platform; +use crate::state::{State, StateType}; +use crate::system::System; +use nalgebra::Vector3; + +pub struct Context { + pub system: System, + pub integrator: Box, + pub platform: Box, +} +impl Context { + pub fn set_positions(&mut self, positions: Vec>) { + unimplemented!() + } + + pub fn get_state(&self, state_type: StateType) -> State { + unimplemented!() + } +} diff --git a/src/force/harmonic_angle_force.rs b/src/force/harmonic_angle_force.rs new file mode 100644 index 0000000..170ae70 --- /dev/null +++ b/src/force/harmonic_angle_force.rs @@ -0,0 +1,18 @@ +use crate::context::Context; +use crate::force::Force; + +#[derive(Debug, Clone, PartialEq)] +pub struct HarmonicAngleForce {} +impl Force for HarmonicAngleForce { + fn add_bond(&mut self, particle1: usize, particle2: usize, length: f64, k: f64) { + unimplemented!() + } + + fn set_bond_parameters(&mut self, particle1: usize, particle2: usize, length: f64, k: f64) { + unimplemented!() + } + + fn update_parameters_in_context(&mut self, context: &mut Context) { + unimplemented!() + } +} diff --git a/src/force/harmonic_bond_force.rs b/src/force/harmonic_bond_force.rs new file mode 100644 index 0000000..8a67eb9 --- /dev/null +++ b/src/force/harmonic_bond_force.rs @@ -0,0 +1,78 @@ +use crate::context::Context; +use crate::force::Force; + +#[derive(Debug, Clone, PartialEq)] +pub struct HarmonicBondForce {} +impl Force for HarmonicBondForce { + fn add_bond(&mut self, particle1: usize, particle2: usize, length: f64, k: f64) { + unimplemented!() + } + + fn set_bond_parameters(&mut self, particle1: usize, particle2: usize, length: f64, k: f64) { + unimplemented!() + } + + fn update_parameters_in_context(&mut self, context: &mut Context) { + unimplemented!() + } +} + +#[cfg(test)] +mod test { + use super::HarmonicBondForce; + use crate::context::Context; + use crate::force::Force; + use crate::integrator::VerletIntegrator; + use crate::platform::CPU; + use crate::state::{State, StateType}; + use crate::system::System; + use approx::assert_relative_eq; + use nalgebra::Vector3; + #[test] + fn test_harmonic_bond_force() { + let mut system = System {}; + system.add_particle(1.0); + system.add_particle(1.0); + system.add_particle(1.0); + let integrator = VerletIntegrator { dt: 0.01 }; + + let mut forcefield = HarmonicBondForce {}; + forcefield.add_bond(0, 1, 1.5, 0.8); + forcefield.add_bond(1, 2, 1.2, 0.7); + + system.add_force(Box::new(forcefield)); + + let mut context = Context { + system, + integrator: Box::new(integrator), + platform: Box::new(CPU), + }; + let mut positions = vec![Vector3::zeros(); 3]; + positions[0] = Vector3::new(0.0, 2.0, 0.0); + positions[1] = Vector3::new(0.0, 0.0, 0.0); + positions[2] = Vector3::new(1.0, 0.0, 0.0); + context.set_positions(positions); + + let state = context.get_state(StateType::Both); + let forces = state.get_forces(); + assert_relative_eq!(forces[0], Vector3::new(0.0, -0.8 * 0.5, 0.0)); + assert_relative_eq!(forces[2], Vector3::new(0.7 * 0.2, 0.0, 0.0)); + assert_relative_eq!(forces[1], -forces[0] - forces[2]); + + let energy = state.get_potential_energy(); + assert_relative_eq!(energy, 0.5 * 0.8 * 0.5 * 0.5 + 0.5 * 0.7 * 0.2 * 0.2); + + forcefield.set_bond_parameters(0, 0, 1.6, 0.9); + forcefield.set_bond_parameters(1, 1, 1.3, 0.8); + forcefield.update_parameters_in_context(&mut context); + + let state = context.get_state(StateType::Both); + let forces = state.get_forces(); + assert_relative_eq!(forces[0], Vector3::new(0.0, -0.9 * 0.4, 0.0)); + assert_relative_eq!(forces[2], Vector3::new(0.8 * 0.3, 0.0, 0.0)); + assert_relative_eq!(forces[1], -forces[0] - forces[2]); + + let energy = state.get_potential_energy(); + assert_relative_eq!(energy, 0.5 * 0.9 * 0.4 * 0.4 + 0.5 * 0.8 * 0.3 * 0.3); + } +} diff --git a/src/force/mod.rs b/src/force/mod.rs new file mode 100644 index 0000000..b13429c --- /dev/null +++ b/src/force/mod.rs @@ -0,0 +1,15 @@ +use std::fmt::Debug; + +use crate::context::Context; + +pub trait Force: Debug { + fn add_bond(&mut self, particle1: usize, particle2: usize, length: f64, k: f64); + fn set_bond_parameters(&mut self, particle1: usize, particle2: usize, length: f64, k: f64); + fn update_parameters_in_context(&mut self, context: &mut Context); +} + +pub mod harmonic_angle_force; +pub use harmonic_angle_force::HarmonicAngleForce; + +pub mod harmonic_bond_force; +pub use harmonic_bond_force::HarmonicBondForce; diff --git a/src/integrator/mod.rs b/src/integrator/mod.rs new file mode 100644 index 0000000..d36fbe6 --- /dev/null +++ b/src/integrator/mod.rs @@ -0,0 +1,6 @@ +pub trait Integrator {} + +pub struct VerletIntegrator { + pub dt: f64, +} +impl Integrator for VerletIntegrator {} diff --git a/src/lib.rs b/src/lib.rs index 61b0bcf..804a3a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,228 +1,8 @@ -pub mod system { - use crate::force::Force; - use crate::virtual_site::VirtualSite; +pub mod context; +pub mod force; +pub mod platform; +pub mod state; +pub mod system; - pub struct System {} - impl System { - pub fn add_particle(&mut self, _mass: f32) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_num_particles(&self) -> usize { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_particle_mass(&self, _index: usize) -> f32 { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn set_particle_mass(&mut self, _index: usize, _mass: f32) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn is_virtual_site(&self, _index: usize) -> bool { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_virtual_site(&self, _index: usize) -> Option> { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn set_virtual_site(&mut self, _index: usize, _vsite: Option>) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn add_constraint(&mut self, _p1: usize, _p2: usize, _dist: f32) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn remove_constraint(&mut self, _index: usize) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_num_constraints(&self) -> usize { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_constraint_parameters(&self, _index: usize) -> (usize, usize, f32) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn set_constraint_parameters( - &mut self, - _index: usize, - _p1: usize, - _p2: usize, - _dist: f32, - ) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn add_force(&mut self, _force: Box) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn remove_force(&mut self, _index: usize) { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_num_forces(&self) -> usize { - // Todo: Rust-OpenMM - unimplemented!() - } - - pub fn get_force(&self, _index: usize) -> Box { - // Todo: Rust-OpenMM - unimplemented!() - } - } -} - -pub mod force { - use std::fmt::Debug; - - pub trait Force: Debug {} - - #[derive(Debug, Clone, PartialEq)] - pub struct HarmonicAngleForce {} - impl Force for HarmonicAngleForce {} - - #[derive(Debug, Clone, PartialEq)] - pub struct HarmonicBondForce {} - impl Force for HarmonicBondForce {} -} - -pub mod virtual_site { - use std::fmt::Debug; - - pub trait VirtualSite: Debug {} - - #[derive(Debug, Clone, PartialEq)] - pub struct TwoParticleAverageSite { - pub p1: usize, - pub p2: usize, - pub weight1: f32, - pub weight2: f32, - } - impl TwoParticleAverageSite { - pub fn new(_p1: usize, _p2: usize, _weight1: f32, _weight2: f32) -> Self { - unimplemented!() - } - } - impl VirtualSite for TwoParticleAverageSite {} -} - -#[cfg(test)] -mod test { - use crate::force::{HarmonicAngleForce, HarmonicBondForce}; - use crate::system::System; - use crate::virtual_site::TwoParticleAverageSite; - - // Todo: Rust-OpenMM - #[ignore] - #[test] - fn test_system_particles() { - let num_particles = 10; - let mut system = System {}; - - for i in 0..num_particles { - system.add_particle(1.0 + 0.1 * i as f32); - } - system.set_particle_mass(5, 100.0); - assert_eq!(system.get_num_particles(), num_particles); - - for i in 0..num_particles { - let expected_mass = if i == 5 { 100.0 } else { 1.0 + 0.1 * i as f32 }; - assert_eq!(system.get_particle_mass(i), expected_mass); - } - } - - // Todo: Rust-OpenMM - #[ignore] - #[test] - fn test_system_constraints() { - let num_particles = 10; - let mut system = System {}; - - for i in 0..num_particles - 1 { - system.add_constraint(i, i + 1, 0.2 * i as f32); - } - system.remove_constraint(5); - system.set_constraint_parameters(3, 0, 5, 99.0); - assert_eq!(system.get_num_constraints(), num_particles - 2); - - for i in 0..num_particles - 2 { - let (p1, p2, dist) = system.get_constraint_parameters(i); - if i == 3 { - assert_eq!(p1, 0); - assert_eq!(p2, 5); - assert_eq!(dist, 99.0); - } else { - let j = if i < 5 { i } else { i + 1 }; - assert_eq!(p1, j); - assert_eq!(p2, j + 1); - assert_eq!(dist, 0.2 * j as f32); - } - } - } - - // Todo: Rust-OpenMM - #[ignore] - #[test] - fn test_system_force() { - let mut system = System {}; - let bonds = HarmonicBondForce {}; - system.add_force(Box::new(bonds)); - - let angles = HarmonicAngleForce {}; - system.add_force(Box::new(angles)); - - assert_eq!(system.get_num_forces(), 2); - // Todo: Rust-OpenMM - // assert_eq!(system.get_force(0), Box::new(bonds)); - // assert_eq!(system.get_force(1), Box::new(angles)); - - system.remove_force(0); - assert_eq!(system.get_num_forces(), 1); - // Todo: Rust-OpenMM - // assert_eq!(system.get_force(0), Box::new(angles)); - } - - // Todo: Rust-OpenMM - #[ignore] - #[test] - fn test_system_virtual_site() { - let mut system = System {}; - let num_particles = 10; - for i in 0..num_particles { - system.add_particle(1.0); - assert!(!system.is_virtual_site(i)); - } - - let vsite = TwoParticleAverageSite::new(2, 3, 0.4, 0.6); - system.set_virtual_site(4, Some(Box::new(vsite))); - for i in 0..num_particles { - assert_eq!(system.is_virtual_site(i), i == 4); - } - // Todo: Rust-OpenMM - // assert_eq!(system.get_virtual_site(4), Some(Box::new(vsite))); - system.set_virtual_site(4, None); - for i in 0..num_particles { - assert!(!system.is_virtual_site(i)); - } - } -} +pub mod integrator; +pub mod virtual_site; diff --git a/src/platform/mod.rs b/src/platform/mod.rs new file mode 100644 index 0000000..09656db --- /dev/null +++ b/src/platform/mod.rs @@ -0,0 +1,7 @@ +pub trait Platform {} + +pub struct CPU; +pub struct OpenCL; + +impl Platform for CPU {} +impl Platform for OpenCL {} diff --git a/src/state.rs b/src/state.rs new file mode 100644 index 0000000..1fc8cca --- /dev/null +++ b/src/state.rs @@ -0,0 +1,23 @@ +use nalgebra::Vector3; + +pub enum StateType { + Both, + Forces, + Energy, +} + +pub struct State { + pub state_type: StateType, + pub forces: Vec>, + pub energy: f32, +} + +impl State { + pub fn get_forces(&self) -> &Vec> { + &self.forces + } + + pub fn get_potential_energy(&self) -> f32 { + self.energy + } +} diff --git a/src/system.rs b/src/system.rs new file mode 100644 index 0000000..bcecee1 --- /dev/null +++ b/src/system.rs @@ -0,0 +1,185 @@ +use crate::force::Force; +use crate::virtual_site::VirtualSite; + +pub struct System {} +impl System { + pub fn add_particle(&mut self, _mass: f32) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_num_particles(&self) -> usize { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_particle_mass(&self, _index: usize) -> f32 { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn set_particle_mass(&mut self, _index: usize, _mass: f32) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn is_virtual_site(&self, _index: usize) -> bool { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_virtual_site(&self, _index: usize) -> Option> { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn set_virtual_site(&mut self, _index: usize, _vsite: Option>) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn add_constraint(&mut self, _p1: usize, _p2: usize, _dist: f32) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn remove_constraint(&mut self, _index: usize) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_num_constraints(&self) -> usize { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_constraint_parameters(&self, _index: usize) -> (usize, usize, f32) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn set_constraint_parameters(&mut self, _index: usize, _p1: usize, _p2: usize, _dist: f32) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn add_force(&mut self, _force: Box) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn remove_force(&mut self, _index: usize) { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_num_forces(&self) -> usize { + // Todo: Rust-OpenMM + unimplemented!() + } + + pub fn get_force(&self, _index: usize) -> Box { + // Todo: Rust-OpenMM + unimplemented!() + } +} +#[cfg(test)] +mod test { + use crate::force::{HarmonicAngleForce, HarmonicBondForce}; + use crate::system::System; + use crate::virtual_site::TwoParticleAverageSite; + + // Todo: Rust-OpenMM + #[ignore] + #[test] + fn test_system_particles() { + let num_particles = 10; + let mut system = System {}; + + for i in 0..num_particles { + system.add_particle(1.0 + 0.1 * i as f32); + } + system.set_particle_mass(5, 100.0); + assert_eq!(system.get_num_particles(), num_particles); + + for i in 0..num_particles { + let expected_mass = if i == 5 { 100.0 } else { 1.0 + 0.1 * i as f32 }; + assert_eq!(system.get_particle_mass(i), expected_mass); + } + } + + // Todo: Rust-OpenMM + #[ignore] + #[test] + fn test_system_constraints() { + let num_particles = 10; + let mut system = System {}; + + for i in 0..num_particles - 1 { + system.add_constraint(i, i + 1, 0.2 * i as f32); + } + system.remove_constraint(5); + system.set_constraint_parameters(3, 0, 5, 99.0); + assert_eq!(system.get_num_constraints(), num_particles - 2); + + for i in 0..num_particles - 2 { + let (p1, p2, dist) = system.get_constraint_parameters(i); + if i == 3 { + assert_eq!(p1, 0); + assert_eq!(p2, 5); + assert_eq!(dist, 99.0); + } else { + let j = if i < 5 { i } else { i + 1 }; + assert_eq!(p1, j); + assert_eq!(p2, j + 1); + assert_eq!(dist, 0.2 * j as f32); + } + } + } + + // Todo: Rust-OpenMM + #[ignore] + #[test] + fn test_system_force() { + let mut system = System {}; + let bonds = HarmonicBondForce {}; + system.add_force(Box::new(bonds)); + + let angles = HarmonicAngleForce {}; + system.add_force(Box::new(angles)); + + assert_eq!(system.get_num_forces(), 2); + // Todo: Rust-OpenMM + // assert_eq!(system.get_force(0), Box::new(bonds)); + // assert_eq!(system.get_force(1), Box::new(angles)); + + system.remove_force(0); + assert_eq!(system.get_num_forces(), 1); + // Todo: Rust-OpenMM + // assert_eq!(system.get_force(0), Box::new(angles)); + } + + // Todo: Rust-OpenMM + #[ignore] + #[test] + fn test_system_virtual_site() { + let mut system = System {}; + let num_particles = 10; + for i in 0..num_particles { + system.add_particle(1.0); + assert!(!system.is_virtual_site(i)); + } + + let vsite = TwoParticleAverageSite::new(2, 3, 0.4, 0.6); + system.set_virtual_site(4, Some(Box::new(vsite))); + for i in 0..num_particles { + assert_eq!(system.is_virtual_site(i), i == 4); + } + // Todo: Rust-OpenMM + // assert_eq!(system.get_virtual_site(4), Some(Box::new(vsite))); + system.set_virtual_site(4, None); + for i in 0..num_particles { + assert!(!system.is_virtual_site(i)); + } + } +} diff --git a/src/virtual_site.rs b/src/virtual_site.rs new file mode 100644 index 0000000..8738cf6 --- /dev/null +++ b/src/virtual_site.rs @@ -0,0 +1,17 @@ +use std::fmt::Debug; + +pub trait VirtualSite: Debug {} + +#[derive(Debug, Clone, PartialEq)] +pub struct TwoParticleAverageSite { + pub p1: usize, + pub p2: usize, + pub weight1: f32, + pub weight2: f32, +} +impl TwoParticleAverageSite { + pub fn new(_p1: usize, _p2: usize, _weight1: f32, _weight2: f32) -> Self { + unimplemented!() + } +} +impl VirtualSite for TwoParticleAverageSite {} -- 2.49.1 From b28e6a033e5e8af48c80fe875e2d0a685c60a455 Mon Sep 17 00:00:00 2001 From: Myeongseon Choi Date: Mon, 25 Nov 2024 10:22:08 +0900 Subject: [PATCH 2/2] finish implement harmonic bond force tests --- src/force/harmonic_angle_force.rs | 4 +++ src/force/harmonic_bond_force.rs | 51 ++++++++++++++++++++++++++++++- src/force/mod.rs | 1 + src/system.rs | 12 +++++++- 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/force/harmonic_angle_force.rs b/src/force/harmonic_angle_force.rs index 170ae70..f27bf74 100644 --- a/src/force/harmonic_angle_force.rs +++ b/src/force/harmonic_angle_force.rs @@ -15,4 +15,8 @@ impl Force for HarmonicAngleForce { fn update_parameters_in_context(&mut self, context: &mut Context) { unimplemented!() } + + fn set_uses_periodic_boundary_conditions(&mut self, status: bool) { + unimplemented!() + } } diff --git a/src/force/harmonic_bond_force.rs b/src/force/harmonic_bond_force.rs index 8a67eb9..82116a1 100644 --- a/src/force/harmonic_bond_force.rs +++ b/src/force/harmonic_bond_force.rs @@ -15,6 +15,10 @@ impl Force for HarmonicBondForce { fn update_parameters_in_context(&mut self, context: &mut Context) { unimplemented!() } + + fn set_uses_periodic_boundary_conditions(&mut self, status: bool) { + unimplemented!() + } } #[cfg(test)] @@ -28,6 +32,7 @@ mod test { use crate::system::System; use approx::assert_relative_eq; use nalgebra::Vector3; + #[test] fn test_harmonic_bond_force() { let mut system = System {}; @@ -40,7 +45,7 @@ mod test { forcefield.add_bond(0, 1, 1.5, 0.8); forcefield.add_bond(1, 2, 1.2, 0.7); - system.add_force(Box::new(forcefield)); + system.add_force(Box::new(forcefield.clone())); let mut context = Context { system, @@ -75,4 +80,48 @@ mod test { let energy = state.get_potential_energy(); assert_relative_eq!(energy, 0.5 * 0.9 * 0.4 * 0.4 + 0.5 * 0.8 * 0.3 * 0.3); } + + #[test] + fn test_harmonic_bond_force_with_periodic_boundary_conditions() { + let mut system = System {}; + system.add_particle(1.0); + system.add_particle(1.0); + system.set_default_periodic_box_vectors( + Vector3::new(3.0, 0.0, 0.0), + Vector3::new(0.0, 3.0, 0.0), + Vector3::new(0.0, 0.0, 3.0), + ); + + let integrator = VerletIntegrator { dt: 0.01 }; + let mut forcefield = HarmonicBondForce {}; + forcefield.add_bond(0, 1, 1.2, 0.8); + forcefield.set_uses_periodic_boundary_conditions(true); + + system.add_force(Box::new(forcefield)); + + let mut context = Context { + system, + integrator: Box::new(integrator), + platform: Box::new(CPU), + }; + + let mut positions = vec![Vector3::zeros(); 2]; + positions[0] = Vector3::new(0.0, 2.0, 0.0); + positions[1] = Vector3::new(0.0, 0.0, 0.0); + context.set_positions(positions); + + let state = context.get_state(StateType::Both); + let forces = state.get_forces(); + assert_relative_eq!(forces[0], Vector3::new(0.0, -0.8 * 0.2, 0.0)); + assert_relative_eq!(forces[1], Vector3::new(0.0, 0.8 * 0.2, 0.0)); + + let energy = state.get_potential_energy(); + assert_relative_eq!(energy, 0.5 * 0.8 * 0.2 * 0.2); + } + + #[test] + fn test_harmonic_bond_force_parallel_computation() { + // TODO: Rust-OpenMM + unimplemented!() + } } diff --git a/src/force/mod.rs b/src/force/mod.rs index b13429c..9121a1f 100644 --- a/src/force/mod.rs +++ b/src/force/mod.rs @@ -6,6 +6,7 @@ pub trait Force: Debug { fn add_bond(&mut self, particle1: usize, particle2: usize, length: f64, k: f64); fn set_bond_parameters(&mut self, particle1: usize, particle2: usize, length: f64, k: f64); fn update_parameters_in_context(&mut self, context: &mut Context); + fn set_uses_periodic_boundary_conditions(&mut self, status: bool); } pub mod harmonic_angle_force; diff --git a/src/system.rs b/src/system.rs index bcecee1..19448b9 100644 --- a/src/system.rs +++ b/src/system.rs @@ -1,6 +1,6 @@ use crate::force::Force; use crate::virtual_site::VirtualSite; - +use nalgebra::Vector3; pub struct System {} impl System { pub fn add_particle(&mut self, _mass: f32) { @@ -82,6 +82,16 @@ impl System { // Todo: Rust-OpenMM unimplemented!() } + + pub fn set_default_periodic_box_vectors( + &mut self, + _a: Vector3, + _b: Vector3, + _c: Vector3, + ) { + // Todo: Rust-OpenMM + unimplemented!() + } } #[cfg(test)] mod test { -- 2.49.1