# VASP Output Management Program Documentation

This document provides an overview of the `vasp_output.py` program, which is designed to manage VASP output files by converting them into CIF format. The program can handle both POSCAR and OUTCAR files, converting them into CIF files for further analysis or visualization.

## 1. プログラムの動作

The `vasp_output.py` program is designed to convert VASP output files (POSCAR and OUTCAR) into CIF (Crystallographic Information File) format. It supports two modes of operation:

- **poscar2cif**: Converts a POSCAR file to a CIF file.
- **outcar2cif**: Converts an OUTCAR file to a series of CIF files, one for each relaxed structure found in the OUTCAR.

The program reads the input files, extracts relevant crystallographic information, and writes this information into CIF files. It also prints detailed information about the crystal structures and energies to the console.

## 2. 必要な非標準ライブラリとインストールコマンドとインストール方法

The program requires the following non-standard Python libraries:

- `numpy`: Used for numerical operations.
- `scipy`: Specifically, the `scipy.interpolate` module is used.
- `matplotlib`: Used for plotting (though not directly used in the provided code).
- `tklib`: A custom library used for file handling and crystal structure manipulation.

### インストールコマンド

You can install the required libraries using pip:

```bash
pip install numpy scipy matplotlib
```

The `tklib` library appears to be a custom or third-party library not available on PyPI. You will need to obtain it from the source where it is provided, and follow the installation instructions specific to that source.

## 3. 必要な入力ファイル

The program requires the following input files depending on the mode:

- **poscar2cif**: A POSCAR file containing the initial crystal structure.
- **outcar2cif**: An OUTCAR file containing the results of a VASP calculation, including relaxed structures and energies.

## 4. 実行後に生成される出力ファイル

The program generates CIF files as output:

- In **poscar2cif** mode, a single CIF file is generated from the POSCAR file.
- In **outcar2cif** mode, multiple CIF files are generated, one for each relaxed structure found in the OUTCAR file. The files are named `relax-0001.cif`, `relax-0002.cif`, etc.

## 5. コマンドラインでの使用例 (Usage)

The program can be executed from the command line with the following syntax:

```bash
# Convert a POSCAR file to a CIF file
python vasp_output.py poscar2cif <poscar_path> <cif_path>

# Example
python vasp_output.py poscar2cif POSCAR output.cif

# Convert an OUTCAR file to CIF files
python vasp_output.py outcar2cif <outcar_path> <cif_path>

# Example
python vasp_output.py outcar2cif OUTCAR output.cif
```

Replace `<poscar_path>`, `<outcar_path>`, and `<cif_path>` with the actual file paths you wish to use. The `<cif_path>` is optional and will be automatically generated if not provided.