def _PELEMinimizerLoop(self, general_path, atoms_to_minimize, report_file): create_directory(general_path) path = self.path + str(self.PID) + '_' + co.MODELS_FOLDER for model_id, active in enumerate(report_file.models): # Set initial variables file_name = str(model_id) + '-' + report_file.trajectory.name original_pdb = path + file_name logfile_name = path + co.LOGFILE_NAME.format(self.PID) minimized_pdb = general_path + file_name # Define new PELERunner runner = PELERunner(self.settings.serial_pele, number_of_processors=1) # Write recalculation control file self._writeRecalculationControlFile( self.settings.pp_control_file, original_pdb, path + co.POST_PROCESSING_CF_NAME.format(self.PID), logfile_name=logfile_name, trajectory_name=minimized_pdb, atoms_to_minimize=atoms_to_minimize) runner.run(path + co.POST_PROCESSING_CF_NAME.format(self.PID)) self._applyMinimizedDistancesTo(original_pdb, minimized_pdb)
def run(self): self._start() create_directory(self.settings.simulation_path) self._run() self._finish()
def run(self): self._start() create_directory(self.path) atoms_to_minimize = self._getAtomIdsToMinimize() for lmb in self.lambdas: writeLambdaTitle(lmb) create_directory(self.path + str(self.PID) + '_' + co.MODELS_FOLDER) print(" - Splitting PELE models") simulation = self._getSimulation(lmb) self._splitModels(simulation) ctt_lmb = None if (lmb.index == 2): if (lmb.type == Lambda.COULOMBIC_LAMBDA): ctt_lmb = Lambda.Lambda(1.0, lambda_type=Lambda.STERIC_LAMBDA) elif (lmb.type == Lambda.STERIC_LAMBDA): ctt_lmb = Lambda.Lambda( 1.0, lambda_type=Lambda.COULOMBIC_LAMBDA) self._createAlchemicalTemplate(lmb, ctt_lmb) self._calculateOriginalEnergies(simulation, lmb) for shf_lmb in self.sampling_method.getShiftedLambdas(lmb): print(" - Applying delta lambda " + str(round(shf_lmb.value - lmb.value, 5))) self._createAlchemicalTemplate(shf_lmb, ctt_lmb, gap=' ') general_path = self._getGeneralPath(lmb, shf_lmb) clear_directory(general_path) self._minimize(simulation, lmb.type, general_path, atoms_to_minimize, gap=' ') self._dECalculation(simulation, lmb, general_path, gap=' ') remove_directory(self.path + str(self.PID) + '_' + co.MODELS_FOLDER) self._finish()
def _parallelPELERecalculatorLoop(self, lambda_, shifted_lambda, general_path, num, report_file): create_directory(general_path) pid = current_process().pid energies = [] rmsds = [] for model_id, active in enumerate(report_file.models): # Set initial variables file_name = str(model_id) + '-' + report_file.trajectory.name original_pdb = self.path + co.MODELS_FOLDER + file_name shifted_pdb = general_path + file_name logfile_name = self.path + co.LOGFILE_NAME.format(pid) # Define new PELERunner runner = PELERunner(self.settings.serial_pele, number_of_processors=1) # In case bad model was previously removed """ if (not active): print(" - Warning: skipping bad model from path: " + "\'{}\'".format(shifted_pdb)) continue """ # Write recalculation control file self._writeRecalculationControlFile( self.settings.sp_control_file, shifted_pdb, self.path + co.SINGLE_POINT_CF_NAME.format(pid), logfile_name=logfile_name) # Run PELE and extract energy prediction energies.append(self._getPELEEnergyPrediction(runner, pid)) # Calculate RMSD between original pdb and shifted one rmsd = self._calculateRMSD(original_pdb, shifted_pdb) rmsds.append(rmsd) # Write trajectories and reports write_energies_report(general_path, report_file, energies, rmsds) join_splitted_models(general_path, "*-" + report_file.trajectory.name) # Clean temporal files remove_splitted_models(general_path, "*-" + report_file.trajectory.name)
def _PELERecalculatorLoop(self, lmb, general_path, report_file): create_directory(general_path) energies = [] rmsds = [] path = self.path + str(self.PID) + '_' + co.MODELS_FOLDER for model_id, active in enumerate(report_file.models): # Set initial variables file_name = str(model_id) + '-' + report_file.trajectory.name original_pdb = path + file_name shifted_pdb = general_path + file_name logfile_name = path + co.LOGFILE_NAME.format(self.PID) # Define new PELERunner runner = PELERunner(self.settings.serial_pele, number_of_processors=1) # Write recalculation control file self._writeRecalculationControlFile( self.settings.sp_control_file, shifted_pdb, path + co.SINGLE_POINT_CF_NAME.format(self.PID), logfile_name=logfile_name) # Run PELE and extract energy prediction energies.append(self._getPELEEnergyPrediction(runner)) # Calculate RMSD between original pdb and shifted one rmsd = self._calculateRMSD(original_pdb, shifted_pdb) rmsds.append(rmsd) # Write trajectories and reports write_energies_report(general_path, report_file, energies, rmsds) join_splitted_models(general_path, "*-" + report_file.trajectory.name) # Clean temporal files remove_splitted_models(general_path, "*-" + report_file.trajectory.name)