Convert .xyz format to Gaussian Input file (.gjf)

I have a .xyz file, and I would like to change the format to .gjf (Gaussian Input File) by converting the name of format.

Do you know how to prevent my situation?

(Originally I talked about 'gif' and 'GIF'(Graphics Interchange...), since I thought the name of extension of gaussian input file is gif like GIF. I hope I make no more confusion for future readers. Gaussian input file has '.gjf' extension, not gif. And it will surely work if you convert the extension of .xyz by changing the name as well as format of data like real gaussian input files.(maybe starting with % section)

• Gaussian generally uses the .gjf (Gaussian Job File) extension for inputs, not .gif. It's also not clear what you intended to do here, as simply changing the xyz extension to gjf is not sufficient to make a runnable Gaussian input.
– Tyberius
Aug 14 at 2:34
• Could you please give an example .xyz and example .gif or .gjf that you want? I see that there's a bit of information in your answer, but it's not very clear. Aug 14 at 14:51
• I am so sorry for your confusion. I made a mistake I thought gif stands for gaussian input file. But it is actually 'gjf'. Thank you. I hope I make no more confusion for future readers. Aug 15 at 0:17

If you have a python installation, you can use ASE to do this in one line.

ase-gui structure.xyz -o structure.gjf


(I have always seen it as gjf not gif)

If you don't have python, you can download anaconda and pip install ase in the anaconda prompt. I can confirm the most recent version of ASE does correctly install in windows and even the GUI is functional.

There are two independent issues here: (1) How to convert XYZ to Gaussian input file and (2) How to make Windows to not associate it with Graphics Interchange Format.

(1) You can use OpenBabel to convert XYZ (or any other chemical format) to Gaussian input. In this case, the suggested extensions are gjf, gjc, gau, com. This extension will also recognized by GaussView.

(2) If you would like that when you double-click on the file, it opens with GaussView or Gaussian executable instead any image reading program, you need to change the Windows association to your file:

Many types of files can be opened by more than one program. For example, you can open a photo with the Photos program or with Paint, among others. Follow these steps to change the default program that Windows uses to open each type of file.

• In Windows 7, Windows 8, and Windows 10, choose Start and then type Control Panel.
• Choose Programs > Make a file type always open in a specific program. If you don't see Programs, choose Default Programs.
• Associate a file type or protocol with a program.
• In the Set Associations tool, select the file type you want to change the program for, then choose Change program.
• Once you've chosen the new program to use to open that file type, choose OK.

Other way to open your file with the program you want, is clicking with the right mouse button, and look for Open with another program (in this case, you will need to do it everytime).

The easiest way to convert .xyz to .gif(Gaussian input file) without being interfered by .GIF(Graphics Interchange) is to use Gaussian 09W (or your version of Gaussian software) and excel.

1. open your .xyz file with excel (It is encouraged to change .xyz format to .txt before open the file with excel)

2. refer all your cells by dragging them (perhaps on A1 column). Click 'Data' on the menu bar and select 'Text to columns'.

3. Click next until you can see split lines like the picture below. Then double click the black arrow so that split xyz data from unnecessary data, for example, integers at the end of xyz float points.

4. After split, leave only 'Atom X Y Z'. In my case 'C X Y Z'. And copy and paste them on Gaussian 09w 'Molecule Specification' section.

1. Save file as .gif or click the third button on the right side bar, which is depicted as putting a molecule in a folder.

2. Then you can see the molecular structure like below

• While this works, generally Gaussian uses .gjf not .gif as an extension as others have noted. The underlying program doesn't care because the file is just text .. and older versions of Gaussian used other extensions for both input and output files. Aug 14 at 13:11