--
Message: 2
Date: Mon, 03 Apr 2017 11:36:10 +0200
From: Peter Otten <__pete...@web.de>
To: tutor@python.org
Subject: Re: [Tutor] Euclidean Distances between Atoms in a Molecule.
Message-ID: <obt525$ths$1...@blaine.gmane.org>
Content-Type: text/plain;
On 04/03/2017 05:36 AM, Peter Otten wrote:
Stephen P. Molnar wrote:
I am trying to port a program that I wrote in FORTRAN twenty years ago
into Python 3 and am having a hard time trying to calculate the
Euclidean distance between each atom in the molecule and every other
atom in the molecule.
Stephen P. Molnar wrote:
> I am trying to port a program that I wrote in FORTRAN twenty years ago
> into Python 3 and am having a hard time trying to calculate the
> Euclidean distance between each atom in the molecule and every other
> atom in the molecule.
>
> Here is a typical table of
Dr. Molnar:
This might be your solution:
>>> import numpy
>>> a = numpy.array((-3.265636, 0.198894, 0.090858))
>>> b = numpy.array((-1.307161, 1.522212, 1.003463))
>>> dist = numpy.linalg.norm(a-b)
>>> dist
2.5337013913983633
>>>
Qiao Qiao
> On Apr 2, 2017, at 1:41 PM, Stephen P. Molnar
Hi Stephen-
The `scipy.spatial.distance` module (part of the SciPy package) contains
what you will need -- specifically, the `scipy.spatial.distance.pdist`
function, which takes a matrix of m observations in n-dimensional space,
and returns a condensed distance matrix as described in
On Sun, Apr 02, 2017 at 01:41:27PM -0400, Stephen P. Molnar wrote:
> I am trying to port a program that I wrote in FORTRAN twenty years ago
> into Python 3 and am having a hard time trying to calculate the
> Euclidean distance between each atom in the molecule and every other
> atom in the
On 02/04/17 18:41, Stephen P. Molnar wrote:
> I am trying to port a program that I wrote in FORTRAN twenty years ago
> into Python 3 and am having a hard time trying to calculate the
> Euclidean distance between each atom in the molecule and every other
> atom in the molecule.
Sounds highly