I am attempting to port a program that I wrote about 20 years ago from FORTRAN to Python. So far, I have bumbled my way to the point that I can get all of the input data resulting from a quantum mechanical calculation of a very simple organic molecule in to a Python program, but am encountering problems with processing the data.

I have an list generated by:   s = np.linspace(start,finish,points)

and an array D:

 [ 0.          2.059801    3.60937686  3.32591826  2.81569212]
 [ 2.059801    0.          4.71452879  4.45776445  4.00467382]
 [ 3.60937686  4.71452879  0.          5.66500917  5.26602175]
 [ 3.32591826  4.45776445  5.66500917  0.          5.02324896]
 [ 2.81569212  4.00467382  5.26602175  5.02324896  0.        ]

Now I can multiply the Array by one element of the list:

s2 = 1.100334448160535050  (The first non-zero list element.)
s2_D = s2*np.array(D)

which results in:

 [ 0.          2.26647     3.97152169  3.65962243  3.09820303]
 [ 2.26647     0.          5.18755844  4.90503178  4.40648056]
 [ 3.97152169  5.18755844  0.          6.23340474  5.79438514]
 [ 3.65962243  4.90503178  6.23340474  0.          5.52725387]
 [ 3.09820303  4.40648056  5.79438514  5.52725387  0.        ]

I checked this, rather laboriously, in a spreadsheet.

However, what I want to do is multiply each element ob D by each element of s and sum all of the products.

I have Goggled quite a bit, but have not found anything too awfully useful.

Any pointers in the right direction will be much appreciated.

Thanks in advance.

--
Stephen P. Molnar, Ph.D.                Life is a fuzzy set
www.molecular-modeling.net              Stochastic and multivariate
(614)312-7528 (c)
Skype: smolnar1
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to