~siesta-maint/siesta/trunk

« back to all changes in this revision

Viewing changes to Src/iofa.f

  • Committer: Nick Papior
  • Date: 2018-06-18 13:12:58 UTC
  • mfrom: (560.1.372 4.1)
  • Revision ID: nickpapior@gmail.com-20180618131258-lu6q75maltb3uod5
Merged r927-932, ion table precision, transiesta fixes and FA/FC precision

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 iofa( na, fa , has_constr )
9
 
c *******************************************************************
10
 
c Writes forces in eV/Ang
11
 
c Emilio Artacho, Feb. 1999
12
 
c Nick Papior, Jun 2015
13
 
c ********** INPUT **************************************************
14
 
c integer na           : Number atoms
15
 
c real*8  fa(3,na)     : Forces on the atoms
16
 
c logical has_constr   : whether the forces are constrained or not
17
 
c *******************************************************************
18
 
 
19
 
      use files,     only : slabel, label_length
20
 
      use precision, only : dp
21
 
      use units,     only : Ang, eV
22
 
 
23
 
      implicit          none
24
 
 
25
 
      integer,  intent(in) :: na
26
 
      real(dp), intent(in) :: fa(3,na)
27
 
      logical,  intent(in) :: has_constr
28
 
 
29
 
      external          io_assign, io_close
30
 
 
31
 
c Internal 
32
 
      character(len=label_length+4) :: fname
33
 
      integer                       :: ia, iu, ix
34
 
c -------------------------------------------------------------------
35
 
 
36
 
      if ( has_constr ) then
37
 
         fname = trim(slabel) // '.FAC'
38
 
      else
39
 
         fname = trim(slabel) // '.FA'
40
 
      end if
41
 
 
42
 
      call io_assign( iu )
43
 
      open( iu, file=fname, form='formatted', status='unknown',
44
 
     $      position='rewind')      
45
 
 
46
 
      write(iu,'(i6)') na
47
 
      write(iu,'(i6,3f12.6)') (ia, (fa(ix,ia)*Ang/eV,ix=1,3), ia=1,na)
48
 
 
49
 
      call io_close( iu )
50
 
 
51
 
      end