Unexpectedly cannot get the geometry after optimization: KEYWORD EXTPRT NOT ALLOWED
-
Dear CRYSTAL support and others,
I am new to CRYSTAL, hence the error is probably on my side.
I am trying to perform a geometry optimization of a molecular crystal and then use it to compute the dielectric susceptibilities. If I understand it correctly, I need to use the keyword EXTPRT within the OPTGEOM section to export the optimized geometry and get a fort.34 file, which I then have to use in my next calculation with EXTERNAL keyword for the geometry.
However, the run fails with an error message:
ERROR **** CONOPT_ **** KEYWORD EXTPRT NOT ALLOWED forrtl: error (78): process killed (SIGTERM)
If I remove the EXTPRT keyword, the optimization runs just fine (at least with some of the functionals)! But I cannot get the geometry out of the .OUT file. I tried using the cell parameters I got after "CRYSTALLOGRAPHIC CELL" and run an elastic constant calculation; however, it failed with "WARNING!! FORCE 9 AT CENTRAL POINT IS GREATER THAN 10^-4. OPTIMIZE THE STRUCTURE AND RE-RUN" (there were multiple such messages for multiple force vectors) and the error
ERROR **** BFGS_ **** PXK TOO SMALL
So I am now at loss trying to get the geometry out of my optimization. Can anyone help please?
Please find inputs for the jobs attached.
CS2_normalP_r2SCANh.pob_tzvp_rev2_opt_withEXTPRT.out CS2_normalP_r2SCANh.pob_tzvp_rev2_opt_withoutEXTPRT.out CS2_r2SCANh.pob_tzvp_rev2_elconst_manualCOORDS.out -
Hi esmuigors,
When you run a geometry optimization (within the
OPTGEOM
block), CRYSTAL will always produce a fort.34 file (that contains the optimized structure and can be used in a subsequent calculation with theEXTERNAL
keyword).
If you don’t see it after the run, a common cause is that it wasn’t copied back by the script used to manage scratch directories for the execution as the runCRY script provided with the code.As for the error that you get, the issue is that
EXTPRT
should be placed outside theOPTGEOM
block, as in this input.d12 example.If you prefer, you can also extract the optimized geometry manually from the .out file. However, note that you must take both the final cell parameters (and angles, if present) and the final fractional atomic coordinates from the “FINAL OPTIMIZED GEOMETRY” section (those in the primitive cell), using only updated cell parameters without matching coordinates will lead to inconsistencies and errors like the ones you saw.
Let me know if you manage to get the optimized structure.
-
Dear Giacomo Ambrogio,
Now I have moved the
EXTPRT
keyword, and the job did run. However, runPcry23 script did not indeed copy fort.34 file back to the launch directory. This is despite that runPcry23 -h suggests it should indeed copy it. Are there any workarounds to persuade the script to actually copy the fort.34 file?About the manual extraction – do I understand correctly that I should take the primitive and not crystallographic cell parameters?! The input in the .d12 file is in crystallographic cell, isn't it?
Also, I am a bit confused as to why in the input at the beginning there were only 2 fractional coordinates, but in the end the results of the geometry optimization show 6 fractional coordinates?
-
Also, in the output file there is this section:
INFORMATION **** fort.34 **** GEOMETRY OUTPUT FILE DIRECT LATTICE VECTORS CARTESIAN COMPONENTS (ANGSTROM) X Y Z 0.318445490153E+01 0.274749634689E+01 0.000000000000E+00 -0.318445490153E+01 0.274749634689E+01 0.000000000000E+00 0.000000000000E+00 0.000000000000E+00 0.960489760492E+01 CARTESIAN COORDINATES - PRIMITIVE CELL ******************************************************************************* * ATOM X(ANGSTROM) Y(ANGSTROM) Z(ANGSTROM) ******************************************************************************* 1 6 C 0.000000000000E+00 0.000000000000E+00 4.802448802459E+00 2 6 C 0.000000000000E+00 2.747496346893E+00 0.000000000000E+00 3 16 S 1.466783675769E-16 1.681580223141E+00 1.145333715792E+00 4 16 S 1.184807688651E-16 1.065916123752E+00 -3.657115086666E+00 5 16 S -5.829198876290E-17 -1.681580223141E+00 -1.145333715792E+00 6 16 S 1.753501641235E-16 -1.065916123752E+00 3.657115086666E+00 **** 8 SYMMOPS - TRANSLATORS IN FRACTIONAL UNITS **** MATRICES AND TRANSLATORS IN THE CRYSTALLOGRAPHIC REFERENCE FRAME V INV ROTATION MATRICES TRANSLATORS 1 1 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 2 2 -1.00 -0.00 0.00 -0.00 -1.00 0.00 0.00 0.00 1.00 0.50 0.50 0.50 3 3 -0.00 -1.00 0.00 -1.00 -0.00 0.00 0.00 0.00 -1.00 0.00 0.00 0.00 4 4 0.00 1.00 0.00 1.00 0.00 0.00 0.00 0.00 -1.00 0.50 -0.50 0.50 5 5 -1.00 -0.00 0.00 -0.00 -1.00 0.00 0.00 0.00 -1.00 0.00 0.00 0.00 6 6 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 -1.00 0.50 -0.50 0.50 7 7 0.00 1.00 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 8 8 -0.00 -1.00 0.00 -1.00 -0.00 0.00 0.00 0.00 1.00 0.50 0.50 0.50 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT END TELAPSE 1827.53 TCPU 1820.59 EEEEEEEEEE TERMINATION DATE 13 08 2025 TIME 11:14:46.6
If I just copy it with *.f34 extension, would that be equivalent to the fort.34 file?
-
I have actually managed to get the crystallographic cell parameters and fractional coordinates, and the calculation seems to be proceeding fine (forces are not greater than 10^-15 a.u.). If anyone finds this useful, the bash script is below. But I haven't tested it with any other spacegroup yet, just the 64th one.
#!/bin/bash outfile="$1" [ ! -f "$outfile" ] && echo "File not found!" && exit 5 [ -z "$(grep -e 'FINAL OPTIMIZED GEOMETRY' "$outfile")" ] && echo "The geometry optimization did not finish!" && exit 3 cat "$outfile" | sed -n '/^ *FINAL OPTIMIZED GEOMETRY/,/TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT END/p' | grep -A 2 -e '^ *CRYSTALLOGRAPHIC CELL' | tail -1 | sed 's@ \+@\n@g' | uniq | grep -v -e '^ *$' -e '^90.0000' > "${outfile%out}gem" fractionals="$(cat "$outfile" | sed -n '/^ *FINAL OPTIMIZED GEOMETRY/,/TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT END/p' | sed -n '/^ *COORDINATES IN THE CRYSTALLOGRAPHIC CELL/,/^ *$/p' | sed '1,3d;$d')" echo "$fractionals" | wc -l >> "${outfile%out}gem" echo "$fractionals" | gawk '{printf " %2d\t% 2.12e\t% 2.12e\t% 2.12e\n",$3,$5,$6,$7}' >> "${outfile%out}gem"