C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C%%%%   Subroutine "Vstruc" is used to get the volume of the   %%%%
C%%%%   structure from the structrue file                      %%%%
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        subroutine Vstruc(volume)

        double precision volume

        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,3)

        inpos='RECELL'

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

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

C       Unit:A^3

        volume=alat**3*(privect(1,1)*recipvect(1,1)+
     &                  privect(1,2)*recipvect(1,2)+
     &                  privect(1,3)*recipvect(1,3))

        end
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C%%%%                      end of Vstruc.f                     %%%%
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
