C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C%%%%   Subroutine "Astruc2d" is used to get the cross-sectional%%%%
C%%%%   area of the structure from the structrue file for 2D    %%%%
C%%%%   material                                                %%%%
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&%%

        subroutine Astruc2d(area)

        double precision area

        double precision alat,pripos,privect
        dimension privect(3,3),pripos(1000,3)
        character*10 title,fix
        character*1 pricoord,seldyn
        character*5 sname
        character*10 inpos   
        dimension sname(10),fix(1000,3)
        integer i,j,k,ntype,natomi,nn
        integer Ncoord,Ndyn,atom_types,anum
        dimension natomi(10),atom_types(1000),anum(11)
        
        double precision recipvect
        dimension recipvect(3)

        inpos='RECELL'

        call readpos(inpos,
     &               title, 
     &               alat,
     &               privect, 
     &               sname,
     &               natomi,                
     &               ntype,
     &               nn,  
     &               Ndyn,
     &               Ncoord,
     &               pripos,
     &               fix,
     &               atom_types)



        recipvect(1)=privect(1,2)*privect(2,3)
     &              -privect(2,2)*privect(1,3)
        recipvect(2)=privect(1,3)*privect(2,1)
     &              -privect(2,3)*privect(1,1)
        recipvect(3)=privect(1,1)*privect(2,2)
     &              -privect(2,1)*privect(1,2)


C       Unit: A^2

        area=alat**2*sqrt(recipvect(1)**2+
     &                    recipvect(2)**2+
     &                    recipvect(3)**2)
                
        end
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C%%%%                     end of Astruc2d.f                    %%%%
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
