[ase-users] Save SocketIOCalculator property to file
Offermans Willem
willem.offermans at vito.be
Tue Jan 21 10:56:54 CET 2020
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<mailto:Willem.Offermans at Vito.be>
[cid:982BA063-B96A-4A1B-89AB-5A01CA9FC70D at vito.local]
On 20 Jan 2020, at 16:17, Offermans Willem via ase-users <ase-users at listserv.fysik.dtu.dk<mailto: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<mailto: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<mailto: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/61d6b333/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vito.jpg
Type: image/jpeg
Size: 15232 bytes
Desc: vito.jpg
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200121/61d6b333/attachment-0001.jpg>
More information about the ase-users
mailing list