Birdada Simret birdada85 at gmail.com writes:
Any help from Numpy community
[[ 0. 1.54 0. 0. 0. 1.08
1.08 1.08 ]
[ 1.54 0. 1.08 1.08 1.08 0. 0.
0. ]
[ 0. 1.08
Birda,
I think this will get you some of the way there:
import numpy as np
x = ... # Here's your 2D atomic distance array
# Create an indexing array
index = np.arange( x.size ).reshape( x.shape )
# Find the non-zero indices
items = index[ x != 0 ]
# You only need the first half
Hi Ryan,Thank you very much indeed, I'm not sure if I well understood your
code, let say, for the example array matrix given represents H3C-CH3
connection(bonding).
the result from your code is:
Rows:[0 0 0 0 1 1 1] # is these for C indices?
Columns: [1 2 3 4 5 6 7] # is these for H
Birdada Simret birdada85 at gmail.com writes:
Hi Ryan,Thank you very much indeed, I'm not sure if I well understood your
code, let say, for the example array matrix given represents H3C-CH3
connection(bonding).
the result from your code is:
Rows: [0 0 0 0 1 1 1] # is these for C
Oh, thanks alot. can the atoms = np.array(['C1', 'C2', 'H3', 'H4', 'H5',
'H6', 'H7', 'H8']) able to make general? I mean, if I have a big
molecule, it seems difficult to label each time. Ofcourse I'm new to
python(even for programing) and I didn't had any knowhow about pandas, but
i will try it.
*
Any help from Numpy community
[[ 0. 1.540. 0. 0.1.08
1.08 1.08 ]
[ 1.540. 1.081.08 1.080. 0.
0. ]
[0. 1.08 0. 0. 0.0.
0.