[ase-users] Sort Atoms in specific Order

fabian Fabian.T89 at web.de
Tue Apr 18 09:36:17 CEST 2017


Dear Professor Kitchin,

Thank you very much for your help! Your code works fine if i set the 
constrains before the sorting!

All the best

fabian


Am 08.04.2017 um 12:00 schrieb ase-users-request at listserv.fysik.dtu.dk:
>> Message: 1
>> Date: Fri, 7 Apr 2017 12:05:58 +0200
>> From: fabian<Fabian.T89 at web.de>
>> To: ase-users<ase-users at listserv.fysik.dtu.dk>
>> Subject: [ase-users] Sort Atoms in specific Order
>> Message-ID:<786700fc-0194-e512-3f1a-519f05c23498 at web.de>
>> Content-Type: text/plain; charset=utf-8; format=flowed
>>
>> Dear all ,
>>
>> I want to sort the order of the atoms in my  Output files
>>
>> in a specific order.
>>
>> currently i use:
>>
>> slab=sort(slab, tags=None)
>>
>> Which sets them in alphabetical order. I want to determine the order myself
>>
>> All the best
>>
>>
>> fabian
>>
>>
> I think an easy way to custom sort would be:
>
> na = [x.index for x in sorted(slab, key=lambda x: ['C', 'H', 'Cu', 'O'].index(x.symbol))]
> slab = slab[na]
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
> ------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170418/fcd5c6dd/attachment.html>


More information about the ase-users mailing list