Example #1
0
    def __init__(self, program='sander', verbosity=1):
        # define instance data
        self.program = program  # which program we're creating the input file for
        self.cntrl_obj = cntrl(
        )  # object with cntrl namelist vars in a dictionary
        self.ewald_obj = ewald(
        )  # object with ewald namelist vars in a dictionary
        self.pb_obj = pb()  # object with pb namelist vars in a dictionary
        self.qmmm_obj = qmmm(
        )  # object with qmmm namelist vars in a dictionary
        self.verbosity = 0  # verbosity level: 0 -- print nothing
        #                  1 -- print errors
        #                  2 -- print errors and warnings
        #                  3 -- print errors, warnings, and notes
        self.cards = [
        ]  # array that has all of the input cards that come after namelists
        self.cntrl_nml = {}  # dictionary with cntrl namelist vars
        self.cntrl_nml_defaults = {
        }  # dictionary with default cntrl namelist vars
        self.ewald_nml = {}  # dictionary with ewald namelist vars
        self.ewald_nml_defaults = {
        }  # dictionary with default ewald namelist vars
        self.pb_nml = {}  # dictionary with pb namelist vars
        self.pb_nml_defaults = {}  # dictionary with default pb namelist vars
        self.qmmm_nml = {}  # dictionary with qmmm namelist vars
        self.qmmm_nml_defaults = {
        }  # dictionary with default qmmm namelist vars
        self.valid_namelists = [
        ]  # array with valid namelists for each program
        self.title = 'mdin prepared by mdin.py'  # title for the mdin file
        self.extra_lines = ''

        if self.program == "sander":
            self.cntrl_nml = self.cntrl_obj.sander
            self.ewald_nml = self.ewald_obj.sander
            self.pb_nml = self.pb_obj.sander
            self.qmmm_nml = self.qmmm_obj.sander
            self.valid_namelists = ['cntrl', 'ewald', 'qmmm', 'pb']
        elif self.program == "sander.APBS":
            self.cntrl_nml = self.cntrl_obj.sander
            self.pb_nml = self.pb_obj.sanderAPBS
            self.valid_namelists = ['cntrl', 'apbs']
        elif self.program == "pmemd":
            self.cntrl_nml = self.cntrl_obj.pmemd
            self.ewald_nml = self.ewald_obj.pmemd
            self.valid_namelists = ['cntrl', 'ewald']
        else:
            print >> stderr, 'Error: program (%s) unrecognized!' % self.program
            return

        self.cntrl_nml_defaults = self.cntrl_nml.copy()
        self.ewald_nml_defaults = self.ewald_nml.copy()
        self.pb_nml_defaults = self.pb_nml.copy()
        self.qmmm_nml_defaults = self.qmmm_nml.copy()
Example #2
0
   def __init__(self, program = 'sander', verbosity = 1):
      # define instance data
      self.program = program        # which program we're creating the input file for
      self.cntrl_obj = cntrl()      # object with cntrl namelist vars in a dictionary
      self.ewald_obj = ewald()      # object with ewald namelist vars in a dictionary
      self.pb_obj = pb()            # object with pb namelist vars in a dictionary
      self.qmmm_obj = qmmm()        # object with qmmm namelist vars in a dictionary
      self.verbosity = 0            # verbosity level: 0 -- print nothing
                                    #                  1 -- print errors
                                    #                  2 -- print errors and warnings
                                    #                  3 -- print errors, warnings, and notes
      self.cards = []               # array that has all of the input cards that come after namelists
      self.cntrl_nml = {}           # dictionary with cntrl namelist vars
      self.cntrl_nml_defaults = {}  # dictionary with default cntrl namelist vars
      self.ewald_nml = {}           # dictionary with ewald namelist vars
      self.ewald_nml_defaults = {}  # dictionary with default ewald namelist vars
      self.pb_nml = {}              # dictionary with pb namelist vars
      self.pb_nml_defaults = {}     # dictionary with default pb namelist vars
      self.qmmm_nml = {}            # dictionary with qmmm namelist vars
      self.qmmm_nml_defaults = {}   # dictionary with default qmmm namelist vars
      self.valid_namelists = []     # array with valid namelists for each program
      self.title = 'mdin prepared by mdin.py'   # title for the mdin file
      self.extra_lines = ''


      if self.program == "sander":
         self.cntrl_nml = self.cntrl_obj.sander
         self.ewald_nml = self.ewald_obj.sander
         self.pb_nml = self.pb_obj.sander
         self.qmmm_nml = self.qmmm_obj.sander
         self.valid_namelists = ['cntrl','ewald','qmmm','pb']
      elif self.program == "sander.APBS":
         self.cntrl_nml = self.cntrl_obj.sander
         self.pb_nml = self.pb_obj.sanderAPBS
         self.valid_namelists = ['cntrl','apbs']
      elif self.program == "pmemd":
         self.cntrl_nml = self.cntrl_obj.pmemd
         self.ewald_nml = self.ewald_obj.pmemd
         self.valid_namelists = ['cntrl','ewald']
      else:
         print >> stderr, 'Error: program (%s) unrecognized!' % self.program
         return

      self.cntrl_nml_defaults = self.cntrl_nml.copy()
      self.ewald_nml_defaults = self.ewald_nml.copy()
      self.pb_nml_defaults = self.pb_nml.copy()
      self.qmmm_nml_defaults = self.qmmm_nml.copy()