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.
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 *******************************************************************
19
use files, only : slabel, label_length
20
use precision, only : dp
21
use units, only : Ang, eV
25
integer, intent(in) :: na
26
real(dp), intent(in) :: fa(3,na)
27
logical, intent(in) :: has_constr
29
external io_assign, io_close
32
character(len=label_length+4) :: fname
34
c -------------------------------------------------------------------
36
if ( has_constr ) then
37
fname = trim(slabel) // '.FAC'
39
fname = trim(slabel) // '.FA'
43
open( iu, file=fname, form='formatted', status='unknown',
47
write(iu,'(i6,3f12.6)') (ia, (fa(ix,ia)*Ang/eV,ix=1,3), ia=1,na)