How to use the parmed.amber.mask.AmberMask function in ParmEd

To help you get started, we’ve selected a few ParmEd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CCPBioSim / fesetup / prepare / mdengines / mdebase.py View on Github external
def mask_indexes(self, parmtop, mask):
        """
        Create AMBER mask index generator from parmtop file.

        :param parmtop: parmtop filename
        :type parmtop: string
        :param mask: AMBER mask
        :type mask: integer
        :returns: mask index generator
        """
                
        p = AmberParm(parmtop)
        m = AmberMask(p, mask)

        return m.Selected()
github slochower / pAPRika / paprika / utils.py View on Github external
if amber_index:
        index_offset = 1
    else:
        index_offset = 0
    if isinstance(structure, str):
        structure = return_parmed_structure(structure)
    elif isinstance(structure, ParmedStructureClass):
        pass
    else:
        raise Exception(
            "index_from_mask does not support the type associated with structure:"
            + type(structure)
        )
    # http://parmed.github.io/ParmEd/html/api/parmed/parmed.amber.mask.html?highlight=mask#module-parmed.amber.mask
    indices = [
        i + index_offset for i in pmd.amber.mask.AmberMask(structure, mask).Selected()
    ]
    logger.debug("There are {} atoms in the mask {}  ...".format(len(indices), mask))
    return indices
github CCPBioSim / fesetup / mutate / util.py View on Github external
mask_str = mask0
        idx_list = [i for i in AmberMask(parm0, mask_str).Selected()]
        idx_list2 = idx_list

        pmemd = False
    else:
        parm0 = AmberParm(parm0_fn)
        parm1 = parm0

        logger.write('Patching parmtop %s with masks %s, %s\n' %
                     (parm0_fn, mask0, mask1) )

        mask_str0 = mask0
        mask_str1 = mask1
        idx_list =  [i for i in AmberMask(parm0, mask_str0).Selected()]
        idx_list2 = [i for i in AmberMask(parm0, mask_str1).Selected()]

        pmemd = True

    atn0 = parm0.parm_data['ATOMIC_NUMBER']
    atn1 = parm1.parm_data['ATOMIC_NUMBER']

    mass0 = parm0.parm_data['MASS']
    mass1 = parm1.parm_data['MASS']

    for idx, idx2 in zip(idx_list, idx_list2):
        if atn0[idx] < 0:
            atn0[idx] = atn1[idx2]

        if mass0[idx] == 0.0:
            mass0[idx] = mass1[idx2]
github alanwilter / acpype / ambertools-19-0_linux / bin / OptC4.py View on Github external
"metal ion and heavy atoms in the ligating residues). "
                  "[Default: 1]")
(options, args) = parser.parse_args()

# Print the title of the program
version = '1.1'
print_title('OptC4.py', version)

#lowercase the input variables
options.simupha=options.simupha.lower()
options.minm=options.minm.lower()
options.platf=options.platf.lower()

#Get the metal center information from prmtop and coordinate files
prmtop, mol, atids, resids = read_amber_prm(options.pfile, options.cfile)
mask = AmberMask(prmtop, options.ion_mask)

blist = get_blist(mol, atids)
all_list = get_all_list(mol, blist, atids, 8.0)
alist = all_list.anglist
dlist = all_list.dihlist

#Get the metal ion ids
metids = []       #Atom IDs
mettyps = []      #Amber Atom Type
mettypinds = []   #Atom Type Index
for i in mask.Selected():
    j = i + 1
    metids.append(j)
    atyp = prmtop.parm_data['AMBER_ATOM_TYPE'][i]
    mettyps.append(atyp)
    mettypind = prmtop.parm_data['ATOM_TYPE_INDEX'][i]
github CCPBioSim / fesetup / mutate / util.py View on Github external
mask_str = mask0
        idx_list = [i for i in AmberMask(parm0, mask_str).Selected()]
        idx_list2 = idx_list

        pmemd = False
    else:
        parm0 = AmberParm(parm0_fn)
        parm1 = parm0

        logger.write('Patching parmtop %s with masks %s, %s\n' %
                     (parm0_fn, mask0, mask1) )

        mask_str0 = mask0
        mask_str1 = mask1
        idx_list =  [i for i in AmberMask(parm0, mask_str0).Selected()]
        idx_list2 = [i for i in AmberMask(parm0, mask_str1).Selected()]

        pmemd = True

    atn0 = parm0.parm_data['ATOMIC_NUMBER']
    atn1 = parm1.parm_data['ATOMIC_NUMBER']

    mass0 = parm0.parm_data['MASS']
    mass1 = parm1.parm_data['MASS']

    for idx, idx2 in zip(idx_list, idx_list2):
        if atn0[idx] < 0:
            atn0[idx] = atn1[idx2]

        if mass0[idx] == 0.0:
            mass0[idx] = mass1[idx2]
github CCPBioSim / fesetup / mutate / util.py View on Github external
if parm1_fn != '':
        parm0 = AmberParm(parm0_fn)
        parm1 = AmberParm(parm1_fn)

        if not const.DUMMY_TYPE in parm0.parm_data['AMBER_ATOM_TYPE'] and \
               not const.DUMMY_TYPE in parm1.parm_data['AMBER_ATOM_TYPE']:
            return

        if parm0.ptr('natom') != parm1.ptr('natom'):
            raise errors.SetupError('BUG: parms of different lengths')

        logger.write('Patching parmtops %s, %s with mask %s\n' %
                     (parm0_fn, parm1_fn, mask0) )

        mask_str = mask0
        idx_list = [i for i in AmberMask(parm0, mask_str).Selected()]
        idx_list2 = idx_list

        pmemd = False
    else:
        parm0 = AmberParm(parm0_fn)
        parm1 = parm0

        logger.write('Patching parmtop %s with masks %s, %s\n' %
                     (parm0_fn, mask0, mask1) )

        mask_str0 = mask0
        mask_str1 = mask1
        idx_list =  [i for i in AmberMask(parm0, mask_str0).Selected()]
        idx_list2 = [i for i in AmberMask(parm0, mask_str1).Selected()]

        pmemd = True