PDielec.p2cif
#
Read the contents of a directory containing DFT output and create a cif file of the structure
This script accepts command-line arguments to define the program used for generating output files, enables debug mode, and processes specified files. If no arguments are provided, it prints usage information. It sorts input files, processes them using a pool of workers equal to the number of logical processors available, and writes the results to standard output.
- Command-line arguments:
-debug: Enable debug mode for more verbose output.
-program <program>: Specify the program used to generate the output files. The program must be one of: ‘abinit’, ‘castep’, ‘crystal’, ‘gulp’, ‘phonopy’, ‘qe’, ‘vasp’, ‘experiment’, ‘auto’. For ‘phonopy’, a quantum mechanics program must be specified immediately after.
Files to process: Specify one or more filenames after the arguments.
This function uses multiprocessing to parallelize file processing, with the number of processes equal to the physical cores available on the machine.
Examples#
Command-line usage examples:
- Process files in automatic mode:
` python script_name.py file1 file2 ... `
- Specify a program and enable debug mode:
` python script_name.py -debug -program gulp file1 file2 ... `
Module Contents#
Functions#
|
Main entry point for processing and converting files. |
|
Read data from a file and process it using specified reader utilities. |
When a new worker process is created, the affinity is set to all CPUs. |
- PDielec.p2cif.main()[source]#
Main entry point for processing and converting files.
This script accepts command-line arguments to define the program used for generating output files, enables debug mode, and processes specified files. If no arguments are provided, it prints usage information. It sorts input files, processes them using a pool of workers equal to the number of logical processors available, and writes the results to standard output.
Notes#
Command-line arguments: - -debug: Enable debug mode for more verbose output. - -program <program>: Specify the program used to generate the output files. The program must be one of: ‘abinit’, ‘castep’, ‘crystal’, ‘gulp’, ‘phonopy’, ‘qe’, ‘vasp’, ‘experiment’, ‘auto’. For ‘phonopy’, a quantum mechanics program must be specified immediately after. - Files to process: Specify one or more filenames after the arguments.
This function uses multiprocessing to parallelize file processing, with the number of processes equal to the physical cores available on the machine.
Examples#
Command-line usage examples:
- Process files in automatic mode:
` python script_name.py file1 file2 ... `
- Specify a program and enable debug mode:
` python script_name.py -debug -program gulp file1 file2 ... `
- PDielec.p2cif.read_a_file(calling_parameters)[source]#
Read data from a file and process it using specified reader utilities.
Parameters#
- calling_parameterstuple
A tuple containing the parameters for the file reading operation. Expected to contain - name (str): The name of the file to be read. - program (str): The type of program or file format to use for reading. - qmprogram (str): Specific quantum mechanics program details, if applicable. - debug (bool): A flag indicating whether debugging is enabled.
Returns#
- tuple
A tuple containing: - name (str): The name of the file read. - unit_cell: The last unit cell read from the file.
Notes#
This function requires that a Utilities class with a get_reader method is available in the scope where this function is used. The get_reader method should return an object with a read_output method and a unit_cells attribute that is a list.