def WALLTIME(self, val): hhmmss = str(val).split(":") # If given in seconds, not HH:MM:SS if len(hhmmss) == 1 and utilities.is_number(val): self.__WALLTIME = int(float(val) // 1) elif len(hhmmss) == 3: isn = True for v in hhmmss: if not (utilities.is_number(v)): isn = False if isn: self.__WALLTIME = val else: errorMessage = ( "Wrong format for walltime: {}. Must be in seconds" "or HH:MM:SS.".format(val)) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "GLOBAL", "Variable": "WALLTIME", "ErrorMessage": errorMessage, "Location": self.__location, }) else: errorMessage = ("Wrong format for walltime: {}. Must be in seconds" "or HH:MM:SS.".format(val)) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "GLOBAL", "Variable": "WALLTIME", "ErrorMessage": errorMessage, "Location": self.__location, })
def FFT_POOL_SCRATCH_LIMIT(self, val): if utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "GLOBAL", "Variable": "FFT_POOL_SCRATCH_LIMIT", "Success": True, "Previous": self.__FFT_POOL_SCRATCH_LIMIT, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__FFT_POOL_SCRATCH_LIMIT = val else: errorMessage = ( "FFT_POOL_SCRATCH_LIMIT must be a number. You passed {}". format(val)) self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "GLOBAL", "Variable": "FFTW_POOL_SCRATCH_LIMIT", "Success": False, "Previous": self.__FFTW_POOL_SCRATCH_LIMIT, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "GLOBAL", "Variable": "EXTENDED_FFTW_POOL_SCRATCH_LIMIT", "ErrorMessage": errorMessage, "Location": self.__location, })
def SIGMA(self, val): if utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "LENNARD-JONES", "Variable": "SIGMA", "Success": True, "Previous": self.__SIGMA, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__SIGMA = val else: errorMessage = "SIGMA must be a number." self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "LENNARD-JONES", "Variable": "SIGMA", "Success": False, "Previous": self.__EPSILON, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "LENNARD-JONES", "Variable": "SIGMA", "ErrorMessage": errorMessage, "Location": self.__location, })
def THETA0(self, val): if utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BEND", "Variable": "THETA0", "Success": True, "Previous": self.__THETA0, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__THETA0 = val else: errorMessage = "THETA0 must be a number." self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BEND", "Variable": "THETA0", "Success": False, "Previous": self.__THETA0, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "BEND", "Variable": "THETA0", "ErrorMessage": errorMessage, "Location": self.__location, })
def PMSWAP(self, val): if val is None or utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "MOVE_PROBABILITIES", "Variable": "PMSWAP", "Success": True, "Previous": self.__PMSWAP, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__PMSWAP = val else: errorMessage = "Invalid option for PMSWAP: {}. Should be a number.".format( val) self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "MOVE_PROBABILITIES", "Variable": "PMSWAP", "Success": False, "Previous": self.__PMSWAP, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "MOVE_PROBABILITIES", "Variable": "PMSWAP", "ErrorMessage": errorMessage, "Location": self.__location, })
def TIMECON(self, val): if utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BAROSTAT", "Variable": "TIMECON", "Success": True, "Previous": self.__TIMECON, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__TIMECON = val else: errorMessage = "PRESSURE must be a number." self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BAROSTAT", "Variable": "TIMECON", "Success": False, "Previous": self.__TIMECON, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "BAROSTAT", "Variable": "TIMECON", "ErrorMessage": errorMessage, "Location": self.__location, })
def _validate_timestep(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "MD TIMESTEP must be a number." errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "MD", "Variable": "TIMESTEP", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_KBS32(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "KBS32 should be a number." errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "BEND", "Variable": "KBS32", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_THETA0(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "THETA0 should be number" errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "THETA0", "Variable": "KIND", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_SIGMA(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "SIGMA should be a number." errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "LENNARD-JONES", "Variable": "SIGMA", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_timecon(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "BAROSTAT TIMECON must be a number." errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "BAROSTAT", "Variable": "TIMECON", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_temperature(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "MD TEMPERATURE must be a number. You provided {}".format( val) errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "MD", "Variable": "TEMPERATURE", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_PMTRANS(val, errorLog=[]): if utilities.is_number(val) or (val is None): return val else: errorMessage = "Invalid option for PMTRANS: {}. Must be a number.".format( val) errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "MOVE_PROBABILITIES", "Variable": "PMTRANS", "ErrorMessage": errorMessage, }) raise TypeError
def _validate_RMCLTRANS(val, errorLog=[]): if val is None or utilities.is_number(val): return val else: errorMessage = "Invalid option for RMCLTRANS: {}. Must be an number.".format( val) errorLog.append({ "Date": datetime.datetime.now(), "Type": "init", "Module": "BOX_DISPLACEMENTS", "Variable": "RMCLTRANS", "ErrorMessage": errorMessage, }) raise TypeError
def RMCLTRANS(self, val): if val is None or utilities.is_number(val): self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BOX_DISPLACEMENTS", "Variable": "RMCLTRANS", "Success": True, "Previous": self.__RMCLTRANS, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__RMCLTRANS = val else: errorMessage = ( "Invalid option for RMCLTRANS: {}. It should be a number.". format(val)) self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BOX_DISPLACEMENTS", "Variable": "RMCLTRANS", "Success": False, "Previous": self.__RMCLTRANS, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "BOX_DISPLACEMENTS", "Variable": "RMCLTRANS", "ErrorMessage": errorMessage, "Location": self.__location, })
def PMCLUS_BOX(self, val): if utilities.is_number(val) or val is None: self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BOX_PROBABILITIES", "Variable": "PMCLUS_BOX", "Success": True, "Previous": self.__PMCLUS_BOX, "New": val, "ErrorMessage": None, "Location": self.__location, }) self.__PMCLUS_BOX = val else: errorMessage = ( "Invalid option for PMCLUS_BOX: {}. Should be a number.". format(val)) self.__changeLog.append({ "Date": datetime.datetime.now(), "Module": "BOX_PROBABILITIES", "Variable": "PMCLUS_BOX", "Success": False, "Previous": self.__PMCLUS_BOX, "New": val, "ErrorMessage": errorMessage, "Location": self.__location, }) self.__errorLog.append({ "Date": datetime.datetime.now(), "Type": "Setter", "Module": "BOX_PROBABILITIES", "Variable": "PMCLUS_BOX", "ErrorMessage": errorMessage, "Location": self.__location, })