[ase-users] Save SocketIOCalculator property to file
Ask Hjorth Larsen
asklarsen at gmail.com
Tue Jan 21 18:57:58 CET 2020
Dear all, (sorry for top-posting, not sure which parts to reply to)
Real calculator objects in ASE are much too complex to save since they can
hold system resources (pipes, sockets, open files, initialized modules with
data structures and buffers in C, etc.), which are typically unsaveable.
Therefore, we should not try to save them. It might work for some, but
then you never really know whether it's buggy or will break one day, or it
might not work if you performed the calculation in a particular way (using
some wrapping calculator like vdW or sockets), etc.
However it makes sense to save the *inputs* of a calculation to a file as
well as the *outputs*, particularly if we can represent this information
using some standard format. This is what the single-point calculator does,
of sorts.
So whatever this saving/loading mechanism does right now should probably be
replaced with a single-point calculator.
Best regards
Ask
Am Di., 21. Jan. 2020 um 10:58 Uhr schrieb Offermans Willem via ase-users <
ase-users at listserv.fysik.dtu.dk>:
> Dear ASE friends,
>
> I dug into the code.
>
> The class TrajectoryReader in io/trajectory.py has a method called
> __getitem__.
>
> If I understand it correctly it will set the calculator to
> SinglePointCalculator upon reading
> a trajectory file. Is my understanding correct? Does this mean we cannot
> save calculator
> objects, other than SinglePointCalculator, together with atoms objects to
> a file?
>
>
> def __getitem__(self, i=-1):
> b = self.backend[i]
> if 'numbers' in b:
> # numbers and other header info was written alongside the
> image:
> atoms = read_atoms(b)
> else:
> # header info was not written because they are the same:
> atoms = read_atoms(b, header=[self.pbc, self.numbers,
> self.masses,
> self.constraints])
> if 'calculator' in b:
> results = {}
> implemented_properties = []
> c = b.calculator
> for prop in all_properties:
> if prop in c:
> results[prop] = c.get(prop)
> implemented_properties.append(prop)
> calc = SinglePointCalculator(atoms, **results)
> calc.name = b.calculator.name
> calc.implemented_properties = implemented_properties
>
> if 'parameters' in c:
> calc.parameters.update(c.parameters)
> atoms.set_calculator(calc)
>
> return atoms
>
>
>
> Met vriendelijke groeten,
> Mit freundlichen Grüßen,
> With kind regards,
>
>
> Willem Offermans
> Researcher Electrocatalysis SCT
> VITO NV | Boeretang 200 | 2400 Mol
> Phone:+32(0)14335263 Mobile:+32(0)492182073
>
> Willem.Offermans at Vito.be
>
>
> On 20 Jan 2020, at 16:17, Offermans Willem via ase-users <
> ase-users at listserv.fysik.dtu.dk> wrote:
>
> Dear ASE friends,
>
> If I save atoms objects to a file, the attached calculator object get lost.
>
> I read a trajectory file with atoms objects. The calculators of each are
> set to ``calculator=SinglePointCalculator(…)``. If I change this to
> ``calculator=SocketIOCalculator(…)`` and save the atoms objects to
> a file, the calculator is reset upon next read.
>
> Most probably, the info about the calculator is not saved and the settings
> of
> ``calculator=SinglePointCalculator(…)`` is initialised during read.
> Is this correct?
>
> Is it possible to save the calculator to a file as is done when saving the
> atoms
> object to a database?
> How can I save the calculator setting?
>
>
>
>
> Met vriendelijke groeten,
> Mit freundlichen Grüßen,
> With kind regards,
>
>
> Willem Offermans
> Researcher Electrocatalysis SCT
> VITO NV | Boeretang 200 | 2400 Mol
> Phone:+32(0)14335263 Mobile:+32(0)492182073
>
> Willem.Offermans at Vito.be
>
> <vito.jpg>
>
> Indien u VITO Mol bezoekt, hou aub er dan rekening mee dat de hoofdingang
> voortaan enkel bereikbaar is vanuit de richting Dessel-Retie, niet vanuit
> richting Mol, zie vito.be/route. <http://www.vito.be/route>
> If you plan to visit VITO at Mol, then please note that the main entrance
> can only be reached coming from Dessel-Retie and no longer coming from Mol,
> see vito.be/en/contact/locations.
> <http://www.vito.be/en/contact/locations>
> VITO Disclaimer: http://www.vito.be/e-maildisclaimer
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200121/5f7e62d4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vito.jpg
Type: image/jpeg
Size: 15232 bytes
Desc: not available
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200121/5f7e62d4/attachment-0001.jpg>
More information about the ase-users
mailing list