[ase-users] 'Compatibility' of Atoms object with other codes
Ask Hjorth Larsen
asklarsen at gmail.com
Thu Oct 20 20:36:26 CEST 2016
I am trying to make atoms.cell default to None. I have "fixed"
atoms.py, but there are endless interactions with other parts of ASE.
Nevertheless it is easy to retain compatibility by replacing all use
of atoms.cell/get_cell() with atoms.get_cell(True), where True means
'use old behaviour'.
We could make the cell an object. Then we can do things like
atoms._cell.is_infinite
atoms._cell.is_orthorhombic
atoms._cell == other_atoms.cell # Would fail with None vs. numpy array
atoms._cell.equals(other_atoms.cell, tol=1e-10)
This kind of thing happens in several places.
Also if the cell is an object, it can later support advanced things
like being infinite in the y direction while not in x and z, or being
a sphere, or something, but that's not something to worry about now.
atoms.cell could return atoms._cell as a 3x3 array when possible
(current behaviour), and else raise an error (weak point: Maybe the
user wants the cell in order to set it properly! But usually that
would look like atoms.cell = [4, 5, 17], which results in a legit call
to set_cell anyway).
The user might want to use the special Cell object though. Either the
cell object could be an array subclass with extra stuff on it
(probably messy to achieve), or it would need some other name which is
not "cell".
Any opinions/suggestions?
Making the cell 'None' is a significant amount of work (evidently!)
but once that is done, most inherently tricky problems will be fixed,
and it could be replaced by an object without too much trouble (except
for all the searching/typing).
Best regards
Ask
2016-10-05 8:32 GMT+02:00 Jens Jørgen Mortensen <jensj at fysik.dtu.dk>:
> Den 05-10-2016 kl. 08:06 skrev Jens Jørgen Mortensen:
>>
>> Den 03-10-2016 kl. 18:39 skrev Ask Hjorth Larsen via ase-users:
>>>
>>> Hello
>>>
>>> Maybe we have discussed this before, but I am not quite sure.
>>>
>>> With ASE you can call other codes, and this is never much of a problem
>>> when ASE defines what the code should do. However, for reading data
>>> produced with other codes, the Atoms object frequently falls short on
>>> two counts:
>>>
>>> 1) The Atoms object always has a 3x3 cell, and many codes have
>>> either no cell, irregular shapes, or something else.
>>> 2) In ASE, each atom has a chemical symbol which corresponds
>>> one-to-one with an atomic number. Many codes allows arbitrary names
>>> for species or something entirely different.
>>>
>>> I suggest somehow improving these two things.
>>>
>>> We could allow the 'cell' could be None. This will undoubtedly be an
>>> annoyance, although only when something wrong was happening in the
>>> first place. One could also define a boolean or something more
>>> complex to describe the cell when an array is not appropriate.
>>>
>>> An extra optional array of 'labels' could represent names when
>>> something more than the chemical symbol is necessary. I know we
>>> already have 'tags', which are numbers.
>>>
>>> Suggestions, protests, ...?
>>
>>
>> I like both suggestions. It will be nice to get rid of the default
>> [[1,0,0],[0,1,0],[0,0,1]] cell we have now.
>
>
> I once did some work on the cell-thing:
>
> https://gitlab.com/jensj/ase/tree/cell
>
> but never finished it ...
>
> Jens Jørgen
>
>
>>
>> Jens Jørgen
>>
>>>
>>> Best regards
>>> Ask
>>> _______________________________________________
>>> 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