Skip to content

Commit

Permalink
Merge pull request #104 from fhh2626/dev
Browse files Browse the repository at this point in the history
merge dev to main
  • Loading branch information
fhh2626 authored Jun 5, 2023
2 parents 0ba1e1e + 9884cb1 commit aa97391
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 151 deletions.
51 changes: 38 additions & 13 deletions BFEE2/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from BFEE2 import doc

__PROGRAM_NAME__ = f'BFEEstimator v{BFEE2.version.__VERSION__}'
__NAMD_VERSION__ = f'v{BFEE2.version.__NAMD_VERSION__}'

class mainSettings(QWidget):
"""settings in the menubar
Expand Down Expand Up @@ -431,6 +432,16 @@ def _initUI(self):
self.FFSettingsLayout.addWidget(self.OPLSMixingRuleCheckbox)
self.FFSettings.setLayout(self.FFSettingsLayout)

# strategy settings
self.strategy = QGroupBox('Strategy settings')
self.strategyLayout = QHBoxLayout()

self.considerRMSDCVCheckbox = QCheckBox('Take into account RMSD CV')
self.considerRMSDCVCheckbox.setChecked(True)

self.strategyLayout.addWidget(self.considerRMSDCVCheckbox)
self.strategy.setLayout(self.strategyLayout)

# membrane protein
self.modeling = QGroupBox('Modeling (avaiable for CHARMM FF)')
self.modelingLayout = QVBoxLayout()
Expand Down Expand Up @@ -463,6 +474,7 @@ def _initUI(self):
self.mainLayout.addWidget(self.doubleWide)
self.mainLayout.addWidget(self.compatibility)
self.mainLayout.addWidget(self.FFSettings)
self.mainLayout.addWidget(self.strategy)
self.mainLayout.addWidget(self.minBeforeSample)
self.mainLayout.addWidget(self.modeling)
self.mainLayout.addLayout(self.alchemicalAdvancedSettingsButtonLayout)
Expand All @@ -483,7 +495,7 @@ class mainUI(QMainWindow):

def __init__(self):
super().__init__()

self._initActions()

self._initNAMDTab()
Expand All @@ -509,6 +521,17 @@ def __init__(self):
self.setWindowIcon(QIcon("BFEE2/icon/icon.png"))
self.show()

self._showNAMDVersionWarning()

def _showNAMDVersionWarning(self):
''' show a message box ask for the latest NAMD version '''
QMessageBox.warning(self,
'Warning',
f'\
{__PROGRAM_NAME__} is fully compatible with NAMD {__NAMD_VERSION__}. \n\
Please use the same or a later version of NAMD if you have any problem.\n'
)

def _initActions(self):
''' initialize actions for menubar '''

Expand Down Expand Up @@ -1463,7 +1486,7 @@ def _showAlchemicalResults(self, unit):
"""

pTreat = postTreatment.postTreatment(
float(self.alchemicalPostTemperatureLineEdit.text()), unit, 'geometric')
float(self.alchemicalPostTemperatureLineEdit.text()), unit, 'alchemical')

# alchemical outputs
files = [
Expand Down Expand Up @@ -1499,28 +1522,32 @@ def _showAlchemicalResults(self, unit):
jobType = 'bar'

# check inputs
for item in [
rigid_ligand = False
for index, item in enumerate([
self.alchemicalBackwardLineEdit1.text(),
self.alchemicalBackwardLineEdit2.text(),
self.alchemicalBackwardLineEdit3.text(),
self.alchemicalBackwardLineEdit4.text()
]:
if (not os.path.exists(item)) and item != '':
]):
if (not os.path.exists(item)) and (index != 3):
QMessageBox.warning(self, 'Error', f'backward file {item} does not exist and is not empty!')
return

for item in [
for index, item in enumerate([
self.alchemicalForwardLineEdit1.text(),
self.alchemicalForwardLineEdit2.text(),
self.alchemicalForwardLineEdit3.text(),
self.alchemicalForwardLineEdit4.text(),
]:
if not os.path.exists(item):
]):
if (not os.path.exists(item)) and (index != 3):
QMessageBox.warning(self, 'Error', f'file {item} does not exist!')
return
elif (not os.path.exists(item)) and (index == 3):
QMessageBox.warning(self, 'Warning', f'Supposing dealing with a rigid ligand!')
rigid_ligand = True

# calculate free energies
result, errors = pTreat.alchemicalBindingFreeEnergy(files, parameters, temperature, jobType)
result, errors = pTreat.alchemicalBindingFreeEnergy(files, parameters, temperature, jobType, rigid_ligand)

QMessageBox.about(
self,
Expand Down Expand Up @@ -1667,10 +1694,7 @@ def f():
QMessageBox.warning(self, 'Error',
f'\
The feature of using GaWTM-eABF as the workhorse engine is \
experimental! Known issues:\n \
The config files for extending GaWTM-eABF simulations \
will do pre-equilibration again. This may cause some errors. \
One can revise the config file manually to avoid it'
experimental! Please always use the latest devel version of NAMD!\n'
)

try:
Expand Down Expand Up @@ -1768,6 +1792,7 @@ def f():
self.alchemicalAdvancedSettings.useOldCvCheckbox.isChecked(),
self.mainSettings.vmdLineEdit.text(),
self.alchemicalAdvancedSettings.OPLSMixingRuleCheckbox.isChecked(),
self.alchemicalAdvancedSettings.considerRMSDCVCheckbox.isChecked()
)
except PermissionError:
QMessageBox.warning(
Expand Down
Loading

0 comments on commit aa97391

Please sign in to comment.