예제 #1
0
 def _wizard(name, arg, kwd, replace, _self=cmd):
     r = DEFAULT_ERROR
     from . import wizard
     try:
         full_name = 'pymol.wizard.' + name
         __import__(full_name)
     except ImportError:
         print("Error: Sorry, couldn't import the '" + name + "' wizard.")
     else:
         mod_obj = sys.modules[full_name]
         if mod_obj:
             oname = name.capitalize()
             r = DEFAULT_SUCCESS
             if hasattr(mod_obj, oname):
                 kwd['_self'] = _self
                 try:
                     wiz = getattr(mod_obj, oname)(*arg, **kwd)
                 except WizardError as e:
                     from pymol.wizard.message import Message
                     wiz = Message("Error: %s" % str(e), _self=_self)
                 if wiz:
                     _self.set_wizard(wiz, replace)
                     _self.do("_ refresh_wizard")
             else:
                 print("Error: Sorry, couldn't find the '" + oname +
                       "' class.")
         else:
             print("Error: Sorry, couldn't import the '" + name +
                   "' wizard.")
     return r
예제 #2
0
파일: nma.py 프로젝트: menchant/pymol-psico
def normalmodes_pdbmat(selection,
                       cutoff=10.0,
                       force=1.0,
                       mass='COOR',
                       first=7,
                       last=10,
                       choose='LOWE',
                       substruct='RESI',
                       blocksize=4,
                       exe='pdbmat',
                       diag_exe='diagrtb',
                       prefix='mode',
                       states=7,
                       factor=-1,
                       clean=1,
                       quiet=1,
                       async_=-1,
                       **kwargs):
    '''
DESCRIPTION

    PDBMAT and DIAGRTB wrapper

    Runs "pdbmat" and "diagrtb" and generates perturbed models for modes
    "first" to "last". WARNING: May run for a long time.

    PDBMAT computes the mass-weighted second derivatives energy matrix,
    using Tirion's model, that is, an elastic network model (ENM).
    In such models, close particles (atoms) are linked by springs.

    http://ecole.modelisation.free.fr/modes.html

NOTES

    Only considers ATOM records, if your model contains MSE residues or
    ligands that you want to consider, prepare it like this:
    mse2met (all)                # for MSE residues
    alter (hetatm), type='ATOM'  # for any hetatm

ARGUMENTS

    selection = string: atom selection

    cutoff = float: interaction distance cutoff in angstroem {default: 10}

    force = float: interaction force constant {default: 1.0}

    mass = string: origin of mass values {default: COOR}

    first = int: first mode to create perturbed model {default: 7}

    last = int: last mode to create perturbed model {default: 10}

    choose = string: eigenvalues chosen {default: LOWE}

    substruct = string: type of substructuring {default: RESI}

    blocksize = int: nb of residues per block {default: 4}
    '''
    args = [
        selection, cutoff, force, mass, first, last, choose, substruct,
        blocksize, exe, diag_exe, prefix, states, factor, clean, quiet
    ]

    quiet, async_ = int(quiet), int(kwargs.pop('async', async_))
    if async_ < 0:
        async_ = not quiet

    if not async_:
        return _normalmodes(*args)

    from pymol.wizard.message import Message
    wiz = Message(['normalmodes: please wait ...', ''], dismiss=0)
    cmd.set_wizard(wiz)

    import threading
    t = threading.Thread(target=_normalmodes, args=args + [wiz])
    t.setDaemon(1)
    t.start()
예제 #3
0
    blocksize = int: nb of residues per block {default: 4}
    '''
    args = [
        selection, cutoff, force, mass, first, last, choose, substruct,
        blocksize, exe, diag_exe, prefix, states, factor, clean, quiet
    ]

    quiet, async = int(quiet), int(async)
    if async < 0:
        async = not quiet

    if not async:
        return _normalmodes(*args)

    from pymol.wizard.message import Message
    wiz = Message(['normalmodes: please wait ...', ''], dismiss=0)
    cmd.set_wizard(wiz)

    import threading
    t = threading.Thread(target=_normalmodes, args=args + [wiz])
    t.setDaemon(1)
    t.start()


def _normalmodes(selection,
                 cutoff,
                 force,
                 mass,
                 first,
                 last,
                 choose,