[ase-users] atoms.get_forces() and atoms.get_forces(md=True)

Michael Joseph Waters michael.j.waters at northwestern.edu
Sat Mar 6 19:44:56 CET 2021


Thanks for confirming Ask,

I ran some tests with the VASP calculator that showed me this earlier. Sorry, I forgot to respond to myself.

Best,
-Mike
________________________________
From: Ask Hjorth Larsen <asklarsen at gmail.com>
Sent: Saturday, March 6, 2021 12:42 PM
To: Michael Joseph Waters <michael.j.waters at northwestern.edu>
Cc: ase-users <ase-users at listserv.fysik.dtu.dk>
Subject: Re: [ase-users] atoms.get_forces() and atoms.get_forces(md=True)

Dear Michael,

Am Fr., 26. Feb. 2021 um 16:52 Uhr schrieb Michael Joseph Waters via
ase-users <ase-users at listserv.fysik.dtu.dk>:
>
> Hi all,
>
> I am implementing a dynamics module. I've been using VelocityVerlet as an example.
>
> I have so far left these lines alone since they don't interfere with what I am doing:
>
>         # We need to store the momenta on the atoms before calculating
>         # the forces, as in a parallel Asap calculation atoms may
>         # migrate during force calculations, and the momenta need to
>         # migrate along with the atoms.
>         atoms.set_momenta(p, apply_constraint=False)
>
>         forces = atoms.get_forces(md=True)
>
> And because 'forces' is returned by .step() .
>
> I realize now that I need the default constrained forces immediately afterwards.
>
>                   f_constrained = atoms.get_forces()
>
> Will requesting the forces a different way cause the calculator to rerun? I'd like to avoid that redundancy.

It is the calculator which controls the caching, for better or worse.

The calculator won't see constraints or the md boolean since those are
handled by the Atoms object without passing them to the calculator.

Requesting the forces in a different way will therefore reuse the
forces from the calculator, but it will re-apply constraints if any,
which could of course also cost something.

Best regards
Ask

>
> Best,
> -Mike
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://urldefense.com/v3/__https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users__;!!Dq0X2DkFhyF93HkjWTBQKhk!DUIiP8tPHUkTItuF2bP2cCmNdC6DSnM8vQL-PZ3hs-g-43zqqfXjsATTVDr_hmV8LuT4xdf4df4H$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210306/699d20c4/attachment-0001.htm>


More information about the ase-users mailing list