mctc-convert - Convert between supported geometry file formats
The mctc-convert program reads molecular structure data from an input file and writes it to an output file, optionally converting between different geometry file formats. The format is automatically determined by the file extension, or can be explicitly specified using format hint options.
The program supports reading from standard input and writing to standard output by using - as the file argument.
When using standard input/output, a format hint option should be provided.
The following geometry formats are supported for both reading and writing:
| Format hint | Description | File extensions |
|---|---|---|
xyz |
Xmol/xyz coordinate files |
.xyz, .log |
tmol, coord |
Turbomole coord files (including periodic/riper) |
.tmol, .coord |
gen |
DFTB+ genFormat (cluster, supercell, fractional) |
.gen |
vasp, poscar, contcar |
VASP POSCAR/CONTCAR geometry files |
.vasp, .poscar, .contcar |
pdb |
Protein Data Bank files (single structures only) |
.pdb |
mol |
MDL Molfile connection table |
.mol |
sdf |
MDL Structure Data Format |
.sdf |
ein |
Gaussian external program input |
.ein |
qcjson, json |
QCSchema JSON ( |
.qcjson, .json |
cjson, json |
Chemical JSON (Avogadro) |
.cjson, .json |
pmgjson, json |
Pymatgen JSON ( |
.pmgjson, .json |
aims |
FHI-aims geometry input |
geometry.in |
qchem |
Q-Chem molecule block |
.qchem |
|
Note
|
JSON format support requires mctc-lib to be compiled with the jonquil dependency. |
- -i, --input format
-
Specify the format of the input file. Use this option when the input file has a non-standard extension or when reading from standard input. See Supported Formats for valid format hints.
- -o, --output format
-
Specify the format of the output file. Use this option when the output file should have a non-standard extension or when writing to standard output. See Supported Formats for valid format hints.
- --normalize
-
Normalize all element symbols to standard capitalized format (e.g., "CL" becomes "Cl", "h" becomes "H"). Useful when working with files that have non-standard element symbol casing.
- --template file
-
Use the specified file as a template to transfer metadata to the output. This option transfers lattice parameters, periodicity information, comments, and format-specific annotations (such as PDB residue information or SDF bond data) from the template to the input structure. The input and template structures must have the same number of atoms.
If
-is provided as the template file, the template structure is read from standard input before the input structure. - --template-format format
-
Specify the format of the template file. Only used when a template file is provided via --template.
- --ignore-dot-files
-
Do not read molecular charge from
.CHRGfiles or spin state from.UHFfiles in the input file’s directory. By default, these files are read if present. - --version
-
Print the program version and exit.
- --help
-
Display a brief help message and exit.
- Convert an xyz file to Turbomole coord format
-
mctc-convert molecule.xyz molecule.coord
- Convert a VASP POSCAR to xyz format
-
mctc-convert POSCAR structure.xyz
- Read from standard input and write to standard output
-
cat molecule.xyz | mctc-convert -i xyz -o mol - -
- Convert format while preserving SDF bond information
-
mctc-convert optimized.xyz final.sdf --template original.sdf
- Normalize element symbols during conversion
-
mctc-convert --normalize input.xyz output.xyz
- Force input format for non-standard extension
-
mctc-convert -i xyz geometry.dat output.mol
- .CHRG
-
If a file named
.CHRGexists in the same directory as the input file, the molecular charge is read from it (unless --ignore-dot-files is specified). - .UHF
-
If a file named
.UHFexists in the same directory as the input file, the number of unpaired electrons is read from it (unless --ignore-dot-files is specified).
- 0
-
Success.
- non-zero
-
An error occurred during file reading, writing, or conversion. Error messages are written to standard error with source location information when available.
The mctc-lib API documentation: https://grimme-lab.github.io/mctc-lib
mctc-lib is developed by the Grimme group at the University of Bonn. See https://github.com/grimme-lab/mctc-lib/graphs/contributors for a list of all contributors.
Report bugs and unclear error messages at: https://github.com/grimme-lab/mctc-lib/issues