Exemplo n.º 1
0
    def test_omm_STMD_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "ShortTrajMD.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_lig26.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_protein_ACE_NMA_caps.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        if using_orion():
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                }
            })
        else:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                },
                "mp": num_proc
            })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)
Exemplo n.º 2
0
def dataset(ctx, filename, id):
    """Records Extraction"""

    ctx.obj['filename'] = filename

    ifs = oechem.oeifstream(filename)

    records = []

    for rec in read_records(ifs):
        records.append(rec)
    ifs.close()

    if id == ('a', 'l', 'l'):
        ctx.obj['records'] = records
    else:

        list_rec = []
        for idx in id:
            if int(idx) < len(records):
                list_rec.append(records[int(idx)])
            else:
                raise ValueError(
                    "Wrong record number selection: {} > max = {}".format(
                        int(id), len(records)))

        ctx.obj['records'] = list_rec
Exemplo n.º 3
0
    def test_gmx_PlainMD_protein_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "PlainMD.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "4JOO_truncNoLig.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "solute": protein_file.identifier,
                "md_engine": "Gromacs",
                "prod_ns": 1,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)
Exemplo n.º 4
0
    def _test_success(self):
        print('Testing cube:', self.cube.name)

        # File name
        ifs = oechem.oeifstream(
            os.path.join(FILE_DIR, "pP38_lig38a_2n_npt_5ns.oedb"))

        for record in read_records(ifs):
            pass

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)

        # Check out the output record
        record = self.runner.outputs["success"].get()

        mdrecord = MDDataRecord(record)

        stages = mdrecord.get_stages
        self.assertEqual(len(stages), 3)

        mdstate = mdrecord.get_stage_state()
        parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

        # Calculate final volume and temperature
        vol_f, temp_f = calculate_VT(mdstate, parmed_structure)

        # Check 3*std volume
        # Average volume and its standard deviation (in nm^3) measured along
        # one 5ns run for the selected system

        avg_volume = 632.4198167 * (unit.nanometers**3)
        std_volume = 1.201609662

        self.assertAlmostEqual(avg_volume / (unit.nanometers**3),
                               vol_f.in_units_of(unit.nanometers**3) /
                               (unit.nanometers**3),
                               delta=3 * std_volume)

        # Check temperature
        # Average temperature and its standard deviation (in K) measured along
        # one 5ns run for the selected system
        avg_temperature = 299.9852145 * unit.kelvin
        std_temperature = 2.021052471
        self.assertAlmostEqual(avg_temperature / unit.kelvin,
                               temp_f.in_units_of(unit.kelvin) / unit.kelvin,
                               delta=3 * std_temperature)
Exemplo n.º 5
0
    def test_protein_non_std_residue(self):
        print('Testing cube:', self.cube.name)

        ifs = oechem.oeifstream(os.path.join(FILE_DIR, "6puq_solvated.oedb"))

        for record in read_records(ifs):
            pass

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)
Exemplo n.º 6
0
    def setUp(self):
        fname = os.path.join(FILE_DIR, "mdrecord.oedb")
        ifs = oechem.oeifstream(fname)
        records = []

        for record in read_records(ifs):
            records.append(record)

        self.assertEqual(len(records), 1)

        self.record = OERecord(records[0])

        self.mdrecord = MDDataRecord(records[0])

        self.cwd = os.getcwd()

        os.chdir(FILE_DIR)
Exemplo n.º 7
0
    def test_OpenFF1_1(self):
        print('Testing cube:', self.cube.name)

        ifs = oechem.oeifstream(os.path.join(FILE_DIR, "6puq_solvated.oedb"))

        for record in read_records(ifs):
            pass

        # Selecting ligand and excipient parametrization
        self.cube.args.ligand_forcefield = 'OpenFF_1.1.1'

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)
Exemplo n.º 8
0
    def _test_success(self):
        print('Testing cube:', self.cube.name)
        # Complex file name

        # File name
        ifs = oechem.oeifstream(os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        for record in read_records(ifs):

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 1)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate the initial potential energy
            eng_i = calculate_eng(mdstate, parmed_structure)

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)

        # Check out the output record
        record = self.runner.outputs["success"].get()

        mdrecord = MDDataRecord(record)

        stages = mdrecord.get_stages
        self.assertEqual(len(stages), 2)

        mdstate = mdrecord.get_stage_state()
        parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

        # Calculate the final potential energy
        eng_f = calculate_eng(mdstate, parmed_structure)

        self.assertLess(eng_f, eng_i)
Exemplo n.º 9
0
    def test_protein_force_field_amber_fb15_Gaff2(self):
        print('Testing cube:', self.cube.name)

        ifs = oechem.oeifstream(os.path.join(FILE_DIR, "6puq_solvated.oedb"))

        for record in read_records(ifs):
            pass

        # Selecting ligand and excipient parametrization
        self.cube.args.ligand_forcefield = 'Gaff2'
        self.cube.args.protein_forcefield = 'AmberFB15'

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)

        # complex = self.runner.outputs["success"].get()

        @pytest.mark.local
        def test_protein_force_field_amber_fb15_OFF_1_2_1(self):
            print('Testing cube:', self.cube.name)

            ifs = oechem.oeifstream(
                os.path.join(FILE_DIR, "6puq_solvated.oedb"))

            for record in read_records(ifs):
                pass

            # Selecting ligand and excipient parametrization
            self.cube.args.ligand_forcefield = 'OpenFF_1.2.1'
            self.cube.args.protein_forcefield = 'AmberFB15'

            # Process the molecules
            self.cube.process(record, self.cube.intake.name)

            # Assert that one molecule was emitted on the success port
            self.assertEqual(self.runner.outputs['success'].qsize(), 1)
            # Assert that zero molecules were emitted on the failure port
            self.assertEqual(self.runner.outputs['failure'].qsize(), 0)
Exemplo n.º 10
0
def analysis(ctx, filename, id):
    """Records Extraction"""

    ctx.obj['filename'] = filename

    ifs = oechem.oeifstream(filename)

    records = []

    for rec in read_records(ifs):
        records.append(rec)
    ifs.close()

    if id == 'all':
        ctx.obj['records'] = records
    else:
        if int(id) < len(records):
            ctx.obj['records'] = [records[int(id)]]
        else:
            raise ValueError(
                "Wrong record number selection: {} > max = {}".format(
                    int(id), len(records)))
Exemplo n.º 11
0
    def _test_success(self):
        print('Testing cube:', self.cube.name)

        # Complex file name
        ifs = oechem.oeifstream(os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        for record in read_records(ifs):
            pass

        # Process the molecules
        self.cube.process(record, self.cube.intake.name)

        # Assert that one molecule was emitted on the success port
        self.assertEqual(self.runner.outputs['success'].qsize(), 1)
        # Assert that zero molecules were emitted on the failure port
        self.assertEqual(self.runner.outputs['failure'].qsize(), 0)

        # Check out the output record
        record = self.runner.outputs["success"].get()

        stages = record.get_value(Fields.md_stages)
        self.assertEqual(len(stages), 2)
Exemplo n.º 12
0
    def test_gmx_tpr_floe(self):

        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "PlainGromacs.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        user_tpr_file = FileWrapper.get_file(
            os.path.join(FILE_DIR, "pL99_ltoluene.tpr"))

        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "tpr": user_tpr_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "GromacsRun": {
                    "cube_run_time": 0.1
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)
Exemplo n.º 13
0
    def test_gmx_npt_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDnpt.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pP38_lig38a_2n_npt_5ns.oedb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "md_engine": "Gromacs",
                "nanoseconds": 0.01,
                "temperature": 300.0,
                "pressure": 1.0,
                "trajectory_interval": 0.0,
                "reporter_interval": 0.0,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "npt": {
                    "save_md_stage": True,
                    "constraints": "H-Bonds",
                    "restraints": "",
                    "nonbondedCutoff": 10.0
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:
            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 3)
Exemplo n.º 14
0
    def test_omm_minimization_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDminimize.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        # Read input record
        ifs = oeifstream(system.dataset_path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)

        # Check the out record list
        self.assertEqual(count, 1)

        # Calculate the initial potential energy
        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 1)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate the initial potential energy
            eng_i = calculate_eng(mdstate, parmed_structure)

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "Minimize": {
                    "save_md_stage": True
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Read output record
        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # The records list must have just one record
        self.assertEqual(count, 1)

        # Calculate the final potential energy
        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 2)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate the final potential energy
            eng_f = calculate_eng(mdstate, parmed_structure)

        self.assertLess(
            eng_f.in_units_of(unit.kilojoule_per_mole) /
            unit.kilojoule_per_mole,
            eng_i.in_units_of(unit.kilojoule_per_mole) /
            unit.kilojoule_per_mole)
Exemplo n.º 15
0
    def test_gmx_minimization_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDminimize.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pbace_lcat13a.oedb"))

        # Read input record
        ifs = oeifstream(system.dataset_path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)

        # Check the out record list
        self.assertEqual(count, 1)

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "md_engine": "Gromacs",
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "Minimize": {
                    "save_md_stage": True
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Read output record
        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # The records list must have just one record
        self.assertEqual(count, 1)
Exemplo n.º 16
0
    def test_compex_prep_split_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "Complex_prep.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_lig26.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "MCL1_protein_ACE_NMA_caps.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "ligands": ligand_file.identifier,
                "protein": protein_file.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        # Each record should have the MD record interface
        for record in records:

            mdrecord = MDDataRecord(record)

            self.assertTrue(record.has_value(Fields.flaskid))
            self.assertTrue(record.has_value(Fields.title))
            self.assertTrue(record.has_value(Fields.ligand))
            self.assertTrue(record.has_value(Fields.protein))
            self.assertTrue(record.has_value(Fields.primary_molecule))
            self.assertTrue(record.has_value(Fields.flask))
            self.assertTrue(record.has_value(Fields.md_stages))
            self.assertTrue(record.has_value(Fields.pmd_structure))

            self.assertEqual(mdrecord.get_flask_id, 0)
            self.assertEqual(mdrecord.get_title, "pMCL1_l26")
            self.assertEqual(record.get_value(Fields.ligand).NumAtoms(), 43)
            self.assertEqual(record.get_value(Fields.protein).NumAtoms(), 2432)

            complx = mdrecord.get_flask
            protein_split, ligand_split, water, excipients = oeommutils.split(
                complx)
            self.assertEqual(protein_split.NumAtoms(), 2432)
            self.assertEqual(ligand_split.NumAtoms(), 43)
            self.assertEqual(water.NumAtoms(), 20022)
            self.assertEqual(excipients.NumAtoms(), 17)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 1)

            stage = stages[0]

            self.assertTrue(stage.has_value(Fields.stage_name))
            self.assertTrue(stage.has_value(Fields.mddata))

            self.assertEqual(stage.get_value(Fields.stage_type), "SETUP")

            top_mol = mdrecord.get_stage_topology()
            self.assertEqual(top_mol.NumAtoms(), complx.NumAtoms())
Exemplo n.º 17
0
    def test_compex_prep_md_comp_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "Complex_prep.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "retigabine.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "kcnq_fix_ARG_fc.oeb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "ligands": ligand_file.identifier,
                "protein": protein_file.identifier,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:

            md_components = record.get_value(Fields.md_components)

            protein = md_components.get_protein
            ligand = md_components.get_ligand
            counter_ions = md_components.get_counter_ions
            excipients = md_components.get_excipients
            water = md_components.get_water

            self.assertEqual(protein.NumAtoms(), 7353)
            self.assertEqual(ligand.NumAtoms(), 40)
            self.assertEqual(water.NumAtoms(), 58308)
            self.assertEqual(excipients.NumAtoms(), 44)
            self.assertEqual(counter_ions.NumAtoms(), 54)
Exemplo n.º 18
0
    def test_omm_npt_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DEV_DIR, "MDnpt.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        system = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "pP38_lig38a_2n_npt_5ns.oedb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        workfloe.start({
            "promoted": {
                "system": system.identifier,
                "nanoseconds": 0.01,
                "temperature": 300.0,
                "pressure": 1.0,
                "trajectory_interval": 0.0,
                "reporter_interval": 0.0,
                "out": output_file.identifier,
                "fail": fail_output_file.identifier
            },
            "cube": {
                "npt": {
                    "save_md_stage": True,
                    "constraints": "H-Bonds",
                    "restraints": "",
                    "nonbondedCutoff": 10.0
                }
            }
        })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        ifs = oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)

        for record in records:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages
            self.assertEqual(len(stages), 3)

            mdstate = mdrecord.get_stage_state()
            parmed_structure = mdrecord.get_parmed(sync_stage_name='last')

            # Calculate final volume and temperature
            vol_f, temp_f = calculate_VT(mdstate, parmed_structure)

            # Check 3*std volume
            # Average volume and its standard deviation (in nm^3) measured along
            # one 5ns run for the selected system
            avg_volume = 632.4198167 * (unit.nanometers**3)
            std_volume = 1.201609662

            self.assertAlmostEqual(avg_volume / (unit.nanometers**3),
                                   vol_f.in_units_of(unit.nanometers**3) /
                                   (unit.nanometers**3),
                                   delta=3 * std_volume)

            # Check temperature
            # Average temperature and its standard deviation (in K) measured along
            # one 5ns run for the selected system
            avg_temperature = 299.9852145 * unit.kelvin
            std_temperature = 2.021052471
            self.assertAlmostEqual(avg_temperature / unit.kelvin,
                                   temp_f.in_units_of(unit.kelvin) /
                                   unit.kelvin,
                                   delta=3 * std_temperature)
Exemplo n.º 19
0
    def test_gmx_STMD_Analysis_large_sys_floe(self):
        workfloe = WorkFloeWrapper.get_workfloe(os.path.join(
            FLOES_DIR, "ShortTrajMDWithAnalysis.py"),
                                                run_timeout=43200,
                                                queue_timeout=2000)

        ligand_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "Hunt13_lig13.oeb"))

        protein_file = DatasetWrapper.get_dataset(
            os.path.join(FILE_DIR, "4JOO_truncNoLig.pdb"))

        output_file = OutputDatasetWrapper(extension=".oedb")
        fail_output_file = OutputDatasetWrapper(extension=".oedb")

        if using_orion:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "md_engine": "Gromacs",
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                }
            })
        else:
            workfloe.start({
                "promoted": {
                    "ligands": ligand_file.identifier,
                    "protein": protein_file.identifier,
                    "md_engine": "Gromacs",
                    "out": output_file.identifier,
                    "fail": fail_output_file.identifier
                },
                "mp": num_proc
            })

        self.assertWorkFloeComplete(workfloe)

        fail_ifs = oechem.oeifstream()
        records_fail = []

        for rec_fail in read_records(fail_ifs):
            records_fail.append(rec_fail)
        fail_ifs.close()

        count = len(records_fail)
        # The fail record must be empty
        self.assertEqual(count, 0)

        # Check output
        ifs = oechem.oeifstream(output_file.path)
        records = []

        for rec in read_records(ifs):
            records.append(rec)
        ifs.close()

        count = len(records)
        # Check the out record list
        self.assertEqual(count, 1)