Пример #1
0
def pairNonbondCreator(name, model, key2index, filter):
    result = NonbondEnergyProxy()
    result.name = name
    result.filter = filter
    if ':columnb-constant:' in key2index and hasattr(model, 'charges'):
        result.columnb_constant = key2index[':columnb-constant:']
    result.par0 = key2index[':start:']
    return result
Пример #2
0
def pairCreator(name, model, key2index, filter):
    result = NonbondEnergyProxy()
    result.name = name
    type = name.split('/')[0]
    rank = 0
    if type == 'pair-14':
        fffunc = FunctionPair14()
        rank = 2
    elif type == 'pair-13':
        fffunc = FunctionPair13()
        rank = 2
    else:
        assert False
    
    lists = []
    start = 0
    for mol, n in model.mols:
        data = fffunc.setup(mol, key2index)
        for atom, _, _ in data:
            for i in range(len(atom)):
                atom[i] = mol.index(atom[i])
        natoms = len(mol.atoms)
        for _ in range(n):
            for atom, _, index in data:
                for j in atom:
                    lists.append(j+start)
                lists.append(index)
            start += natoms
    if lists:
        result.lists = lists
        if ':columnb-constant:' in key2index and hasattr(model, 'charges'):
            result.columnb_constant = key2index[':columnb-constant:']
    
        if rank != 0:
            screenPairList(filter, result, rank)
        return result
    else:
        return None