[ase-users] RuntimeError: Atoms object has no calculator.

Ask Hjorth Larsen asklarsen at gmail.com
Sun Oct 22 16:02:59 CEST 2017


Hi Roger,

2017-10-19 22:09 GMT+02:00 Roger Mason via ase-users
<ase-users at listserv.fysik.dtu.dk>:
> Hello,
>
> This example, from https://wiki.fysik.dtu.dk/ase/ase/atom.html, fails:
>
> Python 2.7.13 (default, Jul  2 2017, 01:20:25)
> [GCC 4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)] on freebsd10
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from ase import Atoms
>>>> OH = Atoms('OH')
>>>> OH[0].charge = -1
>>>> OH.get_charges()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/rmason/Software/ASE/ase/ase/atoms.py", line 639, in get_charges
>     raise RuntimeError('Atoms object has no calculator.')
> RuntimeError: Atoms object has no calculator.
>
> ase --version
> ase-3.15.0
>
> What must I do to make it work?

Sorry, the documentation must have been outdated.  I have updated the
documentation on the web page.

It will say OH.get_initial_charges() when the page rebuilds tomorrow or so.

ASE now distinguishes between get_charges(), which calculates and
returns the charges if there is a calculator, and
get_initial_charges(), which returns those that were set by the user.

Previously it appears that get_charges() could do either of these
things, so its behaviour would be unpredictable.

Best regards
Ask

>
> Thanks,
> Roger
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users


More information about the ase-users mailing list