Adding a new file format

179 views
Skip to first unread message

Peter Ercius

unread,
Oct 2, 2020, 12:40:27 PM10/2/20
to VESTA users' list
I work in transmission electron microscopy and this is an excellent program for visualizing atomic coordinates to match to images and for image simulation known as multislice (see this book for example). For image simulation we typically use a modified XYZ format which incudes a unit cell size (a, b, c below). These files are not compatible with Vesta, and Im wondering how hard it would be to parse these files to simplify our workflow.

The format is:
comment line
a b c
Atomic_number0 X0 Y0 Z0 occupancy0 mean_square_displacement0
Atomic_number1 X1 Y1 Z1 occupancy1 mean_square_displacement1
...
Atomic_numberN XN YN ZN occupancyN mean_square_displacementN
-1

I do not see where the file formats are defined in the code or a way to add new file formats. Any suggestions would be useful.

Peter Ercius

unread,
Dec 9, 2020, 11:31:10 AM12/9/20
to VESTA users' list
As an update to this I found a python package which would be very useful for converting CIF and conventional XYZ files to the format used by TEM and STEM image simulation (called multislice) packages. It is called the Atomic Simulation Environment (ASE). You can use the 'prismatic' file type to read and write these files using ASE. 

It would still be extremely useful to be read these 'prismatic' files in Vesta. But the ASE is very useful for converting these files into something Vesta can already read, or convert to the format from a file output from Vesta.

El-abed Haidar

unread,
Dec 9, 2020, 8:55:24 PM12/9/20
to vesta-...@googlegroups.com

Thank you very much Peter,

That is very useful and pushes me to learn a bit more about python.

Cheers

EL-abed

 

El-abed Haidar Doctor of Philosophy (Science)
 Condensed Matter Theory (CMT) Group| School of Physics
 THE UNIVERSITY OF SYDNEY  | NSW | 2006

--

---
You received this message because you are subscribed to the Google Groups "VESTA users' list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vesta-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vesta-discuss/811f3536-12e8-41d2-9508-b80da5670fcan%40googlegroups.com.

 

KK M

unread,
Dec 9, 2020, 10:34:57 PM12/9/20
to vesta-...@googlegroups.com
how to use the ASE? any tutorial examples?

--

Peter Ercius

unread,
Dec 10, 2020, 12:34:43 PM12/10/20
to VESTA users' list
There is information in their tutorials.

Specifically, for the application Im talking about here is a quick start:

Convert CIF to prismatic (also computem) formatted file:
>> import ase.io
>> atoms = ase.io.read('Silicon.cif')
>> RMS_Si = 0.076 # mean square displacement of silicon
>> db = db = RMS_Si**2 * 8 * np.pi**2 # convert mean square displacement to Debye-Waller Factor in A^2
>> ase.io.prismatic.write_prismatic('Silicon_prismatic.xyz', atoms, debye_waller_factors=db)

You can also use ASE to convert a prismatic/computem file to a XYZ file to load into Vesta
>> import ase.io
>> atoms = ase.io.read('Silicon_prismatic.xyz', format='prismatic')
>> ase.io.write('Silicon_xyz.xyz', atoms)

I hope that is useful for others! It will really help me out when creating unit- and super-cells for simulations.

Peter Ercius

unread,
Dec 10, 2020, 1:16:58 PM12/10/20
to VESTA users' list
I made a mistake in my earlier post. I use the ase.io.write_prismatic() function because Im unable to get the general ase.io.write() function to work with the format='prismatic keyword. However, the simple import ase.io does not automatically import write_prismatic. Please use this code instead:
Convert CIF to prismatic (also computem) formatted file:
>> import ase.io
>> import ase.io.prismatic
>> atoms = ase.io.read('Silicon.cif')
>> RMS_Si = 0.076 # mean square displacement of silicon
>> db = db = RMS_Si**2 * 8 * 3.14159**2 # convert mean square displacement to Debye-Waller Factor in A^2
>> ase.io.prismatic.write_prismatic('Silicon_prismatic.xyz', atoms, debye_waller_factors=db)
Reply all
Reply to author
Forward
0 new messages