[ase-users] ase-users Digest, Vol 106, Issue 7
John Kitchin
jkitchin at andrew.cmu.edu
Sat Apr 8 03:28:03 CEST 2017
>
> 1. Sort Atoms in specific Order (fabian)
> 2. Re: Sort Atoms in specific Order (Mikkel Strange)
> 3. Re: Sort Atoms in specific Order (fabian)
> 4. Re: Sort Atoms in specific Order (Eric Hermes)
> 5. Re: problem with the definition of space group 86 in
> ase.spacegroup.crystal function (Ask Hjorth Larsen)
> 6. Re: failing tests (Ask Hjorth Larsen)
>
>
> ----------------------------------------------------------------------
>
> 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
More information about the ase-users
mailing list