nwchemgit / nwchem

NWChem: Open Source High-Performance Computational Chemistry
http://nwchemgit.github.io
Other
501 stars 160 forks source link

XYZ file output improper format #680

Closed jgiaccai closed 1 year ago

jgiaccai commented 1 year ago

I am using the DFT module in NWChem 7.0.0 with the input below which produces an XYZ file of the optimized geometry. However the first two lines of the XYZ file are inverted. This is a problem when trying to read the optimized geometry file into Avogadro.
XYZ file format requires the total number of atoms to be the first line of the file, and allows the second line of the file to be a comment.

(I'm also curious what the final column in the XYZ file is, although its presence doesn't pose any difficulties so isn't a bug in itself.)

Input:

echo

memory 2 gb
scratch_dir /local
permanent_dir ./APM3

start bz0_01nd   #change to unique molecule name and uncomment

charge 0  #confirm correct charge and uncomment

geometry units angstroms print xyz autoz
C        0.0111474136     -0.6394028853      0.0000000000
C        1.2809540749     -1.2149770592      0.0000000000
C        2.4143192635     -0.4030793194      0.0000000000
C        2.2778777885      0.9843925951      0.0000000000
C        1.0080711272      1.5599667692      0.0000000000
C       -0.1252940614      0.7480690294      0.0000000000
H       -0.8727520060     -1.2725932696     -0.0000000000
H        1.3873633258     -2.2970516030     -0.0000000000
H        3.4046279321     -0.8519634755      0.0000000000
H        3.1617772081      1.6175829791      0.0000000000
H       -1.1156027302      1.1969531856      0.0000000000
H        0.9016618771      2.6420413131      0.0000000000
END

BASIS
 * library 6-31G*  # change to the correct basis set and uncomment
END

DFT
 XC B3LYP
 # mult 2  #check that multiplicity is correct and uncomment
 disp vdw 4  #this is Grimme's D3(BJ) correction
 MAXITER 100
 #print "final evals" "final vectors"  #only need for chemissian runs
END

PROPERTY
  esp
  grid
END

ESP
    recalculate
END

task dft optimize property
TASK ESP

NW Chem output:

* Coordinates in XYZ format
   12
C     0.985823    0.985823    0.000000    2.700323
C    -0.360836    1.346659    0.000000    2.686811
C    -1.346659    0.360836    0.000000    2.671964
C    -0.985823   -0.985823    0.000000    2.655856
C     0.360836   -1.346659    0.000000    2.638565
C     1.346659   -0.360836    0.000000    2.620173
H     1.754656    1.754656    0.000000    2.600762
H    -0.642249    2.396905    0.000000    2.580414
H    -2.396905    0.642249    0.000000    2.559212
H    -1.754656   -1.754656    0.000000    2.537239
H     2.396905   -0.642249    0.000000    2.514573
H     0.642249   -2.396905    0.000000    2.491295

Corrected output:

12

C 0.985823 0.985823 0.0 2.700323
C -0.360836 1.346659 0.0 2.686811
C -1.346659 0.360836 0.0 2.671964
C -0.985823 -0.985823 0.0 2.655856
C 0.360836 -1.346659 0.0 2.638565
C 1.346659 -0.360836 0.0 2.620173
H 1.754656 1.754656 0.0 2.600762
H -0.642249 2.396905 0.0 2.580414
H -2.396905 0.642249 0.0 2.559212
H -1.754656 -1.754656 0.0 2.537239
H 2.396905 -0.642249 0.0 2.514573
H 0.642249 -2.396905 0.0 2.491295
edoapra commented 1 year ago

@jgiaccai thanks for the bug report

edoapra commented 1 year ago

As a temporary workaround, you could copy and paste the XYZ file appearing in the output file after the string "XYZ format geometry"

          XYZ format geometry
            -------------------
    12
 geometry
 C                     0.98582316     0.98582316     0.00000000
 C                    -0.36083632     1.34665947     0.00000000
 C                    -1.34665947     0.36083632     0.00000000
 C                    -0.98582316    -0.98582316     0.00000000
 C                     0.36083632    -1.34665947     0.00000000
 C                     1.34665947    -0.36083632     0.00000000
 H                     1.75465612     1.75465612     0.00000000
 H                    -0.64224871     2.39690483     0.00000000
 H                    -2.39690483     0.64224871     0.00000000
 H                    -1.75465612    -1.75465612     0.00000000
 H                     2.39690483    -0.64224871     0.00000000
 H                     0.64224871    -2.39690483     0.00000000
jgiaccai commented 1 year ago

Thanks--for the moment I wrote a little python script to rearrange the lines so I can fix all my xyz files at once. But I thought others may want to know.

edoapra commented 1 year ago

Thanks--for the moment I wrote a little python script to rearrange the lines so I can fix all my xyz files at once. But I thought others may want to know.

Let me stress that the recommended xyz file is the one embedded in the output file generated with the "geometry print xyz" keyword.

The other recommended option is to use the xyz option from the driver input field https://nwchemgit.github.io/Geometry-Optimization.html#optimization-history-as-xyz-files
This second option generates an xyz file

driver 
  xyz
end
edoapra commented 1 year ago

Commit https://github.com/nwchemgit/nwchem/commit/9a0036a4f7d04fed5dab21eb3bbe3aa6fce2180b addresses this issue