def getSolventList(): """ Return list of solvent molecules for initializing solvation search form. """ database.load('solvation','') SolventList = [(entry.label, index) for index,entry in database.solvation.libraries['solvent'].entries.iteritems()] return SolventList
def getSolventList(): """ Return list of solvent molecules for initializing solvation search form. """ database.load('solvation', '') SolventList = [(entry.label, index) for index, entry in database.solvation.libraries['solvent'].entries.iteritems()] return SolventList
def getSolventList(): """ Return list of solvent molecules for initializing solvation search form. If any of the Mintz parameters are None, that solvent is not shown in the list since it will cause error. """ database.load('solvation', '') solvent_list = [] for index, entry in database.solvation.libraries['solvent'].entries.items(): mintz_parameter_list = [entry.data.s_h, entry.data.b_h, entry.data.e_h, entry.data.l_h, entry.data.a_h, entry.data.c_h] if not any(h is None for h in mintz_parameter_list): solvent_list.append((entry.label, index)) return solvent_list
def get_solvent_temp_list(): """ Return list of solvent molecules for initializing solvation temperature-dependent search form and its correct temperature range. e.g. "water: 280 K - 647.10 K" """ database.load('solvation', '') solvent_temp_list = [] solvent_list = getSolventList() for label, index in solvent_list: solvent_data = database.solvation.get_solvent_data(label) if solvent_data.name_in_coolprop != None: Tc = "%.2f" % (solvent_data.get_solvent_critical_temperature() - 0.01) # 0.01 is subtracted because Tc is not inclusive solvent_temp_list.append((label, index + ": 280 K - " + str(Tc) + " K")) return solvent_temp_list
def clean_temp(self): """ Custom validation for the temperature field to ensure that a valid temperature has been provided """ temp = self.cleaned_data['temp'] try: temp = float(temp) except: raise forms.ValidationError( 'Only non-empty numeric input is allowed') database.load('solvation') db = database.get_solvation_database('', '') solvent_temp = self.cleaned_data['solvent_temp'] if not solvent_temp == '': Tc = db.get_solvent_data( solvent_temp).get_solvent_critical_temperature() if temp < 280 or temp >= Tc: raise forms.ValidationError( 'Temperature is out of the valid range') return temp
method=form.cleaned_data['method'].encode(), fileStore=form.cleaned_data['fileStore'].encode(), scratchDirectory=form.cleaned_data['scratchDirectory'].encode( ), onlyCyclics=form.cleaned_data['onlyCyclics'], maxRadicalNumber=form.cleaned_data['maxRadicalNumber'], ) # Save the input.py file self.rmg.saveInput(self.savepath) ################################################################################ # DATABASE MODELS ################################################################################ database.load('thermo', 'libraries') database.load('kinetics', 'libraries') ThermoLibraries = [(label, label) for label, library in database.thermo.libraries.iteritems()] ThermoLibraries.sort() KineticsLibraries = [ (label, label) for label, library in database.kinetics.libraries.iteritems() ] KineticsLibraries.sort() class ThermoLibrary(models.Model): input = models.ForeignKey(Input, related_name='thermo_libraries') thermolib = models.CharField(choices=ThermoLibraries, max_length=200,
from rmgpy.qm.main import QMCalculator self.rmg.quantumMechanics = QMCalculator(software = form.cleaned_data['software'].encode(), method = form.cleaned_data['method'].encode(), fileStore = form.cleaned_data['fileStore'].encode(), scratchDirectory = form.cleaned_data['scratchDirectory'].encode(), onlyCyclics = form.cleaned_data['onlyCyclics'], maxRadicalNumber = form.cleaned_data['maxRadicalNumber'], ) # Save the input.py file self.rmg.saveInput(self.savepath) ################################################################################ # DATABASE MODELS ################################################################################ database.load('thermo', 'libraries') database.load('kinetics', 'libraries') ThermoLibraries = [(label, label) for label, library in database.thermo.libraries.iteritems()] ThermoLibraries.sort() KineticsLibraries = [(label, label) for label, library in database.kinetics.libraries.iteritems()] KineticsLibraries.sort() class ThermoLibrary(models.Model): input = models.ForeignKey(Input, related_name = 'thermo_libraries') thermolib = models.CharField(choices = ThermoLibraries, max_length=200, blank=True) def __unicode__(self): return self.thermolib class ReactionLibrary(models.Model): input = models.ForeignKey(Input, related_name = 'reaction_libraries') reactionlib = models.CharField(choices = KineticsLibraries, max_length=200, blank=True)