当前位置: 首页>>代码示例>>Python>>正文


Python ParmedTools.ParmedActions类代码示例

本文整理汇总了Python中ParmedTools.ParmedActions的典型用法代码示例。如果您正苦于以下问题:Python ParmedActions类的具体用法?Python ParmedActions怎么用?Python ParmedActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ParmedActions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: strip

def strip(root, amber_prmtop, messages):
   """ Strips a mask from the topology file """
   if amber_prmtop.parm.chamber:
      showerror('Not Implemented', 'The strip command does not yet work with ' +
                'chamber topologies')
      return
   # We need a mask, new radius, new epsilon, and for chamber topologies,
   # a new radius-1-4 and epsilon-1-4. Don't add the latter ones until we
   # know if we have a chamber prmtop or not.
   widget_list = [('MaskEntry', 'Atoms to strip from topology')]
   # We need 5 string variables, then get the description. 
   var_list = [StringVar()]
   description=('Strips the selected atoms from the topology file. All\n' +
                'remaining atoms and parameters remain unchanged. Any\n' +
                'parameters associated with stripped atoms are removed.')
   # Create the window, open it, then wait for it to close
   cmd_window = _guiwidgets.ActionWindow('addLJType', amber_prmtop,
                     widget_list, var_list, description)
   cmd_window.wait_window()
   # See if we got any variables back
   var = var_list[0]
   if not var.get(): return
   try:
      action = ParmedActions.strip(amber_prmtop, ArgumentList(var.get()))
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:27,代码来源:_guiactions.py

示例2: printinfo

def printinfo(root, amber_prmtop, messages):
   """ Prints all of the info in a given FLAG """
   # Set up the window
   # variables we need for printInfo
   widget_list = [('Entry', '%FLAG you want info from')]
   # Variable list -- we need a single string
   var_list = [StringVar()]
   # description
   description = ' '.join(ParmedActions.printinfo.__doc__.split())
   cmd_window = _guiwidgets.ActionWindow('printInfo', amber_prmtop,
                             widget_list, var_list, description)
   cmd_window.wait_window()
   # Make sure we didn't cancel (or just press OK with no input), or just leave
   var = var_list[0].get()
   if not var: return
   # Now that we did something, do it
   action = ParmedActions.printinfo(amber_prmtop, ArgumentList(var))
   if not action.found:
      showerror('Not Found!', '%%FLAG %s not found!' % var.upper())
      return

   window = Toplevel(root)
   window.resizable(True, True)
   window.title('%%FLAG %s Info in %s' % (var.upper(), amber_prmtop))
   text = _guiwidgets.ExitingScrollText(window, None, spacing3=5, padx=5,
                                        pady=5, width=82, height=20)
   text.write(action)
   text.pack(fill=BOTH, expand=1)
   window.wait_window()

   messages.write('Wrote info for flag %s\n' % var.upper())
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:31,代码来源:_guiactions.py

示例3: change

def change(root, amber_prmtop, messages):
   """ Allows us to change a specific atomic property """
   # The spinbox is sent with the Spinbox, label, and then a list of all of the
   # values to give to it
   widget_list = [('Spinbox', 'Property to change', 'CHARGE', 'MASS',
                   'RADII', 'SCREEN', 'ATOM_NAME', 'AMBER_ATOM_TYPE',
                   'ATOM_TYPE_INDEX', 'ATOMIC_NUMBER'),
                  ('MaskEntry', 'Atoms to change'),
                  ('Entry', 'New Value for Property')]
   # We need 3 string variables, then get the description
   var_list = [StringVar(), StringVar(), StringVar()]
   description = 'Changes the property of given atoms to a new value'
   # Create the window, open it, then wait for it to close
   cmd_window = _guiwidgets.ActionWindow('change', amber_prmtop,
                     widget_list, var_list, description)
   cmd_window.wait_window()
   # See if we got any variables back
   vars_found = True in [bool(v.get()) for v in var_list]
   if not vars_found: return
   # If we did, store them and pass it to the class
   var_list = [v.get() for v in var_list]
   try:
      action = ParmedActions.change(amber_prmtop, ArgumentList(var_list))
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:26,代码来源:_guiactions.py

示例4: writeoff

def writeoff(root, amber_prmtop, messages):
   """ Dumps an OFF library to a given filename """
   fname = save_file_chooser('OFF library', '.lib')
   if fname: 
      action = ParmedActions.writeoff(amber_prmtop, ArgumentList(fname))
      messages.write('%s\n' % action)
      action.execute()
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:7,代码来源:_guiactions.py

示例5: writefrcmod

def writefrcmod(root, amber_prmtop, messages):
   """ Dumps an frcmod file to a given filename """
   fname = save_file_chooser('frcmod', '.frcmod')
   if fname: 
      action = ParmedActions.writefrcmod(amber_prmtop, fname)
      action.execute()
      messages.write('%s\n' % action)
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:7,代码来源:_guiactions.py

示例6: changelj14pair

def changelj14pair(root, amber_prmtop, messages):
   """ Changes specific 1-4 Lennard Jones pairs """
   # Only good for chamber topologies
   if not amber_prmtop.parm.chamber:
      showerror('Incompatible',
                'changeLJ14Pair is only valid for chamber topologies!')
      return
   # variables we need for changelj14pair
   widget_list = [('MaskEntry', 'Atom(s) Type 1 Mask'),
                  ('MaskEntry', 'Atom(s) Type 2 Mask'),
                  ('Entry', 'Combined Radius'),
                  ('Entry', 'Combined Well Depth')]
   # Variable list -- we need 2 masks and 2 floats
   var_list = [StringVar(), StringVar(), StringVar(), StringVar()]
   # description
   description = ' '.join(ParmedActions.changeljpair.__doc__.split())
   cmd_window = _guiwidgets.ActionWindow('changeLJ14Pair', amber_prmtop,
                             widget_list, var_list, description)
   cmd_window.wait_window()
   # Make sure we didn't cancel (or just press OK with no input), or just leave
   vars_exist = True in [bool(v.get()) for v in var_list]
   if not vars_exist: return
   # Now that we did something, do it
   var_list = [v.get() for v in var_list]
   try:
      action=ParmedActions.changelj14pair(amber_prmtop, ArgumentList(var_list))
      messages.write('%s\n' % action)
      action.execute()
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:30,代码来源:_guiactions.py

示例7: changeljsingletype

def changeljsingletype(root, amber_prmtop, messages):
   """ Changes radius/well depth of a single LJ type given by the mask """
   # We need a mask, radius, and well depth
   widget_list = [('MaskEntry', 'Mask to change LJ Type'),
                  ('Entry', 'New LJ Radius'), ('Entry', 'New LJ Depth')]
   var_list = [StringVar(), StringVar(), StringVar()]
   description = "Change a given atom type's LJ radius and well depth"
   # Create the window, open it, then wait for it to close
   cmd_window = _guiwidgets.ActionWindow('changeLJSingleType', amber_prmtop,
                     widget_list, var_list, description)
   cmd_window.wait_window()
   # See if we got any variables back
   vars_found = True in [bool(v.get()) for v in var_list]
   if not vars_found: return
   # addljtype expects any _non_specified variables to be None
   var_list = [v.get() for v in var_list]
   for i, v in enumerate(var_list):
      if not v: var_list[i] = None
   # If we did, store them and pass it to the class
   try:
      action = ParmedActions.changeljsingletype(amber_prmtop,
                                                ArgumentList(var_list))
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:25,代码来源:_guiactions.py

示例8: addexclusions

def addexclusions(root, amber_prmtop, messages):
   """ Adds atoms to other atoms' exclusion list """
   # We need 2 masks
   widget_list = [('MaskEntry', 'Atoms to add excluded atoms to'),
                  ('MaskEntry', 'Atoms to exclude from other mask')]
   # We have 2 mask variables
   var_list = [StringVar(), StringVar()]
   # Description
   description=('Allows you to add arbitrary excluded atoms to exclusion\n' +
       'lists. This omits all non-bonded interactions in the direct-space\n' +
       'calculation, but does not omit interactions from adjacent cells in\n' +
       'periodic simulations')
   cmd_window = _guiwidgets.ActionWindow('addExclusions', amber_prmtop,
                     widget_list, var_list, description)
   cmd_window.wait_window()
   
   # Bail out if we didn't get any variables
   if not True in [bool(v.get()) for v in var_list]: return
   
   var_list = [v.get() for v in var_list]
   try:
      action = ParmedActions.addexclusions(amber_prmtop, ArgumentList(var_list))
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:25,代码来源:_guiactions.py

示例9: setangle

def setangle(root, amber_prmtop, messages):
   """ Sets (adds or changes) an angle in the topology file """
   # We need 3 masks, a force constant, and an equilibrium angle
   widget_list = [('MaskEntry', 'First atom in angle'),
                  ('MaskEntry', 'Second (middle) atom in angle'),
                  ('MaskEntry', 'Third atom in angle'),
                  ('Entry', 'Force constant (kcal/mol rad**2)'),
                  ('Entry', 'Equilibrium Angle (Degrees)')]
   # We need 5 variables
   var_list = [StringVar(), StringVar(), StringVar(), StringVar(), StringVar()]
   description = ('Sets an angle in the topology file with the given Force ' +
                  'constant in kcal/mol/rad**2\nand the given equilibrium ' +
                  'angle in Degrees. All three masks must specify only a\n' +
                  'single atom. If the angle exists, it will be replaced. If ' +
                  'it doesn\'t, it will be added.')
   # Create the window, open it, then wait for it to close
   cmd_window = _guiwidgets.ActionWindow('setAngle', amber_prmtop, 
                     widget_list, var_list, description)
   cmd_window.wait_window()
   # See if we got any variables back
   vars_found = True in [bool(v.get()) for v in var_list]
   if not vars_found: return
   # If we did, pass them through
   var_list = [v.get() for v in var_list]
   try:
      action = ParmedActions.setangle(amber_prmtop, ArgumentList(var_list))
      messages.write('%s\n' % action)
      action.execute()
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:31,代码来源:_guiactions.py

示例10: addpdb

def addpdb(root, amber_prmtop, messages):
    """ Adds PDB information to a topology file """

    # Get the name of the file
    type_list = [('PDB', '*.pdb'), ('All Files', '*')]
    fname = file_chooser('PDB File', type_list)
    if not fname: return

    widget_list = [('Checkbutton', 'Require all residue names be consistent.'),
                   ('Checkbutton', 'Print element names in %FLAG ELEMENT'),
                   ('Checkbutton', 'Print all insertion codes, even if all are '
                                   'blank.')]
   
    var_list = [StringVar(value='no') for i in range(3)]
    description = ('Adds information from the PDB file (e.g., CHAIN IDs) to '
                   'the topology file')
    # Create the window, open it, then wait for it to close
    cmd_window = _guiwidgets.ActionWindow('addPDB', amber_prmtop, widget_list,
                                          var_list, description)
    cmd_window.wait_window()
    # See if we got any variables back
    vars_found = True in [bool(v.get()) for v in var_list]
    if not vars_found: return
    newvars = [fname]
    # If we did, pass them through
    if var_list[0] == 'yes': newvars.append('strict')
    if var_list[1] == 'yes': newvars.append('elem')
    if var_list[1] == 'yes': newvars.append('allicodes')
    try:
        action = ParmedActions.addpdb(amber_prmtop, ArgumentList(newvars))
        messages.write('%s\n' % action)
        action.execute()
    except Exception, err:
        showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
        return
开发者ID:jpthompson17,项目名称:ParmEd,代码行数:35,代码来源:_guiactions.py

示例11: deletedihedral

def deletedihedral(root, amber_prmtop, messages):
   """ Deletes a dihedral between 4 given atoms """
   # We need 4 masks
   widget_list = [('MaskEntry', 'First (end) atom in dihedral'),
                  ('MaskEntry', 'Second (middle) atom in dihedral'),
                  ('MaskEntry', 'Third (middle) atom in dihedral'),
                  ('MaskEntry', 'Fourth (end) atom in dihedral')]
   # We need 4 variables
   var_list = [StringVar() for i in range(4)]
   description = ('Deletes dihedrals between the atoms specified in mask1, ' +
                  'mask2, mask3, and mask4.\nIt will try to match dihedrals ' +
                  'only in the order given or reverse order. Dihedrals are\n' +
                  'specified by atom N in mask1, mask2, mask3, and mask4,' +
                  'where N is the selected\natom in that mask.')
   # Create the window, open it, then wait for it to close
   cmd_window = _guiwidgets.ActionWindow('deleteDihedral', amber_prmtop, 
                     widget_list, var_list, description)
   cmd_window.wait_window()
   # See if we got any variables back
   vars_found = True in [bool(v.get()) for v in var_list]
   if not vars_found: return
   # If we did, pass them through
   var_list = [v.get() for v in var_list]
   try:
      action = ParmedActions.deletedihedral(amber_prmtop,ArgumentList(var_list))
      messages.write('%s\n' % action)
      action.execute()
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
      return
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:30,代码来源:_guiactions.py

示例12: hmassrepartition

def hmassrepartition(root, amber_prmtop, messages):
    """
    Repartitions mass by making H-atoms heavier and attached heteroatoms
    lighter by the same amount to preserve the same total mass
    """
    # The spinbox is sent with the Spinbox, label, and then a list of all of the
    # values to give to it
    widget_list = [('Entry', 'New hydrogen mass (daltons)'),
                   ('Checkbutton', 'Repartition waters?')]
    # We need 2 string variables, then get the description
    var_list = [StringVar(value='3.024'), StringVar(value='no')]
    description = ('Repartitions atomic masses to keep total mass the same '
                   'while increasing H-atom masses to allow using a larger '
                   'time step.')
    # Create the window, open it, then wait for it to close
    cmd_window = _guiwidgets.ActionWindow('HMassChange', amber_prmtop,
                                          widget_list, var_list, description)
    cmd_window.wait_window()
    # See if we got any variables back
    vars_found = var_list[0].get() or var_list[1].get()
    if not vars_found: return
    # If we did, store them and pass it to the class
    var_list = [v.get() for v in var_list]
    # Convert the check button into the correct keyword
    if var_list[1] == 'yes':
        var_list[1] = 'dowater'
    else:
        var_list[1] = ''
    try:
        action = ParmedActions.hmassrepartition(amber_prmtop,
                                                ArgumentList(var_list))
    except Exception, err:
        showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
        return
开发者ID:jpthompson17,项目名称:ParmEd,代码行数:34,代码来源:_guiactions.py

示例13: scale

def scale(root, amber_prmtop, messages):
    """ Allows us to scale every value in a particular prmtop section """
    # The spinbox is sent with the Spinbox, label, and then a list of all of the
    # values to give to it
    changeable_properties = ['Spinbox', 'Property to scale']
    for flag in amber_prmtop.parm.flag_list:
        if amber_prmtop.parm.formats[flag].type is float:
            changeable_properties.append(flag)
    widget_list = [changeable_properties, ('Entry', 'Value to scale by')]
    # We need 2 string variables, then get the description
    var_list = [StringVar(), StringVar()]
    description = 'Scales all values in a given prmtop section by a given value'
    # Create the window, open it, then wait for it to close
    cmd_window = _guiwidgets.ActionWindow('scale', amber_prmtop,
                                          widget_list, var_list, description)
    cmd_window.wait_window()
    # See if we got any variables back
    vars_found = var_list[0].get() or var_list[1].get()
    if not vars_found: return
    # If we did, store them and pass it to the class
    var_list = [v.get() for v in var_list]
    try:
        action = ParmedActions.scale(amber_prmtop, ArgumentList(var_list))
    except Exception, err:
        showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
        return
开发者ID:jpthompson17,项目名称:ParmEd,代码行数:26,代码来源:_guiactions.py

示例14: printdetails

def printdetails(root, amber_prmtop, messages):
   """ Prints details about a given Amber mask """
   title = 'Print Details'
   mask = StringVar()
   cmd_window = Toplevel(root)
   cmd_window.title(title)
   mask_entry = _guiwidgets.MaskEntry(cmd_window, amber_prmtop,
                     'Input an Amber Mask', mask, cmd_window)
   mask_entry.config(pady=10)
   mask_entry.grid(row=0, column=0, sticky=N+E+S+W)
   button = Button(cmd_window, text='OK / Quit', command=cmd_window.destroy)
   button.grid(row=1, column=0, sticky=N+E+S+W)
   cmd_window.wait_window()
   if not mask.get(): return
   # Print our mask
   window = Toplevel(root)
   window.resizable(True, True)
   window.title('Atom information for mask %s' % mask.get())
   text = _guiwidgets.ExitingScrollText(window, None, spacing3=5, padx=5,
                                        pady=5, width=100, height=20)
   text.pack(fill=BOTH, expand=1)
   action = ParmedActions.printdetails(amber_prmtop, mask.get())
   text.write(action)
   messages.write('Printed Amber Mask details on [%s]\n' % mask.get())
   window.wait_window()
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:25,代码来源:_guiactions.py

示例15: changeljpair

def changeljpair(root, amber_prmtop, messages):
   """ Changes a pair-wise LJ interaction for pre-combined epsilon/Rmin """
   # The variables we need for changeljpair
   widget_list = [('MaskEntry', 'Atom(s) Type 1 Mask'),
                  ('MaskEntry', 'Atom(s) Type 2 Mask'),
                  ('Entry', 'Combined Radius'),
                  ('Entry', 'Combined Well Depth')]
   # Variable list -- we need 2 masks and 2 floats
   var_list = [StringVar(), StringVar(), StringVar(), StringVar()]
   # description
   description = ' '.join(ParmedActions.changeljpair.__doc__.split())
   cmd_window = _guiwidgets.ActionWindow('changeLJPair', amber_prmtop,
                             widget_list, var_list, description)
   cmd_window.wait_window()
   # Make sure we didn't cancel (or just press OK with no input), or just leave
   vars_exist = True in [bool(v.get()) for v in var_list]
   if not vars_exist: return
   # Now that we did something, do it
   var_list = [v.get() for v in var_list]
   try:
      action = ParmedActions.changeljpair(amber_prmtop, ArgumentList(var_list))
      messages.write('%s\n' % action)
      action.execute()
   except Exception, err:
      showerror('Unexpected Error!', '%s: %s' % (type(err).__name__, err))
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:25,代码来源:_guiactions.py


注:本文中的ParmedTools.ParmedActions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。