1!
2! Copyright (C) 1996-2016	The SIESTA group
3!  This file is distributed under the terms of the
4!  GNU General Public License: see COPYING in the top directory
5!  or http://www.gnu.org/copyleft/gpl.txt.
6! See Docs/Contributors.txt for a list of contributors.
7!
8      subroutine pixmol(iza, xa, na )
9c *******************************************************************
10c Writes and accumulates coordinates to be animated by Xmol
11c Written by E. Artacho. February 1999. Modified to open/close 2003
12c ********* INPUT ***************************************************
13c integer   iza(na)   : Atomic numbers of different atoms
14c double    xa(3,na)  : Atom coordinates
15c integer   na        : Number of atoms
16c character slabel*20 : Label for file naming
17c *******************************************************************
18
19      use precision,      only: dp
20      use periodic_table, only: symbol
21      use files,          only: slabel, label_length
22      use units, only: Ang
23
24      implicit          none
25
26      integer                             :: na
27      integer                             :: iza(na)
28      real(dp)                            :: xa(3,na)
29      external          io_assign, io_close
30
31c Internal variables and arrays
32
33      character(len=label_length+4) :: fname
34      integer :: i, ia
35      integer :: unit
36c -------------------------------------------------------------------
37
38      character(len=2) :: sym
39
40      fname = trim(slabel) //'.ANI'
41
42      call io_assign(unit)
43      open( unit, file=fname, form = 'formatted', position='append',
44     .      status='unknown')
45
46      write(unit,'(i5)') na
47      write(unit,*)
48      do ia = 1, na
49         sym =  symbol(iza(ia))
50         write(unit,'(a2,2x,3f12.6)') sym , (xa(i,ia)/Ang,i=1,3)
51      enddo
52
53      call io_close(unit)
54
55      return
56      end
57
58