Crystal optimization with periodic boundary conditions

356 views
Skip to first unread message

Victor Nazarychev

unread,
Aug 20, 2022, 10:41:05 AM8/20/22
to cp2k

Dear users and developers of CP2K,

I am a new user of CP2K. I want to use CP2K to simulate the DFT of a polymer crystal, which contains ~2500 atoms (C, N, O, H). This initial crystal conformation was suggested by the experimenters, and I need to optimize this structure to find the minimal energy state.

I'm considering using CP2K due to its ability to do periodic DFT calculations. My question is related to what DFT functional and basis sets can be used to optimize a periodic crystal structure if such a massive system is considered? Maybe some there exists some examples of an input file for the problem of optimizing crystal systems using periodic boundary conditions?

For these calculations, I have a workstation with an AMD Ryzen 5950x and 64 GB of memory. Also, is it possible to speed up the calculation with the GPU?

Best wishes,

Victor

Victor Nazarychev

unread,
Sep 9, 2022, 2:55:25 AM9/9/22
to cp2k
Dear users and developers of CP2K,

I tried starting the simulation of the crystal structure using cp2k. To do that, I used an input file:

&GLOBAL
  PROJECT crys_pbc_opt
  RUN_TYPE GEO_OPT
  PRINT_LEVEL MEDIUM
  EXTENDED_FFT_LENGTHS .TRUE.
&END GLOBAL

&MOTION
&GEO_OPT
 
  ! KEEP_SPACE_GROUP .TRUE.
  OPTIMIZER LBFGS    

&END GEO_OPT
&END MOTION

&FORCE_EVAL
  METHOD Quickstep              ! Electronic structure method (DFT,...)
  &DFT
    BASIS_SET_FILE_NAME  BASIS_MOLOPT
    POTENTIAL_FILE_NAME  POTENTIAL

    &POISSON                    ! Solver requested for non periodic calculations
      PERIODIC XYZ
    &END POISSON
    &SCF                        ! Parameters controlling the convergence of the scf. This section should not be changed.
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 300
    &END SCF
    &XC                        ! Parameters needed to compute the electronic exchange potential
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT

  &SUBSYS
    &CELL
      CELL_FILE_FORMAT CIF
      ABC 9.2568 140.3208 18.9674
      PERIODIC XYZ
    &END CELL
    &TOPOLOGY                    ! Section used to center the atomic coordinates in the given box. Useful for big molecules
      COORD_FILE_FORMAT cif
      COORD_FILE_NAME  ./cell.cif
      ! &CENTER_COORDINATES
        ! CENTER_POINT 5. 5. 5.
      ! &END
    &END
    &KIND H
      ELEMENT H
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q1
    &END KIND
    &KIND O
      ELEMENT O
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q6
    &END KIND
    &KIND C
      ELEMENT C
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q4
    &END KIND
    &KIND N
      ELEMENT N
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q5
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

 ##############################################

The simulation starts, but only one step of SCF wavefunction optimization is passed, and then the calculation stops without errors.

 Re-scaling the density matrix to get the right number of electrons
                  # Electrons              Trace(P)               Scaling factor
                         8576              8575.456                        1.000


 SCF WAVEFUNCTION OPTIMIZATION

  Step     Update method      Time    Convergence         Total energy    Change
  ------------------------------------------------------------------------------
     1 P_Mix/Diag. 0.40E+00 ******     1.37713667    -13502.7304100109 -1.35E+04

How do you think, what happens? How could I change the input file to solve this problem?

Best regards, 
Victor

суббота, 20 августа 2022 г. в 17:41:05 UTC+3, Victor Nazarychev:

Jürg Hutter

unread,
Sep 9, 2022, 11:43:58 AM9/9/22
to cp...@googlegroups.com
Hi

probably there is not enough memory? You can try a smaller basis set and a lower
PW cutoff to see if it runs through.
Another possibility is to monitor your memory usage during the run.

regards
JH

________________________________________
From: cp...@googlegroups.com <cp...@googlegroups.com> on behalf of Victor Nazarychev <nazar...@gmail.com>
Sent: Friday, September 9, 2022 8:55 AM
To: cp2k
Subject: [CP2K:17639] Re: Crystal optimization with periodic boundary conditions
--
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<mailto:cp2k+uns...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/a2a11a0e-43d2-4110-986d-4598dc1b0f3dn%40googlegroups.com<https://groups.google.com/d/msgid/cp2k/a2a11a0e-43d2-4110-986d-4598dc1b0f3dn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Victor Nazarychev

unread,
Sep 26, 2022, 11:29:03 AM9/26/22
to cp...@googlegroups.com
Dear Prof. Jürg Hutter, 

Thank you very much for your response. I changed the basis sets for the atom types, and the simulation started. 

However, the energy significantly increases during the first step of the scf field calculation. 

 SCF WAVEFUNCTION OPTIMIZATION

  Step     Update method      Time    Convergence         Total energy    Change
  ------------------------------------------------------------------------------
     1 P_Mix/Diag. 0.40E+00   34.1     1.49352991     -3306.5025219983 -3.31E+03
     2 P_Mix/Diag. 0.40E+00   52.5     0.97283893     -3337.7996220399 -3.13E+01
     3 P_Mix/Diag. 0.40E+00   51.8     0.88366630     -3355.9794833839 -1.82E+01
     4 P_Mix/Diag. 0.40E+00   52.4     1.49440081     -3366.3903106073 -1.04E+01
     5 P_Mix/Diag. 0.40E+00   52.3     4.78093105     -3357.3113062081  9.08E+00
     6 P_Mix/Diag. 0.40E+00   55.6     5.13204666      8949.0258399209  1.23E+04
     7 P_Mix/Diag. 0.40E+00   55.7     4.87209898      1382.2558657457 -7.57E+03
     8 P_Mix/Diag. 0.40E+00   52.1     4.11402739      5878.6202919895  4.50E+03
     9 P_Mix/Diag. 0.40E+00   52.1     3.90597954      3458.6520635220 -2.42E+03
    10 P_Mix/Diag. 0.40E+00   52.1     4.44874753      5101.5066833448  1.64E+03
    11 P_Mix/Diag. 0.40E+00   52.4     4.40856697      4378.1126110753 -7.23E+02
    12 P_Mix/Diag. 0.40E+00   52.1     4.62106313      4808.7707611559  4.31E+02
    13 P_Mix/Diag. 0.40E+00   52.3     4.69047378      4716.1178362235 -9.27E+01


Below is my input file. 

Could you expect that it is due to the standard PW cut-off or "small" basis set? 

Best wishes, 
Victor 

####################################################################
&GLOBAL
  PROJECT crys_pbc
  RUN_TYPE GEO_OPT    ! ENERGY
  PRINT_LEVEL MEDIUM
  EXTENDED_FFT_LENGTHS .TRUE.
&END GLOBAL

&MOTION
    &GEO_OPT
    TYPE MINIMIZATION
    MAX_DR    1.0E-03
    MAX_FORCE 1.0E-03
    RMS_DR    1.0E-03
    RMS_FORCE 1.0E-03
    MAX_ITER 200
    OPTIMIZER CG
    &CG
      MAX_STEEP_STEPS  0
      RESTART_LIMIT 9.0E-01
    &END CG
    ! KEEP_SYMMETRY .TRUE.
      ! OPTIMIZER CG !LBFGS
    &END
&PRINT
    &TRAJECTORY LOW
       ADD_LAST NUMERIC
       LOG_PRINT_KEY T
       FORMAT XMOL
      &EACH
        GEO_OPT 1
      &END EACH
     &END TRAJECTORY
     &RESTART LOW
      ADD_LAST NUMERIC
      LOG_PRINT_KEY T
      &EACH
        GEO_OPT 1
      &END EACH
    &END RESTART
  &END PRINT

&END MOTION

&FORCE_EVAL
  METHOD Quickstep              ! Electronic structure method (DFT,...)
  STRESS_TENSOR NUMERICAL
 &DFT
    BASIS_SET_FILE_NAME  BASIS_MOLOPT
    POTENTIAL_FILE_NAME  POTENTIAL

    &POISSON                    ! Solver requested for non periodic calculations
      PERIODIC XYZ
    &END POISSON
    &SCF                        ! Parameters controlling the convergence of the scf. This section should not be changed.
      SCF_GUESS ATOMIC
      EPS_SCF 1.0E-6
      MAX_SCF 60
      &PRINT
         &RESTART  SILENT
           ADD_LAST  NUMERIC
           COMMON_ITERATION_LEVELS  1
           FILENAME =./WFN_restart.wfn
           LOG_PRINT_KEY  T
           &EACH
           &END EACH
         &END RESTART
       &END PRINT

    &END SCF
    &XC                        ! Parameters needed to compute the electronic exchange potential
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT

  &SUBSYS
    &CELL
      CELL_FILE_FORMAT CIF
      ABC 4.6284 140.3208 9.4837
      SYMMETRY MONOCLINIC
      PERIODIC XYZ
      MULTIPLE_UNIT_CELL 3 1 3
    &END CELL
    &TOPOLOGY                    ! Section used to center the atomic coordinates in the given box. Useful for big molecules
      COORD_FILE_FORMAT cif
      COORD_FILE_NAME ./cell.cif
      ! &CENTER_COORDINATES
        ! CENTER_POINT 5. 5. 5.
      ! &END
    &END
    &KIND H
      ELEMENT H
      BASIS_SET SZV-MOLOPT-GTH

      POTENTIAL GTH-PBE-q1
    &END KIND
    &KIND O
      ELEMENT O
      BASIS_SET SZV-MOLOPT-GTH

      POTENTIAL GTH-PBE-q6
    &END KIND
    &KIND C
      ELEMENT C
      BASIS_SET SZV-MOLOPT-GTH

      POTENTIAL GTH-PBE-q4
    &END KIND
    &KIND N
      ELEMENT N
      BASIS_SET SZV-MOLOPT-GTH

      POTENTIAL GTH-PBE-q5
    &END KIND
  &END SUBSYS
&END FORCE_EVAL

####################################################################


пт, 9 сент. 2022 г. в 18:44, Jürg Hutter <hut...@chem.uzh.ch>:
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/N_cusnCv_B4/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/ZR0P278MB0759063BF93FD6DC95CA1ABB9F439%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM.

Jürg Hutter

unread,
Sep 27, 2022, 5:21:33 AM9/27/22
to cp...@googlegroups.com
Hi

the first task is to get the wavefunction converged. Have a look into the &SCF section
that has been proposed for similar systems on this mailing list.
You should also change STRESS_TENSOR NUMERICAL
to STRESS_TENSOR ANALYTICAL in order to save CPU time.

regards
JH

________________________________________
From: cp...@googlegroups.com <cp...@googlegroups.com> on behalf of Victor Nazarychev <nazar...@gmail.com>
Sent: Monday, September 26, 2022 5:28 PM
To: cp...@googlegroups.com
Subject: Re: [CP2K:17757] Re: Crystal optimization with periodic boundary conditions
пт, 9 сент. 2022 г. в 18:44, Jürg Hutter <hut...@chem.uzh.ch<mailto:hut...@chem.uzh.ch>>:
Hi

probably there is not enough memory? You can try a smaller basis set and a lower
PW cutoff to see if it runs through.
Another possibility is to monitor your memory usage during the run.

regards
JH

________________________________________
From: cp...@googlegroups.com<mailto:cp...@googlegroups.com> <cp...@googlegroups.com<mailto:cp...@googlegroups.com>> on behalf of Victor Nazarychev <nazar...@gmail.com<mailto:nazar...@gmail.com>>
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com<mailto:cp2k%2Bunsu...@googlegroups.com><mailto:cp2k+uns...@googlegroups.com<mailto:cp2k%2Bunsu...@googlegroups.com>>.
To unsubscribe from this group and all its topics, send an email to cp2k+uns...@googlegroups.com<mailto:cp2k%2Bunsu...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/ZR0P278MB0759063BF93FD6DC95CA1ABB9F439%40ZR0P278MB0759.CHEP278.PROD.OUTLOOK.COM.

--
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<mailto:cp2k+uns...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/CALpHq2czwj5CtAX%2BKNx8ex89EqRMow_r1PRmrk1qAGE%3DoT_zMg%40mail.gmail.com<https://groups.google.com/d/msgid/cp2k/CALpHq2czwj5CtAX%2BKNx8ex89EqRMow_r1PRmrk1qAGE%3DoT_zMg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages