Example #1
0
    def minimize_liq(self, in_gromos_simulation_system: Gromos_System, prev_JobID: int):
        """
        Minimize Liquide
        Parameters
        ----------
        in_gromos_simulation_system : Gromos_System
            input Gromos System to minimize
        prev_JobID
            previous jobID to wait for
        Returns
        -------
        emin_sys : Gromos_System
            Energy minimized Gromos System
        jobID : int
            ID of submitted job for the next job to wait for (only relevant for LSF)
        """
        in_gromos_simulation_system.adapt_imd_automatically = False
        in_gromos_simulation_system.imd = self.imd_liq_min
        emin_sys = simulation(
            in_gromos_simulation_system=in_gromos_simulation_system,
            override_project_dir=self.groSys_liq.work_folder,
            step_name=self.system_name + "_emin",
            submission_system=self._subsystem,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        return emin_sys, emin_sys._last_jobID
def sd(
    in_gromos_system: Gromos_System,
    step_name: str = "sd",
    override_project_dir: str = None,
    in_imd_path=None,
    submission_system: _SubmissionSystem = LOCAL(),
    simulation_runs: int = 1,
    equilibration_runs: int = 0,
    initialize_first_run=False,
    previous_simulation_run: int = None,
    _template_imd_path: str = template_sd,
    _no_double_submit_check: bool = False,
    analysis_script: callable = simulation_analysis.do,
    verbose: bool = True,
) -> Tuple[Gromos_System, int]:
    return simulation(
        in_gromos_simulation_system=in_gromos_system,
        override_project_dir=override_project_dir,
        previous_simulation_run=previous_simulation_run,
        step_name=step_name,
        in_imd_path=in_imd_path,
        submission_system=submission_system,
        initialize_first_run=initialize_first_run,
        simulation_runs=simulation_runs,
        equilibration_runs=equilibration_runs,
        analysis_script=analysis_script,
        _template_imd_path=_template_imd_path,
        _no_double_submit_check=_no_double_submit_check,
        verbose=verbose,
    )
    def run_liq(self):

        # minsys_emin_liq, jobID
        self.groSys_liq.imd = self.imd_liq_min
        self.groSys_liq.prepare_for_simulation()
        sys_emin_liq = simulation(
            in_gromos_simulation_system=self.groSys_liq,
            override_project_dir=self.groSys_liq.work_folder,
            step_name="1_emin",
            submission_system=self.submissonSystem_liq,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        # eq
        sys_emin_liq.imd = self.imd_liq_eq
        sys_emin_liq.prepare_for_simulation()
        sys_eq_liq = simulation(
            in_gromos_simulation_system=sys_emin_liq,
            override_project_dir=self.groSys_liq.work_folder,
            step_name="2_eq",
            submission_system=self.submissonSystem_liq,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        # md
        sys_eq_liq.imd = self.imd_liq_md
        sys_eq_liq.prepare_for_simulation()
        sys_md_liq = simulation(
            in_gromos_simulation_system=sys_eq_liq,
            override_project_dir=self.groSys_liq.work_folder,
            step_name="3_sd",
            submission_system=self.submissonSystem_liq,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        self.groSys_liq_final = sys_md_liq
    def run_gas(self):

        # min
        self.groSys_gas.imd = self.imd_gas_min
        self.groSys_gas.prepare_for_simulation()
        sys_emin_gas = simulation(
            in_gromos_simulation_system=self.groSys_gas,
            override_project_dir=self.groSys_gas.work_folder,
            step_name="1_emin",
            submission_system=self.submissonSystem_gas,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        # eq
        sys_emin_gas.imd = self.imd_gas_eq
        sys_emin_gas.prepare_for_simulation()
        sys_eq_gas = simulation(
            in_gromos_simulation_system=sys_emin_gas,
            override_project_dir=self.groSys_gas.work_folder,
            step_name="2_eq",
            submission_system=self.submissonSystem_gas,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        # sd
        sys_eq_gas.imd = self.imd_gas_eq
        sys_eq_gas.prepare_for_simulation()
        sys_sd_gas = simulation(
            in_gromos_simulation_system=sys_eq_gas,
            override_project_dir=self.groSys_gas.work_folder,
            step_name="3_sd",
            submission_system=self.submissonSystem_gas,
            analysis_script=simulation_analysis.do,
            verbose=self.verbose,
        )

        self.groSys_gas_final = sys_sd_gas
Example #5
0
def _TI_lam_step(
    in_gromos_system: Gromos_System,
    project_dir: str,
    step_name: str = "lam",
    in_imd_path=None,
    submission_system: _SubmissionSystem = LOCAL(),
    simulation_runs: int = 1,
    equilibration_runs: int = 0,
    previous_simulation_run: int = None,
    analysis_script: callable = simulation_analysis.do,
    verbose: bool = True,
) -> Gromos_System:
    template_control_dict = OrderedDict({
        "concat": {
            "do": True,
            "sub": {
                "cp_cnf": True,
                "repair_NaN": True,
                "cp_omd": True,
                "cat_trc": True,
                "cat_tre": True,
                "cat_trg": True,
                "convert_trcs": False,
            },
        },
        "simulation_folder": {
            "do": False,
            "sub": {
                "tar": False,
                "remove": False
            }
        },
    })
    return simulation(
        in_gromos_simulation_system=in_gromos_system,
        override_project_dir=project_dir,
        previous_simulation_run=previous_simulation_run,
        step_name=step_name,
        in_imd_path=in_imd_path,
        submission_system=submission_system,
        simulation_runs=simulation_runs,
        equilibration_runs=equilibration_runs,
        analysis_control_dict=template_control_dict,
        analysis_script=analysis_script,
        verbose=verbose,
    )
def emin(
    in_gromos_system: Gromos_System,
    step_name: str = "emin",
    override_project_dir: str = None,
    in_imd_path=None,
    submission_system: _SubmissionSystem = LOCAL(),
    simulation_runs: int = 1,
    equilibration_runs: int = 0,
    previous_simulation_run: int = None,
    _template_imd_path: str = template_emin,
    _no_double_submit_check: bool = False,
    initialize_first_run=False,
    analysis_script: callable = simulation_analysis.do,
    verbose: bool = True,
) -> Tuple[Gromos_System, int]:
    template_emin_control_dict = simulation_analysis.template_control_dict
    template_emin_control_dict["concat"]["cat_trc"] = False
    template_emin_control_dict["concat"]["cat_tre"] = False
    template_emin_control_dict["concat"]["cat_trg"] = False

    if hasattr(in_gromos_system.imd, "WRITETRAJ"):
        if in_gromos_system.imd.WRITETRAJ.NTWX > 0:
            template_emin_control_dict["concat"]["cat_trc"] = False
        if in_gromos_system.imd.WRITETRAJ.NTWE > 0:
            template_emin_control_dict["concat"]["cat_tre"] = False
        if in_gromos_system.imd.WRITETRAJ.NTWG > 0:
            template_emin_control_dict["concat"]["cat_trg"] = False

    return simulation(
        in_gromos_simulation_system=in_gromos_system,
        override_project_dir=override_project_dir,
        previous_simulation_run=previous_simulation_run,
        step_name=step_name,
        in_imd_path=in_imd_path,
        submission_system=submission_system,
        initialize_first_run=initialize_first_run,
        simulation_runs=simulation_runs,
        equilibration_runs=equilibration_runs,
        analysis_control_dict=template_emin_control_dict,
        analysis_script=analysis_script,
        _template_imd_path=_template_imd_path,
        _no_double_submit_check=_no_double_submit_check,
        verbose=verbose,
    )
Example #7
0
    def equilibration_gromos_system_step(
        self,
        in_gromos_simulation_system: Gromos_System,
        NTIVAL: int = 0,
        NTISHI: int = 0,
        TEMPI: float = 0,
        TEMPO: float = 0,
        prevID: int = -1,
        run_name: str = "",
        natoms: int = 0,
    ):
        """
        Perform one step in equilibration routine
        Parameters
        ----------
        in_gromos_simulation_system : Gromos_System
            Gromos System to work on
        NTIVAL : int
            NTIVAL Parameter to set
        NTISHI : int
            NTISHI Parameter to set
        TEMPI : float
            TEMPI Parameter to set
        TEMPO : float
            TEMPO Parameter to set
        prevID : int
            ID of previous run (for LSF Submission Syste)
        run_name : str
            Name of the current run (note needs to be unique for LSF not to crash)
        natoms : int
            Number of Atoms in the molecule

        Returns
        -------
        md_sys : Gromos_System
            Equilibrated gromos system
        JobID : int
            ID of the submitted job for the next job to wait on
        """

        # adapt imd
        eq_imd = Imd(template_md)
        eq_imd.SYSTEM.NSM = 0
        eq_imd.STEP.NSTLIM = 25000

        multibath = MULTIBATH(
            ALGORITHM=0, NBATHS=1, TEMP0=[TEMPO], TAU=[0.1], DOFSET=1, LAST=[natoms], COMBATH=[1], IRBATH=[1]
        )
        eq_imd.MULTIBATH = multibath

        eq_imd.PRESSURESCALE.COUPLE = 1

        eq_imd.FORCE.NEGR = 1
        eq_imd.FORCE.NRE = [natoms]

        eq_imd.NONBONDED.EPSRF = 4
        eq_imd.NONBONDED.NSHAPE = -1
        eq_imd.NONBONDED.NQEVAL = 100000

        # add COVALENTFORM Block
        covalentform = COVALENTFORM(NTBBH=0, NTBAH=0, NTBDN=0)
        eq_imd.add_block(block=covalentform)

        if self.amberscaling:
            # Add AMBER Block
            amber_block = AMBER(True, 1.2)
            eq_imd.add_block(block=amber_block)

        eq_imd.INITIALISE.IG = 3
        eq_imd.INITIALISE.NTIVEL = NTIVAL
        eq_imd.INITIALISE.NTISHI = NTISHI
        eq_imd.INITIALISE.TEMPI = TEMPI

        eq_imd.WRITETRAJ.NTWX = 500
        eq_imd.WRITETRAJ.NTWE = 500

        eq_imd.PRINTOUT.NTPR = 500
        eq_imd.randomize_seed()

        if prevID == -1:
            md_sys = simulation(
                in_gromos_simulation_system=in_gromos_simulation_system,
                override_project_dir=self.groSys_liq.work_folder,
                step_name="eq" + run_name,
                in_imd_path=eq_imd,
                submission_system=self._subsystem,
                analysis_script=simulation_analysis.do,
                verbose=self.verbose,
            )
        else:
            md_sys = simulation(
                in_gromos_simulation_system=in_gromos_simulation_system,
                override_project_dir=self.groSys_liq.work_folder,
                step_name="eq" + run_name,
                in_imd_path=eq_imd,
                submission_system=self._subsystem,
                analysis_script=simulation_analysis.do,
                verbose=self.verbose,
                previous_simulation_run=prevID,
            )

        return md_sys, md_sys._last_jobID