Thanks for your reply. Apparently, this got lost somewhere in space, so I just saw it. I attach my full input at the end of my post.
The system is a sheet of oxidized graphite oxide and I am trying to get an idea of the stress tensor during cell optimization. Based on your post, yes, you are right -- the multiple SCF wavefunction optimizations are just the finite differences to find the stress tensor. I tried using the diagonal analytical keyword but it wouldn't work for some reason. The error was:
I am unsure why (and trying both on a locally compiled copy and also on a cluster copy didn't work) I got this error. I will also look into using Ewald summations as, yes, my system is both periodic and I am using DFTB. I forgot I turned it off to test some input a long time ago and never returned it to on!
Now I am finding that if I take a snapshot (same atomic coordinates) of the system and recalculate the stress doing a single point (ENERGY_FORCES) calculation it doesn't give me the same stress values. This is probably because the wavefunction is not the same during the cell optimization. Would you agree with my conclusion, and do you have any hints or tips for obtaining accurate results of the stress tensor in CP2K calculations for systems like mine?
&FORCE_EVAL
STRESS_TENSOR DIAGONAL_ANALYTICAL
&DFT
&QS
METHOD DFTB
&DFTB
SELF_CONSISTENT T
DO_EWALD F
DISPERSION F
&PARAMETER
PARAM_FILE_PATH /home/ras536/dftb_parameter_sets/cp2k/scc/
PARAM_FILE_NAME parameter_table
UFF_FORCE_FIELD uff_table
&END PARAMETER
&END DFTB
&END QS
&SCF
SCF_GUESS ATOMIC
MAX_SCF 200
&OT ON
LINESEARCH 3PNT
PRECONDITIONER FULL_SINGLE
&END OT
&END SCF
&END DFT
&SUBSYS
&CELL
# Change with the system coordinates
ABC 21.30 22.14 100
ALPHA_BETA_GAMMA 90 90 90
PERIODIC XYZ
SYMMETRY ORTHORHOMBIC
# End of changes
&END CELL
&COORD
# Paste here system coordinates
C -8.2554109139 -9.8380490000 -1.6801378957
C -6.9603351788 -9.8380490000 -1.0891408567
C -4.2077759278 -9.8380490000 -0.1860590641
C -2.8047748598 -9.8380490000 -0.6483639658
C 0.0305892406 -9.8380490000 -0.7150005959
C 4.2690168758 -9.8380490000 -0.3760461092
C 5.6664878525 -9.8380490000 -0.4625534107
C 8.4484394028 -9.8380490000 -1.0534139503
C 9.7255781492 -9.8380490000 -1.6742526456
C -7.0439867935 -7.2373328254 -0.6570825690
C -4.1763859225 -7.2904474044 -0.0793908609
C -2.7886680738 -7.3678348562 0.1494769378
C 1.4362238243 -7.3305334791 0.0153523063
C 4.3072200959 -7.3730543584 -0.0323089425
C 5.7027726205 -7.3779693175 0.0553353058
C 8.5981901881 -7.4077687091 -0.0953368521
C -8.5331267996 -4.9483020547 0.3406093844
C -7.0724367777 -4.9564599509 0.2657712613
C -4.2254424230 -4.9846974287 0.7071689382
C -2.8480576373 -5.0882055399 1.0069512422
C 0.0704776256 -5.2273656984 1.4576809278
C 4.2793779988 -4.9936842255 0.6343906667
C 5.7071843984 -4.9113081353 0.1905227833
C 8.5552943829 -4.9957621971 0.6352164812
C -8.6002141940 -2.4819289823 0.3741555523
C -7.1563188658 -2.4454452797 0.7116466576
C -4.3069012779 -2.5216286004 1.0850320691
C -2.8791481429 -2.5543815024 1.4631591816
C 5.7360443357 -2.4940389231 0.6446448620
C 8.5099570392 -2.5179613785 0.1399341536
C 9.8721387228 -2.6411693850 -0.4011131502
C -8.4596011734 -0.0818263347 -0.3925756458
C -2.8248985105 -0.0843239729 0.6959641828
C 0.1325543046 -0.0578172287 1.2380994318
C 4.4064702533 -0.0221312965 1.0209496686
C 5.6121787770 -0.0464685329 0.1157682169
C -8.5467454195 2.3532929023 -0.3010984903
C -7.1219726175 2.3874681466 -0.0098605373
C -4.3151789651 2.4829173878 0.7291164593
C 0.0400047393 2.5507542999 1.2060003356
C 4.5367289495 2.5216544772 1.0636492603
C 5.8374928297 2.4316470815 0.3735257264
C 8.5233373896 2.3386910061 -0.6326970839
C 9.9150883808 2.3913769374 -0.6665557150
C -4.2341671084 4.9415211135 -0.0028013005
C -2.7572522644 4.8691927236 0.0315161057
C 0.0363238454 4.8427722188 0.1550498238
C 5.8415572798 5.0141215284 -0.0529185737
C 8.5677091315 4.8628974386 -0.9011544249
C -8.5785988586 7.3208566965 -0.8812910916
C -7.0859748318 7.3055543123 -1.1253976473
C -4.1784573301 7.2726438967 -1.0526749672
C -2.7206040161 7.2332650301 -0.8223777357
C 0.0940719511 7.2059048429 -0.6611814788
C 1.4399475863 7.2448802650 -0.4340429073
C 5.6854421612 7.3566202427 -0.9311017225
C 8.5393584777 7.4231842542 -0.7947132985
C 9.8189258148 7.4524790797 0.0017242812
C -8.3732267677 9.6612076320 -0.3589679883
C -7.0051511115 9.7755665711 -0.7041647465
C 0.0911966208 9.7547547599 -1.1007446745
C 4.3439053738 9.8029462979 -0.0739978476
C 5.7135153097 9.8113572154 -0.6010994960
C -2.0704457686 -8.5704609705 -0.3555369196
C -0.6063485758 -8.6588286762 -0.2747244544
C 2.1833164547 -8.5373715834 -0.4947031257
C 3.6193971798 -8.5942803810 -0.2741664115
C 6.3957988846 -8.6471152497 -0.1032894572
C 7.8658522400 -8.6647078304 -0.3936925714
C 10.6500000000 -7.8592320412 -1.7610761829
C -9.2300000000 -6.2665845556 0.2010576526
C -4.8977218596 -6.1428534643 0.2429583275
C -2.1242771475 -6.2711961217 0.7113046670
C -0.6957422206 -6.5292807572 1.1461770651
C 3.5795668231 -6.1875225776 0.3899015044
C 7.8374927331 -6.2197122713 0.3892422550
C 10.6500000000 -5.9729374753 -0.2788794784
C -2.1777099679 -3.8910725962 1.5464153272
C 2.2316486052 -3.8971569891 1.3971083452
C 3.6004895148 -3.8417692248 1.0463822284
C 6.4174662317 -3.6975585666 0.6770607764
C 7.8921126614 -3.6723730235 0.8937721592
C 10.6500000000 -3.8702304200 -0.1015888358
C -2.0899365660 -1.3591238299 1.0325078484
C 3.6117105941 -1.2456095524 1.1228126380
C -6.4190432860 1.2200688718 0.2300154157
C -4.9200055446 1.1937960809 0.2227836837
C -2.0699137548 1.2114864538 0.6218006355
C 2.2990791703 1.2964366528 1.6652055840
C 6.4237474346 1.2227985235 0.0904971675
C 7.7870937684 1.1307610658 -0.4081797618
C 10.6500000000 1.1572259982 -0.8711299063
C -9.2300000000 3.6048663212 -0.3940892390
C -6.4496204946 3.6594216864 -0.0775582487
C -5.0416364017 3.7417617647 0.3749721528
C -0.6753282603 3.7198759329 0.5928422298
C 2.2748716577 3.6809570200 0.7683983178
C 10.6500000000 3.5963070964 -0.5356003656
C -9.2300000000 6.0801776209 -0.4461744497
C -2.0354212531 5.9953390133 -0.3835130465
C 2.2037798592 6.0616371756 -0.1183521781
C 3.5669153457 6.1034744510 -0.1055506858
C 6.4062984138 6.0967107948 -0.8843790940
C 7.8568772699 6.1447110541 -1.0693363526
C 10.6500000000 6.1444582970 -0.0842165521
C -9.2300000000 8.5863543297 -0.4901248403
C -1.9940875265 8.5164822035 -0.6272077266
C -0.6206966288 8.4115176199 -1.2471555320
C 2.0966787479 8.5220744732 -0.1284748887
C 3.5828957507 8.5415635646 -0.0402279786
C 6.4078656451 8.6415829221 -0.8824985224
C 7.8469833696 8.6384833950 -0.8840406513
C -9.2300000000 11.4995858204 -1.1160295455
C -6.3855524443 11.0678050000 -0.6840123785
C -4.9791153776 11.0678050000 -0.3130180005
C -2.1681493315 11.0678050000 -1.1972113971
C -0.6524133221 11.0678050000 -1.1653715291
C 2.0849982762 11.0678050000 -0.1778413260
C 3.5623284838 11.0678050000 -0.0387246169
O -4.6777363828 -9.2253342445 1.0989554957
O 10.2079764542 0.4934541487 -2.1276211008
H -0.7850313932 8.9604531716 -3.1420253848
O 9.7864808712 -7.9014405994 0.6665056612
O -6.3098448737 -7.5059310232 -1.8978221721
O 7.3464299452 -9.0322427143 0.9743154124
O -8.1758245819 -2.3056573684 1.7996205538
O -6.5707343797 -4.1791396933 -0.8939126621
H -2.4760365573 11.7942184241 -3.0152739481
O 4.4048079834 3.4479539428 2.2230009769
O -4.7219891251 10.2161314670 0.8965614283
O -2.6044949790 -8.8118862401 -1.7300593484
O -8.5860226476 -8.7861613327 -2.6011121064
O 9.3109418613 7.5528426776 1.3721215308
O 5.6653747209 -4.7076142666 -1.2920345798
O -2.0307910841 9.2450245497 0.6481865681
O -5.5426461217 5.5383606761 -2.1026189311
H 10.0569505282 7.3957517196 1.9910989603
H 5.1173462960 -3.9070169743 -1.4629850022
O 3.2436019737 1.3753032380 2.7768907508
O 0.7569176903 -2.6404575147 3.0704622096
O 10.0212883421 -8.7988046173 -2.5962751314
O 8.0710287666 -3.3598363282 2.3425638891
O 1.8898161109 -10.0017392183 -2.2995000711
O 10.3387791368 9.7787800452 0.7595749790
O 2.0280443388 3.6561582903 -0.7000866911
O -8.4327653282 -0.9730147860 -1.5900432959
H 7.7633542676 -4.1437149163 2.8510348445
O 10.2101596538 5.3045960579 1.0609541213
O 0.5950173047 2.8568724072 2.5381760859
O -9.3338135292 -6.9266098967 1.4905933018
O 5.1725145944 -0.1464129148 -1.3004555794
O 1.9650249103 -0.6203794480 3.0421169148
O -8.8610806315 10.8968173003 0.1181628156
O 2.7960335320 8.3673865830 1.1779573297
O 5.4921779218 5.5105761764 1.2989177131
O 8.4970986658 5.4276234963 -2.2770587677
O -0.2997587917 -4.8057459707 2.8230959424
O -3.6910711849 2.4517493789 2.0542504659
O 0.1278029727 -0.9413933163 0.0475544553
H -0.8342460257 -6.5891825276 3.1320820245
H -4.8886509524 0.3476323338 -1.6120829717
# End of system coordinates
&END COORD
&END SUBSYS
&PRINT
&STRESS_TENSOR
FILENAME __STD_OUT__
LOG_PRINT_KEY TRUE
ADD_LAST NUMERIC
&EACH
CELL_OPT 1
&END EACH
&END STRESS_TENSOR
&END PRINT
&END FORCE_EVAL
&GLOBAL
PROJECT geo_opt_go_patch
RUN_TYPE CELL_OPT
PRINT_LEVEL LOW
&END GLOBAL
&MOTION
&CELL_OPT
EXTERNAL_PRESSURE 0 0 0 0 0 0 0 0 0
KEEP_ANGLES TRUE
KEEP_SYMMETRY TRUE
MAX_ITER 1000
&END CELL_OPT
# Uncomment to allow printing of stress tensor.
# Also need to uncomment the stress tensor evaluation.
&PRINT
&STRESS
&END STRESS
&END PRINT
# End of uncomment
&END MOTION