Beispiel #1
0
#filename = "1ivs.cif"
cleaned_filename = filename[:-4] + "_cleaned.cif"
if not os.path.exists(cleaned_filename):
    chain_id = sys.argv[2]

    if chain_id is None:
        raise Exception("Chain ID must be provided!")
    clean_pdb(filename, cleaned_filename, chain_id, parameters)

h = float(sys.argv[3])
steps = int(sys.argv[4])
save_step = int(sys.argv[5])

# Load PDB file
print("initializing")
pdb = PDB(cleaned_filename)
N = pdb.positions.shape[0]


def parse_name(name):
    if name == "OP1":
        name = "O1P"
    if name == "OP2":
        name = "O2P"
    return name


#get neighbours of i and then angles
all_angles = []
for i in range(0, N):
    neighbours = []
Beispiel #2
0
from mpi4py import MPI
from pdb import PDB
from numpy import array, zeros

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

if rank == 0:
    pdb = PDB('5ire.pdb')
    n = len(pdb)
    # how many atoms should each process get?
    chunk = 3 * (n / size)
    left = 3 * (n % size)

    # calculate send counts and offsets
    counts = [chunk] * size
    counts[-1] += left
    counts = tuple(counts)
    offsets = [x * chunk for x in range(size)]
    offsets = tuple(offsets)

    # send chunk size to everyone and prepare a receive array
    comm.bcast(counts, root=0)
    comm.bcast(offsets, root=0)
    my_coords = zeros((counts[rank], 3), float)
    # scatter coordinates to all processes
    comm.Scatterv([pdb.coordinates, counts, offsets, MPI.DOUBLE], my_coords)

    # calculate the sum of coordinates
    result = sum(my_coords)
Beispiel #3
0
#   2 (e)
#  / \
# 3---1
#  \ /
#   4
#
# tetrahedral (f)
#   3-2
#   |X|
#   4-1

if __name__ == "__main__":
    from pdb import PDB
    pdb = PDB([("1", 1, 'H3'), ("2", 1, 'H3'), ("3", 1, 'H3'), ("4", 1, 'C3'),
               ("5", 1, 'H2'), ("6", 1, 'H2'), ("7", 1, 'C2'), ("8", 1, 'H2'),
               ("9", 1, 'H2'), ("10", 1, 'C2'), ("11", 1, 'H3'),
               ("12", 1, 'H3'), ("13", 1, 'H3'), ("14", 1, 'C3')], [], [],
              edge=[(0, 3), (1, 3), (2, 3), (3, 6), (4, 6), (5, 6), (6, 9),
                    (7, 9), (8, 9), (9, 13), (10, 13), (11, 13), (12, 13)])
    #def f(i,j):
    #    return i == 4 or j == 4
    #sel = Conn(1,2) * Type('C', 'H') | Conn(1,3) * IdFn(f)
    #sel = OOP()
    #sel = Conn(1,2,3)
    #sel = Conn(1,3)
    #sel = ( Conn(1,2,3,4) | (Conn(1,3,2,1) & Id(1,None,None,1)) ) \
    #            & Type(None, 'C', 'C', None)
    #sel = Conn(1,2) | Conn(1,3) | Conn(1,4)
    #print set(sel.run(pdb))
    top = read_terms(pdb, '../share/vanilla.py')
    from cg_topol import show_index
    show_index(top)