.XYZ format

1,177 views
Skip to first unread message

Matt

unread,
Nov 6, 2008, 4:26:28 PM11/6/08
to diffpy-users
Dear group,

I am attempting to model an amorphous molecular solid, and the
starting model is coming from Gaussian. Therefore, my only option for
the file format is .xyz. My question is, how does diffpy handle
the .xyz format? Is any translational symmetry assumed? Also, does
it matter if my model is far off of the origin? What are the units?
Are they fractional based off of a unit cell (like a .cif) or does the
fraction represent some unit (like A)? There seems to be some
difference in the way that the two programs handle the .xyz file
format: the structure looks reasonable in Gaussian, but then gives me
an odd looking PDF. When I export to .cif with diffpy the resulting
structure is completely non physical, but I am unsure if this is an
artifact of the .xyz -> .cif conversion or evidence that the
initial .xyz format was not read properly by diffpy.

Any input would be greatly appreciated.

Thanks!

-Matt

Pavol Juhas

unread,
Nov 7, 2008, 1:18:50 PM11/7/08
to diffpy...@googlegroups.com
On Thu, Nov 06, 2008 at 01:26:28PM -0800, Matt wrote:
> I am attempting to model an amorphous molecular solid, and the
> starting model is coming from Gaussian. Therefore, my only option for
> the file format is .xyz. My question is, how does diffpy handle
> the .xyz format? Is any translational symmetry assumed? Also, does
> it matter if my model is far off of the origin? What are the units?
> Are they fractional based off of a unit cell (like a .cif) or does the
> fraction represent some unit (like A)?

Hi Matt, excellent question, sorry if my answer is a bit long winded.

Structure storage and I/O operations are internally handled by a
Structure class from the diffpy.Structure module. Currently, this
class does not have explicit knowledge of translational or other
symmetries, it basically allows to convert between absolute Cartesian
and fractional coordinates with respect to base vectors va, vb, vc.

The PDF calculator in PDFgui assumes that all structures are periodic
with the unit cell given by the base vectors va, vb, vc.

For the xyz structure format the base vectors are equal to Cartesian
axes, thus in terms of PDF calculation the structure is considered to
have a cubic lattice with a=1. Any fractional coordinates outside of
0 <= x < 1 range get shifted to their equivalent positions inside unit
cell.

I admit that loading of xyz files is not very useful in PDFgui. One
can change the lattice parameters in the phase panel, but since all
coordinates on that panel are fractional, the whole structure just
gets expanded/contracted, while all "outside" fractionals still get
shifted inside the cell.

For your case, the solution would be to preprocess the xyz structure
before loading it in PDFgui. This can be done by a Python script -
there are 2 scenarios:

(1) Calculate PDF of an aperiodic cluster. The trick is to setup
lattice parameters large enough so that atoms from translated
clusters to not contribute. Note, that the baseline of the
calculated PDF would be incorrect, as it follows
-4*pi*rho0*r, with rho0 given by the box size.

# python script
A = 50 # size of the large lattice
from diffpy.Structure import Structure, Lattice

stru = Structure(filename="cluster.xyz")
big_lattice = Lattice(A, A, A, 90, 90, 90)

# placeInLattice updates the fractional base, while preserving
# absolute Cartesian positions.
stru.placeInLattice(big_lattice)

# PDF calculation is independent of origin, but the structure
# is easier to check if it starts at [0,0,0].
import numpy
# vector of minimum values for x, y, z
xyz_min = numpy.min([a.xyz for a in stru], axis=0)
for a in a.xyz:
a.xyz = a.xyz - xyz_min

# save the updated structure
stru.write("cluster_boxed.stru", format="pdffit")

(2) Setup a big box with periodic boundary conditions. You need to
make sure all Cartesian positions in your xyz file remain inside
the 0 <= xc < A box. (You can try to generate much bigger cluster
and cut out a cubic box.) Use the same script as above, the PDF
baseline should be in this case correct.

If you are using Linux OS, the script above should run as is.
On Windows the best bet it to start pdffit2 and run it with
execfile("scriptname.py"). [pdffit2 is just a Python session
with a couple of preloaded PDF modules.]

Hope this helps,

Pavol

Pavol Juhas

unread,
Jan 16, 2013, 5:26:20 PM1/16/13
to diffpy...@googlegroups.com
On Tue, Jan 15, 2013 at 01:50:04PM -0800, Amal wrote:
> Hi Pavol
> Thank you for this message in Nov 2008.
> This was useful to use xyz files to generate pdf today.
>
> I am writing to ask you if you can provide a script for scenario 2 you have
> outlined below.

Hi Amal,

Attached is a Python code that generates a big periodic box from xyz
file. Hope this helps,

Pavol

--
Dr. Pavol Juhas
Condensed Matter Physics and Materials Science Department
building 510B
Brookhaven National Laboratory
P.O. Box 5000
Upton, NY 11973-5000
xyztoperiodicbigbox.py

Pavol Juhas

unread,
Jun 7, 2013, 4:53:14 PM6/7/13
to diffpy...@googlegroups.com
On Fri, Jun 07, 2013 at 09:10:13AM -0700, Amal wrote:
...
> We could export the Gcalc and plot it in another plotting program
> along with Gobs for comparison. But it would be useful to plot the
> Gcalc and Gobs in PDFgui, along with the Gdiff.
>
> Also, with the Gcalc from the xyz file, how do one go about
> calculating the residuals, Rw?
>
> To summarize, Is there a way to plot the Gcalc(from xyz file) and Gobs in
> PDFgui, along with Gdiff and get the Rw?

Hi Amal,

These are great suggestions, but unfortunately none of them is
is currently available in PDFgui.

PDFgui is not actively developed at this point. On occasion I do
small bug fixes, but there are no resources to add any new
significant features.

With best regards,

Amal

unread,
May 23, 2014, 9:35:43 AM5/23/14
to diffpy...@googlegroups.com, pju...@bnl.gov, Amal Dass
Hi Pavol:
Thank you for your help with the XYZ files, and the python code (xyztoperiodicbigbox.py) you wrote, dating back to your Jan 2013 and Nov 2008 messages.

With your help, we have calculated the PDF of some atomic models. 
This work is now published here: http://pubs.acs.org/doi/abs/10.1021/ja502327a
J. Am. Chem. Soc., 2014, 136 (20), pp 7410–7417  DOI: 10.1021/ja502327a
ACS Nano, Just Accepted Manuscript DOI: 10.1021/nn501970v

I appreciate your help and would be glad to receive any suggestions / comments you or the google-group members may have. 

best, 
  Amal

Pavol Juhas

unread,
May 25, 2014, 3:02:54 AM5/25/14
to diffpy...@googlegroups.com, Amal Dass
Hi Amal,

You are welcome, I am glad the script was helpful. Thank you for
letting me know about the paper and also for the acknowledgment, it is
a very nice work.

BTW, the new DiffPy-CMI release supports simulation and refinement of
a single-molecule PDFs without a need for huge-cell workarounds. It
also does
a better job of reproducing the G(r) baseline, which is for isolated
particles non-linear - unlike the linear baseline for periodic
structures.

Best,

Pavol


--
Dr. Pavol Juhas
Condensed Matter Physics and Materials Science Department
Reply all
Reply to author
Forward
0 new messages