Skip to content

Commit

Permalink
Remove unused code and optimize performance
Browse files Browse the repository at this point in the history
  • Loading branch information
khb7840 committed Mar 7, 2024
1 parent b8611c9 commit f818a75
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/structure/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ pub struct CompactStructure {
pub n_vector: CarbonCoordinateVector,
pub ca_vector: CarbonCoordinateVector,
pub cb_vector: CarbonCoordinateVector,
pub ca_torsion_vector: Vec<Option<f32>>,
}

impl CompactStructure {
pub fn build(origin: &Structure) -> CompactStructure {
let start = std::time::Instant::now();
// Store only backbone atoms
let model = &origin.atom_vector;

Expand Down Expand Up @@ -204,24 +202,7 @@ impl CompactStructure {
_ => (),
}
}
let elapsed = start.elapsed().as_secs_f64();
if elapsed > 60.0 {
// Print all information available
eprintln!("Elapsed time: {:.2} seconds", elapsed);
eprintln!("Origin info: {:?}", origin);
eprintln!("Total {} atoms", origin.num_atoms);
eprintln!("Atom: {:?}", model.atom_name);

eprintln!("Residue serial: {:?}", res_serial_vec);
eprintln!("Residue name: {:?}", res_name_vec);
eprintln!("Chain per residue: {:?}", chain_per_residue);
eprintln!("Current index: {}", idx);
// Terminate
std::process::exit(1);
}
}

let ca_torsion_vec = ca_vec.calc_all_torsion_angles();

CompactStructure {
num_chains: origin.num_chains,
Expand All @@ -233,7 +214,6 @@ impl CompactStructure {
n_vector: n_vec,
ca_vector: ca_vec,
cb_vector: cb_vec,
ca_torsion_vector: ca_torsion_vec,
}
}

Expand Down Expand Up @@ -335,19 +315,6 @@ impl CompactStructure {
(self.residue_serial[idx1], self.residue_serial[idx2])
}

pub fn get_accumulated_torsion(&self, idx1: usize, idx2: usize) -> Option<f32> {
if idx1.abs_diff(idx2) < 3 {
return None;
}
let start_ind = idx1;
let end_ind = idx2 - 3;
let mut torsion = 0.0;
for idx in start_ind..end_ind {
torsion += self.ca_torsion_vector[idx].unwrap_or(0.0);
}
Some(torsion)
}

pub fn get_ppf(&self, idx1: usize, idx2: usize) -> Option<Vec<f32>> {
let ca1 = self.get_ca(idx1);
let cb1 = self.get_cb(idx1);
Expand All @@ -363,10 +330,6 @@ impl CompactStructure {
}
}

pub fn get_torsion(&self, idx: usize) -> Option<f32> {
self.ca_torsion_vector[idx]
}

fn _get_trrosetta_feature(&self, idx1: usize, idx2: usize) -> Option<[f32; 6]> {
let ca1 = self.get_ca(idx1);
let ca2 = self.get_ca(idx2);
Expand Down

0 comments on commit f818a75

Please sign in to comment.