Memory Error with Constrained Optimization

I have been trying to perform a constrained optimization calculation on a set of substituted terphenyl’s. For several substituents, the jobs give me the same error after the first optimization step. I have tried adjusting the step size, the memory, the level of theory, the number of atoms constrained, and the number of nodes I run the job on. If I remove my constraints, the jobs run fine and at higher levels of theory. I need the constraint unfortunately. My current simplest input is:
$molecule
-1 2
C 3.4884707 0.2930225 0.1550480
C 4.0815307 1.3239588 -0.5796189
H 3.4695878 1.9025179 -1.2603270
C 5.4324992 1.6060177 -0.4661583
H 5.8612789 2.4122108 -1.0501042
C 6.2395133 0.8563349 0.3782765
C 5.6703200 -0.1747290 1.1105426
H 6.2838166 -0.7667869 1.7798699
C 4.3170615 -0.4499651 1.0009752
H 3.8819409 -1.2401586 1.5995653
C 2.0473566 -0.0114911 0.0459403
C 1.1218405 0.9755268 -0.1584767
H 1.4412994 2.0093017 -0.2297990
C -0.2868696 0.7275608 -0.1533457
H -0.8924210 1.4563647 -0.6825234
C -0.7173691 -0.6539623 -0.2021491
C 0.2437718 -1.6402935 0.0164148
H -0.0646813 -2.6776265 0.0832027
C 1.5834876 -1.3541340 0.1679935
H 2.2899969 -2.1599040 0.3211212
C -2.1239297 -0.9790107 -0.3966092
C -3.1261573 -0.0101624 -0.2106944
H -2.8522015 0.9845893 0.1138453
C -4.4652271 -0.3081242 -0.3982374
H -5.2066972 0.4649144 -0.2302050
C -4.8660642 -1.5795731 -0.7816643
C -3.8915682 -2.5522975 -0.9783223
H -4.1786384 -3.5508157 -1.2896080
C -2.5546820 -2.2580975 -0.7941436
H -1.8205455 -3.0295785 -0.9881926
Br -5.9144221 -1.8089535 -0.9296410
Br 7.2973849 1.0732432 0.4648214
C -0.7723443 1.5730331 1.6363939
O -0.8155087 0.7277121 2.4834438
O -0.9008759 2.7539534 1.4294990
$end
$rem
GEOM_OPT_DMAX = 20
BASIS = 6-31G
JOB_TYPE = SP
GEOM_OPT_MAX_CYCLES = 400
MEM_STATIC = 8000
MEM_TOTAL = 64000
METHOD = B3LYP
SCF_CONVERGENCE = 8
SCF_MAX_CYCLES = 200
SYMMETRY = FALSE
SYMMETRY_IGNORE = 1
UNRESTRICTED = 1
$end

$opt
FIXED
14 XYZ
33 XYZ
ENDFIXED
$end

@@@@

$molecule
read
$end

$rem
GEOM_OPT_DMAX = 20
BASIS = 6-31G
JOB_TYPE = Optimization
GEOM_OPT_MAX_CYCLES = 400
MEM_STATIC = 8000
MEM_TOTAL = 64000
METHOD = B3LYP
SCF_CONVERGENCE = 8
SCF_MAX_CYCLES = 200
SYMMETRY = FALSE
SYMMETRY_IGNORE = 1
UNRESTRICTED = 1
SCF_GUESS = READ
$end

$opt
FIXED
14 XYZ
33 XYZ
ENDFIXED
$end

I keep receiving this error:
“”"
Calculated Step too Large. Step scaled by 0.003265
Step Taken. Stepsize is 0.020000

                         Maximum     Tolerance    Cnvgd?
     Gradient           3.095163      0.000300      NO
     Displacement       0.010105      0.001200      NO
     Energy change     *********      0.000001      NO

*** Error in `/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s’: double free or corruption (!prev): 0x00000000388f33c0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7f69a1e2b329]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0xaf03ba7]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c6ac82]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c3ad5b]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c3735e]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c32a9c]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c31cdf]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x4c306b6]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x43cc37]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x43aed8]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x43900b]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x43765e]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f69a1dcc555]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe_s[0x40c079]
======= Memory map: ========
00400000-28319000 r-xp 00000000 00:30 7005488 /spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe.LINUX_Ix86_64.5420
28518000-29145000 rw-p 27f18000 00:30 7005488 /spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/exe/qcprog.exe.LINUX_Ix86_64.5420
29145000-3605d000 rw-p 00000000 00:00 0
37329000-3d0cb000 rw-p 00000000 00:00 0 [heap]
7f66dcde4000-7f66dd0e5000 rw-p 00000000 00:00 0
7f66ec948000-7f66ecc49000 rw-p 00000000 00:00 0
7f66fc4ac000-7f66fc7ad000 rw-p 00000000 00:00 0
7f670425e000-7f670455f000 rw-p 00000000 00:00 0
7f670c1bd000-7f670c4be000 rw-p 00000000 00:00 0
7f6713f6f000-7f6714270000 rw-p 00000000 00:00 0
7f671bb74000-7f671be75000 rw-p 00000000 00:00 0
7f6751964000-7f6751e17000 rw-p 00000000 00:00 0
7f675220e000-7f67525b7000 rw-p 00000000 00:00 0
7f6752ff6000-7f67534a9000 rw-p 00000000 00:00 0
7f67539ab000-7f6753d54000 rw-p 00000000 00:00 0
7f67540fd000-7f67545b0000 rw-p 00000000 00:00 0
7f67549a7000-7f6754d50000 rw-p 00000000 00:00 0
7f6755702000-7f6756411000 rw-p 00000000 00:00 0
7f6756bb1000-7f6756f5a000 rw-p 00000000 00:00 0
7f67575f0000-7f6757aa3000 rw-p 00000000 00:00 0
7f6758243000-7f67585ec000 rw-p 00000000 00:00 0
7f6758c82000-7f6759135000 rw-p 00000000 00:00 0
7f67598d5000-7f6759c7e000 rw-p 00000000 00:00 0
7f675a314000-7f675a7c7000 rw-p 00000000 00:00 0
7f675af67000-7f675b310000 rw-p 00000000 00:00 0
7f675bd45000-7f675c5a1000 rw-p 00000000 00:00 0
7f675c94a000-7f675d1a6000 rw-p 00000000 00:00 0
7f675d54f000-7f675e25e000 rw-p 00000000 00:00 0
7f675e607000-7f675ee63000 rw-p 00000000 00:00 0
7f675f20c000-7f675fa68000 rw-p 00000000 00:00 0
7f675fe11000-7f676066d000 rw-p 00000000 00:00 0
7f6764000000-7f6764021000 rw-p 00000000 00:00 0
7f6764021000-7f6768000000 —p 00000000 00:00 0
7f6768b6e000-7f676a3ef000 rw-p 00000000 00:00 0
7f676a890000-7f676b948000 rw-p 00000000 00:00 0
7f676bcf1000-7f676c000000 rw-p 00000000 00:00 0
7f676c000000-7f676d760000 rw-p 00000000 00:00 0
7f676d760000-7f6770000000 —p 00000000 00:00 0
7f6770188000-7f6770531000 rw-p 00000000 00:00 0
7f67708da000-7f6770bdb000 rw-p 00000000 00:00 0
7f6770c80000-7f677198f000 rw-p 00000000 00:00 0
7f677246d000-7f677276e000 rw-p 00000000 00:00 0
7f6772ba2000-7f677324c000 rw-p 00000000 00:00 0
7f67733c9000-7f6773b7d000 rw-p 00000000 00:00 0
7f6774000000-7f6776087000 rw-p 00000000 00:00 0
7f6776087000-7f6778000000 —p 00000000 00:00 0
7f6778316000-7f6778617000 rw-p 00000000 00:00 0
7f6779578000-7f6779879000 rw-p 00000000 00:00 0
7f6779e96000-7f677a546000 rw-p 00000000 00:00 0
7f677aceb000-7f677ae6c000 rw-p 00000000 00:00 0
7f677b2db000-7f677b2f2000 r-xp 00000000 00:30 175879 /spack/apps/gcc/8.3.0/lib64/libgcc_s.so.1
7f677b2f2000-7f677b4f1000 —p 00017000 00:30 175879 /spack/apps/gcc/8.3.0/lib64/libgcc_s.so.1
7f677b4f1000-7f677b4f2000 r–p 00016000 00:30 175879 /spack/apps/gcc/8.3.0/lib64/libgcc_s.so.1
7f677b4f2000-7f677b4f3000 rw-p 00017000 00:30 175879 /spack/apps/gcc/8.3.0/lib64/libgcc_s.so.1
7f677b4f3000-7f677b7fc000 rw-p 00000000 00:00 0
7f677b7fc000-7f677b7fd000 —p 00000000 00:00 0
7f677b7fd000-7f677bbfe000 rw-p 00000000 00:00 0
7f677bbfe000-7f677bbff000 —p 00000000 00:00 0
7f677bbff000-7f677c000000 rw-p 00000000 00:00 0
7f677c000000-7f677dc01000 rw-p 00000000 00:00 0
7f677dc01000-7f6780000000 —p 00000000 00:00 0
7f6780000000-7f6781810000 rw-p 00000000 00:00 0
7f6781810000-7f6784000000 —p 00000000 00:00 0
7f6784000000-7f6785805000 rw-p 00000000 00:00 0
7f6785805000-7f6788000000 —p 00000000 00:00 0
7f6788000000-7f6789c1a000 rw-p 00000000 00:00 0
7f6789c1a000-7f678c000000 —p 00000000 00:00 0
7f678c000000-7f678d813000 rw-p 00000000 00:00 0
7f678d813000-7f6790000000 —p 00000000 00:00 0
7f6790000000-7f679180f000 rw-p 00000000 00:00 0
7f679180f000-7f6794000000 —p 00000000 00:00 0
7f6794000000-7f6795cab000 rw-p 00000000 00:00 0
7f6795cab000-7f6798000000 —p 00000000 00:00 0
7f6798000000-7f6799c8a000 rw-p 00000000 00:00 0
7f6799c8a000-7f679c000000 —p 00000000 00:00 0
7f679c000000-7f679d811000 rw-p 00000000 00:00 0
7f679d811000-7f67a0000000 —p 00000000 00:00 0
7f67a0000000-7f67a1c17000 rw-p 00000000 00:00 0
7f67a1c17000-7f67a4000000 —p 00000000 00:00 0
7f67a4000000-7f67a5815000 rw-p 00000000 00:00 0
7f67a5815000-7f67a8000000 —p 00000000 00:00 0
7f67a8000000-7f67a97df000 rw-p 00000000 00:00 0
7f67a97df000-7f67ac000000 —p 00000000 00:00 0
7f67ac000000-7f67ad813000 rw-p 00000000 00:00 0
7f67ad813000-7f67b0000000 —p 00000000 00:00 0
7f67b0000000-7f67b180d000 rw-p 00000000 00:00 0
7f67b180d000-7f67b4000000 —p 00000000 00:00 0
7f67b4000000-7f67b574e000 rw-p 00000000 00:00 0
7f67b574e000-7f67b8000000 —p 00000000 00:00 0
7f67b8000000-7f67b9749000 rw-p 00000000 00:00 0
7f67b9749000-7f67bc000000 —p 00000000 00:00 0
7f67bc000000-7f67bd341000 rw-p 00000000 00:00 0
7f67bd341000-7f67c0000000 —p 00000000 00:00 0
7f67c009c000-7f67c049c000 rw-p 00000000 00:00 0
7f67c049c000-7f67c049d000 —p 00000000 00:00 0
7f67c049d000-7f67c089e000 rw-p 00000000 00:00 0
7f67c089e000-7f67c089f000 —p 00000000 00:00 0
7f67c089f000-7f67c0ca0000 rw-p 00000000 00:00 0
7f67c0ca0000-7f67c0ca1000 —p 00000000 00:00 0
7f67c0ca1000-7f67c10a2000 rw-p 00000000 00:00 0
7f67c10a2000-7f67c10a3000 —p 00000000 00:00 0
7f67c10a3000-7f67c14a4000 rw-p 00000000 00:00 0
7f67c14a4000-7f67c14a5000 —p 00000000 00:00 0
7f67c14a5000-7f67c18a6000 rw-p 00000000 00:00 0
7f67c18a6000-7f67c18a7000 —p 00000000 00:00 0
7f67c18a7000-7f67c1ca8000 rw-p 00000000 00:00 0
7f67c1ca8000-7f67c1ca9000 —p 00000000 00:00 0
7f67c1ca9000-7f67c20aa000 rw-p 00000000 00:00 0
7f67c20aa000-7f67c20ab000 —p 00000000 00:00 0
7f67c20ab000-7f67c24ac000 rw-p 00000000 00:00 0
7f67c24ac000-7f67c24ad000 —p 00000000 00:00 0
7f67c24ad000-7f67c28ae000 rw-p 00000000 00:00 0
7f67c28ae000-7f67c28af000 —p 00000000 00:00 0
7f67c28af000-7f67c2cb0000 rw-p 00000000 00:00 0
7f67c2cb0000-7f67c2cb1000 —p 00000000 00:00 0
7f67c2cb1000-7f67c30b2000 rw-p 00000000 00:00 0
7f67c30b2000-7f67c30b3000 —p 00000000 00:00 0
7f67c30b3000-7f67c34b4000 rw-p 00000000 00:00 0
7f67c34b4000-7f67c34b5000 —p 00000000 00:00 0
7f67c34b5000-7f67c38b6000 rw-p 00000000 00:00 0
7f67c38b6000-7f67c38b7000 —p 00000000 00:00 0
7f67c38b7000-7f67c3cb8000 rw-p 00000000 00:00 0
7f67c3cb8000-7f67c3cb9000 —p 00000000 00:00 0
7f67c3cb9000-7f67c40ba000 rw-p 00000000 00:00 0
7f67c40ba000-7f67c40bb000 —p 00000000 00:00 0
7f67c40bb000-7f69a15a9000 rw-p 00000000 00:00 0
7f69a15a9000-7f69a15aa000 —p 00000000 00:00 0
7f69a15aa000-7f69a1daa000 rw-p 00000000 00:00 0
7f69a1daa000-7f69a1f6e000 r-xp 00000000 00:13 84359 /usr/lib64/libc-2.17.so
7f69a1f6e000-7f69a216d000 —p 001c4000 00:13 84359 /usr/lib64/libc-2.17.so
7f69a216d000-7f69a2171000 r–p 001c3000 00:13 84359 /usr/lib64/libc-2.17.so
7f69a2171000-7f69a2173000 rw-p 001c7000 00:13 84359 /usr/lib64/libc-2.17.so
7f69a2173000-7f69a2178000 rw-p 00000000 00:00 0
7f69a2178000-7f69a217f000 r-xp 00000000 00:13 84389 /usr/lib64/librt-2.17.so
7f69a217f000-7f69a237e000 —p 00007000 00:13 84389 /usr/lib64/librt-2.17.so
7f69a237e000-7f69a237f000 r–p 00006000 00:13 84389 /usr/lib64/librt-2.17.so
7f69a237f000-7f69a2380000 rw-p 00007000 00:13 84389 /usr/lib64/librt-2.17.so
7f69a2380000-7f69a2481000 r-xp 00000000 00:13 84367 /usr/lib64/libm-2.17.so
7f69a2481000-7f69a2680000 —p 00101000 00:13 84367 /usr/lib64/libm-2.17.so
7f69a2680000-7f69a2681000 r–p 00100000 00:13 84367 /usr/lib64/libm-2.17.so
7f69a2681000-7f69a2682000 rw-p 00101000 00:13 84367 /usr/lib64/libm-2.17.so
7f69a2682000-7f69a2699000 r-xp 00000000 00:13 84385 /usr/lib64/libpthread-2.17.so
7f69a2699000-7f69a2898000 —p 00017000 00:13 84385 /usr/lib64/libpthread-2.17.so
7f69a2898000-7f69a2899000 r–p 00016000 00:13 84385 /usr/lib64/libpthread-2.17.so
7f69a2899000-7f69a289a000 rw-p 00017000 00:13 84385 /usr/lib64/libpthread-2.17.so
7f69a289a000-7f69a289e000 rw-p 00000000 00:00 0
7f69a289e000-7f69a28a0000 r-xp 00000000 00:13 84365 /usr/lib64/libdl-2.17.so
7f69a28a0000-7f69a2aa0000 —p 00002000 00:13 84365 /usr/lib64/libdl-2.17.so
7f69a2aa0000-7f69a2aa1000 r–p 00002000 00:13 84365 /usr/lib64/libdl-2.17.so
7f69a2aa1000-7f69a2aa2000 rw-p 00003000 00:13 84365 /usr/lib64/libdl-2.17.so
7f69a2aa2000-7f69a2ac4000 r-xp 00000000 00:13 84352 /usr/lib64/ld-2.17.so
7f69a2b5a000-7f69a2bbe000 rw-p 00000000 00:00 0
7f69a2bbe000-7f69a2c7f000 r–s 00000000 00:13 68942 /var/db/nscd/passwd
7f69a2c7f000-7f69a2cb4000 r–s 00000000 00:13 68944 /var/db/nscd/hosts
7f69a2cb4000-7f69a2cba000 rw-p 00000000 00:00 0
7f69a2cba000-7f69a2cc3000 rw-p 00000000 00:00 0
7f69a2cc3000-7f69a2cc4000 r–p 00021000 00:13 84352 /usr/lib64/ld-2.17.so
7f69a2cc4000-7f69a2cc5000 rw-p 00022000 00:13 84352 /usr/lib64/ld-2.17.so
7f69a2cc5000-7f69a2cc6000 rw-p 00000000 00:00 0
7fff17193000-7fff1726a000 rw-p 00000000 00:00 0 [stack]
7fff17325000-7fff17327000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
/spack/apps/linux-centos7-x86_64/gcc-8.3.0/qchem-5.4.2/openmp/bin/qchem: line 126: 74667 Aborted ${QCPROG_S} ${inp} ${scr}
Error in Q-Chem run part 2
remove work dirs /scratch1/kareesak/qchem74626.0 – /scratch1/kareesak/qchem74626.-1
rm -rf /scratch1/kareesak/qchem74626
Error in the Q-Chem run
“”""

Does this error seem like it would stem from the super computing resource I am using (CARC USC) or from Q-Chem? I have tried running the optimization on the quick Q-Chem public servers but it times out too early to see if CARC is the issue. Could someone give me some advice or try it to see if they receive similar errors?

It doesn’t look like a memory error with your settings so much as a double-free or some other type of bug. This happens after the first step? Because I reproduce this part of your output:

                             Maximum     Tolerance    Cnvgd?
         Gradient           3.095162      0.000300      NO
         Displacement       0.010105      0.001200      NO
         Energy change     *********      0.000001      NO

but my job keeps going. (This is with the latest trunk, a pre-release version of 6.0). What version of Q-Chem are you using?

Update: I can now confirm this behavior with the current version of the code (it just wasn’t consistently crashing on the first step, sometimes on 2nd step). Although I am not sure why this generates a crash, I believe it is related to a significant flaw in your input geometry, namely, that the two C-Br bond lengths are much too short. You can see this manifested in the gradient that is computed during the first optimization step. The tail end of the gradient is:

           31          32          33          34          35
    1   3.0638528  -3.0951625  -0.0060370   0.0023001   0.0063753
    2   0.6704295  -0.6343107   0.0138942   0.0401494  -0.0565675
    3   0.4323998  -0.2529390   0.0287531  -0.0439651   0.0086469
 Max gradient component =       3.095E+00
 RMS gradient           =       5.979E-01

Atoms 31 and 32 are the bromines and you can see that they have gradient components ~3 Hartree/Bohr, which is huge. I tried changing the input geometry so that the two C-Br bonds are closer to 1.84 A:

 C    -2.554682    -2.258097    -0.794144
 C    -2.123930    -0.979011    -0.396609
 C    -3.126157    -0.010162    -0.210694
 C    -4.465227    -0.308124    -0.398237
 C    -4.866064    -1.579573    -0.781664
 C    -3.891568    -2.552298    -0.978322
 C    -0.717369    -0.653962    -0.202149
 C    -0.286870     0.727561    -0.153346
 C     1.121840     0.975527    -0.158477
 C     2.047357    -0.011491     0.045940
 C     1.583488    -1.354134     0.167993
 C     0.243772    -1.640293     0.016415
 C     3.488471     0.293023     0.155048
 C     4.081530     1.323959    -0.579619
 C     5.432499     1.606018    -0.466159
 C     6.239513     0.856335     0.378276
 C     5.670320    -0.174729     1.110542
 C     4.317062    -0.449965     1.000975
Br     8.033014     0.863083     0.832059
Br    -6.484621    -2.399469    -1.138727
 C    -0.772344     1.573033     1.636394
 O    -0.900876     2.753953     1.429499
 O    -0.815509     0.727712     2.483444
 H     3.469587     1.902518    -1.260327
 H     5.861279     2.412211    -1.050104
 H     6.283817    -0.766787     1.779870
 H     3.881941    -1.240158     1.599565
 H     1.441299     2.009302    -0.229799
 H    -0.892421     1.456365    -0.682524
 H    -0.064681    -2.677626     0.083203
 H     2.289997    -2.159904     0.321121
 H    -2.852202     0.984589     0.113845
 H    -5.206697     0.464914    -0.230205
 H    -4.178638    -3.550816    -1.289608
 H    -1.820546    -3.029578    -0.988193

This optimization ran without a crash until the maximum number of optimization steps was reached. It looks like it is getting towards convergence, and you can increase the max number of steps. I might also suggest the use of harmonic confining potentials as an alternative to fixed-atom constraints. These are described in the manual and also here:
https://doi.org/10.1021/acs.jpcb.9b11060

Thank you for the feedback! I was having issues even with modifying the Br lengths, but I have found a work-around in Avogadro that is pretty quick.

I modified them two ways: either use MolDen as a Z-matrix editor so that you can just change one or two coordinates (and Q-Chem can convert to MolDen format with MOLDEN_FORMAT=TRUE, although I have my own scripts) or use IQmol to relax the structure with a force field, although that may affect the coordinates you are trying to constrain.

We identified the bug and it is a very specific issue with steepest-descent optimization in the presence of constraints. Steepest descent is rarely used under normal circumstances so this doesn’t come up much, but the optimizer automatically switches to SD when the gradient is very large.