Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic guesser features #3753

Merged
merged 295 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
295 commits
Select commit Hold shift + click to select a range
60b24c1
Update core.py
aya9aladdin Jul 23, 2022
ce68bd1
Update core.py
aya9aladdin Jul 23, 2022
ae862fc
Update core.py
aya9aladdin Jul 23, 2022
c5d3453
Merge branch 'develop' into guesser-basics
aya9aladdin Jul 23, 2022
f6053dc
Update core.py
aya9aladdin Jul 23, 2022
bb04030
remove guessing from parser
aya9aladdin Jul 25, 2022
91f0d08
Update universe.py
aya9aladdin Jul 25, 2022
2a013f1
Update universe.py
aya9aladdin Jul 25, 2022
93ffc3f
Update base.py
aya9aladdin Jul 25, 2022
bf41f72
Update core.py
aya9aladdin Jul 25, 2022
9cd3460
Update tables.py
aya9aladdin Jul 25, 2022
ca1f871
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Jul 25, 2022
6d48520
Parsers modification / guess_bond update
aya9aladdin Jul 26, 2022
4f2782f
aa
aya9aladdin Jul 26, 2022
6661c36
plural attr
aya9aladdin Jul 26, 2022
8b0cec5
Update __init__.py
aya9aladdin Jul 27, 2022
5a9ed58
Update __init__.py
aya9aladdin Jul 27, 2022
b28f09a
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Jul 27, 2022
6fe79ac
Merge branch 'develop' into guesser-basics
aya9aladdin Jul 27, 2022
fc4ec30
Rename DefaultGuesser.py to defaultGuesser.py
aya9aladdin Jul 27, 2022
ede16ca
Update DefaultGuesser.py
aya9aladdin Jul 27, 2022
76275a3
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Jul 27, 2022
f7bbbe6
Update package/MDAnalysis/core/universe.py
aya9aladdin Jul 28, 2022
f1a09bb
complete baseGuesser + removing rank + upgrading parts of code accord…
aya9aladdin Aug 1, 2022
4dc0ada
remove assigning atomtypes to names in PDBParser
aya9aladdin Aug 1, 2022
770b4ce
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Aug 1, 2022
2c92aa0
resolve automatic guessing empty universe
aya9aladdin Aug 4, 2022
5125953
Update PQRParser.py
aya9aladdin Aug 4, 2022
b0a0ee2
..
aya9aladdin Aug 4, 2022
c2f1f9a
Update default_guesser.py
aya9aladdin Aug 4, 2022
6b2c4c7
Update universe.py
aya9aladdin Aug 4, 2022
0c9e78d
Update universe.py
aya9aladdin Aug 4, 2022
bf2463f
Update universe.py
aya9aladdin Aug 4, 2022
c159461
Update universe.py
aya9aladdin Aug 4, 2022
2039be7
Update universe.py
aya9aladdin Aug 4, 2022
6b6c07b
Update universe.py
aya9aladdin Aug 4, 2022
2ceeec6
Update universe.py
aya9aladdin Aug 4, 2022
4679c18
modify guess_atoms to resolve errors
aya9aladdin Aug 4, 2022
5f81d3e
Update universe.py
aya9aladdin Aug 4, 2022
60cedfc
Update universe.py
aya9aladdin Aug 4, 2022
a7ea8da
Update universe.py
aya9aladdin Aug 4, 2022
18c86f8
Update universe.py
aya9aladdin Aug 4, 2022
3d996c4
modifying bond guessing to not break default behavior
aya9aladdin Aug 5, 2022
23932ca
update guess angles and dihedrals
aya9aladdin Aug 5, 2022
1d988de
modifying parser checking
aya9aladdin Aug 5, 2022
75e7b81
Update universe.py
aya9aladdin Aug 5, 2022
baa3e0b
Update universe.py
aya9aladdin Aug 5, 2022
54b2a64
Update universe.py
aya9aladdin Aug 5, 2022
c85a593
pep style
aya9aladdin Aug 5, 2022
2bd7fff
Update universe.py
aya9aladdin Aug 5, 2022
81c5382
pep
aya9aladdin Aug 5, 2022
78365bd
pep
aya9aladdin Aug 5, 2022
97a3d6b
pep
aya9aladdin Aug 5, 2022
c796eee
pep
aya9aladdin Aug 5, 2022
63d6fe1
Update universe.py
aya9aladdin Aug 5, 2022
8748515
pep
aya9aladdin Aug 5, 2022
c010d47
pep
aya9aladdin Aug 5, 2022
b6fa523
pep
aya9aladdin Aug 5, 2022
ba3e733
Update default_guesser.py
aya9aladdin Aug 5, 2022
3711962
pep
aya9aladdin Aug 5, 2022
10b8c03
Update tables.py
aya9aladdin Aug 5, 2022
c0f826f
Update tables.py
aya9aladdin Aug 5, 2022
636e4bc
pep
aya9aladdin Aug 5, 2022
752f05e
Update universe.py
aya9aladdin Aug 5, 2022
d0e2a8a
Update universe.py
aya9aladdin Aug 5, 2022
986335e
handeling TXYZParser special behavior of guessing masses from names n…
aya9aladdin Aug 5, 2022
b80edec
Update universe.py
aya9aladdin Aug 6, 2022
438ac52
Update universe.py
aya9aladdin Aug 6, 2022
5d6772c
remove guessed attributes test from parsers
aya9aladdin Aug 6, 2022
0dcca86
remove guessed attributes tests from parsers tests
aya9aladdin Aug 6, 2022
1a74cfd
remove guessed attributes tests from parsers tests
aya9aladdin Aug 6, 2022
eba975c
updating test
aya9aladdin Aug 6, 2022
45f90ef
remove tpr from topology cjecking
aya9aladdin Aug 8, 2022
ca525ad
transfer parser checkpoints to guess_topology_attr
aya9aladdin Aug 17, 2022
05a7623
Update universe.py
aya9aladdin Aug 17, 2022
9318bf2
passing all existing tests
aya9aladdin Aug 17, 2022
0297954
reordering some checkpoints
aya9aladdin Aug 18, 2022
2c88dd0
fix openmm and rdkit tests
aya9aladdin Aug 19, 2022
d1516d0
openmm
aya9aladdin Aug 19, 2022
99c8684
addin guess_topology_attr tests
aya9aladdin Aug 19, 2022
0f4fb3d
modify warning msg
aya9aladdin Aug 19, 2022
0d999f1
adding unit test
aya9aladdin Aug 21, 2022
c6431c0
Update base.py
aya9aladdin Aug 21, 2022
1e4395c
Update base.py
aya9aladdin Aug 21, 2022
23d627b
redirect table import to guesser packagr
aya9aladdin Aug 22, 2022
d77e14f
fix txyz parser checkpoint in guess_masses
aya9aladdin Aug 22, 2022
ba1d392
Update default_guesser.py
aya9aladdin Aug 22, 2022
8aaa305
rename file
aya9aladdin Aug 22, 2022
b120594
adding tests
aya9aladdin Aug 22, 2022
0901cb3
Update test_base.py
aya9aladdin Aug 22, 2022
c9dfa0b
adding universe test
aya9aladdin Aug 22, 2022
72e62f0
unit tests modification
aya9aladdin Aug 22, 2022
d2f0ec6
remove unused error checking
aya9aladdin Aug 22, 2022
3ba87de
adding more tests to pass codcov
aya9aladdin Aug 22, 2022
6a819b9
Delete .coverage.Aya-MacBook.11217.035601
aya9aladdin Aug 22, 2022
f3669df
Update test_encore.py
aya9aladdin Aug 22, 2022
044bc74
add more tests
aya9aladdin Aug 23, 2022
4a821e1
updating some messages
aya9aladdin Aug 26, 2022
ed05187
Update test_openmm_parser.py
aya9aladdin Aug 26, 2022
1032019
update documents
aya9aladdin Aug 26, 2022
7b0041c
Update test_openmm_parser.py
aya9aladdin Aug 26, 2022
2fe59fa
Update test_openmm_parser.py
aya9aladdin Aug 26, 2022
5d6550e
opemmm test
aya9aladdin Aug 27, 2022
6a1e4c5
Update default_guesser.py
aya9aladdin Aug 27, 2022
25aaf73
BaseGuesser documentation
aya9aladdin Aug 27, 2022
501e397
DefaultGuesser documentation
aya9aladdin Aug 27, 2022
d9a65a7
bond guessing + updating guessing API code + minor updates
aya9aladdin Sep 10, 2022
4395f6f
style fixes
aya9aladdin Sep 10, 2022
c234e75
Update universe.py
aya9aladdin Sep 10, 2022
fdb296c
fixing openmm parser message typos
aya9aladdin Sep 10, 2022
c4b200d
Update testsuite/MDAnalysisTests/converters/test_rdkit_parser.py
aya9aladdin Sep 12, 2022
a9b4354
Update testsuite/MDAnalysisTests/guesser/test_default_guesser.py
aya9aladdin Sep 12, 2022
965cd72
Update testsuite/MDAnalysisTests/core/test_universe.py
aya9aladdin Sep 12, 2022
6338a8e
restore table.py default style
aya9aladdin Sep 12, 2022
4324f72
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Sep 12, 2022
17fded8
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 17, 2022
4c29a39
pep styling
aya9aladdin Sep 17, 2022
9fa7b32
Update test_default_guesser.py
aya9aladdin Sep 17, 2022
f450c6f
pep styling
aya9aladdin Sep 17, 2022
f6b9b97
Apply suggestions from code review
aya9aladdin Sep 17, 2022
460d2f5
typos fixing
aya9aladdin Sep 17, 2022
af84927
adding partial guessing + parser tests + noValue topologyattr
aya9aladdin Sep 21, 2022
002e1d6
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 21, 2022
390ae37
Apply suggestions from code review
aya9aladdin Sep 21, 2022
a5c303c
Update base.py
aya9aladdin Sep 21, 2022
b01b092
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Sep 21, 2022
61831f8
Update bat.py
aya9aladdin Sep 21, 2022
7f638fb
Update bat.py
aya9aladdin Sep 21, 2022
cd37c19
Update bat.py
aya9aladdin Sep 21, 2022
71e9a2b
Update bat.py
aya9aladdin Sep 21, 2022
084ab13
removing test skipping
aya9aladdin Sep 21, 2022
fa9128a
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 21, 2022
991070c
update txyz
aya9aladdin Sep 21, 2022
62c43cd
variable names update + partial guessing updates
aya9aladdin Sep 25, 2022
314b31c
Apply suggestions from code review
aya9aladdin Sep 26, 2022
0dcbacd
Adding docstring
aya9aladdin Sep 27, 2022
9a230a4
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Sep 27, 2022
f82bdcf
fix typo in topology tests + add element to ITPParser
aya9aladdin Sep 28, 2022
6f6f634
Added tests for BaseGuesser + updating guess_Attr()
aya9aladdin Sep 30, 2022
40ef1ed
update docstring of guess_attr
aya9aladdin Sep 30, 2022
9222d96
removed parser checking for auto-guessing
aya9aladdin Oct 12, 2022
b712a77
restoring old style
aya9aladdin Oct 12, 2022
8724bba
Apply suggestions from code review
aya9aladdin Oct 12, 2022
0abb069
removing autopep8 effect
aya9aladdin Oct 12, 2022
c1b05ba
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Oct 12, 2022
02d62b1
add comment to bat.py::_sort_atoms_by_mass
aya9aladdin Oct 12, 2022
710df7d
Update OpenMM.py
aya9aladdin Oct 12, 2022
d7cb653
Update universe.py
aya9aladdin Oct 13, 2022
5f6a6f3
passing empty attribute indices for partial guessing
aya9aladdin Oct 14, 2022
f12e5f1
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Oct 14, 2022
d76362b
updating docstring
aya9aladdin Oct 15, 2022
a8ba36c
Merge branch 'MDAnalysis:develop' into guesser-basics
aya9aladdin Oct 15, 2022
49c803c
solve universe unpickle issue
aya9aladdin Oct 15, 2022
f816441
Update test_h5md.py
aya9aladdin Oct 15, 2022
e1347a7
override is_value_missing for Masses class
aya9aladdin Oct 18, 2022
3ebce3f
default guesser pdep8 upates
aya9aladdin Oct 18, 2022
10cad41
pep8 updates
aya9aladdin Oct 18, 2022
626cb39
pep8 updates
aya9aladdin Oct 18, 2022
b476301
remove unrelated analysis module tests
aya9aladdin Oct 18, 2022
3fbdc46
remove line from test_encore.py
aya9aladdin Oct 18, 2022
7b42095
remove autopep8 effect from testpositionaveraging.py
aya9aladdin Oct 19, 2022
21aae8e
Update test_positionaveraging.py
aya9aladdin Oct 19, 2022
3e5a9e9
add guesser tests + pep8 updates
aya9aladdin Oct 19, 2022
98d91fe
restore universe.Merge docstring formatting
aya9aladdin Oct 19, 2022
78654e5
remove autopep8 effect from universe.py
aya9aladdin Oct 19, 2022
a954aee
remove autopep8 effect from universe.py
aya9aladdin Oct 19, 2022
dfb3761
Apply suggestions from code review
aya9aladdin Oct 19, 2022
3df1d9b
removing autopep8 effect from irrelevant parts + adding pep styles
aya9aladdin Oct 19, 2022
e273d68
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Oct 19, 2022
4ad3948
finishing pep8 styling
aya9aladdin Oct 19, 2022
1518729
docstring updates
aya9aladdin Oct 19, 2022
d1e27e3
restore a useful autopep8 change
aya9aladdin Oct 20, 2022
348f62d
add guessing elements from masses to DefaultGuesser
aya9aladdin Oct 20, 2022
e2c03cd
Update test_default_guesser.py
aya9aladdin Oct 20, 2022
ad50c17
added tests to DefaultGuesser and GuesserBasics
aya9aladdin Oct 20, 2022
7663a5b
Update base.py
aya9aladdin Oct 20, 2022
aece5bc
update docstring
aya9aladdin Oct 23, 2022
6175b37
Update topology_modules.rst
aya9aladdin Oct 23, 2022
52fcb41
Merge branch 'develop' into guesser-basics
aya9aladdin Jan 28, 2023
a463561
Revert "Merge branch 'develop' into guesser-basics"
aya9aladdin Jan 28, 2023
d67c921
Revert "Revert "Merge branch 'develop' into guesser-basics""
aya9aladdin Jan 28, 2023
492ccd7
Revert "Revert "Merge branch 'develop' into guesser-basics""
aya9aladdin Jan 29, 2023
f50a7b1
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Jan 29, 2023
3dc7535
silencing guessing processes in some tests
aya9aladdin Feb 20, 2023
2e8d863
silencing guessing process in irrelevant tests
aya9aladdin Feb 25, 2023
a22afc0
style fixations
aya9aladdin Feb 26, 2023
0285dd1
fix styling
aya9aladdin Feb 26, 2023
476444e
style fixations
aya9aladdin Feb 26, 2023
3c3df98
add guesser context + removing styling errors in ITP
aya9aladdin Mar 3, 2023
6be3ec4
Update universe.py
aya9aladdin Mar 3, 2023
7b0ce2e
copy method of Guesser class
aya9aladdin Mar 3, 2023
aaf1d08
Update universe.py
aya9aladdin Mar 3, 2023
1fd7d69
pass universe context to serialisation methods
aya9aladdin Mar 3, 2023
e29d3e6
Update universe.py
aya9aladdin Mar 3, 2023
f64ca1d
update changelog and versionchanged
aya9aladdin Mar 10, 2023
c0ff781
Merge branch 'develop' into guesser-basics
aya9aladdin Mar 10, 2023
58a0d75
docstring error
aya9aladdin Mar 10, 2023
2291a4d
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Mar 10, 2023
21950f6
typo fixing
aya9aladdin Mar 10, 2023
e7c0241
Update CHANGELOG
aya9aladdin Mar 10, 2023
c0ce6e0
Merge branch 'develop' into guesser-basics
aya9aladdin Apr 27, 2023
b776f09
Update groups.py
aya9aladdin Apr 28, 2023
1d8e2cd
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 10, 2023
fc18d4f
updating CHANGELOG + versionchanged doc
aya9aladdin Sep 10, 2023
06211cc
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 12, 2023
240af1c
improving guess_attr + updating changelog
aya9aladdin Sep 12, 2023
ff71b1a
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 17, 2023
2aeb0fc
removed types from FHIAMSParser and XYZParser
aya9aladdin Sep 17, 2023
7580855
Update CHANGELOG
aya9aladdin Sep 17, 2023
202d62a
added DefaultGuesser tests
aya9aladdin Sep 24, 2023
27fcf3b
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 24, 2023
5c5c684
Merge branch 'develop' into guesser-basics
aya9aladdin Nov 6, 2023
5ccd1d1
Update package/CHANGELOG
aya9aladdin Dec 27, 2023
b343d11
Update package/CHANGELOG
aya9aladdin Dec 27, 2023
b3f292d
Merge branch 'develop' into guesser-basics
aya9aladdin Dec 27, 2023
8dc935b
Apply suggestions from code review
aya9aladdin Dec 27, 2023
51c75a6
silencing auto guessing in coordinates tests
aya9aladdin Dec 27, 2023
e1e5b3e
applying @lilyminium suggestions
aya9aladdin Dec 27, 2023
68580ea
applying @lilyminium code review suggesitions
aya9aladdin Jan 6, 2024
6da8ca8
removed guessed_types/masses tests
aya9aladdin Jan 6, 2024
5d505a4
Apply suggestions from code review
aya9aladdin Feb 1, 2024
934d7e6
Merge branch 'develop' into guesser-basics
aya9aladdin Feb 1, 2024
c7ca389
removed guessed_types/masses + unnecessary imports
aya9aladdin Feb 1, 2024
14a6ed2
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Feb 1, 2024
bd12db2
fixed test_itp typo + removed guessed_attrs errors
aya9aladdin Feb 1, 2024
88bb017
Adding more tests
aya9aladdin Feb 1, 2024
40c7632
Merge branch 'develop' into guesser-basics
aya9aladdin Mar 16, 2024
28aeb6a
adding guesser tests
aya9aladdin Mar 16, 2024
da15709
adding tests for DefaultGuesser
aya9aladdin Mar 16, 2024
83ee7f5
adding final tests + styling
aya9aladdin Mar 25, 2024
c67dc3a
Removing old modules + updating CHANGELOG
aya9aladdin Mar 26, 2024
ca43651
Merge branch 'develop' into guesser-basics
aya9aladdin Mar 26, 2024
67ad49e
fix importing error
aya9aladdin Mar 26, 2024
5ee7bae
Merge branch 'guesser-basics' of https://github.com/aya9aladdin/mdana…
aya9aladdin Mar 26, 2024
817cab1
removing guessing part from topology docs
aya9aladdin Mar 26, 2024
6f60435
updating docs
aya9aladdin Mar 30, 2024
a946156
Merge branch 'develop' into guesser-basics
aya9aladdin Mar 31, 2024
ba9deaf
Merge branch 'develop' into guesser-basics
aya9aladdin Apr 17, 2024
fc0ebe6
Apply suggestions from code review
aya9aladdin Apr 21, 2024
4976166
fixing styling
aya9aladdin Apr 26, 2024
77fb208
fixing styling issue + rdkitparser tests
aya9aladdin May 19, 2024
eeaf35a
Apply LAST suggestions from code review
aya9aladdin Sep 17, 2024
80a1b74
Merge branch 'develop' into guesser-basics
aya9aladdin Sep 17, 2024
8986a97
- removed guessing types from masses
aya9aladdin Sep 17, 2024
c0b833e
Update CHANGELOG
aya9aladdin Sep 17, 2024
00dff7c
Update universe.py
aya9aladdin Sep 17, 2024
1c15f21
Merge branch 'develop' into guesser-basics
IAlibay Sep 29, 2024
7cc0341
Update package/CHANGELOG
IAlibay Oct 17, 2024
c225f75
Merge remote-tracking branch 'upstream/develop' into guesser-basics
lilyminium Oct 19, 2024
e7ddaaf
Merge branch 'develop' into guesser-basics
lilyminium Oct 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/benchmarks/topology.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MDAnalysis
import numpy as np
from MDAnalysis.topology import guessers
from MDAnalysis.guesser import DefaultGuesser

try:
from MDAnalysisTests.datafiles import GRO
Expand All @@ -26,7 +26,7 @@ def setup(self, num_atoms):

def time_guessbonds(self, num_atoms):
"""Benchmark for guessing bonds"""
guessers.guess_bonds(self.ag, self.ag.positions,
DefaultGuesser(None).guess_bonds(self.ag, self.ag.positions,
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
box=self.ag.dimensions,
vdwradii=self.vdwradii)

Expand Down
19 changes: 17 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ The rules for this file:
-------------------------------------------------------------------------------
??/??/?? IAlibay, HeetVekariya, marinegor, lilyminium, RMeli,
ljwoods2, aditya292002, pstaerk, PicoCentauri, BFedder,
tyler.je.reddy, SampurnaM, leonwehrhan, kainszs, orionarcher,
tyler.je.reddy, SampurnaM, leonwehrhan, kainszs, orionarcher,
yuxuanzhuang, PythonFZ, laksh-krishna-sharma, orbeckst, MattTDavies,
talagayev
talagayev, aya9aladdin

* 2.8.0

Fixes
* Fix Bohrium (Bh) atomic mass in tables.py (PR #3753)
* set `n_parts` to the total number of frames being analyzed if
`n_parts` is bigger. (Issue #4685)
* Catch higher dimensional indexing in GroupBase & ComponentBase (Issue #4647)
Expand Down Expand Up @@ -56,6 +57,17 @@ Fixes
* Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374)

Enhancements
* Removed type and mass guessing from all topology parsers (PR #3753)
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
* Added guess_TopologyAttrs() API to the Universe to handle attribute
guessing (PR #3753)
* Added the DefaultGuesser class, which is a general-purpose guesser with
the same functionalities as the existing guesser.py methods (PR #3753)
* Removed type guessing from RDKitParser and assigned type attribute
to be equal to the element attribute, if type is not provided (PR #3753)
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
* Added is_value_missing() to `TopologyAttrs` to check for missing
values (PR #3753)
* Added guessed `Element` attribute to the ITPParser to preserve old mass
partial guessing behavior from being broken (PR #3753)
* Introduce parallelization API to `AnalysisBase` and to `analysis.rms.RMSD` class
(Issue #4158, PR #4304)
* Enables parallelization for analysis.gnm.GNMAnalysis (Issue #4672)
Expand Down Expand Up @@ -96,6 +108,9 @@ Changes
numpy.testing.assert_allclose #4438)

Deprecations
* Unknown masses are set to 0.0 for current version, this will be depracated
in version 3.0.0 and replaced by :class:`Masses`' no_value_label attribute(np.nan)
(PR #3753)
* The MMTF Reader is deprecated and will be removed in version 3.0
as the MMTF format is no longer supported (Issue #4634)
* The MDAnalysis.analysis.waterdynamics module has been deprecated in favour
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
_TOPOLOGY_ATTRS: Dict = {} # {attrname: cls}
_TOPOLOGY_TRANSPLANTS: Dict = {} # {name: [attrname, method, transplant class]}
_TOPOLOGY_ATTRNAMES: Dict = {} # {lower case name w/o _ : name}

_GUESSERS: Dict = {}

# custom exceptions and warnings
from .exceptions import (
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/analysis/bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class to calculate dihedral angles for a given set of atoms or residues


def _sort_atoms_by_mass(atoms, reverse=False):
r"""Sorts a list of atoms by name and then by index
r"""Sorts a list of atoms by mass and then by index

The atom index is used as a tiebreaker so that the ordering is reproducible.

Expand Down
44 changes: 26 additions & 18 deletions package/MDAnalysis/converters/OpenMMParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
===================================================================

.. versionadded:: 2.0.0
.. versionchanged:: 2.8.0
Removed type and mass guessing (attributes guessing takes place
now through universe.guess_TopologyAttrs() API)


Converts an
Expand Down Expand Up @@ -59,8 +62,7 @@
import warnings

from ..topology.base import TopologyReaderBase
from ..topology.tables import SYMB2Z
from ..topology.guessers import guess_types, guess_masses
from ..guesser.tables import SYMB2Z
from ..core.topology import Topology
from ..core.topologyattrs import (
Atomids,
Expand Down Expand Up @@ -108,11 +110,6 @@
-------
top : MDAnalysis.core.topology.Topology

Note
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we transplanting this back in? This behaviour can't change for the 2.x release of MDA.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the guessing behavior is transferred to the universe through the guess_topologyAttribute API without breaking default behavior

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To double check, we are removing this note because the default behaviour is equivalent to this note?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed... the idea is this is no longer specific/happening inside the parser

----
When none of the elements are present in the openmm topolgy, their
atomtypes are guessed using their names and their masses are
then guessed using their atomtypes.

When partial elements are present, values from available elements
are used whereas the absent elements are assigned an empty string
Expand Down Expand Up @@ -184,21 +181,32 @@
warnings.warn("Element information missing for some atoms. "
"These have been given an empty element record ")
if any(i == 'X' for i in atomtypes):
warnings.warn("For absent elements, atomtype has been "
"set to 'X' and mass has been set to 0.0. "
"If needed these can be guessed using "
"MDAnalysis.topology.guessers.")
warnings.warn(

Check warning on line 184 in package/MDAnalysis/converters/OpenMMParser.py

View check run for this annotation

Codecov / codecov/patch

package/MDAnalysis/converters/OpenMMParser.py#L184

Added line #L184 was not covered by tests
"For absent elements, atomtype has been "
"set to 'X' and mass has been set to 0.0. "
"If needed these can be guessed using "
"universe.guess_TopologyAttrs("
"to_guess=['masses', 'types']). "
"(for MDAnalysis version 2.x "
"this is done automatically,"
" but it will be removed in 3.0).")

attrs.append(Elements(np.array(validated_elements,
dtype=object)))

else:
atomtypes = guess_types(atomnames)
masses = guess_masses(atomtypes)
wmsg = ("Element information is missing for all the atoms. "
"Elements attribute will not be populated. "
"Atomtype attribute will be guessed using atom "
"name and mass will be guessed using atomtype."
"See MDAnalysis.topology.guessers.")
wmsg = (

Check warning on line 198 in package/MDAnalysis/converters/OpenMMParser.py

View check run for this annotation

Codecov / codecov/patch

package/MDAnalysis/converters/OpenMMParser.py#L198

Added line #L198 was not covered by tests
"Element information is missing for all the atoms. "
"Elements attribute will not be populated. "
"Atomtype attribute will be guessed using atom "
"name and mass will be guessed using atomtype."
"For MDAnalysis version 2.x this is done automatically, "
"but it will be removed in MDAnalysis v3.0. "
"These can be guessed using "
"universe.guess_TopologyAttrs("
"to_guess=['masses', 'types']) "
"See MDAnalysis.guessers.")

warnings.warn(wmsg)
else:
attrs.append(Elements(np.array(validated_elements, dtype=object)))
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/converters/ParmEd.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@
import itertools
import warnings

from ..guesser.tables import SYMB2Z
import numpy as np
from numpy.lib import NumpyVersion

from . import base
from ..coordinates.base import SingleFrameReaderBase
from ..topology.tables import SYMB2Z
from ..core.universe import Universe
from ..exceptions import NoDataError

Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/converters/ParmEdParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
import numpy as np

from ..topology.base import TopologyReaderBase, change_squash
from ..topology.tables import Z2SYMB
from ..guesser.tables import Z2SYMB
from ..core.topologyattrs import (
Atomids,
Atomnames,
Expand Down
4 changes: 1 addition & 3 deletions package/MDAnalysis/converters/RDKit.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ class RDKitConverter(base.ConverterBase):
from MDAnalysisTests.datafiles import PSF, DCD
from rdkit.Chem.Descriptors3D import Asphericity

u = mda.Universe(PSF, DCD)
elements = mda.topology.guessers.guess_types(u.atoms.names)
u.add_TopologyAttr('elements', elements)
u = mda.Universe(PSF, DCD, to_guess=['elements'])
jbarnoud marked this conversation as resolved.
Show resolved Hide resolved
ag = u.select_atoms("resid 1-10")

for ts in u.trajectory:
Expand Down
16 changes: 9 additions & 7 deletions package/MDAnalysis/converters/RDKitParser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
Expand Down Expand Up @@ -47,7 +47,6 @@
import numpy as np

from ..topology.base import TopologyReaderBase, change_squash
from ..topology import guessers
from ..core.topologyattrs import (
Atomids,
Atomnames,
Expand Down Expand Up @@ -90,16 +89,14 @@
- Atomnames
- Aromaticities
- Elements
- Types
- Masses
- Bonds
- Resids
- Resnums
- RSChirality
- Segids

Guesses the following:
IAlibay marked this conversation as resolved.
Show resolved Hide resolved
- Atomtypes

Depending on RDKit's input, the following Attributes might be present:
- Charges
- Resnames
Expand Down Expand Up @@ -156,6 +153,12 @@
.. versionadded:: 2.0.0
.. versionchanged:: 2.1.0
Added R/S chirality support
.. versionchanged:: 2.8.0
Removed type guessing (attributes guessing takes place now
through universe.guess_TopologyAttrs() API). If atoms types is not
present in the input rdkit molecule as a _TriposAtomType property,
the type attribute get the same values as the element attribute.

"""
format = 'RDKIT'

Expand Down Expand Up @@ -303,8 +306,7 @@
if atomtypes:
attrs.append(Atomtypes(np.array(atomtypes, dtype=object)))
else:
atomtypes = guessers.guess_types(names)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason the types used to be guessed rather than just assigned elements? The change looks reasonable to me, but I am worried there is a subtlety we may be missing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all type guessing from parsers and transferred it to be guessed at the universe creation. For PDB, FIAMS, XYZP and RDKit parsers, I assigned the atomtypes to be either read from the file if not be assigned to elements, if not be assigned to names (as per issue #2931). but if we are not ready for this move I'll remove it no worries

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is OK. I just wanted to avoid missing something. We should keep note of that and maybe have it a separate entry in the changelog.

We will also need to be careful with the tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To what extent does this change behaviour? Does this amount to a breaking change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked the test for that yet. Hopefully, it should not be a problem, except... The one case I see that could break is if the type was guessed as CA because we historically have an alpha carbon type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not change the types that were guessed, the "CA" is guessed as a "C" in both develop and this PR:

import MDAnalysis as mda
from rdkit import Chem
u = mda.Universe.empty(1, 1, 1, trajectory=True)
u.atoms.positions = [[0, 0, 0]]
u.add_TopologyAttr("names", ["CA"])
u.atoms.write("ca.pdb")
rdmol = Chem.MolFromPDBFile("ca.pdb")
u2 = mda.Universe(rdmol)

u2.atoms.types and elements is "C", u2.atoms.names stays "CA".

attrs.append(Atomtypes(atomtypes, guessed=True))
atomtypes = np.char.upper(elements)

Check warning on line 309 in package/MDAnalysis/converters/RDKitParser.py

View check run for this annotation

Codecov / codecov/patch

package/MDAnalysis/converters/RDKitParser.py#L309

Added line #L309 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aya9aladdin @lilyminium - this is assigned but nothing else is done with it afterwards it seems? I feel like I'm missing something, could you please just double check?


# Partial charges
if charges:
Expand Down
1 change: 0 additions & 1 deletion package/MDAnalysis/coordinates/PDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
from ..lib.util import store_init_arguments
from . import base
from .timestep import Timestep
from ..topology.core import guess_atom_element
from ..exceptions import NoDataError


Expand Down
23 changes: 10 additions & 13 deletions package/MDAnalysis/core/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -3453,7 +3453,6 @@ def guess_bonds(self, vdwradii=None, fudge_factor=0.55, lower_bound=0.1):
----------
vdwradii : dict, optional
Dict relating atom types: vdw radii

fudge_factor : float, optional
The factor by which atoms must overlap each other to be considered
a bond. Larger values will increase the number of bonds found. [0.55]
Expand All @@ -3477,8 +3476,8 @@ def guess_bonds(self, vdwradii=None, fudge_factor=0.55, lower_bound=0.1):
Corrected misleading docs, and now allows passing of `fudge_factor`
and `lower_bound` arguments.
"""
from ..topology.core import guess_bonds, guess_angles, guess_dihedrals
from .topologyattrs import Bonds, Angles, Dihedrals
from ..guesser.default_guesser import DefaultGuesser

def get_TopAttr(u, name, cls):
"""either get *name* or create one from *cls*"""
Expand All @@ -3490,22 +3489,20 @@ def get_TopAttr(u, name, cls):
return attr

# indices of bonds
b = guess_bonds(
self.atoms,
self.atoms.positions,
vdwradii=vdwradii,
box=self.dimensions,
fudge_factor=fudge_factor,
lower_bound=lower_bound,
)
bondattr = get_TopAttr(self.universe, "bonds", Bonds)
guesser = DefaultGuesser(None, fudge_factor=fudge_factor,
lower_bound=lower_bound,
box=self.dimensions,
vdwradii=vdwradii)
b = guesser.guess_bonds(self.atoms, self.atoms.positions)

bondattr = get_TopAttr(self.universe, 'bonds', Bonds)
bondattr._add_bonds(b, guessed=True)

a = guess_angles(self.bonds)
a = guesser.guess_angles(self.bonds)
angleattr = get_TopAttr(self.universe, 'angles', Angles)
angleattr._add_bonds(a, guessed=True)

d = guess_dihedrals(self.angles)
d = guesser.guess_dihedrals(self.angles)
diheattr = get_TopAttr(self.universe, 'dihedrals', Dihedrals)
diheattr._add_bonds(d)

Expand Down
13 changes: 13 additions & 0 deletions package/MDAnalysis/core/topologyattrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,18 @@ def set_segments(self, sg, values):
"""Set segmentattributes for a given SegmentGroup"""
raise NotImplementedError

@classmethod
def are_values_missing(cls, values):
"""check if an attribute has a missing value

.. versionadded:: 2.8.0
"""
missing_value_label = getattr(cls, 'missing_value_label', None)

if missing_value_label is np.nan:
return np.isnan(values)
else:
return values == missing_value_label

# core attributes

Expand Down Expand Up @@ -1441,6 +1453,7 @@ class Masses(AtomAttr):
attrname = 'masses'
singular = 'mass'
per_object = 'atom'
missing_value_label = np.nan
target_classes = [AtomGroup, ResidueGroup, SegmentGroup,
Atom, Residue, Segment]
transplants = defaultdict(list)
Expand Down
Loading
Loading