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"
-
esmuigors said in Unexpectedly cannot get the geometry after optimization: KEYWORD EXTPRT NOT ALLOWED:
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?
Hi esmuigors,
If you want to proceed with the manual extraction of the geometry you should copy the Crystallographic cell lattice parameters required by the space group you are working with (e.g. Monoclinic will require you a, b, c and β, while a cubic only the a lattice vector), the only exception to this are P lattices where the primitive and crystallographic coincide. Accordingly, also the fractionary coordinate you will copy should be the one of the Crystallographic cell, but you should copy only the atoms present in the asymmetric unit of your system identified by a T in the FINAL OPTIMIZED GEOMETRY print in the .out file, I will include here below an example to better clarify.FINAL OPTIMIZED GEOMETRY - DIMENSIONALITY OF THE SYSTEM 3 (NON PERIODIC DIRECTION: LATTICE PARAMETER FORMALLY SET TO 500) ******************************************************************************* LATTICE PARAMETERS (ANGSTROMS AND DEGREES) - BOHR = 0.5291772083 ANGSTROM PRIMITIVE CELL - CENTRING CODE 6/0 VOLUME= 62.890767 - DENSITY 13.512 g/cm^3 A B C ALPHA BETA GAMMA 6.02167869 6.02167869 6.02167869 147.475653 147.475653 46.660012 ******************************************************************************* ATOMS IN THE ASYMMETRIC UNIT 2 - ATOMS IN THE UNIT CELL: 4 ATOM X/A Y/B Z/C ******************************************************************************* 1 T 273 TA -2.420755613827E-03 -2.420755613827E-03 4.983867094700E-20 2 F 273 TA -2.524207556138E-01 2.475792443862E-01 -5.000000000000E-01 3 T 233 AS 4.184207556138E-01 4.184207556138E-01 -2.220446049250E-16 4 F 233 AS 1.684207556138E-01 -3.315792443862E-01 -5.000000000000E-01 TRANSFORMATION MATRIX PRIMITIVE-CRYSTALLOGRAPHIC CELL 0.0000 1.0000 1.0000 1.0000 0.0000 1.0000 1.0000 1.0000 0.0000 ******************************************************************************* CRYSTALLOGRAPHIC CELL (VOLUME= 125.78153367) A B C ALPHA BETA GAMMA 3.37253732 3.37253732 11.05868170 90.000000 90.000000 90.000000 COORDINATES IN THE CRYSTALLOGRAPHIC CELL ATOM X/A Y/B Z/C ******************************************************************************* 1 T 273 TA -1.956455588613E-19 2.296201495291E-19 -2.420755613827E-03 2 F 273 TA -5.000000000000E-01 2.084229456032E-17 -2.524207556138E-01 3 T 233 AS 5.000000000000E-01 5.000000000000E-01 -8.157924438617E-02 4 F 233 AS -5.117515658395E-17 -5.000000000000E-01 -3.315792443862E-01
In this example you'll have to extract from the second geometry print (i.e. Crystallographic cell) the a and c lattice parameters, given the Tetragonal lattice, alongside the fractionary coordinate of atoms 1 and 3.
esmuigors said in Unexpectedly cannot get the geometry after optimization: KEYWORD EXTPRT NOT ALLOWED:
Are there any workarounds to persuade the script to actually copy the fort.34 file?
In this regards, I don't have your script, but it should be sufficient to add to your script something along these lines in the section where all the files are copied back to your working folder:
if [ -e fort.34 ] then cp fort.34 $HERE/$INPUTFILE.f34 fi
in this case
$HERE=$PWD
, while$INPUTFILE
is the variable corresponding to your input name.I hope this helps.