fn premove_atoms(&self, motion: &mut WorldStepInfo, atom_key: AtomKey, movement: Movement) -> SimResult<()> {
        let mut moving_atoms = VecDeque::<AtomKey>::new();
        moving_atoms.push_back(atom_key);

        while let Some(this_key) = moving_atoms.pop_front() {
            let maybe_move = motion.atoms.get(this_key);
            if let Some(curr_move) = maybe_move {
                if curr_move != &movement {
                    println!("was {:?},applying {:?}",curr_move,movement);
                    let error_str = &"Atom moved in multiple directions!";
                    return Err(sim_error_pos(error_str,self.atoms.atom_map[this_key].pos));
                }
            } else {
                motion.atoms.insert(this_key, movement);
                let atom = &self.atoms.atom_map[this_key];
                for dir in 0..6 {
                    if !(atom.connections[dir as usize] & Bonds::DYNAMIC_BOND).is_empty() {
                        let newpos = atom.pos + rot_to_pos(dir);
                        let newkey = *self.atoms.locs.get(&newpos).expect("Inconsistent atoms (movement prep)");
                        moving_atoms.push_back(newkey);
                    }
                }
            }
        }
        Ok(())
    }
//sets up a move for the specified atom and all atoms connected to it
sets up a move for the specified atom and all atoms connected to it
sets up a move for the specified atom and all atoms connected to it
fn premove_atoms(&self, motion: &mut WorldStepInfo, atom_key: AtomKey, movement: Movement) -> SimResult<()> {
        let mut moving_atoms = VecDeque::<AtomKey>::new();
        moving_atoms.push_back(atom_key);
        while let Some(this_key) = moving_atoms.pop_front() {
            let maybe_move = motion.atoms.get(this_key);
            if let Some(curr_move) = maybe_move {
                if curr_move != &movement {
                    println!("was {:?},applying {:?}",curr_move,movement);
                    let error_str = &"Atom moved in multiple directions!";
                    return Err(sim_error_pos(error_str,self.atoms.atom_map[this_key].pos));
                }
            } else {
                motion.atoms.insert(this_key, movement);
                let atom = &self.atoms.atom_map[this_key];
                for dir in 0..6 {
                    if !(atom.connections[dir as usize] & Bonds::DYNAMIC_BOND).is_empty() {
                        let newpos = atom.pos + rot_to_pos(dir);
                        let newkey = *self.atoms.locs.get(&newpos).expect("Inconsistent atoms (movement prep)");
                        moving_atoms.push_back(newkey);
                    }
                }
            }
        }
        Ok(())
    }
fn premove_atoms ( & self , motion : & mut WorldStepInfo , atom_key : AtomKey , movement : Movement ) -> SimResult < ( ) > { let mut moving_atoms = VecDeque :: < AtomKey > :: new ( ) ; moving_atoms . push_back ( atom_key ) ; while let Some ( this_key ) = moving_atoms . pop_front ( ) { let maybe_move = motion . atoms . get ( this_key ) ; if let Some ( curr_move ) = maybe_move { if curr_move != & movement { println ! ( " " curr_move movement ) ; let error_str = & " " ; return Err ( sim_error_pos ( error_str , self . atoms . atom_map [ this_key ] . pos ) ) ; } } else { motion . atoms . insert ( this_key , movement ) ; let atom = & self . atoms . atom_map [ this_key ] ; for dir in 0 .. 6 { if ! ( atom . connections [ dir as usize ] & Bonds :: DYNAMIC_BOND ) . is_empty ( ) { let newpos = atom . pos + rot_to_pos ( dir ) ; let newkey = * self . atoms . locs . get ( & newpos ) . expect ( " " ) ; moving_atoms . push_back ( newkey ) ; } } } } Ok ( ( ) ) }
sets up a move for the specified atom and all atoms connected to it
sets up a move for the specified atom and all atoms connected to it
&self
motion
&mut WorldStepInfo
atom_key
AtomKey
movement
Movement
&self
motion
&mut WorldStepInfo
atom_key
AtomKey
movement
Movement