Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tbgl
tools
mrdna
Commits
1e16cc4d
Commit
1e16cc4d
authored
Aug 11, 2017
by
cmaffeo2
Browse files
Sped up minimizeRMSD when no weight is used
parent
3268d1e7
Changes
1
Hide whitespace changes
Inline
Sidebyside
coords.py
View file @
1e16cc4d
...
...
@@ 48,17 +48,23 @@ def _minimizeRmsd(coordsB, coordsA, weights=None):
shapeA
,
shapeB
=
[
np
.
shape
(
X
)
for
X
in
(
A
,
B
)]
assert
(
shapeA
==
shapeB
)
for
X
,
s
in
zip
((
A
,
B
),(
shapeA
,
shapeB
)):
assert
(
s
[
1
]
==
3
and
s
[
0
]
>=
s
[
1
]
)
assert
(
s
[
1
]
==
3
and
s
[
0
]
>=
s
[
1
]
)
if
weights
is
None
:
weights
=
np
.
ones
(
len
(
A
))
assert
(
len
(
weights
[:])
==
len
(
B
)
)
W
=
np
.
diag
(
weights
)
# if weights is None: weights = np.ones(len(A))
if
weights
is
None
:
comA
,
comB
=
[
np
.
mean
(
X
,
axis
=
0
)
for
X
in
(
A
,
B
)]
else
:
assert
(
len
(
weights
[:])
==
len
(
B
)
)
W
=
np
.
diag
(
weights
)
comA
,
comB
=
[
np
.
sum
(
W
.
dot
(
X
),
axis
=
0
)
/
np
.
sum
(
W
)
for
X
in
(
A
,
B
)]
comA
,
comB
=
[
np
.
sum
(
W
.
dot
(
X
),
axis
=
0
)
/
np
.
sum
(
W
)
for
X
in
(
A
,
B
)]
A
=
np
.
array
(
A

comA
)
B
=
np
.
array
(
B

comB
)
s
=
A
.
T
.
dot
(
W
.
dot
(
B
))
if
weights
is
None
:
s
=
A
.
T
.
dot
(
B
)
else
:
s
=
A
.
T
.
dot
(
W
.
dot
(
B
))
sxx
,
sxy
,
sxz
=
s
[
0
,:]
syx
,
syy
,
syz
=
s
[
1
,:]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment