src/utilities.py
def update_bond_lists_mpi(bond_matrix, comm, size, rank):
	"""
	update_bond_lists(bond_matrix)

	Return atom indicies of angular terms
	"""

	N = bond_matrix.shape[0]

	"Get indicies of bonded beads"
	bond_index_full = np.argwhere(bond_matrix)

	"Create index lists for referring to in 2D arrays"
	indices_full = create_index(bond_index_full)

	angle_indices = []
	angle_bond_indices = []

	"Count number of unique bonds"
	count = np.unique(bond_index_full.T[0]).shape[0]

	"""
	"Find indicies of ends of fibrils"
	fib_end_check = np.argwhere(np.sum(bond_matrix, axis=1) <= 1)
	n_fib_end = fib_end_check.shape[0]
	fib_end_check_ind = np.tile(fib_end_check, n_fib_end)
	fib_end_check_ind = np.stack((fib_end_check_ind, fib_end_check_ind.T), axis=2)
	fib_end_check_ind = create_index(fib_end_check_ind[np.where(~np.eye(n_fib_end,dtype=bool))])

	fib_end = np.zeros(bond_matrix.shape)
	fib_end[fib_end_check_ind] += 1
	"""

	for n in range(N):
		slice_full = np.argwhere(bond_index_full.T[0] == n)

		if slice_full.shape[0] > 1:
			angle_indices.append(np.unique(bond_index_full[slice_full].flatten()))
			angle_bond_indices.append(bond_index_full[slice_full][::-1])

	bond_indices = np.nonzero(np.array_split(bond_matrix, size)[rank])
	angle_indices = np.array_split(angle_indices, size)[rank]
	angle_bond_indices = create_index(np.array_split(angle_bond_indices, size)[rank].reshape((2 * len(angle_indices), 2)))
	
	return bond_indices, angle_indices, angle_bond_indices

	update_bond_lists(bond_matrix)

	Return atom indicies of angular terms
	
update_bond_lists(bond_matrix)
Return atom indicies of angular terms
update_bond_lists ( bond_matrix ) Return atom indicies of angular terms
def update_bond_lists_mpi(bond_matrix, comm, size, rank):
	N = bond_matrix.shape[0]
	bond_index_full = np.argwhere(bond_matrix)
	indices_full = create_index(bond_index_full)
	angle_indices = []
	angle_bond_indices = []
	count = np.unique(bond_index_full.T[0]).shape[0]
	for n in range(N):
		slice_full = np.argwhere(bond_index_full.T[0] == n)
		if slice_full.shape[0] > 1:
			angle_indices.append(np.unique(bond_index_full[slice_full].flatten()))
			angle_bond_indices.append(bond_index_full[slice_full][::-1])
	bond_indices = np.nonzero(np.array_split(bond_matrix, size)[rank])
	angle_indices = np.array_split(angle_indices, size)[rank]
	angle_bond_indices = create_index(np.array_split(angle_bond_indices, size)[rank].reshape((2 * len(angle_indices), 2)))
	return bond_indices, angle_indices, angle_bond_indices
def update_bond_lists_mpi ( bond_matrix , comm , size , rank ) : N = bond_matrix . shape [ 0 ] "Get indicies of bonded beads" bond_index_full = np . argwhere ( bond_matrix ) "Create index lists for referring to in 2D arrays" indices_full = create_index ( bond_index_full ) angle_indices = [ ] angle_bond_indices = [ ] "Count number of unique bonds" count = np . unique ( bond_index_full . T [ 0 ] ) . shape [ 0 ] """
	"Find indicies of ends of fibrils"
	fib_end_check = np.argwhere(np.sum(bond_matrix, axis=1) <= 1)
	n_fib_end = fib_end_check.shape[0]
	fib_end_check_ind = np.tile(fib_end_check, n_fib_end)
	fib_end_check_ind = np.stack((fib_end_check_ind, fib_end_check_ind.T), axis=2)
	fib_end_check_ind = create_index(fib_end_check_ind[np.where(~np.eye(n_fib_end,dtype=bool))])

	fib_end = np.zeros(bond_matrix.shape)
	fib_end[fib_end_check_ind] += 1
	""" for n in range ( N ) : slice_full = np . argwhere ( bond_index_full . T [ 0 ] == n ) if slice_full . shape [ 0 ] > 1 : angle_indices . append ( np . unique ( bond_index_full [ slice_full ] . flatten ( ) ) ) angle_bond_indices . append ( bond_index_full [ slice_full ] [ : : - 1 ] ) bond_indices = np . nonzero ( np . array_split ( bond_matrix , size ) [ rank ] ) angle_indices = np . array_split ( angle_indices , size ) [ rank ] angle_bond_indices = create_index ( np . array_split ( angle_bond_indices , size ) [ rank ] . reshape ( ( 2 * len ( angle_indices ) , 2 ) ) ) return bond_indices , angle_indices , angle_bond_indices
update_bond_lists(bond_matrix)
Return atom indicies of angular terms
update_bond_lists ( bond_matrix ) Return atom indicies of angular terms
"""
	update_bond_lists(bond_matrix)

	Return atom indicies of angular terms
	""" "Get indicies of bonded beads" "Create index lists for referring to in 2D arrays" "Count number of unique bonds" """
	"Find indicies of ends of fibrils"
	fib_end_check = np.argwhere(np.sum(bond_matrix, axis=1) <= 1)
	n_fib_end = fib_end_check.shape[0]
	fib_end_check_ind = np.tile(fib_end_check, n_fib_end)
	fib_end_check_ind = np.stack((fib_end_check_ind, fib_end_check_ind.T), axis=2)
	fib_end_check_ind = create_index(fib_end_check_ind[np.where(~np.eye(n_fib_end,dtype=bool))])

	fib_end = np.zeros(bond_matrix.shape)
	fib_end[fib_end_check_ind] += 1
	"""
bond_matrix
comm
size
rank