def test_example_CPC_alt(self): input_reader = input.InputReader( "examples/example_CPC_alt/TITAN_CPC.inp") R, N, distance, field_strength, name, out_format, point1_X, point1_Y, point1_Z, point2_X, point2_Y, point2_Z, \ unit = input_reader.read_input_cpc() self.assertAlmostEqual((point1_X, point1_Y, point1_Z), (0.0, 1.0, 2.0), 1)
def setup_input_reader(filename): """ sets up an instance of the input_reader """ header.header_command_line() input_reader = input.InputReader(filename) input_reader.determine_type() return input_reader
def test_example_quant_txt(self): input_reader = input.InputReader( "examples/example_QUANT_TXT/TITAN_QUANTIFICATION_txt.inp") unit, file_type, name, charge_select, charge_seq, direction, v1x, v1y, v1z, v2x, v2y, v2z, \ point_x, point_y, point_z = input_reader.read_input_quantification() quantification_txt = titan.QuantificationTxt(name, point_x, point_y, point_z, v1x, v1y, v1z, v2x, v2y, v2z, charge_seq, charge_select, unit) quantification_txt.execute() (vector_x, vector_y, vector_z) = (v2x - v1x, v2y - v1y, v2z - v1z) oef = quantification_txt.charge_distribution_to_quantify.calculate_oriented_electric_field( point_x, point_y, point_z, vector_x, vector_y, vector_z, "ANS") self.assertAlmostEqual(oef, 0.0025000443, 6)
def test_example_SL(self): input_reader = input.InputReader("examples/example_SL/TITAN_SL.inp") radius, N, step, chirality, name, fatom, sequence, charge, point_X, point_Y, point_Z, unit = \ input_reader.read_input_sl() sl_calculation = titan.SpiralLineGenerate(sequence, fatom, charge, radius, step, N, chirality, point_X, point_Y, point_Z, name, unit) sl_calculation.create_spiral_line_distribution() efx, efy, efz, ef_tot = sl_calculation.charge_distribution_sl.calculate_electric_field( point_X, point_Y, point_Z, "ANS") self.assertAlmostEqual(efx, -0.000561, 6) self.assertAlmostEqual(efy, 0.003331, 6) self.assertAlmostEqual(efz, 0.001549, 6)
def test_example_CPC(self): input_reader = input.InputReader("examples/example_CPC/TITAN_CPC.inp") R, N, distance, field_strength, name, out_format, point1_X, point1_Y, point1_Z, point2_X, point2_Y, point2_Z, \ unit = input_reader.read_input_cpc() circular = titan.CircularGenerate(point1_X, point1_Y, point1_Z, point2_X, point2_Y, point2_Z, R, N, distance, field_strength, name, unit) (vector_x, vector_y, vector_z) = (point2_X - point1_X, point2_Y - point1_Y, point2_Z - point1_Z) circular.create_and_write_plates(out_format) oef = circular.charge_distribution_cpc.calculate_oriented_electric_field( point1_X, point1_Y, point1_Z, vector_x, vector_y, vector_z, "ANS") self.assertAlmostEqual(oef, 0.002500, 3)
def test_example_quant_pdb(self): input_reader = input.InputReader( "examples/example_QUANT_PDB/TITAN_QUANTIFICATION_PDB.inp") unit, file_type, name, charge_select, charge_seq, direction, v1x, v1y, v1z, v2x, v2y, v2z, \ point_x, point_y, point_z = input_reader.read_input_quantification() force_field, n_terminal, c_terminal = input_reader.read_input_pdb() name = "examples/example_QUANT_PDB/" + name quantification_amber = titan.QuantificationPdbAmber( name, point_x, point_y, point_z, v1x, v1y, v1z, v2x, v2y, v2z, n_terminal, c_terminal, charge_seq, charge_select, unit) quantification_amber.execute() (vector_x, vector_y, vector_z) = (v2x - v1x, v2y - v1y, v2z - v1z) oef = quantification_amber.charge_distribution_to_quantify.calculate_oriented_electric_field( point_x, point_y, point_z, vector_x, vector_y, vector_z, "ANS") self.assertAlmostEqual(oef, -0.0001016013, 6)
def test_example_quant_log(self): input_reader = input.InputReader( "examples/example_QUANT_LOG/TITAN_QUANTIFICATION_LOG.inp") unit, file_type, name, charge_select, charge_seq, direction, v1x, v1y, v1z, v2x, v2y, v2z, \ point_x, point_y, point_z = input_reader.read_input_quantification() name = "examples/example_QUANT_LOG/" + name quantification_log = titan.QuantificationLog(name, point_x, point_y, point_z, v1x, v1y, v1z, v2x, v2y, v2z, charge_seq, charge_select, unit) quantification_log.execute() (vector_x, vector_y, vector_z) = (v2x - v1x, v2y - v1y, v2z - v1z) oef = quantification_log.charge_distribution_to_quantify.calculate_oriented_electric_field( point_x, point_y, point_z, vector_x, vector_y, vector_z, "ANS") self.assertAlmostEqual(oef, 3.7534039842, 6)
def test_example_quant_direction(self): input_reader = input.InputReader( "examples/example_QUANT_DIRECTION/TITAN_QUANTIFICATION_DIRECTION.inp" ) unit, file_type, name, charge_select, charge_seq, direction, v1x, v1y, v1z, v2x, v2y, v2z, \ point_x, point_y, point_z = input_reader.read_input_quantification() force_field, n_terminal, c_terminal = input_reader.read_input_pdb() aspp, glup, disu = input_reader.read_input_charmm() name = "examples/example_QUANT_DIRECTION/" + name quantification_charmm = titan.QuantificationPdbCharmm( name, point_x, point_y, point_z, v1x, v1y, v1z, v2x, v2y, v2z, n_terminal, c_terminal, charge_seq, charge_select, unit, aspp, glup, disu) quantification_charmm.execute() (vector_x, vector_y, vector_z) = (v2x - v1x, v2y - v1y, v2z - v1z) oef = quantification_charmm.charge_distribution_to_quantify.calculate_oriented_electric_field( point_x, point_y, point_z, vector_x, vector_y, vector_z, "ANS") self.assertAlmostEqual(oef, -0.0211101298, 6)
def test_example_SL_alt(self): input_reader = input.InputReader( "examples/example_SL_alt/TITAN_SL.inp") radius, N, step, chirality, name, fatom, sequence, charge, point_X, point_Y, point_Z, unit = \ input_reader.read_input_sl() self.assertAlmostEqual((point_X, point_Y, point_Z), (0.0, 1.0, 2.0), 1)