-
Notifications
You must be signed in to change notification settings - Fork 663
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
AttributeError: AtomGroup has no attribute charges #2536
Comments
Does your topology file contain charges? The How did you load your Universe, i.e., what input files do you have? |
So on a dev level, maybe this message should grab some debug info from Universe (filenames) to make the message clearer? |
Yeah that will save some headaches. 👍 |
@richardjgowers BTW what is the rationale behind this whole |
Yeah mostly to try and not clutter AtomGroup will every attribute and
method we support across all formats.
Maybe we can raise a different error (NoDataError), but I’m slightly in
favour of the error here. Here’s an example of where we catch an error and
do better:
https://github.com/MDAnalysis/mdanalysis/blob/develop/package/MDAnalysis/core/groups.py#L2218
All that said, maybe we should include more attributes by default, ie
charge, mass, name. I’ve been thinking of making AtomGroup a cython class,
which ties in with this...
…On Tue, Feb 18, 2020 at 08:52, Johannes Zeman ***@***.***> wrote:
@richardjgowers <https://github.com/richardjgowers> BTW what is the
rationale behind this whole AtomGroup argument injection machinery
besides uncluttering tab completion?
IMHO raising exceptions due to missing TopologyAttrs should be the
responsibility of Topology.
The fact that missing transplanted properties/methods raise unhelpful
AttributeErrors has the potential to confuse users and has already led to
some dirty workarounds on the dev side, see e.g. in AtomGroup.wrap()
<https://github.com/MDAnalysis/mdanalysis/blob/1e3f3627990353cf0d5ee00a567e563f012de624/package/MDAnalysis/core/groups.py#L1440>
and AtomGroup.unwrap()
<https://github.com/MDAnalysis/mdanalysis/blob/1e3f3627990353cf0d5ee00a567e563f012de624/package/MDAnalysis/core/groups.py#L1584>
(and there's more of that kind elsewhere).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2536?email_source=notifications&email_token=ACGSGB53GHZLNBMIOKR64M3RDOOUZA5CNFSM4KW3SMXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMBDONI#issuecomment-587347765>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGSGB6R2DL3HDERV2W2M7DRDOOUZANCNFSM4KW3SMXA>
.
|
I see your point, but keep in mind that this solution means we have to do the bookkeeping manually.
I'm all in favor of this. However, if we have attributes like masses and charges by default, shouldn't that also apply to related methods such as |
Yeah so associated methods would get included in with the mandatory attributes. One thing that would get a lot faster would be |
@laurapulido To give you a quick answer: The most likely reason for the error you are seeing is that the topology file format you used to construct your I would appreciate it if you could tell us whether my (and @orbeckst's) guess is right (or wrong). |
Thank you for all your answers. I checked the topology file and I found that it doesn't have charges. Thank you |
Thanks @laurapulido for reporting back! |
sure
… On Feb 19, 2020, at 5:25 PM, Johannes Zeman ***@***.***> wrote:
Thanks @laurapulido <https://github.com/laurapulido> for reporting back!
@richardjgowers <https://github.com/richardjgowers> @orbeckst <https://github.com/orbeckst> Should we close this and open a new issue regarding improving the error handling/message?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#2536?email_source=notifications&email_token=AAB2DHDEFMOSHDNAOGRE7HDRDXEXXA5CNFSM4KW3SMXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMKH4OA#issuecomment-588545592>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAB2DHHR5WTCTRLVBZEMQKTRDXEXXANCNFSM4KW3SMXA>.
--
Oliver Beckstein
orbeckst@gmail.com * orbeckst@gmx.net
|
@zemanj – you have been put in charge for closing this issue and opening a new one :-) |
Superseded by #2565, closing. |
I'm trying to use the potential_profile.py code available in the examples folder. After loading the topology and trajectory, I want to get the charges of all atoms in the system using the command universe.atoms.charges, but I get the following error:
AttributeError: AtomGroup has no attribute charges
Actual behavior
What happened instead. Add as much detail as you can. Include (copy and paste) stack traces and any output.
Thank you for your help
The text was updated successfully, but these errors were encountered: