// Run a callback in eco mode without needing to create a PotentialBuilder.
Run a callback in eco mode without needing to create a PotentialBuilder.
Run a callback in eco mode without needing to create a PotentialBuilder .
fn eco_mode_without_potential<B, F>(
    settings: &Settings,
    on_demand: Option<LammpsOnDemand>,
    continuation: F,
) -> FailResult<B>
where F: FnOnce(EcoModeProof<'_>) -> FailResult<B>,
{
    // can't use rsp2_lammps_wrap::potential::None due to Meta type mismatch
    //
    // FIXME: This is dumb; creating a dummy potential just so we can make a builder
    // so we can call this method. LammpsOnDemand should expose an `eco_mode` method.
    #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
    pub struct NoPotential;
    impl rsp2_lammps_wrap::Potential for NoPotential {
        type Meta = CommonMeta;
        fn atom_types(&self, _: &Coords, _: &Self::Meta) -> Vec<rsp2_lammps_wrap::AtomType>
        { unreachable!() }
        fn init_info(&self, _: &Coords, _: &Self::Meta) -> rsp2_lammps_wrap::InitInfo
        { unreachable!() }
        fn molecule_ids(&self, _: &Coords, _: &Self::Meta) -> Option<Vec<usize>>
        { unreachable!() }
    }
    let trial_dir = None;
    let pot: &dyn PotentialBuilder = &crate::potential::lammps::Builder::new(
        trial_dir, on_demand, &settings.threading, &settings.lammps,
        NoPotential,
    )?;
    pot.eco_mode(|eco_proof| continuation(eco_proof))
}
fn eco_mode_without_potential < B , F > ( settings : & Settings , on_demand : Option < LammpsOnDemand > , continuation : F , ) -> FailResult < B > where F : FnOnce ( EcoModeProof < ' _ > ) -> FailResult < B > , { // can't use rsp2_lammps_wrap::potential::None due to Meta type mismatch // // FIXME: This is dumb; creating a dummy potential just so we can make a builder // so we can call this method. LammpsOnDemand should expose an `eco_mode` method. # [ derive ( Debug Copy Clone PartialEq Eq Default ) ] pub struct NoPotential ; impl rsp2_lammps_wrap :: Potential for NoPotential { type Meta = CommonMeta ; fn atom_types ( & self , _ : & Coords , _ : & Self :: Meta ) -> Vec < rsp2_lammps_wrap :: AtomType > { unreachable ! ( ) } fn init_info ( & self , _ : & Coords , _ : & Self :: Meta ) -> rsp2_lammps_wrap :: InitInfo { unreachable ! ( ) } fn molecule_ids ( & self , _ : & Coords , _ : & Self :: Meta ) -> Option < Vec < usize > > { unreachable ! ( ) } } let trial_dir = None ; let pot : & dyn PotentialBuilder = & crate :: potential :: lammps :: Builder :: new ( trial_dir , on_demand , & settings . threading , & settings . lammps , NoPotential , ) ? ; pot . eco_mode ( | eco_proof | continuation ( eco_proof ) ) }
Run a callback in eco mode without needing to create a PotentialBuilder.
Run a callback in eco mode without needing to create a PotentialBuilder .
settings
&Settings
on_demand
Option<LammpsOnDemand>
continuation
F