diffpy.structure.apps package
Script applications that use the diffpy.structure package.
Submodules
diffpy.structure.apps.transtru module
Translate structure file to different format.
Usage: transtru INFMT..OUTFMT strufile
Translates structure file strufile from INFMT to OUTFMT format and prints it to the screen. Use “-” as strufile to read from standard input. To save the translated file, use
transtru INFMT..OUTFMT strufile > strufile.out
- Supported input and output structure formats are
INFMT:
inputFormatsOUTFMT:
outputFormats
- Options:
- -h, --help
Display this message.
- -V, --version
Show script version.
diffpy.structure.apps.anyeye module
Anyeye view structure file in atomeye.
Usage: anyeye [options] strufile
Anyeye understands more Structure formats than atomeye. It converts strufile
to a temporary XCFG file which is opened in atomeye. See supported file formats:
inputFormats
- Options:
- -f, --formula
Override chemical formula in strufile. The formula defines elements in the same order as in strufile, e.g.,
Na4Cl4.- -w, --watch
Watch input file for changes.
- --viewer=VIEWER
The structure viewer program, by default “atomeye”. The program will be executed as “VIEWER structurefile”.
- --formats=FORMATS
Comma-separated list of file formats that are understood by the VIEWER, by default
"xcfg,pdb". Files of other formats will be converted to the first listed format.- -h, --help
Display this message and exit.
- -V, --version
Show script version and exit.
- diffpy.structure.apps.anyeye.cleanUp(pd)
- diffpy.structure.apps.anyeye.convertStructureFile(pd)
- diffpy.structure.apps.anyeye.loadStructureFile(filename, format='auto')
Load structure from specified file.
- Parameters:
filename (str) – Path to the structure file.
format (str, Optional) – File format, by default “auto”.
- Returns:
A tuple of (Structure, fileformat).
- Return type:
tuple
- diffpy.structure.apps.anyeye.load_structure_file(filename, format='auto')[source]
Load structure from specified file.
- Parameters:
filename (str) – Path to the structure file.
format (str, Optional) – File format, by default “auto”.
- Returns:
A tuple of (Structure, fileformat).
- Return type:
tuple
- diffpy.structure.apps.anyeye.parseFormula(formula)
Parse chemical formula and return a list of elements.
- diffpy.structure.apps.anyeye.parse_formula(formula)[source]
Parse chemical formula and return a list of elements.
- diffpy.structure.apps.anyeye.signalHandler(signum, stackframe)
- diffpy.structure.apps.anyeye.usage(style=None)[source]
Show usage info, for
style=="brief"show only first 2 lines.
- diffpy.structure.apps.anyeye.watchStructureFile(pd)
diffpy.structure.apps.vesta_viewer module
View structure file in VESTA.
Usage: vestaview [options] strufile
Vestaview understands more Structure formats than VESTA. It converts
strufile to a temporary VESTA or CIF file which is opened in VESTA.
See supported file formats: inputFormats
- Options:
- -f, --formula
Override chemical formula in strufile. The formula defines elements in the same order as in strufile, e.g.,
Na4Cl4.- -w, --watch
Watch input file for changes.
- --viewer=VIEWER
The structure viewer program, by default “vesta”. The program will be executed as “VIEWER structurefile”.
- --formats=FORMATS
Comma-separated list of file formats that are understood by the VIEWER, by default
"vesta,cif". Files of other formats will be converted to the first listed format.- -h, --help
Display this message and exit.
- -V, --version
Show script version and exit.
Notes
VESTA is the actively maintained successor to AtomEye. Unlike AtomEye,
VESTA natively reads CIF, its own .vesta format, and several other
crystallographic file types, so format conversion is only required for
formats not in that set.
AtomEye XCFG format is no longer a default target format but the XCFG
parser (P_xcfg) remains available in diffpy.structure.parsers
for backward compatibility.
- diffpy.structure.apps.vesta_viewer.clean_up(pd)[source]
Remove temporary file and directory created during conversion.
- Parameters:
pd (dict) – The parameter dictionary that may contain
"tmpfile"and"tmpdir"entries to be removed.
- diffpy.structure.apps.vesta_viewer.convert_structure_file(pd)[source]
Convert
strufileto a temporary file understood by the viewer.On the first call, a temporary directory is created and stored in
pd. Subsequent calls in watch mode reuse the directory.The VESTA viewer natively reads
.vestaand.ciffiles, so if the source is already in one of the formats listed inpd["formats"]and no formula override is requested, the file is copied unchanged. Otherwise the structure is loaded and re-written in the first format listed inpd["formats"].- Parameters:
pd (dict) – The parameter dictionary containing at minimum
"strufile"and"formats"keys. It is modified in place to add"tmpdir"and"tmpfile"on the first call.
- diffpy.structure.apps.vesta_viewer.die(exit_status=0, pd=None)[source]
Clean up temporary files and exit with
exit_status.- Parameters:
exit_status (int, optional) – The exit code passed to
sys.exit(), by default 0.pd (dict, optional) – The parameter dictionary forwarded to
clean_up().
- diffpy.structure.apps.vesta_viewer.load_structure_file(filename, format='auto')[source]
Load structure from the specified file.
- Parameters:
filename (str or Path) – The path to the structure file.
format (str, optional) – The file format, by default
"auto".
- Returns:
The loaded
(Structure, fileformat)pair.- Return type:
tuple
- diffpy.structure.apps.vesta_viewer.parse_formula(formula)[source]
Parse chemical formula and return a list of elements.
- Parameters:
formula (str) – The chemical formula string such as
"Na4Cl4"or"H2O".- Returns:
The ordered list of element symbols with repetition matching the formula.
- Return type:
list of str
- Raises:
RuntimeError – Raised when
formuladoes not start with an uppercase letter or contains a non-integer count.
- diffpy.structure.apps.vesta_viewer.signal_handler(signum, stackframe)[source]
Handle OS signals by reverting to the default handler and exiting.
On
SIGCHLDthe child exit status is harvested viaos.wait(); on all other signalsdie()is called with exit status 1.- Parameters:
signum (int) – The signal number.
stackframe (frame) – The current stack frame. Unused.
- diffpy.structure.apps.vesta_viewer.usage(style=None)[source]
Show usage info. for
style=="brief"show only first 2 lines.- Parameters:
style (str, optional) – The usage display style.
- diffpy.structure.apps.vesta_viewer.watch_structure_file(pd)[source]
Watch
strufilefor modifications and reconvert when changed.Polls the modification timestamps of
pd["strufile"]andpd["tmpfile"]once per second. When the source is newer, the file is reconverted viaconvert_structure_file().- Parameters:
pd (dict) – The parameter dictionary as used by
convert_structure_file().