Structure optimization problem. Current rprimd gives negative (R1 x R2) . R3

Hello all, I am an Abinit beginner. I use Abinit for calculating nonlinear optic response. As I understand first I need to relax structure, for that I need to make primitive cell from conventional and launch Abinit, but I am obtaining error:

--- !ERROR
src_file: m_geometry.F90
src_line: 1242
mpi_rank: 0
message: |
    Current rprimd gives negative (R1 x R2) . R3 . 
    Rprimd =   -2.618686E+01   -0.000000E+00   -0.000000E+00
               -0.000000E+00   -2.618686E+01   -0.000000E+00
                1.309343E+01    1.309343E+01   -1.994089E+01
    Action: if the cell size and shape are fixed (optcell==0),
            exchange two of the input rprim vectors;
            if you are optimizing the cell size and shape (optcell/=0),
            maybe the move was too large, and you might try to decrease strprecon.

As I understand, this error statment indicate that I made a mistake in the input.abi file.
Can anybody help me to indicate such error? I will be extremely grateful.
To make primitive unit cell I used Avogadro software. Also, can you, please, tell me what is the regular steps in structure optimization? First I need to find optimal ecut, when k-point greed and it is all?

Here is my input file:

# BPO4 Space group 82 I-4 : computation of the total energy
#

#Definition of the unit cell
acell      1  1  1 Angstroms #
rprim      4.3736800000E+00  0.0000000000E+00  0.00000000000E+00
           0.0000000000E+00  4.3736800000E+00  0.00000000000E+00
           -2.186840000E+00  -2.186840000E+00  3.3304900000E+00
iatcon 1 #to see atom positions' number in calculation or not if 0 is set
optcell 1
ionmov 2 # 1 - molecular dynamic(not working), 2 should be less than 10 degrees of freedom to optimise, optcell 0 not avaliable
dilatmx 1.05
strprecon 1
tolsym 1e-04
#spgroup 82 
# atomic positions in units of cell vectors
xred

  0.00000  0.50000  0.50000  # B
  0.00000  0.00000  0.00000  # P
  0.14006  0.74006  0.25383  # O
  0.24086  0.36086  0.74617  # O
  0.86006  0.26006  0.25383  # O
  0.75914  0.63914  0.74617  # O

#Definition of the atom types and pseudopotentials
 ntypat 3 # three types of atoms
 znucl 5 15 8 # the atom types are Boron, Phosphorus and Oxygen


# the following norm-conserving pseudopotentials are stored in the abinit distribution, but are freely
# available through www.pseudo-dojo.org
# this set uses the Perdew-Wang parameterization of LDA for the xc model
 pp_dirpath "../../"
 pseudos "B.psp8, P.psp8, O.psp8"

#Definition of the atoms
 natom 6 # six atoms in the cell
 typat 1 2 3 3 3 3 # type 1 is Boron,type 2 is Phosphorous, type 3 is Oxygen (order defined by znucl above and pseudos list)

#Definition of the planewave basis set
ecut  10.0         # Maximal kinetic energy cut-off, in Hartree
ecutsm 0.005
#Definition of the k-point grid
kptopt 1          # Option for the automatic generation of k points, taking
                  # into account the symmetry
ngkpt 6 6 6       # This is a 6x6x6 grid based on the primitive vectors
nshiftk 1         # of the reciprocal space (that form a BCC lattice !),
                  # repeated four times, with different shifts :
tolmxf 1.0e-6

#Definition of the SCF procedure
nstep 100          # Maximal number of SCF cycles
toldfe 1.0d-6     # Will stop when, twice in a row, the difference
                  # between two consecutive evaluations of total energy
                  # differ by less than toldfe (in Hartree)
                  # This value is way too large for most realistic studies of materials
diemac 5.0       # Although this is not mandatory, it is worth to
                  # precondition the SCF cycle. The model dielectric
                  # function used as the standard preconditioner
                  # is described in the "dielng" input variable section.
                  # Here, we follow the prescription for bulk silicon.

PBO4.abi (3.1 KB)
PBO4.abo (71.2 KB)

Hi, I have a few comments that might be helpful.
First, to get from a cif file to an abinit input structure, I’d suggest using abinit directly, or abinit’s own tools (abipy) or the 3rd party software “cif2cell”. If you use abinit directly, your input would look something like

spgroup 82
angdeg 90.0 90.0 90.0
acell 4.332 4.332 6.640 angstrom
brvltt -1

ntypat 3
typat 1 2 3
znucl 15 5 8
natom 6
natrd 3
xred
0 0 0
0 1/2 1/4
0.138 0.26 0.131

This fragment lets abinit do the work of generating the primitive cell. But generally, you will save a lot of time by using abipy tools, or cif2cell, which can read cif files directly.

Next, for structure optimization, have you done our various tutorials, especially the basic tutorials 1-4? They include instructions for how to do convergence checks, structural optimizations, and so forth.

Thank you a lot for your help. I will try and I’ll study tutorials more carefully I think I missed information about convergence test