def test_second_neighbor(self): """ Tests that Pauli operators for 2nd neighbor interactions are created correctly. """ main_chain_residue_seq = "SAASS" side_chain_residue_sequences = ["", "", "A", "", ""] mj_interaction = MiyazawaJerniganInteraction() pair_energies = mj_interaction.calculate_energy_matrix( main_chain_residue_seq) peptide = Peptide(main_chain_residue_seq, side_chain_residue_sequences) lambda_1 = 2 lower_main_bead_index = 1 upper_main_bead_index = 4 side_chain_lower_main_bead = 0 side_chain_upper_main_bead = 0 distance_map = DistanceMap(peptide) second_neighbor = distance_map._second_neighbor( peptide, lower_main_bead_index, side_chain_upper_main_bead, upper_main_bead_index, side_chain_lower_main_bead, lambda_1, pair_energies, ) expected_path = self.get_resource_path( "test_second_neighbor", PATH, ) expected = read_expected_file(expected_path) self.assertEqual(second_neighbor, expected)
def test_calc_total_distances(self): """ Tests that total distances for all beads are calculated correctly. """ distance_map = DistanceMap(self.peptide) upper_bead_1 = self.peptide.get_main_chain[2].side_chain[0] lower_bead_1 = self.peptide.get_main_chain[1] upper_bead_2 = self.peptide.get_main_chain[2].side_chain[0] lower_bead_2 = self.peptide.get_main_chain[0] expected_path = self.get_resource_path( "test_calc_total_distances_1", PATH, ) expected_1 = read_expected_file(expected_path) expected_path = self.get_resource_path( "test_calc_total_distances_2", PATH, ) expected_2 = read_expected_file(expected_path) self.assertEqual(distance_map[lower_bead_1, upper_bead_1], expected_1) self.assertEqual(distance_map[lower_bead_2, upper_bead_2], expected_2)