예제 #1
0
    class FEC:
        # Free Energy
        free_energy = OEField('FE_OPLMD',
                              Types.Float,
                              meta=OEFieldMeta().set_option(
                                  Meta.Units.Energy.kCal_per_mol))

        metaFreeEnergy_err = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaFreeEnergy_err.add_relation(Meta.Relations.ErrorsFor, free_energy)
        free_energy_err = OEField('FE_Error_OPLMD',
                                  Types.Float,
                                  meta=metaFreeEnergy_err)

        class RBFEC:
            # Oriented Edge field for relative free energy calculations
            # The first integer of the list is the ligand ID of the starting
            # thermodynamic state and the second the final one
            edgeid = OEField("EdgeID_OPLMD", Types.Int, meta=_metaHidden)
            edge_name = OEField("EdgeName_OPLMD", Types.String)

            # The Thermodynamics leg type is used for Bound and
            # UnBound State run identification
            thd_leg_type = OEField("Thd_Leg_OPLMD",
                                   Types.String,
                                   meta=_metaHidden)

            class NESC:

                state_A = OEField("StateA_OPLMD", Types.Record)
                state_B = OEField("StateB_OPLMD", Types.Record)

                gmx_top = OEField("GMX_Top_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                gmx_gro = OEField("GMX_Gro_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                work = OEField("GMX_Work_OPLMD",
                               Types.Float,
                               meta=OEFieldMeta().set_option(
                                   Meta.Units.Energy.kJ_per_mol))
                frame_count = OEField("frame_count",
                                      Types.Int,
                                      meta=_metaHidden)

                # The Work record is used to collect the data related to the
                # Work Forward and Reverse for the Bound and Unbound States
                work_rec = OEField("Work_Record_OPLMD", Types.Record)

                # The Relative Binding Affinity record collects data for the
                # different analysis methods used to compute it
                DDG_rec = OEField("DDG_Record_OPLMD", Types.Record)
예제 #2
0
            class NESC:

                state_A = OEField("StateA_OPLMD", Types.Record)
                state_B = OEField("StateB_OPLMD", Types.Record)

                gmx_top = OEField("GMX_Top_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                gmx_gro = OEField("GMX_Gro_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                work = OEField("GMX_Work_OPLMD",
                               Types.Float,
                               meta=OEFieldMeta().set_option(
                                   Meta.Units.Energy.kJ_per_mol))
                frame_count = OEField("frame_count",
                                      Types.Int,
                                      meta=_metaHidden)

                # The Work record is used to collect the data related to the
                # Work Forward and Reverse for the Bound and Unbound States
                work_rec = OEField("Work_Record_OPLMD", Types.Record)

                # The Relative Binding Affinity record collects data for the
                # different analysis methods used to compute it
                DDG_rec = OEField("DDG_Record_OPLMD", Types.Record)
예제 #3
0
def data_trajectory_extraction(ctx, name, only):

    check_only = ['a', 'stages', 'parmed', 'protein_confs']

    for v in only:
        if v not in check_only:
            raise ValueError(
                "The only keyword value is not recognized {}. Option available: {}"
                .format(only, check_only[1:]))

    session = ctx.obj['session']

    ofs = oechem.oeofstream(name)

    for record in tqdm(ctx.obj['records']):

        new_record = OERecord(record)

        if not record.has_field(Fields.collection):
            raise ValueError(
                "No Collection field has been found in the record")

        collection_id = record.get_value(Fields.collection)

        collection = session.get_resource(ShardCollection, collection_id)

        new_stages = []

        if 'a' in only or 'stages' in only:

            mdrecord = MDDataRecord(record)

            stages = mdrecord.get_stages

            system_title = mdrecord.get_title
            sys_id = mdrecord.get_flask_id

            for stage in stages:

                stg_type = stage.get_value(Fields.stage_type)
                new_stage = OERecord(stage)

                with TemporaryDirectory() as output_directory:
                    data_fn = os.path.basename(
                        output_directory) + '_' + system_title + '_' + str(
                            sys_id) + '-' + stg_type + '.tar.gz'
                    shard_id = stage.get_value(
                        OEField("MDData_OPLMD", Types.Int))

                    shard = session.get_resource(Shard(collection=collection),
                                                 shard_id)
                    shard.download_to_file(data_fn)

                    new_stage.delete_field(OEField("MDData_OPLMD", Types.Int))
                    new_stage.set_value(Fields.mddata, data_fn)

                    if stage.has_field(OEField("Trajectory_OPLMD", Types.Int)):

                        trj_field = stage.get_field("Trajectory_OPLMD")

                        trj_meta = trj_field.get_meta()
                        md_engine = trj_meta.get_attribute(
                            Meta.Annotation.Description)

                        trj_id = stage.get_value(trj_field)
                        trj_fn = os.path.basename(
                            output_directory) + '_' + system_title + '_' + str(
                                sys_id) + '-' + stg_type + '_traj' + '.tar.gz'

                        resource = session.get_resource(File, trj_id)
                        resource.download_to_file(trj_fn)

                        trj_meta = OEFieldMeta()
                        trj_meta.set_attribute(Meta.Annotation.Description,
                                               md_engine)
                        new_trj_field = OEField(Fields.trajectory.get_name(),
                                                Fields.trajectory.get_type(),
                                                meta=trj_meta)

                        new_stage.delete_field(
                            OEField("Trajectory_OPLMD", Types.Int))
                        new_stage.set_value(new_trj_field, trj_fn)

                new_stages.append(new_stage)

            new_record.set_value(Fields.md_stages, new_stages)

        if 'a' in only or 'parmed' in only:
            if record.has_field(OEField('Structure_Parmed_OPLMD', Types.Int)):
                pmd_id = record.get_value(
                    OEField('Structure_Parmed_OPLMD', Types.Int))
                shard = session.get_resource(Shard(collection=collection),
                                             pmd_id)

                with TemporaryDirectory() as output_directory:
                    parmed_fn = os.path.join(output_directory, "parmed.pickle")

                    shard.download_to_file(parmed_fn)

                    with open(parmed_fn, 'rb') as f:
                        parm_dic = pickle.load(f)

                    pmd_structure = parmed.structure.Structure()
                    pmd_structure.__setstate__(parm_dic)

                new_record.delete_field(
                    OEField('Structure_Parmed_OPLMD', Types.Int))
                new_record.set_value(Fields.pmd_structure, pmd_structure)

        if 'a' in only or 'protein_confs' in only:
            if record.has_field(OEField('OETraj', Types.Record)):

                oetrajrec = record.get_value(OEField('OETraj', Types.Record))

                prot_conf_id = oetrajrec.get_value(
                    OEField("ProtTraj_OPLMD", Types.Int))

                shard = session.get_resource(Shard(collection=collection),
                                             prot_conf_id)

                with TemporaryDirectory() as output_directory:
                    protein_fn = os.path.join(output_directory,
                                              "prot_traj_confs.oeb")

                    shard.download_to_file(protein_fn)

                    protein_conf = oechem.OEMol()

                    with oechem.oemolistream(protein_fn) as ifs:
                        oechem.OEReadMolecule(ifs, protein_conf)

                oetrajrec.delete_field(OEField('ProtTraj_OPLMD', Types.Int))
                oetrajrec.set_value(Fields.protein_traj_confs, protein_conf)

                new_record.set_value(OEField('OETraj', Types.Record),
                                     oetrajrec)

        new_record.delete_field(Fields.collection)

        OEWriteRecord(ofs, new_record, fmt='binary')

    ofs.close()
예제 #4
0
    def add_new_stage(self,
                      stage_name,
                      stage_type,
                      topology,
                      mdstate,
                      data_fn,
                      append=True,
                      log=None,
                      trajectory_fn=None,
                      trajectory_engine=None,
                      trajectory_orion_ui='OrionFile'):
        """
        This method add a new MD stage to the MD stage record

        Parameters
        ----------
        stage_name: String
            The new MD stage name
        stage_type: String
            The MD stage type e.g. SETUP, MINIMIZATION etc.
        topology: OEMol
            The topology
        mdstate: MDState
            The new mdstate made of state positions, velocities and box vectors
        data_fn: String
            The data file name is used only locally and is linked to the MD data associated
            with the stage. In Orion the data file name is not used
        append: Bool
            If the flag is set to true the stage will be appended to the MD stages otherwise
            the last stage will be overwritten by the new created MD stage
        log: String or None
            Log info
        trajectory_fn: String, Int or None
            The trajectory name for local run or id in Orion associated with the new MD stage
        trajectory_engine: String or None
            The MD engine used to generate the new MD stage. Possible names: OpenMM or Gromacs
        trajectory_orion_ui: String
            The trajectory string name to be displayed in the Orion UI

        Returns
        -------
        boolean: Bool
            True if the MD stage creation was successful
        """

        record = OERecord()

        record.set_value(Fields.stage_name, stage_name)
        record.set_value(Fields.stage_type, stage_type)

        if log is not None:
            record.set_value(Fields.log_data, log)

        with TemporaryDirectory() as output_directory:

            top_fn = os.path.join(output_directory, MDFileNames.topology)

            with oechem.oemolostream(top_fn) as ofs:
                oechem.OEWriteConstMolecule(ofs, topology)

            state_fn = os.path.join(output_directory, MDFileNames.state)

            with open(state_fn, 'wb') as f:
                pickle.dump(mdstate, f)

            with tarfile.open(data_fn, mode='w:gz') as archive:
                archive.add(top_fn, arcname=os.path.basename(top_fn))
                archive.add(state_fn, arcname=os.path.basename(state_fn))

        if trajectory_fn is not None:

            if not os.path.isfile(trajectory_fn):
                raise IOError(
                    "The trajectory file has not been found: {}".format(
                        trajectory_fn))

            trj_meta = OEFieldMeta()
            trj_meta.set_attribute(Meta.Annotation.Description,
                                   trajectory_engine)
            trj_field = OEField(Fields.trajectory.get_name(),
                                Fields.trajectory.get_type(),
                                meta=trj_meta)

        if self.rec.has_field(Fields.md_stages):

            stage_names = self.get_stages_names

            if append:
                if stage_name in stage_names:
                    raise ValueError(
                        "The selected stage name is already present in the MD stages: {}"
                        .format(stage_names))

            else:
                if stage_name in stage_names and not stage_name == stage_names[
                        -1]:
                    raise ValueError(
                        "The selected stage name is already present in the MD stages: {}"
                        .format(stage_names))

            lf = utils.upload_data(data_fn,
                                   collection_id=self.collection_id,
                                   shard_name=data_fn)

            record.set_value(Fields.mddata, lf)

            if trajectory_fn is not None:
                lft = utils.upload_file(trajectory_fn,
                                        orion_ui_name=trajectory_orion_ui)
                record.set_value(trj_field, lft)

            stages = self.get_stages

            if append:
                stages.append(record)
            else:
                self.delete_stage_by_name('last')
                stages[-1] = record

            self.rec.set_value(Fields.md_stages, stages)

        else:

            lf = utils.upload_data(data_fn,
                                   collection_id=self.collection_id,
                                   shard_name=data_fn)

            record.set_value(Fields.mddata, lf)

            if trajectory_fn is not None:
                lft = utils.upload_file(trajectory_fn,
                                        orion_ui_name=trajectory_orion_ui)
                record.set_value(trj_field, lft)

            self.rec.set_value(Fields.md_stages, [record])

        self.processed[stage_name] = False

        return True
예제 #5
0
class Fields:

    # The LigInitialRecord Field is for the initial ligand record read in at the start
    ligInit_rec = OEField("LigInitial", Types.Record, meta=_metaHidden)

    # The Title field is a string name for the flask which used to compose file names
    title = OEField("Title_OPLMD", Types.String, meta=_metaIDHidden)

    # The flaskid field is a unique integer for each flask (final system for simulation)
    flaskid = OEField("FlaskID_OPLMD", Types.Int, meta=_metaIDHidden)

    # The ligid field is a unique integer used to keep track of the ligand input order
    ligid = OEField("LigID_OPLMD", Types.Int, meta=_metaIDHidden)

    # The ConfID field is used to identify a particular conformer
    confid = OEField("ConfID_OPLMD", Types.Int, meta=_metaIDHidden)

    # The Ligand field should be used to save in a record a ligand as an OEMolecule
    ligand = OEField(
        "Ligand_OPLMD",
        Types.Chem.Mol,
        meta=OEFieldMeta(
            options=[Meta.Hints.Chem.Ligand, Meta.Display.Hidden]))

    # The ligand name
    ligand_name = OEField("Ligand_name_OPLMD", Types.String, meta=_metaHidden)

    # The protein field should be used to save in a record a Protein as an OEMolecule
    protein = OEField("Protein_OPLMD", Types.Chem.Mol, meta=_metaProtHidden)

    # The protein name
    protein_name = OEField("Protein_name_OPLMD",
                           Types.String,
                           meta=_metaHidden)

    # The super-molecule for the entire flask (ie the final system for simulation)
    flask = OEField("Flask_OPLMD", Types.Chem.Mol, meta=_metaHidden)

    # Primary Molecule
    primary_molecule = OEPrimaryMolField()

    # Parmed Structure, Trajectory, MDData and Protein trajectory conformers Fields
    if in_orion():
        pmd_structure = OEField('Structure_Parmed_OPLMD',
                                Types.Int,
                                meta=_metaHidden)
        trajectory = OEField("Trajectory_OPLMD", Types.Int, meta=_metaHidden)
        mddata = OEField("MDData_OPLMD", Types.Int, meta=_metaHidden)
        protein_traj_confs = OEField("ProtTraj_OPLMD",
                                     Types.Int,
                                     meta=_metaHidden)
    else:
        pmd_structure = OEField('Structure_Parmed_OPLMD',
                                ParmedData,
                                meta=_metaHidden)
        trajectory = OEField("Trajectory_OPLMD",
                             Types.String,
                             meta=_metaHidden)
        mddata = OEField("MDData_OPLMD", Types.String, meta=_metaHidden)
        protein_traj_confs = OEField("ProtTraj_OPLMD",
                                     Types.Chem.Mol,
                                     meta=_metaHidden)

    # The Stage Name
    stage_name = OEField('Stage_name_OPLMD', Types.String)

    # The Stage Type
    stage_type = OEField('Stage_type_OPLMD', Types.String)

    # Topology Field
    topology = OEField('Topology_OPLMD',
                       Types.Chem.Mol,
                       meta=OEFieldMeta().set_option(
                           Meta.Hints.Chem.PrimaryMol))

    # Log Info
    log_data = OEField('Log_data_OPLMD', Types.String)

    # MD State
    md_state = OEField("MDState_OPLMD", MDStateData)

    # Design Unit Field
    design_unit = OEField('Design_Unit_OPLMD', DesignUnit)

    # Design Unit Field from Spruce
    # design_unit_from_spruce = OEField('du_single', Types.Blob)
    design_unit_from_spruce = OEField('designunit', Types.Chem.DesignUnit)

    # MD Components
    md_components = OEField('MDComponents_OPLMD', MDComponentData)

    # Collection is used to offload data from the record which must be < 100Mb
    collection = OEField("Collection_ID_OPLMD", Types.Int, meta=_metaHidden)

    # Stage list Field
    md_stages = OEField("MDStages_OPLMD", Types.RecordVec, meta=_metaHidden)

    floe_report = OEField('Floe_report_OPLMD', Types.String, meta=_metaHidden)

    floe_report_svg_lig_depiction = OEField("Floe_report_lig_svg_OPLMD",
                                            Types.String,
                                            meta=OEFieldMeta().set_option(
                                                Meta.Hints.Image_SVG))

    floe_report_label = OEField('Floe_report_label_OPLMD',
                                Types.String,
                                meta=_metaHidden)

    floe_report_URL = OEField('Floe_report_URL_OPLMD',
                              Types.String,
                              meta=OEFieldMeta(options=[Meta.Hints.URL]))

    floe_report_collection_id = OEField('Floe_report_ID_OPLMD',
                                        Types.Int,
                                        meta=_metaHidden)

    class Analysis:

        # The poseIdVec vector addresses an input poseid for each traj frame
        poseIdVec = OEField("PoseIdVec", Types.IntVec, meta=_metaHidden)

        # The OETraj Field is for the record containing Traj OEMols and energies
        oetraj_rec = OEField("OETraj", Types.Record, meta=_metaHidden)

        # The TrajIntE Field is for the record containing Traj interaction energies
        oeintE_rec = OEField("TrajIntE", Types.Record, meta=_metaHidden)

        # The TrajIntEDict Field is for the POD Dictionary containing Traj interaction energies
        oeintE_dict = OEField("TrajIntEDict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The TrajPBSA Field is for the record containing Traj PBSA energies
        oepbsa_rec = OEField("TrajPBSA", Types.Record, meta=_metaHidden)

        # The TrajPBSADict Field is for the POD Dictionary containing Traj PBSA energies
        oepbsa_dict = OEField("TrajPBSADict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The TrajClus Field is for the record containing Traj ligand clustering results
        oeclus_rec = OEField("TrajClus", Types.Record, meta=_metaHidden)

        # The TrajClusDict Field is for the POD Dictionary containing Traj ligand clustering results
        oeclus_dict = OEField("TrajClusDict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The ClusPopDict Field is for the POD Dictionary containing conf/cluster population results
        cluspop_dict = OEField("ClusPopDict",
                               Types.JSONObject,
                               meta=_metaHidden)

        # The AnalysesDone Field is for a list of the analyses that have been done
        analysesDone = OEField("AnalysesDone",
                               Types.StringVec,
                               meta=_metaHidden)

        # The Lig_Conf_Data Field is for the record containing Traj conf data for all confs
        oetrajconf_rec = OEField("Lig_Conf_Data",
                                 Types.RecordVec,
                                 meta=_metaHidden)

        # The vector of ligand Traj RMSDs from the initial pose
        lig_traj_rmsd = OEField('LigTrajRMSD',
                                Types.FloatVec,
                                meta=OEFieldMeta().set_option(
                                    Meta.Units.Length.Ang))

        # The mmpbsa Field contains the vector of per-frame mmpbsa values over the whole trajectory
        zapMMPBSA_fld = OEField("OEZap_MMPBSA6_Bind",
                                Types.FloatVec,
                                meta=OEFieldMeta().set_option(
                                    Meta.Units.Energy.kCal))

        # mmpbsa ensemble average over the whole trajectory
        mmpbsa_traj_mean = OEField('MMPBSATrajMean',
                                   Types.Float,
                                   meta=OEFieldMeta().set_option(
                                       Meta.Units.Energy.kCal_per_mol))

        metaMMPBSA_traj_serr = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaMMPBSA_traj_serr.add_relation(Meta.Relations.ErrorsFor,
                                          mmpbsa_traj_mean)
        mmpbsa_traj_serr = OEField('MMPBSATrajSerr',
                                   Types.Float,
                                   meta=metaMMPBSA_traj_serr)

        # The number of major clusters found
        n_major_clusters = OEField("n major clusters", Types.Int)

        # Trajectory cluster averages and medians of protein and ligand
        ClusLigAvg_fld = OEField('ClusLigAvgMol', Types.Chem.Mol)
        ClusProtAvg_fld = OEField('ClusProtAvgMol', Types.Chem.Mol)
        ClusLigMed_fld = OEField('ClusLigMedMol', Types.Chem.Mol)
        ClusProtMed_fld = OEField('ClusProtMedMol', Types.Chem.Mol)

        max_waters = OEField("MaxWaters_OPLMD", Types.Int, meta=_metaHidden)

        # Free Energy Yank
        # Analysis Fields
        free_energy = OEField('FE_OPLMD',
                              Types.Float,
                              meta=OEFieldMeta().set_option(
                                  Meta.Units.Energy.kCal_per_mol))

        metaFreeEnergy_err = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaFreeEnergy_err.add_relation(Meta.Relations.ErrorsFor, free_energy)
        free_energy_err = OEField('FE_Error_OPLMD',
                                  Types.Float,
                                  meta=metaFreeEnergy_err)

    class FEC:
        # Free Energy
        free_energy = OEField('FE_OPLMD',
                              Types.Float,
                              meta=OEFieldMeta().set_option(
                                  Meta.Units.Energy.kCal_per_mol))

        metaFreeEnergy_err = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaFreeEnergy_err.add_relation(Meta.Relations.ErrorsFor, free_energy)
        free_energy_err = OEField('FE_Error_OPLMD',
                                  Types.Float,
                                  meta=metaFreeEnergy_err)

        class RBFEC:
            # Oriented Edge field for relative free energy calculations
            # The first integer of the list is the ligand ID of the starting
            # thermodynamic state and the second the final one
            edgeid = OEField("EdgeID_OPLMD", Types.Int, meta=_metaHidden)
            edge_name = OEField("EdgeName_OPLMD", Types.String)

            # The Thermodynamics leg type is used for Bound and
            # UnBound State run identification
            thd_leg_type = OEField("Thd_Leg_OPLMD",
                                   Types.String,
                                   meta=_metaHidden)

            class NESC:

                state_A = OEField("StateA_OPLMD", Types.Record)
                state_B = OEField("StateB_OPLMD", Types.Record)

                gmx_top = OEField("GMX_Top_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                gmx_gro = OEField("GMX_Gro_OPLMD",
                                  Types.String,
                                  meta=_metaHidden)
                work = OEField("GMX_Work_OPLMD",
                               Types.Float,
                               meta=OEFieldMeta().set_option(
                                   Meta.Units.Energy.kJ_per_mol))
                frame_count = OEField("frame_count",
                                      Types.Int,
                                      meta=_metaHidden)

                # The Work record is used to collect the data related to the
                # Work Forward and Reverse for the Bound and Unbound States
                work_rec = OEField("Work_Record_OPLMD", Types.Record)

                # The Relative Binding Affinity record collects data for the
                # different analysis methods used to compute it
                DDG_rec = OEField("DDG_Record_OPLMD", Types.Record)
예제 #6
0
    class Analysis:

        # The poseIdVec vector addresses an input poseid for each traj frame
        poseIdVec = OEField("PoseIdVec", Types.IntVec, meta=_metaHidden)

        # The OETraj Field is for the record containing Traj OEMols and energies
        oetraj_rec = OEField("OETraj", Types.Record, meta=_metaHidden)

        # The TrajIntE Field is for the record containing Traj interaction energies
        oeintE_rec = OEField("TrajIntE", Types.Record, meta=_metaHidden)

        # The TrajIntEDict Field is for the POD Dictionary containing Traj interaction energies
        oeintE_dict = OEField("TrajIntEDict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The TrajPBSA Field is for the record containing Traj PBSA energies
        oepbsa_rec = OEField("TrajPBSA", Types.Record, meta=_metaHidden)

        # The TrajPBSADict Field is for the POD Dictionary containing Traj PBSA energies
        oepbsa_dict = OEField("TrajPBSADict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The TrajClus Field is for the record containing Traj ligand clustering results
        oeclus_rec = OEField("TrajClus", Types.Record, meta=_metaHidden)

        # The TrajClusDict Field is for the POD Dictionary containing Traj ligand clustering results
        oeclus_dict = OEField("TrajClusDict",
                              Types.JSONObject,
                              meta=_metaHidden)

        # The ClusPopDict Field is for the POD Dictionary containing conf/cluster population results
        cluspop_dict = OEField("ClusPopDict",
                               Types.JSONObject,
                               meta=_metaHidden)

        # The AnalysesDone Field is for a list of the analyses that have been done
        analysesDone = OEField("AnalysesDone",
                               Types.StringVec,
                               meta=_metaHidden)

        # The Lig_Conf_Data Field is for the record containing Traj conf data for all confs
        oetrajconf_rec = OEField("Lig_Conf_Data",
                                 Types.RecordVec,
                                 meta=_metaHidden)

        # The vector of ligand Traj RMSDs from the initial pose
        lig_traj_rmsd = OEField('LigTrajRMSD',
                                Types.FloatVec,
                                meta=OEFieldMeta().set_option(
                                    Meta.Units.Length.Ang))

        # The mmpbsa Field contains the vector of per-frame mmpbsa values over the whole trajectory
        zapMMPBSA_fld = OEField("OEZap_MMPBSA6_Bind",
                                Types.FloatVec,
                                meta=OEFieldMeta().set_option(
                                    Meta.Units.Energy.kCal))

        # mmpbsa ensemble average over the whole trajectory
        mmpbsa_traj_mean = OEField('MMPBSATrajMean',
                                   Types.Float,
                                   meta=OEFieldMeta().set_option(
                                       Meta.Units.Energy.kCal_per_mol))

        metaMMPBSA_traj_serr = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaMMPBSA_traj_serr.add_relation(Meta.Relations.ErrorsFor,
                                          mmpbsa_traj_mean)
        mmpbsa_traj_serr = OEField('MMPBSATrajSerr',
                                   Types.Float,
                                   meta=metaMMPBSA_traj_serr)

        # The number of major clusters found
        n_major_clusters = OEField("n major clusters", Types.Int)

        # Trajectory cluster averages and medians of protein and ligand
        ClusLigAvg_fld = OEField('ClusLigAvgMol', Types.Chem.Mol)
        ClusProtAvg_fld = OEField('ClusProtAvgMol', Types.Chem.Mol)
        ClusLigMed_fld = OEField('ClusLigMedMol', Types.Chem.Mol)
        ClusProtMed_fld = OEField('ClusProtMedMol', Types.Chem.Mol)

        max_waters = OEField("MaxWaters_OPLMD", Types.Int, meta=_metaHidden)

        # Free Energy Yank
        # Analysis Fields
        free_energy = OEField('FE_OPLMD',
                              Types.Float,
                              meta=OEFieldMeta().set_option(
                                  Meta.Units.Energy.kCal_per_mol))

        metaFreeEnergy_err = OEFieldMeta().set_option(
            Meta.Units.Energy.kCal_per_mol)
        metaFreeEnergy_err.add_relation(Meta.Relations.ErrorsFor, free_energy)
        free_energy_err = OEField('FE_Error_OPLMD',
                                  Types.Float,
                                  meta=metaFreeEnergy_err)
예제 #7
0
    all = [OpenMM, Gromacs]


# ---------------- File  Name Standards -------------- #


class MDFileNames:
    topology = 'topology.oeb'
    state = 'state.pickle'
    trajectory = "trajectory.tar.gz"
    trajectory_conformers = "trajectory_confs.oeb"
    mddata = "data.tar.gz"


# Orion Hidden meta data options
_metaHidden = OEFieldMeta(options=[Meta.Display.Hidden])
_metaIDHidden = OEFieldMeta(options=[Meta.Source.ID, Meta.Display.Hidden])
_metaProtHidden = OEFieldMeta(
    options=[Meta.Hints.Chem.Protein, Meta.Display.Hidden])


# ---------------- Field Standards -------------- #
class Fields:

    # The LigInitialRecord Field is for the initial ligand record read in at the start
    ligInit_rec = OEField("LigInitial", Types.Record, meta=_metaHidden)

    # The Title field is a string name for the flask which used to compose file names
    title = OEField("Title_OPLMD", Types.String, meta=_metaIDHidden)

    # The flaskid field is a unique integer for each flask (final system for simulation)
예제 #8
0
from datarecord import Types, OEField, OEFieldMeta, Meta

from orionclient.session import in_orion

# Orion Hidden meta data options
_metaHidden = OEFieldMeta(options=[Meta.Display.Hidden])
_metaIDHidden = OEFieldMeta(options=[Meta.Source.ID, Meta.Display.Hidden])


class Fields:
    # Current number of MD steps
    current_iteration_field = OEField("Current_Iterations_OMD", Types.Int)

    # Total number of MD steps
    md_nsteps_field = OEField("MD_nsteps_OMD", Types.Int)

    # Current number of cycles
    cycle_id = OEField("Cycle_ID_OMD", Types.Int)

    # Tpr binary file
    tpr_field = OEField("TPR_bytes_OMD", Types.Blob, meta=_metaHidden)

    # Prefix name field
    prefix_name_field = OEField("Prefix_OPLMD", Types.String)

    if in_orion():
        trajectory = OEField("GMXTrajectory_OMD", Types.Int, meta=_metaHidden)
        gmx_restart = OEField("GMXRestart_OMD", Types.Int, meta=_metaHidden)
    else:
        trajectory = OEField("GMXTrajectory_OMD", Types.String, meta=_metaHidden)
        gmx_restart = OEField("GMXRestart_OMD", Types.String, meta=_metaHidden)