[ase-users] [ase-developers] ASE calculator interface proposal

Ask Hjorth Larsen asklarsen at gmail.com
Fri Feb 1 15:50:35 CET 2013


Hi

Sorry for not following the discussion so well.  I find the read/write
stuff a bit confusing.  Below are some comments.

I think read_atoms is a misleading name for something which reads the
results of an entire calculation.  It sounds as if it reads only an
Atoms object and does nothing else.  read() is much better as it
claims nothing about what it reads, implying that it changes the
calculator.

While I slightly prefer performing a calculation first and then
calling (or not) a write() function, like one presently does in GPAW,
I guess it is not completely silly to specify the filename in the
calculator constructor since many calculators need to create files
anyway.  So that's probably fine.  However I hope it won't be a
mandatory argument.

I have some trouble understanding if the filename 'si.abc' in the
examples results in a read or a (delayed) write.  I think generally
it's "read if the file exists, write if/when a calculation is done"
although I would probably prefer for that to be entirely obvious e.g
from keywords like output='si.abc'.  Also: What if one wants to read
from one file and write to another?

I'm not sure about this example:

>>> atoms = ...
>>> calc = ABC('si.abc', atoms, xc='LDA')
>>> atoms.get_potential_energy()
-1.2

What is the purpose of specifying an Atoms object to the calculator if
a new Atoms object is read from the file?

Perhaps the purpose will be more clear if examples with structure
optimization and MD/NEB are added.

Regards
Ask

2013/2/1 Jens Jørgen Mortensen <jensj at fysik.dtu.dk>:
> Den 01-02-2013 12:20, Max Hoffmann skrev:
>> Dear All,
>>
>> I have a question regarding [1], where is says "The read_atoms()
>> method is equivalent to:"
>> Can you clarify, where this 'read_atoms' is precisely located? More
>> specifically, what is 'ABC'  in :
>>
>>>>> atoms = ABC.read_atoms('si.abc')
>> Because: Following the text above 'ABC' would be the uninstantiated
>> calculator class.
>
> Yes, that is correct ABC is the uninstantiated class.  read_atoms is a
> so-called class-method.  You can see the implementation here:
>
> https://trac.fysik.dtu.dk/projects/ase/browser/branches/aep1/ase/calculators/calculator.py#L198
>    http://docs.python.org/2/library/functions.html#classmethod
>
> Jens Jørgen
>
>> Though I think such a constructor is uncommon in python. As a python user
>> I would expect to either have a read_atoms function as  in
>> ase.io.ABC.read_atoms('...') or
>> alternatively use the constructor like
>> ase.calculators.abc.ABC(read_atoms='si.abc').
>>
>> Best,
>> Max.
>>
>>
>> [1] https://wiki.fysik.dtu.dk/ase/development/proposals/calculators.html
>>
>>
>> 2013/1/28 John Kitchin <jkitchin at andrew.cmu.edu>:
>>>> * Restart
>>>>>> There is another use mode worth discussing. In the following example:
>>>>>>
>>>>>> myatoms = Atoms(..., ideal positions)
>>>>>>
>>>>>> calc = MyCalculator(arg1, atoms=myatoms, kwargs)
>>>>>> # I greatly prefer this to myatoms.set_calculator(calc)
>>>>>> atoms.get_potential_energy()
>>>>>
>>>>> I like that way of attaching the calculator to the atoms.  I'll put that
>>>>> idea in the proposal.
>>>>>> 1. The first time you run this, a calculation get run.
>>>> As a personal preference :-), I do not like that heavy calculations get
>>>> run when one creates an object (even though some GPAW functionality behaves
>>>> this way), but that user has to explicitly request calculation by calling a
>>>> function.
>>>
>>> Maybe something above was unclear. No calculation is done until
>>> atoms.get_potential_energy() is called.
>>>
>>>
>>>
>>> _______________________________________________
>>> 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




More information about the ase-users mailing list