modification of CELL_ parameters

115 views
Skip to first unread message

oandr...@gmail.com

unread,
Apr 24, 2023, 10:33:34 AM4/24/23
to cp2k
Dear Cp2k users and developers, 

I was wondering if you could help me with a doubt i have , 
does cp2k modifies the cell vectors (applies an operation to them) once you set up a cell opt calculations 

for example 
say you have a systems with these cell parameters in the input file 
      &CELL
         A -1.59515785     -2.7628944422923 -3.9070099102745e-16
         B -1.59515785     2.7628944422923 1.9535049551373e-16
         C 0.0             0.0             -14.879004
         MULTIPLE_UNIT_CELL 4 4 1
         SYMMETRY MONOCLINIC_GAMMA_AB


but once the simulations starts it becomes 

CELL_TOP| Volume [angstrom^3]:                                      2098.417005
 CELL_TOP| Vector a [angstrom    12.761     0.000     0.000   |a| =    12.761263
 CELL_TOP| Vector b [angstrom    -6.381    11.052     0.000   |b| =    12.761263
 CELL_TOP| Vector c [angstrom     0.000     0.000    14.879   |c| =    14.879004
 CELL_TOP| Angle (b,c), alpha [degree]:                                90.000000
 CELL_TOP| Angle (a,c), beta  [degree]:                                90.000000
 CELL_TOP| Angle (a,b), gamma [degree]:                               120.000000
 CELL_TOP| Requested initial symmetry:                       MONOCLINIC_GAMMA_AB
 CELL_TOP| Numerically orthorhombic:                                          NO

So if you notices the magnitudes are the same but vector a, and b are in a different basis. 
Is there a way to avoid this ? 

best

Andres Ortega

Krack Matthias

unread,
Apr 24, 2023, 10:40:52 AM4/24/23
to cp...@googlegroups.com

Hi Andres

 

The keyword SYMMETRY MONOCLINIC_GAMMA_AB changes the cell as requested. Drop that keyword, if you want to keep the cell vectors from your input.

 

HTH

 

Matthias

--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/d1809a50-7ad4-41a3-abe9-d10c4e3e8d2dn%40googlegroups.com.

oandr...@gmail.com

unread,
Apr 24, 2023, 10:56:08 AM4/24/23
to cp2k
Dear Mathias , 
thank you for your email 

However how can I make a cell opt, where I keep the symmetry, 
then I should just use KEEP_ANGLES , will it be enough?

best 

Andres 

Krack Matthias

unread,
Apr 24, 2023, 11:09:45 AM4/24/23
to cp...@googlegroups.com

Yes, you can try KEEP_ANGLES, but this is not exactly the same constraint, because a and b are allowed to differ in length.

oandr...@gmail.com

unread,
Apr 24, 2023, 11:30:27 AM4/24/23
to cp2k
Dear Mathias, 

I tried the KEEP_ANGLES, and indeed it keeps the cell vectors, but only the first step, after that it applies the same transformation . 

CELL_REF| Volume [angstrom^3]:                                      2098.417005
 CELL_REF| Vector a [angstrom    -6.381   -11.052    -0.000   |a| =    12.761263
 CELL_REF| Vector b [angstrom    -6.381    11.052     0.000   |b| =    12.761263
 CELL_REF| Vector c [angstrom     0.000     0.000   -14.879   |c| =    14.879004
 CELL_REF| Angle (b,c), alpha [degree]:                                90.000000
 CELL_REF| Angle (a,c), beta  [degree]:                                90.000000
 CELL_REF| Angle (a,b), gamma [degree]:                               120.000000
 CELL_REF| Numerically orthorhombic:                                          NO
 CELL_OPT| Pressure tolerance [bar]:                                       100.0
 CELL_OPT| Keep angles between the cell vectors:                             YES
 CELL_OPT| Keep cell symmetry:                                                NO
 CELL_OPT| Constraint:                                                      NONE
 ***                     STARTING   CELL   OPTIMIZATION                      ***
 CELL| Volume [angstrom^3]:                                          2098.417005
 CELL| Vector a [angstrom]:      12.761     0.000     0.000   |a| =    12.761263
 CELL| Vector b [angstrom]:      -6.381    11.052     0.000   |b| =    12.761263
 CELL| Vector c [angstrom]:       0.000     0.000    14.879   |c| =    14.879004
 CELL| Angle (b,c), alpha [degree]:                                    90.000000
 CELL| Angle (a,c), beta  [degree]:                                    90.000000
 CELL| Angle (a,b), gamma [degree]:                                   120.000000
 CELL| Numerically orthorhombic:                                              NO
 CELL| Volume [angstrom^3]:                                          2083.849671
 CELL| Vector a [angstrom]:      12.727     0.000     0.000   |a| =    12.726904
 CELL| Vector b [angstrom]:      -6.363    11.022     0.000   |b| =    12.726904
 CELL| Vector c [angstrom]:       0.000     0.000    14.856   |c| =    14.855602
 CELL| Angle (b,c), alpha [degree]:                                    90.000000
 CELL| Angle (a,c), beta  [degree]:                                    90.000000
 CELL| Angle (a,b), gamma [degree]:                                   120.000000
 CELL| Numerically orthorhombic:                                              NO

I wonder if is possible to stop this behaviour , 

best, 

Andres Ortega

Krack Matthias

unread,
Apr 24, 2023, 12:08:49 PM4/24/23
to cp...@googlegroups.com

Without the full input, it is difficult to give further hints.

oandr...@gmail.com

unread,
Apr 24, 2023, 1:15:48 PM4/24/23
to cp2k
Dear Matthias, 
this could be an example 


&FORCE_EVAL
   &DFT
      BASIS_SET_FILE_NAME BASIS_MOLOPT
      BASIS_SET_FILE_NAME BASIS_MOLOPT_UCL
      CHARGE 0
      &MGRID
         CUTOFF 700
         NGRIDS 5
         REL_CUTOFF 70
      &END MGRID
      MULTIPLICITY 0
      &POISSON
         PERIODIC XYZ
      &END POISSON
      POTENTIAL_FILE_NAME GTH_POTENTIALS
      &PRINT
         &MO_CUBES
            ADD_LAST SYMBOLIC
            &EACH
               CELL_OPT 0
               GEO_OPT 0
            &END EACH
            NHOMO 1
            NLUMO 1
            WRITE_CUBE .FALSE.
         &END MO_CUBES
         &MULLIKEN ON
            ADD_LAST SYMBOLIC
            &EACH
               CELL_OPT 0
               GEO_OPT 0
            &END EACH
         &END MULLIKEN
      &END PRINT
      &QS
         EPS_DEFAULT 1e-12
         METHOD GPW
      &END QS
      &SCF
EPS_SCF 5e-08
         MAX_ITER_LUMO 5000
         MAX_SCF 80
         &MIXING
            ALPHA 0.4
            BETA 0.5
            METHOD DIRECT_P_MIXING
         &END MIXING
         &OT
            MINIMIZER CG
            PRECONDITIONER FULL_ALL
         &END OT
         &OUTER_SCF
            EPS_SCF 5e-08
            MAX_SCF 60
         &END OUTER_SCF
         &PRINT
            &RESTART
               BACKUP_COPIES 0
            &END RESTART
         &END PRINT
      &END SCF
      UKS .FALSE.
      &XC
         DENSITY_CUTOFF 1e-10
         GRADIENT_CUTOFF 1e-10
         TAU_CUTOFF 1e-10
         &VDW_POTENTIAL
            &PAIR_POTENTIAL
               PARAMETER_FILE_NAME dftd3.dat
               REFERENCE_FUNCTIONAL PBE
               R_CUTOFF 10.0
               TYPE DFTD3(BJ)
            &END PAIR_POTENTIAL
            POTENTIAL_TYPE PAIR_POTENTIAL
         &END VDW_POTENTIAL
         &XC_FUNCTIONAL
            &PBE
 PARAMETRIZATION ORIG
            &END PBE
         &END XC_FUNCTIONAL
      &END XC
   &END DFT
   METHOD QUICKSTEP
   STRESS_TENSOR ANALYTICAL
   &SUBSYS

      &CELL
         A -1.59515785     -2.7628944422923 -3.9070099102745e-16
         B -1.59515785     2.7628944422923 1.9535049551373e-16
         C 0.0             0.0             -14.879004
         MULTIPLE_UNIT_CELL 4 4 1
      &END CELL
      &KIND Mo
         BASIS_SET TZVP-MOLOPT-SR-GTH-q14
         POTENTIAL GTH-PBE-q14
      &END KIND
      &KIND S
         BASIS_SET DZVP-MOLOPT-SR-GTH-q6
         POTENTIAL GTH-PBE-q6
      &END KIND
      &TOPOLOGY
         COORD_FILE_FORMAT XYZ
         COORD_FILE_NAME aiida.coords.xyz
         MULTIPLE_UNIT_CELL 4 4 1
      &END TOPOLOGY
   &END SUBSYS
&END FORCE_EVAL
&GLOBAL
   ELPA_KERNEL GENERIC
   PRINT_LEVEL MEDIUM
   PROJECT aiida
   RUN_TYPE CELL_OPT
&END GLOBAL
&MOTION
   &CELL_OPT
      &BFGS
         TRUST_RADIUS [angstrom] 0.2
      &END BFGS
      EXTERNAL_PRESSURE [bar] 0.0
      KEEP_ANGLES .TRUE.
      KEEP_SYMMETRY .FALSE.
      MAX_DR [bohr] 0.0005
      MAX_FORCE [bohr^-1*hartree] 0.00010
      MAX_ITER 1000
      OPTIMIZER BFGS
      PRESSURE_TOLERANCE [bar] 100
      RMS_DR [bohr] 0.0005
      RMS_FORCE [bohr^-1*hartree] 0.00010
      TYPE DIRECT_CELL_OPT
   &END CELL_OPT
   &GEO_OPT
      &BFGS
         TRUST_RADIUS [angstrom] 0.20
      &END BFGS
      MAX_DR [bohr] 0.0005
      MAX_FORCE [bohr^-1*hartree] 0.00010
      MAX_ITER 1000
      OPTIMIZER BFGS
      RMS_DR [bohr] 0.0005
      RMS_FORCE [bohr^-1*hartree] 0.00010
      TYPE MINIMIZATION
   &END GEO_OPT
&PRINT
      &RESTART
         BACKUP_COPIES 0
         &EACH
            CELL_OPT 1
            GEO_OPT 1
            MD 1
         &END EACH
      &END RESTART
      &TRAJECTORY
         &EACH
            CELL_OPT 1
            GEO_OPT 1
            MD 1
         &END EACH
         FORMAT DCD_ALIGNED_CELL
      &END TRAJECTORY
   &END PRINT
&END MOTION
                                                                                                                                                                    161,1         Bot

Krack Matthias

unread,
Apr 24, 2023, 3:21:51 PM4/24/23
to cp...@googlegroups.com

You can try to drop the keyword FORMAT DCD_ALIGNED_CELL or use just FORMAT DCD instead.

Andres Ortega

unread,
Apr 25, 2023, 3:11:45 AM4/25/23
to cp...@googlegroups.com
Dear Matthias, 

I tried your suggestion, 
the transformation still occurs in the first step of the optimization , I also try just keeping using the default of FORMAT, it doesnt work   

best, 

Andres 

Krack Matthias

unread,
Apr 25, 2023, 8:16:51 AM4/25/23
to cp...@googlegroups.com

CP2K always initializes the cell by aligning the lattice vector a with the x axis and then the vector b is placed in the xy plane, even if A, B, and C are explicitly specified in the input. That transformation should not matter as the atomic coordinates are transformed accordingly. Sorry, could have noted that earlier.

Andres Ortega

unread,
Apr 25, 2023, 8:28:06 AM4/25/23
to cp...@googlegroups.com
Dear Matthias, 

Thank you for your email, 
So what i notice , is that the user can define the A, B , C in a different way that the conventional . 
Actually, the first scf, cp2k do not modify the cell parameters , is when the CELL_OPT starts. 
This transformation could modify results that are related to the symmetry of a system, like computing a property like a tensor. 

In principle, if i use this input and just do a GEO_OPT , the cell parameters do not suffer a transformation to the conventional from cp2k. 
Is there a choice to avoid this change in the CELL_OPT ?

best, 

Andres 

You received this message because you are subscribed to a topic in the Google Groups "cp2k" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cp2k/8C0g5vialvA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/ZRAP278MB082756609080A0E18686BE9FF4649%40ZRAP278MB0827.CHEP278.PROD.OUTLOOK.COM.

Krack Matthias

unread,
Apr 25, 2023, 8:37:18 AM4/25/23
to cp...@googlegroups.com

Dear Andres

 

If I am not mistaken, the transformation is directly performed after the cell information has been read from the input. Thus all calculations in CP2K are done with that transformed cell including the first SCF.

 

Best

 

Matthias

Andres Ortega

unread,
Apr 25, 2023, 8:42:32 AM4/25/23
to cp...@googlegroups.com
Dear Matthias,

You are right, cp2k read cell parameters from the input, and then does the transformation when doing a CELL_OPT.
The cell parameters do not suffer any transformation when the run is a GEO_OPT

Is there a input choice to avoid this behaviour in the CELL_OPT? 
best 

Andres 

Krack Matthias

unread,
Apr 25, 2023, 9:50:55 AM4/25/23
to cp...@googlegroups.com

Dear Andres

 

As I said, the transformation is always carried out, even with a GEO_OPT run. The initial cell expression at the top of the CP2K output files reflects only what CP2K read from the input file. At the start of the GEO_OPT run, in contrast to the CELL_OPT run, there is no cell printout, but you can perform a GEO_OPT run and request the .cell file output. You will then see that the first row in the cell file is already the transformed cell.

Andres Ortega

unread,
Apr 25, 2023, 9:58:48 AM4/25/23
to cp...@googlegroups.com
Dear Matthias , 

Thank you again for the fast reply , 
so what I am observing is not like that , the GEO_OPT keep the cell parameters fixed , and the restart file that cp2k prints at the end of the GEO_OPT keeps the cell_parameters that were defined in the beginning 

best 

Andres 


Krack Matthias

unread,
Apr 25, 2023, 12:18:48 PM4/25/23
to cp...@googlegroups.com

Dear Andres

 

You are right, the behavior of GEO_OPT and CELL_OPT is indeed different. Sorry, I missed that. Meanwhile, I checked the code. With CELL_OPT, the cell matrix is always transformed to a triangular form for non-orthorhombic cells and there is currently no way to change that by any input key. The triangular cell matrix setup/transformation makes sense for some cases (e.g. when ABC and ALBEGA are specified), but I am not sure if that is always needed. The fix would be easy, but it could have many unforeseen side effects. I have to perform further checks.

Matthias Krack

unread,
May 2, 2023, 8:44:24 AM5/2/23
to cp2k
This PR fixes hopefully the issue in the current CP2K development version.

Best regards

Matthias

Andres Ortega

unread,
May 2, 2023, 10:13:12 AM5/2/23
to cp...@googlegroups.com
Dear Matthias , 

Thank you for your email and addressing this! 


best , 

Andres Ortega-Guerrero  

Reply all
Reply to author
Forward
0 new messages