LCOV - code coverage report
Current view: top level - src/41_geometry - m_spgbuilder.F90 (source / functions) Coverage Total Hit
Test: coverage.info Lines: 90.1 % 517 466
Test Date: 2026-09-21 13:49:52 Functions: 100.0 % 3 3

            Line data    Source code
       1              : !!****m* ABINIT/m_spgbuilder
       2              : !! NAME
       3              : !! m_spgbuilder
       4              : !!
       5              : !! FUNCTION
       6              : !!  Spacegroup builder.
       7              : !!
       8              : !! COPYRIGHT
       9              : !!  Copyright (C) 2008-2026 ABINIT group (RC, XG)
      10              : !!  This file is distributed under the terms of the
      11              : !!  GNU General Public License, see ~abinit/COPYING
      12              : !!  or http://www.gnu.org/copyleft/gpl.txt .
      13              : !!
      14              : !! SOURCE
      15              : 
      16              : #if defined HAVE_CONFIG_H
      17              : #include "config.h"
      18              : #endif
      19              : 
      20              : #include "abi_common.h"
      21              : 
      22              : module m_spgbuilder
      23              : 
      24              :  use defs_basis
      25              :  use m_errors
      26              :  use m_abicore
      27              : 
      28              :  use m_symtk,   only : sg_multable, print_symmetries
      29              :  use m_symsg,   only : symsgcube, symsghexa, symsgmono, symsgortho, symsgtetra
      30              : 
      31              :  implicit none
      32              : 
      33              :  private
      34              : !!***
      35              : 
      36              :  public :: gensymspgr
      37              :  public :: gensymshub
      38              :  public :: gensymshub4
      39              : !!***
      40              : 
      41              : contains
      42              : !!***
      43              : 
      44              : !!****f* m_spgbuilder/gensymspgr
      45              : !! NAME
      46              : !! gensymspgr
      47              : !!
      48              : !! FUNCTION
      49              : !! Give all the symmetry operations starting from the space group symbol.
      50              : !! Suppose we are working in a conventional cell
      51              : !! If brvltt 0 or positive, the pure translations of the
      52              : !! Bravais lattice are included as generator of the group.
      53              : !! In brvltt=-1, no pure translation is present, and the
      54              : !! cell should be changed from conventional to primitive,
      55              : !! outside of this routine.
      56              : !! Treat also Shubnikov type III space groups.
      57              : !!
      58              : !! INPUTS
      59              : !! brvltt = input variable giving Bravais lattice
      60              : !! msym = default number of symmetry operations
      61              : !! shubnikov= magnetic type of the space group to be generated
      62              : !! spgaxor = orientation of the cell axis (might be needed)
      63              : !! spgorig = second choice of origin for certain groups
      64              : !! (might be needed if nsym==0)
      65              : !! spgroup = number of space group
      66              : !! spgroupma= number of the magnetic space group
      67              : !!
      68              : !! OUTPUT
      69              : !! nsym = number of symmetry operations
      70              : !! symafm(nsym)=(anti)ferromagnetic part of symmetry operations
      71              : !! symrel(3,3,nsym)=symmetry operations in real space in terms
      72              : !!                  of primitive translations
      73              : !! tnons(3,nsym)=nonsymmorphic translations for symmetry operations
      74              : !!
      75              : !! SIDE EFFECTS
      76              : !! brvltt = input variable giving Bravais lattice
      77              : !!
      78              : !! SOURCE
      79              : 
      80         1623 : subroutine gensymspgr(brvltt,msym,nsym,shubnikov,spgaxor,spgorig,spgroup,spgroupma,symafm,symrel,tnons)
      81              : 
      82              : !Arguments ------------------------------------
      83              : !scalars
      84              :  integer,intent(in) :: msym,shubnikov,spgaxor,spgorig,spgroup,spgroupma
      85              :  integer,intent(inout) :: brvltt
      86              :  integer,intent(out) :: nsym
      87              : !arrays
      88              :  integer,intent(inout) :: symafm(msym),symrel(3,3,msym) !vz_i
      89              :  real(dp),intent(inout) :: tnons(3,msym) !vz_i
      90              : 
      91              : !Local variables ------------------------------
      92              : ! intsym,inttn = intermediate real to swap the columns of the symmetry matrix
      93              : ! bckbrvltt = backup to brvltt to compare the assigned and the input values
      94              : !real(dp) :: tsec(2)
      95              : !scalars
      96              :  integer :: bckbrvltt,ii,inversion,jj,kk,ierr
      97              :  integer :: intsym
      98              :  real(dp) :: inttn
      99              :  character(len=500) :: message
     100              : ! *************************************************************************
     101              : 
     102              : !List of the input parameters
     103              : !DEBUG
     104              : !write(std_out,*)' gensymspgr : enter with:'
     105              : !write(std_out,*)' spgroup = ',spgroup
     106              : !write(std_out,*)' spgaxor = ',spgaxor
     107              : !write(std_out,*)' spgorig = ',spgorig
     108              : !write(std_out,*)' brvltt  = ',brvltt
     109              : !ENDDEBUG
     110              : 
     111              : !Assume that the value of spgroupma is consistent with the one of spgroup
     112              : !(this has been checked earlier)
     113              : 
     114              : !Tests for consistency first the space group number and then the orientation
     115              : !Checks the space group number
     116         1623 :  if (.not.(spgroup>0 .and. spgroup<231) ) then
     117              :    write(message, '(a,i0,a,a,a,a)' )&
     118            0 : &   'spgroup must be between 1 to 230, but is ',spgroup,ch10,&
     119            0 : &   'This is not allowed.  ',ch10,&
     120            0 : &   'Action: modify spgroup in the input file.'
     121            0 :    ABI_ERROR(message)
     122              :  end if
     123              : 
     124              : !Checks the orientation
     125         1623 :  if (.not.(spgaxor>0 .and. spgaxor<10)) then
     126              :    write(message, '(a,i12,a,a,a,a)' )&
     127            0 : &   'spgaxor must be from 1 to 9, but is',spgaxor,ch10,&
     128            0 : &   'This is not allowed.  ',ch10,&
     129            0 : &   'Action: modify spgaxor in the input file.'
     130            0 :    ABI_ERROR(message)
     131              :  end if
     132              : 
     133              : !Checks the consistency between the origin and space group
     134         1623 :  if (spgorig==1 .or. spgorig==2) then
     135              :  else
     136              :    write(message, '(a,i4,a,a,a,a,a,a)' )&
     137            0 : &   'spgorig is',spgorig,ch10,&
     138            0 : &   'while it should be 0 or 1',ch10,&
     139            0 : &   'This is not allowed.  ',ch10,&
     140            0 : &   'Action: modify spgorig in the input file.'
     141            0 :    ABI_ERROR(message)
     142              :  end if
     143              : 
     144         1623 :  if (spgorig>1) then
     145            0 :    select case (spgroup)
     146              :    case (48,50,59,68,70,85,86,88,125,126,129,130,133,134,137,138,&
     147              : &     141,142,201,203,222,224,227,228)
     148              :    case default
     149              :      write(message, '(a,a,a,a,a)' )&
     150            0 : &     'spgroup does not accept several origin choices',ch10,&
     151            0 : &     'This is not allowed.  ',ch10,&
     152            0 : &     'Action: modify spgorig in the input file.'
     153            7 :      ABI_ERROR(message)
     154              :    end select
     155              :  end if
     156              : 
     157              : !Checks for consistency between the orientation and space group
     158         1623 :  if (spgaxor>1) then
     159            0 :    select case (spgroup)
     160              :    case (3:74,146,148,155,160,161,166,167)
     161              :    case default
     162              :      write(message, '(a,a,a,a,a)' )&
     163            0 : &     'spgroup does not accept several orientations',ch10,&
     164            0 : &     'This is not allowed.  ',ch10,&
     165            0 : &     'Action: modify spgaxor or spgroup in the input file.'
     166           74 :      ABI_ERROR(message)
     167              :    end select
     168              :  end if
     169              : 
     170         1623 :  if (brvltt<-1 .or. brvltt>7)then
     171              :    write(message, '(a,i4,a,a,a,a,a,a)' )&
     172            0 : &   'The input brvltt was ',brvltt,ch10,&
     173            0 : &   'and it should be an integer from -1 to 7',ch10,&
     174            0 : &   'This is not allowed.  ',ch10,&
     175            0 : &   'Action: modify brvltt  in the input file.'
     176            0 :    ABI_ERROR(message)
     177              :  end if
     178              : 
     179              : !Assign nsym for each group according first to the order of the group
     180              : !Note that this value might be modified later:
     181              : !first because of the product with the inversion,
     182              : !second because of the centering operations
     183            5 :  select case (spgroup)
     184              :  case (1,2)
     185            5 :    nsym=1
     186              :  case (3:9)
     187           34 :    nsym=2
     188              :  case (143:148)
     189           43 :    nsym=3
     190              :  case (10:42,44:47,49,51:58,60:67,69,71:84,87)
     191          560 :    nsym=4
     192              :  case (149:176)
     193          242 :    nsym=6
     194              :  case (48,50,59,68,70,85,86,88:121,123,124,127,128,131,132,135,136,139,140)
     195          398 :    nsym=8
     196              :  case (177:200,202,204:206)
     197          127 :    nsym=12
     198              :  case (43,122,125,126,129,130,133,134,137,138)
     199           97 :    nsym=16
     200              :  case (201,207:219,221,223,225,226,229,230)
     201           72 :    nsym=24
     202              :  case (141,142)
     203           20 :    nsym=32
     204              :  case (203,220,222,224)
     205           15 :    nsym=48
     206              :  case (227,228)
     207         1623 :    nsym=192
     208              :  end select
     209              : 
     210              : !DEBUG
     211              : !write(std_out,*)'gensymspgr :  assigns nsym = ',nsym
     212              : !ENDDEBUG
     213              : 
     214              : !Makes a backup to the brvltt for further comparison with the assigned value
     215         1623 :  bckbrvltt=brvltt
     216              : !Default brvltt
     217         1623 :  brvltt=1
     218              : 
     219              : !call timab(47,1,tsec)
     220              : 
     221              : !Assigns the first part of the symmetry operations:
     222              : !Rotation axis and mirror planes with or without translations,
     223              : !and sometimes also inversion operations.
     224              :  select case (spgroup)
     225              :  case (1:2)
     226           65 :    symrel(:,:,1)=0
     227            5 :    symrel(1,1,1)=1 ; symrel(2,2,1)=1 ; symrel(3,3,1)=1
     228           20 :    tnons(:,1)=zero ; symafm(1)=1
     229              :  case (3:15)
     230              :    call symsgmono(brvltt,msym,nsym,shubnikov,spgaxor,spgorig,spgroup,&
     231           79 : &   spgroupma,symafm,symrel,tnons)
     232              :  case (16:74)
     233              :    call symsgortho(msym,nsym,shubnikov,spgaxor,spgorig,spgroup,&
     234          521 : &   spgroupma,symafm,symrel,tnons)
     235              :  case (75:142)
     236              :    call symsgtetra(msym,nsym,shubnikov,spgaxor,spgorig,spgroup,&
     237          509 : &   spgroupma,symafm,symrel,tnons)
     238              :  case (143:194)
     239              :    call symsghexa(brvltt,msym,nsym,shubnikov,spgaxor,spgorig,spgroup,&
     240          391 : &   spgroupma,symafm,symrel,tnons)
     241              :  case (195:230)
     242              :    call symsgcube(msym,nsym,shubnikov,spgaxor,spgorig,spgroup,&
     243         1623 : &   spgroupma,symafm,symrel,tnons)
     244              :  end select
     245              : 
     246              : !call timab(47,2,tsec)
     247              : 
     248              : !Assign the inversion center (if necessary).
     249              : !Note that for monoclinic space groups, the inversion was already
     250              : !assigned in symsgmono.f. Some other inversions have also been assigned in the
     251              : !corresponding system routine
     252         1623 :  inversion=0
     253          597 :  select case (spgroup)
     254              :  case (2,47,49,51:58,60:67,69,71:74,83,84,87,123,124,127,128,131,132,&
     255              : &   135,136,139,140,147,148,162:167,175,176,191:194,200,202,204:206,&
     256              : &   221,223,225,226,229,230)
     257          597 :    inversion=1
     258              : !    Treat the magnetic part
     259         1623 :    if(shubnikov==3)then
     260              :      select case (spgroup)
     261              :      case(2) ! Triclinic
     262          123 :        inversion=-1
     263              :      case(47,49,51:58,60:67,69,71:74) ! Orthorhombic
     264          202 :        select case (spgroupma)
     265              :        case(251,253,259,261,267,268,271,279,280,283,291,292,293,297,307,&
     266              : &         308,309,313,323,324,325,329,339,340,341,345,355,356,359,367,368,371,&
     267              : &         379,380,381,385,395,396,399,407,408,411,419,420,421,425,435,437,443,&
     268              : &         444,445,449,459,460,461,465,471,472,473,477,483,484,487,493,494,497,&
     269              : &         503,504,507,513,514,517,523,525,529,531,535,537,541,542,545,550,552,556,557,560)
     270          123 :          inversion=-1
     271              :        end select
     272              :      case(83,84,87,123,124,127,128,131,132,135,136,139,140) ! Tetragonal
     273          133 :        select case (spgroupma)
     274              :        case(46,47,54,55,62,63,70,71,78,79,84,85,341,344,346,347,353,356,358,359,365,&
     275              : &         368,370,371,377,380,382,383,389,392,394,395,401,404,406,407,&
     276              : &         413,416,418,419,425,428,430,431,437,440,442,443,449,452,454,455,&
     277              : &         461,464,466,467,473,476,478,479,485,488,490,491,497,500,502,503,&
     278              : &         509,512,514,515,521,524,526,527,533,536,538,539,543,546,548,549)
     279           79 :          inversion=-1
     280              :        end select
     281              :      case(147,148,162:167,175,176,191:194) ! Hexagonal or rhombohedral
     282           77 :        select case (spgroupma)
     283              :        case(15,19,75,76,81,82,87,88,93,94,99,100,105,106,139,140,145,146,&
     284              : &         235,236,237,241,245,246,247,251,255,256,257,261,265,266,267,271)
     285           54 :          inversion=-1
     286              :        end select
     287              :      case(200,202,204:206,221,223,225,226,229,230) ! Cubic
     288          280 :        select case (spgroupma)
     289              :        case(16,20,24,28,32,35,39,94,96,100,102,106,108,112,114,118,120,124,126,&
     290              : &         130,132,136,138,142,144,147,149)
     291           23 :          inversion=-1
     292              :        end select
     293              :      end select
     294              :    end if
     295              :  end select
     296              : 
     297              : !DEBUG
     298              : !write(std_out,*)' gensymspgr : before inversion'
     299              : !write(std_out,*)' Describe the different symmetry operations (index,symrel,tnons,symafm)'
     300              : !do ii=1,nsym
     301              : !write(std_out,'(i3,2x,9i3,3es12.2,i3)')ii,symrel(:,:,ii),tnons(:,ii),symafm(ii)
     302              : !end do
     303              : !ENDDEBUG
     304              : 
     305              :  if(inversion/=0)then
     306         4613 :    do ii=1,nsym        ! visit all the symmetries assigned before
     307        16064 :      do jj=1,3        ! visit the 3x3 matrix corresponding to the symmetry i
     308        12048 :        tnons(jj,nsym+ii)=-tnons(jj,ii)
     309        52208 :        do kk=1,3
     310        48192 :          symrel(jj,kk,nsym+ii)=-symrel(jj,kk,ii)
     311              :        end do
     312              :      end do
     313         4613 :      symafm(nsym+ii)=inversion*symafm(ii)
     314              :    end do
     315          597 :    nsym=nsym*2
     316              :  end if
     317              : 
     318              : !DEBUG
     319              : !write(std_out,*)' gensymspgr : after inversion'
     320              : !write(std_out,*)' Describe the different symmetry operations (index,symrel,tnons,symafm)'
     321              : !do ii=1,nsym
     322              : !write(std_out,'(i3,2x,9i3,3es12.2,i3)')ii,symrel(:,:,ii),tnons(:,ii),symafm(ii)
     323              : !end do
     324              : !ENDDEBUG
     325              : 
     326              : !Assign the Bravais lattice to each space group to which it has not yet
     327              : !been assigned
     328           28 :  select case (spgroup)
     329              :  case (38:41)
     330           28 :    brvltt=5                ! A
     331              :  case (20,21,35:37,63:68)
     332          101 :    brvltt=4                ! C
     333              :  case (22,42,43,69,70,196,202,203,209,210,216,219,225:228)
     334           63 :    brvltt=3                ! F
     335              :  case (23,24,44:46,71:74,79,80,82,87,88,97,98,107:110,119:122,&
     336              : &   139:142,197,199,204,206,211,214,217,220,229,230)
     337          181 :    brvltt=2                ! I
     338              :  case (146,148,155,160,161,166,167)
     339         1623 :    if (spgaxor==1) then
     340           36 :      brvltt=7
     341              :    end if
     342              :  end select
     343              : 
     344         1623 :  if (bckbrvltt/=0 .and. bckbrvltt/=-1) then
     345           34 :    if (bckbrvltt/=brvltt) then
     346              :      write(message, '(a,i8,a,a,a,i8,a,a)' )&
     347            0 : &     'The assigned brvltt ',brvltt,' is not equal',ch10,&
     348            0 : &     'to the input value ',bckbrvltt,ch10,&
     349            0 : &     'Assume experienced user. Execution will continue.'
     350            0 :      ABI_WARNING(message)
     351              :    end if
     352              :  end if
     353              : 
     354              : !if(bckbrvltt>=0)then
     355              : !Complete the set of primitive symmetries by translations
     356              : !associated with brvltt.
     357         1651 :  select case (brvltt)
     358              : !  Bravais lattice type : A ! translation associated: b/2+c/2
     359              :  case (5)
     360          140 :    do ii=1,nsym
     361          112 :      tnons(1,nsym+ii)=tnons(1,ii)
     362          112 :      tnons(2,nsym+ii)=tnons(2,ii)+0.5
     363          112 :      tnons(3,nsym+ii)=tnons(3,ii)+0.5
     364         1456 :      symrel(:,:,nsym+ii)=symrel(:,:,ii)
     365          140 :      symafm(nsym+ii)=symafm(ii)
     366              :    end do
     367           28 :    nsym=nsym*2
     368              : 
     369              : !    Bravais lattice type : B ! translation associated: a/2+c/2
     370              :  case (6)
     371            0 :    do ii=1,nsym
     372            0 :      tnons(1,nsym+ii)=tnons(1,ii)+0.5
     373            0 :      tnons(2,nsym+ii)=tnons(2,ii)
     374            0 :      tnons(3,nsym+ii)=tnons(3,ii)+0.5
     375            0 :      symrel(:,:,nsym+ii)=symrel(:,:,ii)
     376            0 :      symafm(nsym+ii)=symafm(ii)
     377              :    end do
     378            0 :    nsym=nsym*2
     379              : 
     380              : !    Bravais lattice type : C ! translation associated: a/2+b/2
     381              :  case (4)
     382          886 :    do ii=1,nsym
     383          760 :      tnons(1,nsym+ii)=tnons(1,ii)+0.5
     384          760 :      tnons(2,nsym+ii)=tnons(2,ii)+0.5
     385          760 :      tnons(3,nsym+ii)=tnons(3,ii)
     386         9880 :      symrel(:,:,nsym+ii)=symrel(:,:,ii)
     387          886 :      symafm(nsym+ii)=symafm(ii)
     388              :    end do
     389          126 :    nsym=nsym*2
     390              : 
     391              : !    Bravais lattice type : F ! translations associated: a/2+b/2,b/2+c/2,b/2+c/2
     392              :  case (3)
     393              : !    For space groups containing d elements, all the symmetry operations
     394              : !    have already been obtained
     395           63 :     if(spgroup/=43 .and. spgroup/=227 .and. spgroup/=228)then
     396         1189 :      do ii=1,nsym
     397              : !        First translation: a/2+b/2
     398         1140 :        tnons(1,nsym+ii)=tnons(1,ii)+0.5
     399         1140 :        tnons(2,nsym+ii)=tnons(2,ii)+0.5
     400         1140 :        tnons(3,nsym+ii)=tnons(3,ii)
     401        14820 :        symrel(:,:,nsym+ii)=symrel(:,:,ii)
     402         1189 :        symafm(nsym+ii)=symafm(ii)
     403              :      end do
     404              : !      Second translation: b/2+c/2
     405         1189 :      do ii=1,nsym
     406         1140 :        tnons(1,2*nsym+ii)=tnons(1,ii)
     407         1140 :        tnons(2,2*nsym+ii)=tnons(2,ii)+0.5
     408         1140 :        tnons(3,2*nsym+ii)=tnons(3,ii)+0.5
     409        14820 :        symrel(:,:,2*nsym+ii)=symrel(:,:,ii)
     410         1189 :        symafm(2*nsym+ii)=symafm(ii)
     411              :      end do
     412              : !      Third translation: a/2+c/2
     413         1189 :      do ii=1,nsym
     414         1140 :        tnons(1,3*nsym+ii)=tnons(1,ii)+0.5
     415         1140 :        tnons(2,3*nsym+ii)=tnons(2,ii)
     416         1140 :        tnons(3,3*nsym+ii)=tnons(3,ii)+0.5
     417        14820 :        symrel(:,:,3*nsym+ii)=symrel(:,:,ii)
     418         1189 :        symafm(3*nsym+ii)=symafm(ii)
     419              :      end do
     420           49 :      nsym=nsym*4
     421              :    end if
     422              : 
     423              : !    Bravais lattice type: I ! translation associated: a/2+b/2+c/2
     424              :  case (2)
     425              : !    For space groups containing d elements, all the symmetry operations
     426              : !    have already been obtained
     427          181 :    if(spgroup/=122 .and. spgroup/=141 .and. spgroup/=142 .and. &
     428           36 : &   spgroup/=220 )then
     429         1914 :      do ii=1,nsym        ! visit all the symmetries assigned before
     430         7040 :        tnons(:,nsym+ii)=tnons(:,ii)+0.5
     431        22880 :        symrel(:,:,nsym+ii)=symrel(:,:,ii)
     432         1914 :        symafm(nsym+ii)=symafm(ii)
     433              :      end do
     434          154 :      nsym=nsym*2
     435              :    end if
     436              : 
     437              : !    Bravais lattice type: R
     438              : !    translations for hexagonal axes ONLY: (2/3,1/3,1/3) & (1/3,2/3,2/3)
     439              : !    first translation (2/3,1/3,1/3)
     440              :  case (7)
     441          348 :    do ii=1,nsym
     442          312 :      tnons(1,nsym+ii)=tnons(1,ii)+two_thirds
     443          312 :      tnons(2,nsym+ii)=tnons(2,ii)+third
     444          312 :      tnons(3,nsym+ii)=tnons(3,ii)+third
     445         4056 :      symrel(:,:,nsym+ii)=symrel(:,:,ii)
     446          348 :      symafm(nsym+ii)=symafm(ii)
     447              :    end do
     448              : !    Second translation (1/3,2/3,2/3)
     449          348 :    do ii=1,nsym
     450          312 :      tnons(1,2*nsym+ii)=tnons(1,ii)+third
     451          312 :      tnons(2,2*nsym+ii)=tnons(2,ii)+two_thirds
     452          312 :      tnons(3,2*nsym+ii)=tnons(3,ii)+two_thirds
     453         4056 :      symrel(:,:,2*nsym+ii)=symrel(:,:,ii)
     454          348 :      symafm(2*nsym+ii)=symafm(ii)
     455              :    end do
     456         1659 :    nsym=nsym*3
     457              : 
     458              :  end select
     459              : 
     460              : !end if
     461              : 
     462              : !Translate tnons in the ]-0.5,0.5] interval
     463       104751 :  tnons(:,1:nsym)=tnons(:,1:nsym)-nint(tnons(:,1:nsym)-1.0d-8)
     464              : 
     465              : !Orientations for the orthorhombic space groups
     466              : !WARNING : XG 000620 : I am not sure that this coding is correct !!
     467         1623 :  if (spgroup>15 .and. spgroup <75) then
     468          508 :    select case (spgaxor)
     469              :    case (1)             ! abc
     470          508 :      write(std_out,*)' the choosen orientation corresponds to: abc; the proper one'
     471              :    case (2)             ! cab
     472           34 :      do ii=1,nsym
     473           32 :        intsym=symrel(1,1,ii)
     474           32 :        symrel(1,1,ii)=symrel(2,2,ii)
     475           32 :        symrel(2,2,ii)=intsym
     476           32 :        inttn=tnons(1,ii)
     477           32 :        tnons(1,ii)=tnons(2,ii)
     478           34 :        tnons(2,ii)=inttn
     479              :      end do
     480           34 :      do ii=1,nsym
     481           32 :        intsym=symrel(1,1,ii)
     482           32 :        symrel(1,1,ii)=symrel(3,3,ii)
     483           32 :        symrel(3,3,ii)=intsym
     484           32 :        inttn=tnons(1,ii)
     485           32 :        tnons(1,ii)=tnons(3,ii)
     486           34 :        tnons(3,ii)=inttn
     487              :      end do
     488            2 :      write(std_out,*)' the choosen orientation corresponds to:  cab'
     489              :    case (3)             ! bca
     490           43 :      do ii=1,nsym
     491           40 :        intsym=symrel(1,1,ii)
     492           40 :        symrel(1,1,ii)=symrel(2,2,ii)
     493           40 :        symrel(2,2,ii)=intsym
     494           40 :        inttn=tnons(1,ii)
     495           40 :        tnons(1,ii)=tnons(2,ii)
     496           43 :        tnons(2,ii)=inttn
     497              :      end do
     498           43 :      do ii=1,nsym
     499           40 :        intsym=symrel(2,2,ii)
     500           40 :        symrel(2,2,ii)=symrel(3,3,ii)
     501           40 :        symrel(3,3,ii)=intsym
     502           40 :        inttn=tnons(2,ii)
     503           40 :        tnons(2,ii)=tnons(3,ii)
     504           43 :        tnons(3,ii)=inttn
     505              :      end do
     506            3 :      write(std_out,*)' the choosen orientation corresponds to:  bca'
     507              :    case (4)             ! acb
     508           34 :      do ii=1,nsym
     509           32 :        intsym=symrel(2,2,ii)
     510           32 :        symrel(2,2,ii)=symrel(3,3,ii)
     511           32 :        symrel(3,3,ii)=intsym
     512           32 :        inttn=tnons(1,ii)
     513           32 :        tnons(2,ii)=tnons(3,ii)
     514           34 :        tnons(3,ii)=inttn
     515              :      end do
     516            2 :      write(std_out,*)' the choosen orientation corresponds to:  acb'
     517              :    case (5)             ! bac
     518           43 :      do ii=1,nsym
     519           40 :        intsym=symrel(1,1,ii)
     520           40 :        symrel(1,1,ii)=symrel(2,2,ii)
     521           40 :        symrel(2,2,ii)=intsym
     522           40 :        inttn=tnons(1,ii)
     523           40 :        tnons(1,ii)=tnons(2,ii)
     524           43 :        tnons(2,ii)=inttn
     525              :      end do
     526            3 :      write(std_out,*)' the choosen orientation corresponds to:  bac'
     527              :    case (6)             ! cba
     528           34 :      do ii=1,nsym
     529           32 :        intsym=symrel(1,1,ii)
     530           32 :        symrel(1,1,ii)=symrel(3,3,ii)
     531           32 :        symrel(3,3,ii)=intsym
     532           32 :        inttn=tnons(1,ii)
     533           32 :        tnons(1,ii)=tnons(3,ii)
     534           34 :        tnons(3,ii)=inttn
     535              :      end do
     536          523 :      write(std_out,*)' the choosen orientation corresponds to:  cba'
     537              :    end select
     538              :  end if
     539              : 
     540              : !DEBUG
     541              : !write(std_out,*)' gensymspgr  : out of the Bravais lattice, nsym is',nsym
     542              : !ENDDEBUG
     543              : 
     544         1623 :  call sg_multable(nsym,symafm,symrel,ierr,tnons=tnons,tnons_tol=tol5)
     545         1623 :  if (ierr/=0) call print_symmetries([std_out], nsym, symrel, tnons, symafm)
     546              : 
     547         1623 :  ABI_CHECK(ierr==0,"Error in group closure")
     548              : 
     549         1623 : end subroutine gensymspgr
     550              : !!***
     551              : 
     552              : !!****f* m_spgbuilder/gensymshub
     553              : !! NAME
     554              : !! gensymshub
     555              : !!
     556              : !! FUNCTION
     557              : !! Analyse the Shubnikov space group, from the input of the
     558              : !! the Fedorov space group number, and the Shubnikov space group number:
     559              : !! 1) determine the type (III or IV)
     560              : !! 2) for type (IV), determine the translation generating
     561              : !!   the anti-ferromagnetic operations
     562              : !! At present, follow strictly the specifications of Bradley
     563              : !! and Cracknell. However, one should take into account the
     564              : !! orientation of the symmetry group (spgaxor).
     565              : !!
     566              : !! INPUTS
     567              : !! spgroup = number of space group
     568              : !! spgroupma = number of magnetic space group
     569              : !!
     570              : !! OUTPUT
     571              : !! genafm(3) = in case of shubnikov type IV, translation, generator of the
     572              : !!  anti-ferromagnetic symmetry operations
     573              : !! shubnikov = type of the shubnikov group
     574              : !!
     575              : !! SOURCE
     576              : 
     577         1192 : subroutine gensymshub(genafm,spgroup,spgroupma,shubnikov)
     578              : 
     579              : !Arguments ------------------------------------
     580              : !scalars
     581              :  integer,intent(in) :: spgroup,spgroupma
     582              :  integer,intent(out) :: shubnikov
     583              : !arrays
     584              :  real(dp),intent(out) :: genafm(3)
     585              : 
     586              : !Local variables ------------------------------
     587              : !scalars
     588              :  integer :: brvlttbw=0,spgrmatch=1
     589              :  character(len=500) :: message
     590              : ! *************************************************************************
     591              : 
     592              : !List of the input parameters
     593              : !DEBUG
     594              : !write(std_out,*)
     595              : !write(std_out,*)' gensymshub : enter with:'
     596              : !write(std_out,*)' brvlttbw  = ',brvlttbw
     597              : !write(std_out,*)' spgroup = ',spgroup
     598              : !write(std_out,*)' spgroupma = ',spgroupma
     599              : !ENDDEBUG
     600              : 
     601              : !Test for consistency the magnetic and non-magnetic space group
     602         1193 :  select case (spgroup)
     603              :  case(1)
     604            1 :    if (.not.(spgroupma>=3  .and.  3 >=spgroupma) ) spgrmatch=0
     605              :  case(2)
     606            2 :    if (.not.(spgroupma>=6  .and.  7 >=spgroupma) ) spgrmatch=0
     607              :  case(3)
     608            4 :    if (.not.(spgroupma>=3   .and.  6 >=spgroupma) ) spgrmatch=0
     609              :  case(4)
     610            4 :    if (.not.(spgroupma>=9   .and.  12 >=spgroupma) ) spgrmatch=0
     611              :  case(5)
     612            3 :    if (.not.(spgroupma>=15   .and.  17 >=spgroupma) ) spgrmatch=0
     613              :  case(6)
     614            4 :    if (.not.(spgroupma>=20   .and.  23 >=spgroupma) ) spgrmatch=0
     615              :  case(7)
     616            6 :    if (.not.(spgroupma>=26   .and.  31 >=spgroupma) ) spgrmatch=0
     617              :  case(8)
     618            3 :    if (.not.(spgroupma>=34   .and.  36 >=spgroupma) ) spgrmatch=0
     619              :  case(9)
     620            3 :    if (.not.(spgroupma>=39   .and.  41 >=spgroupma) ) spgrmatch=0
     621              :  case(10)
     622            6 :    if (.not.(spgroupma>=44   .and.  49 >=spgroupma) ) spgrmatch=0
     623              :  case(11)
     624            6 :    if (.not.(spgroupma>=52   .and.  57 >=spgroupma) ) spgrmatch=0
     625              :  case(12)
     626            5 :    if (.not.(spgroupma>=60   .and.  64 >=spgroupma) ) spgrmatch=0
     627              :  case(13)
     628            8 :    if (.not.(spgroupma>=67   .and.  74 >=spgroupma) ) spgrmatch=0
     629              :  case(14)
     630            8 :    if (.not.(spgroupma>=77   .and.  84 >=spgroupma) ) spgrmatch=0
     631              :  case(15)
     632            5 :    if (.not.(spgroupma>=87   .and.  91 >=spgroupma) ) spgrmatch=0
     633              :  case(16)
     634            4 :    if (.not.(spgroupma>= 3  .and.   6>=spgroupma) ) spgrmatch=0
     635              :  case(17)
     636            7 :    if (.not.(spgroupma>= 9  .and.  15 >=spgroupma) ) spgrmatch=0
     637              :  case(18)
     638            7 :    if (.not.(spgroupma>=18   .and.  24 >=spgroupma) ) spgrmatch=0
     639              :  case(19)
     640            4 :    if (.not.(spgroupma>=27   .and.  30 >=spgroupma) ) spgrmatch=0
     641              :  case(20)
     642            5 :    if (.not.(spgroupma>=33   .and.  37 >=spgroupma) ) spgrmatch=0
     643              :  case(21)
     644            5 :    if (.not.(spgroupma>=40   .and.  44 >=spgroupma) ) spgrmatch=0
     645              :  case(22)
     646            2 :    if (.not.(spgroupma>=47   .and.  48 >=spgroupma) ) spgrmatch=0
     647              :  case(23)
     648            2 :    if (.not.(spgroupma>=51   .and.  52 >=spgroupma) ) spgrmatch=0
     649              :  case(24)
     650            2 :    if (.not.(spgroupma>=55   .and.  56 >=spgroupma) ) spgrmatch=0
     651              :  case(25)
     652            7 :    if (.not.(spgroupma>=59   .and.  65 >=spgroupma) ) spgrmatch=0
     653              :  case(26)
     654           10 :    if (.not.(spgroupma>=68   .and.  77 >=spgroupma) ) spgrmatch=0
     655              :  case(27)
     656            7 :    if (.not.(spgroupma>=80   .and.  86 >=spgroupma) ) spgrmatch=0
     657              :  case(28)
     658           10 :    if (.not.(spgroupma>=89   .and.  98 >=spgroupma) ) spgrmatch=0
     659              :  case(29)
     660           10 :    if (.not.(spgroupma>=101  .and.  110 >=spgroupma) ) spgrmatch=0
     661              :  case(30)
     662           10 :    if (.not.(spgroupma>=113   .and. 122  >=spgroupma) ) spgrmatch=0
     663              :  case(31)
     664           10 :    if (.not.(spgroupma>=125   .and. 134  >=spgroupma) ) spgrmatch=0
     665              :  case(32)
     666            7 :    if (.not.(spgroupma>=137   .and. 143  >=spgroupma) ) spgrmatch=0
     667              :  case(33)
     668           10 :    if (.not.(spgroupma>=146   .and.  155 >=spgroupma) ) spgrmatch=0
     669              :  case(34)
     670            7 :    if (.not.(spgroupma>=158   .and.  164 >=spgroupma) ) spgrmatch=0
     671              :  case(35)
     672            5 :    if (.not.(spgroupma>=167   .and.   171>=spgroupma) ) spgrmatch=0
     673              :  case(36)
     674            6 :    if (.not.(spgroupma>=174   .and.   179>=spgroupma) ) spgrmatch=0
     675              :  case(37)
     676            5 :    if (.not.(spgroupma>=182   .and.  186 >=spgroupma) ) spgrmatch=0
     677              :  case(38)
     678            6 :    if (.not.(spgroupma>=189   .and.  194 >=spgroupma) ) spgrmatch=0
     679              :  case(39)
     680            6 :    if (.not.(spgroupma>=197   .and.  202 >=spgroupma) ) spgrmatch=0
     681              :  case(40)
     682            6 :    if (.not.(spgroupma>=205   .and.  210 >=spgroupma) ) spgrmatch=0
     683              :  case(41)
     684            6 :    if (.not.(spgroupma>=213   .and.  218 >=spgroupma) ) spgrmatch=0
     685              :  case(42)
     686            3 :    if (.not.(spgroupma>=221   .and.   223>=spgroupma) ) spgrmatch=0
     687              :  case(43)
     688            3 :    if (.not.(spgroupma>=226   .and.   228>=spgroupma) ) spgrmatch=0
     689              :  case(44)
     690            4 :    if (.not.(spgroupma>=231   .and.  234 >=spgroupma) ) spgrmatch=0
     691              :  case(45)
     692            4 :    if (.not.(spgroupma>=237   .and.  240 >=spgroupma) ) spgrmatch=0
     693              :  case(46)
     694            6 :    if (.not.(spgroupma>=243   .and.  248 >=spgroupma) ) spgrmatch=0
     695              :  case(47)
     696            6 :    if (.not.(spgroupma>=251   .and.  256 >=spgroupma) ) spgrmatch=0
     697              :  case(48)
     698            6 :    if (.not.(spgroupma>=259   .and.  264 >=spgroupma) ) spgrmatch=0
     699              :  case(49)
     700           10 :    if (.not.(spgroupma>=267   .and.  276 >=spgroupma) ) spgrmatch=0
     701              :  case(50)
     702           10 :    if (.not.(spgroupma>=279   .and.  288 >=spgroupma) ) spgrmatch=0
     703              :  case(51)
     704           14 :    if (.not.(spgroupma>=291   .and.  304 >=spgroupma) ) spgrmatch=0
     705              :  case(52)
     706           14 :    if (.not.(spgroupma>=307   .and.  320 >=spgroupma) ) spgrmatch=0
     707              :  case(53)
     708           14 :    if (.not.(spgroupma>=323   .and.  336 >=spgroupma) ) spgrmatch=0
     709              :  case(54)
     710           14 :    if (.not.(spgroupma>=339   .and.  352 >=spgroupma) ) spgrmatch=0
     711              :  case(55)
     712           10 :    if (.not.(spgroupma>=355   .and.  364 >=spgroupma) ) spgrmatch=0
     713              :  case(56)
     714           10 :    if (.not.(spgroupma>=367   .and.  376 >=spgroupma) ) spgrmatch=0
     715              :  case(57)
     716           14 :    if (.not.(spgroupma>=379   .and.  392 >=spgroupma) ) spgrmatch=0
     717              :  case(58)
     718           10 :    if (.not.(spgroupma>=395   .and.  404 >=spgroupma) ) spgrmatch=0
     719              :  case(59)
     720           10 :    if (.not.(spgroupma>=407   .and.  416 >=spgroupma) ) spgrmatch=0
     721              :  case(60)
     722           14 :    if (.not.(spgroupma>=419   .and.  432 >=spgroupma) ) spgrmatch=0
     723              :  case(61)
     724            6 :    if (.not.(spgroupma>=435   .and.  440 >=spgroupma) ) spgrmatch=0
     725              :  case(62)
     726           14 :    if (.not.(spgroupma>=443   .and.  456 >=spgroupma) ) spgrmatch=0
     727              :  case(63)
     728           10 :    if (.not.(spgroupma>=459   .and.  468 >=spgroupma) ) spgrmatch=0
     729              :  case(64)
     730           10 :    if (.not.(spgroupma>=471   .and.  480 >=spgroupma) ) spgrmatch=0
     731              :  case(65)
     732            8 :    if (.not.(spgroupma>=483   .and.  490 >=spgroupma) ) spgrmatch=0
     733              :  case(66)
     734            8 :    if (.not.(spgroupma>=493   .and.  500 >=spgroupma) ) spgrmatch=0
     735              :  case(67)
     736            8 :    if (.not.(spgroupma>=503   .and.  510 >=spgroupma) ) spgrmatch=0
     737              :  case(68)
     738            8 :    if (.not.(spgroupma>=513   .and.  520 >=spgroupma) ) spgrmatch=0
     739              :  case(69)
     740            4 :    if (.not.(spgroupma>=523   .and.  526 >=spgroupma) ) spgrmatch=0
     741              :  case(70)
     742            4 :    if (.not.(spgroupma>=529   .and.  532 >=spgroupma) ) spgrmatch=0
     743              :  case(71)
     744            4 :    if (.not.(spgroupma>=535   .and.  538 >=spgroupma) ) spgrmatch=0
     745              :  case(72)
     746            7 :    if (.not.(spgroupma>=541   .and.  547 >=spgroupma) ) spgrmatch=0
     747              :  case(73)
     748            4 :    if (.not.(spgroupma>=550   .and.  553 >=spgroupma) ) spgrmatch=0
     749              :  case(74)
     750            7 :    if (.not.(spgroupma>=556   .and.  562 >=spgroupma) ) spgrmatch=0
     751              :  case(75)
     752            4 :    if (.not.(spgroupma>= 3  .and.   6>=spgroupma) ) spgrmatch=0
     753              :  case(76)
     754            4 :    if (.not.(spgroupma>= 9  .and.  12 >=spgroupma) ) spgrmatch=0
     755              :  case(77)
     756            4 :    if (.not.(spgroupma>= 15  .and.   18>=spgroupma) ) spgrmatch=0
     757              :  case(78)
     758            4 :    if (.not.(spgroupma>= 21  .and.   24>=spgroupma) ) spgrmatch=0
     759              :  case(79)
     760            2 :    if (.not.(spgroupma>= 27  .and.  28 >=spgroupma) ) spgrmatch=0
     761              :  case(80)
     762            2 :    if (.not.(spgroupma>= 31  .and.  32 >=spgroupma) ) spgrmatch=0
     763              :  case(81)
     764            4 :    if (.not.(spgroupma>= 35  .and.  38 >=spgroupma) ) spgrmatch=0
     765              :  case(82)
     766            2 :    if (.not.(spgroupma>= 41  .and.  42 >=spgroupma) ) spgrmatch=0
     767              :  case(83)
     768            6 :    if (.not.(spgroupma>=45   .and.   50>=spgroupma) ) spgrmatch=0
     769              :  case(84)
     770            6 :    if (.not.(spgroupma>=53   .and.   58>=spgroupma) ) spgrmatch=0
     771              :  case(85)
     772            6 :    if (.not.(spgroupma>=61   .and.   66>=spgroupma) ) spgrmatch=0
     773              :  case(86)
     774            6 :    if (.not.(spgroupma>=69   .and.   74>=spgroupma) ) spgrmatch=0
     775              :  case(87)
     776            4 :    if (.not.(spgroupma>=77   .and.   80>=spgroupma) ) spgrmatch=0
     777              :  case(88)
     778            4 :    if (.not.(spgroupma>=83   .and.   86>=spgroupma) ) spgrmatch=0
     779              :  case(89)
     780            6 :    if (.not.(spgroupma>=89   .and.   94>=spgroupma) ) spgrmatch=0
     781              :  case(90)
     782            6 :    if (.not.(spgroupma>=97   .and.   102>=spgroupma) ) spgrmatch=0
     783              :  case(91)
     784            6 :    if (.not.(spgroupma>=105   .and.   110>=spgroupma) ) spgrmatch=0
     785              :  case(92)
     786            6 :    if (.not.(spgroupma>=113   .and.   118>=spgroupma) ) spgrmatch=0
     787              :  case(93)
     788            6 :    if (.not.(spgroupma>=121   .and.   126>=spgroupma) ) spgrmatch=0
     789              :  case(94)
     790            6 :    if (.not.(spgroupma>=129   .and.   134>=spgroupma) ) spgrmatch=0
     791              :  case(95)
     792            6 :    if (.not.(spgroupma>=137   .and.   142>=spgroupma) ) spgrmatch=0
     793              :  case(96)
     794            6 :    if (.not.(spgroupma>=145   .and.   150>=spgroupma) ) spgrmatch=0
     795              :  case(97)
     796            4 :    if (.not.(spgroupma>=153   .and.   156>=spgroupma) ) spgrmatch=0
     797              :  case(98)
     798            4 :    if (.not.(spgroupma>=159   .and.   162>=spgroupma) ) spgrmatch=0
     799              :  case(99)
     800            6 :    if (.not.(spgroupma>=165   .and.   170>=spgroupma) ) spgrmatch=0
     801              :  case(100)
     802            6 :    if (.not.(spgroupma>=173   .and.   178>=spgroupma) ) spgrmatch=0
     803              :  case(101)
     804            6 :    if (.not.(spgroupma>=181   .and.   186>=spgroupma) ) spgrmatch=0
     805              :  case(102)
     806            6 :    if (.not.(spgroupma>=189   .and.   194>=spgroupma) ) spgrmatch=0
     807              :  case(103)
     808            6 :    if (.not.(spgroupma>=197   .and.   202>=spgroupma) ) spgrmatch=0
     809              :  case(104)
     810            6 :    if (.not.(spgroupma>=205   .and.   210>=spgroupma) ) spgrmatch=0
     811              :  case(105)
     812            6 :    if (.not.(spgroupma>=213   .and.   218>=spgroupma) ) spgrmatch=0
     813              :  case(106)
     814            6 :    if (.not.(spgroupma>=221   .and.   226>=spgroupma) ) spgrmatch=0
     815              :  case(107)
     816            4 :    if (.not.(spgroupma>=229  .and.   232>=spgroupma) ) spgrmatch=0
     817              :  case(108)
     818            4 :    if (.not.(spgroupma>=235   .and.   238>=spgroupma) ) spgrmatch=0
     819              :  case(109)
     820            4 :    if (.not.(spgroupma>=241   .and.   244>=spgroupma) ) spgrmatch=0
     821              :  case(110)
     822            4 :    if (.not.(spgroupma>=247   .and.   250>=spgroupma) ) spgrmatch=0
     823              :  case(111)
     824            6 :    if (.not.(spgroupma>=253   .and.   258>=spgroupma) ) spgrmatch=0
     825              :  case(112)
     826            6 :    if (.not.(spgroupma>=261   .and.   266>=spgroupma) ) spgrmatch=0
     827              :  case(113)
     828            6 :    if (.not.(spgroupma>=269   .and.   274>=spgroupma) ) spgrmatch=0
     829              :  case(114)
     830            6 :    if (.not.(spgroupma>=277   .and.   282>=spgroupma) ) spgrmatch=0
     831              :  case(115)
     832            6 :    if (.not.(spgroupma>=285   .and.   290>=spgroupma) ) spgrmatch=0
     833              :  case(116)
     834            6 :    if (.not.(spgroupma>=293   .and.   298>=spgroupma) ) spgrmatch=0
     835              :  case(117)
     836            6 :    if (.not.(spgroupma>=301   .and.   306>=spgroupma) ) spgrmatch=0
     837              :  case(118)
     838            6 :    if (.not.(spgroupma>=309   .and.   314>=spgroupma) ) spgrmatch=0
     839              :  case(119)
     840            4 :    if (.not.(spgroupma>=317   .and.   320>=spgroupma) ) spgrmatch=0
     841              :  case(120)
     842            4 :    if (.not.(spgroupma>=323   .and.   326>=spgroupma) ) spgrmatch=0
     843              :  case(121)
     844            4 :    if (.not.(spgroupma>=329   .and.   332>=spgroupma) ) spgrmatch=0
     845              :  case(122)
     846            4 :    if (.not.(spgroupma>=335   .and.   338>=spgroupma) ) spgrmatch=0
     847              :  case(123)
     848           10 :    if (.not.(spgroupma>=341   .and.   350>=spgroupma) ) spgrmatch=0
     849              :  case(124)
     850           10 :    if (.not.(spgroupma>=353   .and.   362>=spgroupma) ) spgrmatch=0
     851              :  case(125)
     852           10 :    if (.not.(spgroupma>=365   .and.   374>=spgroupma) ) spgrmatch=0
     853              :  case(126)
     854           10 :    if (.not.(spgroupma>=377   .and.   386>=spgroupma) ) spgrmatch=0
     855              :  case(127)
     856           10 :    if (.not.(spgroupma>=389   .and.   398>=spgroupma) ) spgrmatch=0
     857              :  case(128)
     858           10 :    if (.not.(spgroupma>=401   .and.   410>=spgroupma) ) spgrmatch=0
     859              :  case(129)
     860           10 :    if (.not.(spgroupma>=413   .and.   422>=spgroupma) ) spgrmatch=0
     861              :  case(130)
     862           10 :    if (.not.(spgroupma>=425   .and.   434>=spgroupma) ) spgrmatch=0
     863              :  case(131)
     864           10 :    if (.not.(spgroupma>=437   .and.   446>=spgroupma) ) spgrmatch=0
     865              :  case(132)
     866           10 :    if (.not.(spgroupma>=449   .and.   458>=spgroupma) ) spgrmatch=0
     867              :  case(133)
     868           10 :    if (.not.(spgroupma>=461   .and.   470>=spgroupma) ) spgrmatch=0
     869              :  case(134)
     870           10 :    if (.not.(spgroupma>=473   .and.   482>=spgroupma) ) spgrmatch=0
     871              :  case(135)
     872           10 :    if (.not.(spgroupma>=485   .and.   494>=spgroupma) ) spgrmatch=0
     873              :  case(136)
     874           10 :    if (.not.(spgroupma>=497  .and.   506>=spgroupma) ) spgrmatch=0
     875              :  case(137)
     876           10 :    if (.not.(spgroupma>=509   .and.   518>=spgroupma) ) spgrmatch=0
     877              :  case(138)
     878           10 :    if (.not.(spgroupma>=521   .and.   530>=spgroupma) ) spgrmatch=0
     879              :  case(139)
     880            8 :    if (.not.(spgroupma>=533   .and.   540>=spgroupma) ) spgrmatch=0
     881              :  case(140)
     882            8 :    if (.not.(spgroupma>=543   .and.   550>=spgroupma) ) spgrmatch=0
     883              :  case(141)
     884            8 :    if (.not.(spgroupma>=553   .and.   560>=spgroupma) ) spgrmatch=0
     885              :  case(142)
     886            8 :    if (.not.(spgroupma>=563   .and.   570>=spgroupma) ) spgrmatch=0
     887              :  case(143)
     888            1 :    if (.not.(spgroupma>=3   .and.   3>=spgroupma) ) spgrmatch=0
     889              :  case(144)
     890            1 :    if (.not.(spgroupma>=6   .and.   6>=spgroupma) ) spgrmatch=0
     891              :  case(145)
     892            1 :    if (.not.(spgroupma>=9   .and.   9>=spgroupma) ) spgrmatch=0
     893              :  case(146)
     894            1 :    if (.not.(spgroupma>=12   .and.   12>=spgroupma) ) spgrmatch=0
     895              :  case(147)
     896            2 :    if (.not.(spgroupma>=15   .and.   16>=spgroupma) ) spgrmatch=0
     897              :  case(148)
     898            2 :    if (.not.(spgroupma>=19   .and.   20>=spgroupma) ) spgrmatch=0
     899              :  case(149)
     900            2 :    if (.not.(spgroupma>=23   .and.   24>=spgroupma) ) spgrmatch=0
     901              :  case(150)
     902            2 :    if (.not.(spgroupma>=27   .and.   28>=spgroupma) ) spgrmatch=0
     903              :  case(151)
     904            2 :    if (.not.(spgroupma>=31   .and.   32>=spgroupma) ) spgrmatch=0
     905              :  case(152)
     906            2 :    if (.not.(spgroupma>=35   .and.   36>=spgroupma) ) spgrmatch=0
     907              :  case(153)
     908            2 :    if (.not.(spgroupma>=39   .and.   40>=spgroupma) ) spgrmatch=0
     909              :  case(154)
     910            2 :    if (.not.(spgroupma>=43   .and.   44>=spgroupma) ) spgrmatch=0
     911              :  case(155)
     912            2 :    if (.not.(spgroupma>=47   .and.   48>=spgroupma) ) spgrmatch=0
     913              :  case(156)
     914            2 :    if (.not.(spgroupma>=51   .and.   52>=spgroupma) ) spgrmatch=0
     915              :  case(157)
     916            2 :    if (.not.(spgroupma>=55   .and.   56>=spgroupma) ) spgrmatch=0
     917              :  case(158)
     918            2 :    if (.not.(spgroupma>=59   .and.   60>=spgroupma) ) spgrmatch=0
     919              :  case(159)
     920            2 :    if (.not.(spgroupma>=63   .and.   64>=spgroupma) ) spgrmatch=0
     921              :  case(160)
     922            2 :    if (.not.(spgroupma>=67   .and.   68>=spgroupma) ) spgrmatch=0
     923              :  case(161)
     924            2 :    if (.not.(spgroupma>=71   .and.   72>=spgroupma) ) spgrmatch=0
     925              :  case(162)
     926            4 :    if (.not.(spgroupma>=75   .and.   78>=spgroupma) ) spgrmatch=0
     927              :  case(163)
     928            4 :    if (.not.(spgroupma>=81   .and.   84>=spgroupma) ) spgrmatch=0
     929              :  case(164)
     930            4 :    if (.not.(spgroupma>=87   .and.   90>=spgroupma) ) spgrmatch=0
     931              :  case(165)
     932            4 :    if (.not.(spgroupma>=93   .and.   96>=spgroupma) ) spgrmatch=0
     933              :  case(166)
     934            5 :    if (.not.(spgroupma>=99   .and.   102>=spgroupma) ) spgrmatch=0
     935              :  case(167)
     936            4 :    if (.not.(spgroupma>=105   .and.   108>=spgroupma) ) spgrmatch=0
     937              :  case(168)
     938            2 :    if (.not.(spgroupma>=111   .and.   112>=spgroupma) ) spgrmatch=0
     939              :  case(169)
     940            2 :    if (.not.(spgroupma>=115   .and.   116>=spgroupma) ) spgrmatch=0
     941              :  case(170)
     942            2 :    if (.not.(spgroupma>=119   .and.   120>=spgroupma) ) spgrmatch=0
     943              :  case(171)
     944            2 :    if (.not.(spgroupma>=123   .and.   124>=spgroupma) ) spgrmatch=0
     945              :  case(172)
     946            2 :    if (.not.(spgroupma>=127   .and.   128>=spgroupma) ) spgrmatch=0
     947              :  case(173)
     948            2 :    if (.not.(spgroupma>=131   .and.   132>=spgroupma) ) spgrmatch=0
     949              :  case(174)
     950            2 :    if (.not.(spgroupma>=135   .and.   136>=spgroupma) ) spgrmatch=0
     951              :  case(175)
     952            4 :    if (.not.(spgroupma>=139   .and.   142>=spgroupma) ) spgrmatch=0
     953              :  case(176)
     954            4 :    if (.not.(spgroupma>=145   .and.   148>=spgroupma) ) spgrmatch=0
     955              :  case(177)
     956            4 :    if (.not.(spgroupma>=151   .and.   154>=spgroupma) ) spgrmatch=0
     957              :  case(178)
     958            4 :    if (.not.(spgroupma>=157   .and.   160>=spgroupma) ) spgrmatch=0
     959              :  case(179)
     960            4 :    if (.not.(spgroupma>=163   .and.   166>=spgroupma) ) spgrmatch=0
     961              :  case(180)
     962            4 :    if (.not.(spgroupma>=169   .and.   172>=spgroupma) ) spgrmatch=0
     963              :  case(181)
     964            4 :    if (.not.(spgroupma>=175   .and.   178>=spgroupma) ) spgrmatch=0
     965              :  case(182)
     966            4 :    if (.not.(spgroupma>=181   .and.   184>=spgroupma) ) spgrmatch=0
     967              :  case(183)
     968            4 :    if (.not.(spgroupma>=187   .and.   190>=spgroupma) ) spgrmatch=0
     969              :  case(184)
     970            4 :    if (.not.(spgroupma>=193   .and.   196>=spgroupma) ) spgrmatch=0
     971              :  case(185)
     972            4 :    if (.not.(spgroupma>=199   .and.   202>=spgroupma) ) spgrmatch=0
     973              :  case(186)
     974            4 :    if (.not.(spgroupma>=205   .and.   208>=spgroupma) ) spgrmatch=0
     975              :  case(187)
     976            4 :    if (.not.(spgroupma>=211   .and.   214>=spgroupma) ) spgrmatch=0
     977              :  case(188)
     978            4 :    if (.not.(spgroupma>=217   .and.   220>=spgroupma) ) spgrmatch=0
     979              :  case(189)
     980            4 :    if (.not.(spgroupma>=223   .and.   226>=spgroupma) ) spgrmatch=0
     981              :  case(190)
     982            4 :    if (.not.(spgroupma>=229   .and.   232>=spgroupma) ) spgrmatch=0
     983              :  case(191)
     984            8 :    if (.not.(spgroupma>=235   .and.   242>=spgroupma) ) spgrmatch=0
     985              :  case(192)
     986            8 :    if (.not.(spgroupma>=245   .and.   252>=spgroupma) ) spgrmatch=0
     987              :  case(193)
     988            8 :    if (.not.(spgroupma>=255   .and.   262>=spgroupma) ) spgrmatch=0
     989              :  case(194)
     990            8 :    if (.not.(spgroupma>=265   .and.   272>=spgroupma) ) spgrmatch=0
     991              :  case(195)
     992            1 :    if (.not.(spgroupma>=3   .and.   3>=spgroupma) ) spgrmatch=0
     993              :  case(196)
     994            1 :    if (.not.(spgroupma>=6   .and.   6>=spgroupma) ) spgrmatch=0
     995              :  case(197)
     996            0 :    spgrmatch=0
     997              :  case(198)
     998            1 :    if (.not.(spgroupma>=11  .and.   11>=spgroupma) ) spgrmatch=0
     999              :  case(199)
    1000            0 :    spgrmatch=0
    1001              :  case(200)
    1002            2 :    if (.not.(spgroupma>=16   .and.   17>=spgroupma) ) spgrmatch=0
    1003              :  case(201)
    1004            2 :    if (.not.(spgroupma>=20   .and.   21>=spgroupma) ) spgrmatch=0
    1005              :  case(202)
    1006            2 :    if (.not.(spgroupma>=24   .and.   25>=spgroupma) ) spgrmatch=0
    1007              :  case(203)
    1008            2 :    if (.not.(spgroupma>=28   .and.   29>=spgroupma) ) spgrmatch=0
    1009              :  case(204)
    1010            1 :    if (.not.(spgroupma>=32   .and.   32>=spgroupma) ) spgrmatch=0
    1011              :  case(205)
    1012            2 :    if (.not.(spgroupma>=35   .and.   36>=spgroupma) ) spgrmatch=0
    1013              :  case(206)
    1014            1 :    if (.not.(spgroupma>=39   .and.   39>=spgroupma) ) spgrmatch=0
    1015              :  case(207)
    1016            2 :    if (.not.(spgroupma>=42   .and.   43>=spgroupma) ) spgrmatch=0
    1017              :  case(208)
    1018            2 :    if (.not.(spgroupma>=46   .and.   47>=spgroupma) ) spgrmatch=0
    1019              :  case(209)
    1020            2 :    if (.not.(spgroupma>=50   .and.   51>=spgroupma) ) spgrmatch=0
    1021              :  case(210)
    1022            2 :    if (.not.(spgroupma>=54   .and.   55>=spgroupma) ) spgrmatch=0
    1023              :  case(211)
    1024            1 :    if (.not.(spgroupma>=58   .and.   58>=spgroupma) ) spgrmatch=0
    1025              :  case(212)
    1026            2 :    if (.not.(spgroupma>=61  .and.   62>=spgroupma) ) spgrmatch=0
    1027              :  case(213)
    1028            2 :    if (.not.(spgroupma>=65   .and.   66>=spgroupma) ) spgrmatch=0
    1029              :  case(214)
    1030            1 :    if (.not.(spgroupma>=69   .and.   69>=spgroupma) ) spgrmatch=0
    1031              :  case(215)
    1032            2 :    if (.not.(spgroupma>=72   .and.   73>=spgroupma) ) spgrmatch=0
    1033              :  case(216)
    1034            2 :    if (.not.(spgroupma>=76   .and.   77>=spgroupma) ) spgrmatch=0
    1035              :  case(217)
    1036            1 :    if (.not.(spgroupma>=80   .and.   80>=spgroupma) ) spgrmatch=0
    1037              :  case(218)
    1038            2 :    if (.not.(spgroupma>=83   .and.   84>=spgroupma) ) spgrmatch=0
    1039              :  case(219)
    1040            2 :    if (.not.(spgroupma>=87   .and.   88>=spgroupma) ) spgrmatch=0
    1041              :  case(220)
    1042            1 :    if (.not.(spgroupma>=91   .and.   91>=spgroupma) ) spgrmatch=0
    1043              :  case(221)
    1044            4 :    if (.not.(spgroupma>=94   .and.   97>=spgroupma) ) spgrmatch=0
    1045              :  case(222)
    1046            4 :    if (.not.(spgroupma>=100  .and.   103>=spgroupma) ) spgrmatch=0
    1047              :  case(223)
    1048            4 :    if (.not.(spgroupma>=106   .and.   109>=spgroupma) ) spgrmatch=0
    1049              :  case(224)
    1050            4 :    if (.not.(spgroupma>=112   .and.   115>=spgroupma) ) spgrmatch=0
    1051              :  case(225)
    1052            4 :    if (.not.(spgroupma>=118   .and.   121>=spgroupma) ) spgrmatch=0
    1053              :  case(226)
    1054            4 :    if (.not.(spgroupma>=124   .and.   127>=spgroupma) ) spgrmatch=0
    1055              :  case(227)
    1056            4 :    if (.not.(spgroupma>=130   .and.   133>=spgroupma) ) spgrmatch=0
    1057              :  case(228)
    1058            4 :    if (.not.(spgroupma>=136   .and.   139>=spgroupma) ) spgrmatch=0
    1059              :  case(229)
    1060            3 :    if (.not.(spgroupma>=142   .and.   144>=spgroupma) ) spgrmatch=0
    1061              :  case(230)
    1062            3 :    if (.not.(spgroupma>=147   .and.   149>=spgroupma) ) spgrmatch=0
    1063              :  case default
    1064              :    write(message, '(3a,i8,4a)' )&
    1065            0 : &   'The non-magnetic spacegroup is not specified ',ch10,&
    1066            0 : &   'while the magnetic space group is specified, spgroupma= ',spgroupma,ch10,&
    1067            0 : &   'This is not allowed.  ',ch10,&
    1068            0 : &   'Action: specify spgroup in the input file.'
    1069         1192 :    ABI_ERROR(message)
    1070              :  end select
    1071              : 
    1072         1192 :  if (spgrmatch==0) then
    1073              :    write(message, '(a,i8,a,a,i8,4a)' )&
    1074            0 : &   'mismatch between the non-magnetic spacegroup ',spgroup,ch10,&
    1075            0 : &   'and the magnetic space group ',spgroupma,ch10,&
    1076            0 : &   'This is not allowed.  ',ch10,&
    1077            0 : &   'Action: modify spgroup or spgroupma in the input file.'
    1078            0 :    ABI_ERROR(message)
    1079              :  end if
    1080              : 
    1081              : !DEBUG
    1082              : !write(std_out,*) ' gensymshub, after check the spgroup ... '
    1083              : !ENDDEBUG
    1084              : 
    1085              : !Assign the magnetic Bravais lattice type from the magnetic space group number
    1086              : !As the magnetic space group number begins with 1 for EACH crystal system
    1087              : !we must first make our choice as a function of spgroup
    1088              : 
    1089              : !Convention :
    1090              : !brvlttbw = input variable giving Bravais black-and-white translation
    1091              : !(from 1 to 8 : Shubnikov type IV space group)
    1092              : !1,2,3 = 1/2 translation along a, b, or c respectively
    1093              : !4,5,6 = translation corresponding to A,B,C centering, respectively
    1094              : !7 = I centering
    1095              : !8 = (1/2 0 0) centering corresponding to normal F lattice
    1096              : !9 -> Shubnikov type III space group
    1097              : !Note that the use of the table 7.3 (p585) of Bradney and Cracknell
    1098              : !for the definition of the translation vectors
    1099              : !is extremely confusing, due to the strange choice of basis
    1100              : !vectors of table 3.1.
    1101              : !See table 7.4 (p588) for the spgroupma interpretation
    1102              : 
    1103            3 :  select case(spgroup)
    1104              :  case(1,2)     !Triclinic
    1105           69 :    select case(spgroupma)
    1106              :    case(6)
    1107            1 :      brvlttbw=9      !ShubIII
    1108              :    case(3,7)
    1109            3 :      brvlttbw=1      !Ps (note that it is not body centered, according to Table
    1110              : !        7.3 of Bradley and Cracknell)
    1111              :    end select
    1112              :  case(3:15)     !Monoclinic
    1113          534 :    select case(spgroupma)
    1114              :    case(3,9,15,20,26,34,39,44:46,52:54,60:62,67:69,77:79,87:89)
    1115           25 :      brvlttbw=9      !ShubIII
    1116              :    case(4,10,17,21,27,36,41,47,55,64,70,80,91)
    1117           13 :      brvlttbw=1     !a
    1118              :    case(5,11,22,29,48,56,71,81)
    1119            8 :      brvlttbw=2     !b
    1120              :    case(16,28,35,40,63,72,82,90)
    1121            8 :      brvlttbw=3     !c
    1122              :    case(31,73,83)
    1123            3 :      brvlttbw=4     !A
    1124              :    case(6,12,23,30,49,57,74,84)
    1125           65 :      brvlttbw=6     !C
    1126              :    end select
    1127              :  case(16:74)     !Orthorhombic
    1128         1091 :    select case(spgroupma)
    1129              :    case(3,9,10,18,19,27,33,34,40,41,47,51,55,59,60,68:70,&
    1130              : &     80,81,89:91,101:103,113:115,125:127,137,138,146:148,158,159,&
    1131              : &     167,168,174:176,182,183,189:191,197:199,205:207,213:215,221,&
    1132              : &     222,226,227,231,232,237,238,243:245,251:253,259:261,267:271,&
    1133              : &     279:283,291:297,307:313,323:329,339:345,355:359,367:371,&
    1134              : &     379:385,395:399,407:411,419:425,435:437,443:449,459:465,&
    1135              : &     471:477,483:487,493:497,503:507,513:517,523:525,529:531,&
    1136              : &     535:537,541:545,550:552,556:560)
    1137          213 :      brvlttbw=9      !ShubIII
    1138              :    case(4,11,20,28,36,43,62,71,83,92,104,116,128,140,&
    1139              : &     149,160,170,178,185,192,200,208,216,234,240,247,254,262,272,&
    1140              : &     284,298,314,330,346,360,372,386,400,412,426,438,450,467,&
    1141              : &     479,489,499,509,519,547,562)
    1142           50 :      brvlttbw=1     !a
    1143              :    case(72,93,105,117,129,150,248,299,315,331,347,387,427,451)
    1144           14 :      brvlttbw=2     !b
    1145              :    case(12,21,35,42,52,56,61,73,82,94,106,118,130,139,&
    1146              : &     151,161,169,177,184,193,201,209,217,233,239,246,273,285,300,&
    1147              : &     316,332,348,361,373,388,401,413,428,452,466,478,488,498,&
    1148              : &     508,518,538,546,553,561)
    1149           49 :      brvlttbw=3     !c
    1150              :    case(13,22,37,44,64,74,85,95,107,119,131,142,152,162,&
    1151              : &     171,179,186,274,286,301,317,333,349,362,374,389,402,414,429,&
    1152              : &     453,468,480,490,500,510,520)
    1153           36 :      brvlttbw=4     !A
    1154              :    case(75,96,108,120,132,153,302,318,334,350,390,430,454)
    1155           13 :      brvlttbw=5     !B
    1156              :    case(5,14,23,29,63,76,84,97,109,121,133,141,154,163,&
    1157              : &     194,202,210,218,255,263,275,287,303,319,335,351,363,375,&
    1158              : &     391,403,415,431,439,455)
    1159           34 :      brvlttbw=6     !C
    1160              :    case(6,15,24,30,65,77,86,98,110,122,134,143,155,164,256,&
    1161              : &     264,276,288,304,320,336,352,364,376,392,404,416,432,440,456)
    1162           30 :      brvlttbw=7     !I
    1163              :    case(48,223,228,526,532)
    1164          444 :      brvlttbw=8     !s
    1165              :    end select
    1166              :  case(75:142)       !Tetragonal
    1167          871 :    select case(spgroupma)
    1168              :    case(3,9,15,21,27,31,35,41,45:47,53:55,61:63,69:71,&
    1169              : &     77:79,83:85,89:91,97:99,105:107,113:115,121:123,129:131,&
    1170              : &     137:139,145:147,153:155,159:161,165:167,173:175,181:183,&
    1171              : &     189:191,197:199,205:207,213:215,221:223,229:231,235:237,&
    1172              : &     241:243,247:249,253:255,261:263,269:271,277:279,285:287,&
    1173              : &     293:295,301:303,309:311,317:319,323:325,329:331,335:337,&
    1174              : &     341:347,353:359,365:371,377:383,389:395,401:407,413:419,&
    1175              : &     425:431,437:443,449:455,461:467,473:479,485:491,497:503,&
    1176              : &     509:515,521:527,533:539,543:549,553:559,563:569)
    1177          268 :      brvlttbw=9      !ShubIII
    1178              :    case(4,10,16,22,28,32,36,42,48,56,64,72,80,86,92,100,&
    1179              : &     108,116,124,132,140,148,156,162,168,176,184,192,200,208,&
    1180              : &     216,224,232,238,244,250,256,264,272,280,288,296,304,312,&
    1181              : &     320,326,332,338,348,360,372,384,396,408,420,432,444,456,&
    1182              : &     468,480,492,504,516,528,540,550,560,570)
    1183           68 :      brvlttbw=3     !c
    1184              :    case(5,11,17,23,37,49,57,65,73,93,101,109,117,125,133,141,&
    1185              : &     149,169,177,185,193,201,209,217,225,257,265,273,281,289,297,&
    1186              : &     305,313,349,361,373,385,397,409,421,433,445,457,469,481,493,&
    1187              : &     505,517,529)
    1188           49 :      brvlttbw=6     !C
    1189              :    case(6,12,18,24,38,50,58,66,74,94,102,110,118,126,134,142,&
    1190              : &     150,170,178,186,194,202,210,218,226,258,266,274,282,290,298,&
    1191              : &     306,314,350,362,374,386,398,410,422,434,446,458,470,482,494,&
    1192              : &     506,518,530)
    1193          434 :      brvlttbw=7     !I
    1194              :    end select
    1195              :  case(143:194)      !Hexagonal
    1196          362 :    select case(spgroupma)
    1197              :    case(15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,&
    1198              : &     75:77,81:83,87:89,93:95,99:101,105:107,111,115,119,123,127,&
    1199              : &     131,135,139:141,145:147,151:153,157:159,163:165,169:171,&
    1200              : &     175:177,181:183,187:189,193:195,199:201,205:207,211:213,&
    1201              : &     217:219,223:225,229:231,235:241,245:251,255:261,265:271)
    1202          116 :      brvlttbw=9      !ShubIII
    1203              :    case(3,6,9,16,24,28,32,36,40,44,52,56,60,64,78,84,&
    1204              : &     90,96,112,116,120,124,128,132,136,142,148,154,160,166,172,&
    1205              : &     178,184,190,196,202,208,214,220,226,232,242,252,262,272)
    1206              : !    brvlttbw=6     !C    XG230719 This is likely erroneous
    1207           45 :      brvlttbw=3     !c
    1208              :    case(12,20,48,68,72,102,108)
    1209          169 :      brvlttbw=7     !I
    1210              :    end select
    1211              :  case(195:230)       !Cubic
    1212         1192 :    select case(spgroupma)
    1213              :    case(16,20,24,28,32,35,39,42,46,50,54,58,61,65,69,&
    1214              : &     72,76,80,83,87,91,94:96,100:102,106:108,112:114,118:120,&
    1215              : &     124:126,130:132,136:138,142:144,147:149)
    1216           51 :      brvlttbw=9      !ShubIII
    1217              :    case(3,11,17,21,36,43,47,62,66,73,84,97,103,109,115)
    1218           15 :      brvlttbw=7     !I
    1219              :    case(6,25,29,51,55,77,88,121,127,133,139)
    1220           77 :      brvlttbw=8     !s
    1221              :    end select
    1222              :  end select
    1223              : 
    1224         1192 :  if(brvlttbw==9)shubnikov=3 !Shubnikov type III
    1225         1192 :  if(brvlttbw>=1 .and. brvlttbw<=8) shubnikov=4 !Shubnikov type IV
    1226              : 
    1227         1192 :  genafm(:)=zero
    1228         1192 :  if(shubnikov==4)then
    1229          518 :    if(brvlttbw==1)genafm(1)=half
    1230          518 :    if(brvlttbw==2)genafm(2)=half
    1231          518 :    if(brvlttbw==3)genafm(3)=half
    1232          518 :    if(brvlttbw>=4 .and. brvlttbw<=8)then
    1233         1044 :      genafm(:)=half
    1234          261 :      if(brvlttbw==4)genafm(1)=zero
    1235          261 :      if(brvlttbw==5)genafm(2)=zero
    1236          261 :      if(brvlttbw==6)genafm(3)=zero
    1237              :    end if
    1238              :  end if
    1239              : 
    1240              : !DEBUG
    1241              : !write(std_out,*) 'gensymshub : end '
    1242              : !write(std_out,*) 'gensymshub : brvlttbw=',brvlttbw
    1243              : !write(std_out,*) 'gensymshub : genafm=',genafm
    1244              : !write(std_out,*) 'gensymshub, shubnikov =',shubnikov
    1245              : !ENDDEBUG
    1246              : 
    1247         1192 : end subroutine gensymshub
    1248              : !!***
    1249              : 
    1250              : !!****f* m_spgbuilder/gensymshub4
    1251              : !! NAME
    1252              : !! gensymshub4
    1253              : !!
    1254              : !! FUNCTION
    1255              : !! Assigns the Bravais magnetic translations for shubnikov type IV
    1256              : !! symmetry groups starting from the Fedorov space group
    1257              : !! and the translation, generator of the anti-ferromagnetic
    1258              : !! operations (as input). It will double nsym and tnons. In the end both
    1259              : !! symrel and tnons are completely determined.
    1260              : !!
    1261              : !! INPUTS
    1262              : !! genafm(3) = translation, generator of the anti-ferromagnetic symmatry operations
    1263              : !! msym = maximum number of symmetry operations
    1264              : !!
    1265              : !! OUTPUT
    1266              : !! symafm(msym)= (anti)ferromagnetic part of symmetry operations
    1267              : !!
    1268              : !! SIDE EFFECTS
    1269              : !! nsym=number of symmetry operations, without magnetic operations at input,
    1270              : !!  and with magnetic operations at output
    1271              : !! symrel(3,3,msym)=symmetry operations in real space in terms
    1272              : !!  of primitive translations, without magnetic operations at input,
    1273              : !!  and with magnetic operations at output
    1274              : !! tnons(3,msym)=nonsymmorphic translations for symmetry operations
    1275              : !!  without magnetic operations at input,
    1276              : !!  and with magnetic operations at output
    1277              : !!
    1278              : !! SOURCE
    1279              : 
    1280          519 : subroutine gensymshub4(genafm,msym,nsym,symafm,symrel,tnons)
    1281              : 
    1282              : !Arguments ------------------------------------
    1283              : !scalars
    1284              :  integer,intent(in) :: msym
    1285              :  integer,intent(inout) :: nsym
    1286              : !arrays
    1287              :  integer,intent(inout) :: symafm(msym),symrel(3,3,msym)
    1288              :  real(dp),intent(in) :: genafm(3)
    1289              :  real(dp),intent(inout) :: tnons(3,msym)
    1290              : 
    1291              : !Local variables ------------------------------
    1292              : !scalars
    1293              :  integer :: ii
    1294              :  character(len=500) :: message
    1295              : ! *************************************************************************
    1296              : 
    1297          519 :  if(msym<2*nsym)then
    1298              :    write(message, '(3a)' )&
    1299            0 :    'The number of symmetries in the Shubnikov type IV space group',ch10,&
    1300            0 :    'is larger than the maximal allowed number of symmetries.'
    1301            0 :    ABI_ERROR(message)
    1302              :  end if
    1303              : 
    1304         6666 :  do ii=1,nsym
    1305        24588 :    tnons(:,nsym+ii)=tnons(:,ii)+genafm(:)
    1306        79911 :    symrel(:,:,nsym+ii)=symrel(:,:,ii)
    1307         6147 :    symafm(ii)=1
    1308         6666 :    symafm(nsym+ii)=-1
    1309              :  end do
    1310          519 :  nsym=nsym*2
    1311              : 
    1312          519 : end subroutine gensymshub4
    1313              : !!***
    1314              : 
    1315              : end module m_spgbuilder
    1316              : !!***
        

Generated by: LCOV version 2.3-1