Skip to content

Commit

Permalink
add some magic tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Aug 13, 2024
1 parent f542cbb commit 77dab06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,16 @@ fn generate_z_restraints(

let mut interactors: Vec<Interactor> = Vec::new();
let mut counter = 0;
let restraint_distance = ((grid_spacing / 2.0) - 2.0).max(2.0);
selections
.iter()
.enumerate()
.for_each(|(index, selection)| {
let beads = restraints.get(&(index)).unwrap();
let z = beads[0].position.z;

let comparison_operator = if z >= 0.0 { "ge" } else { "le" };

selection.iter().for_each(|resnum| {
let mut interactor_i = Interactor::new(counter);
counter += 1;
Expand All @@ -344,12 +347,13 @@ fn generate_z_restraints(
interactor_i.set_active(vec![*resnum as i16]);
interactor_i.set_active_atoms(vec!["CA".to_string()]);
interactor_i.set_passive_atoms(vec!["SHA".to_string()]);
interactor_i.set_lower_margin(0.0);
interactor_i.set_target_distance(restraint_distance);
interactor_i.set_lower_margin(restraint_distance);
interactor_i.set_upper_margin(0.0);
interactor_i.set_target_distance(2.0);

interactor_j.set_chain("S");
interactor_j.set_wildcard(format!("attr z gt {:.2}", z).as_str());
interactor_j
.set_wildcard(format!("and attr z {} {:.3}", comparison_operator, z).as_str());

interactors.push(interactor_i);
interactors.push(interactor_j);
Expand Down

0 comments on commit 77dab06

Please sign in to comment.