Subsections


structure.read_xyz

Image structure Image document-open

Synopsis

Reading structures from XYZ files.

Defaults

structure.read_xyz(file=None, dir=None, read_mol=None, set_mol_name=None, read_model=None, set_model_num=None, verbosity=1)

Keyword arguments

file: The name of the XYZ file.

dir: The directory where the file is located.

read_mol: If set, only the given molecule(s) will be read. The molecules are numbered consecutively from 1. If unset, then all molecules will be loaded. By providing a list of numbers such as [1, 2], multiple molecules will be read.

set_mol_name: Set the names of the read molecules. If unset, then the molecules will be automatically labelled based on the file name or other information. This can either be a single name or a list of names.

read_model: If set, only the given model number(s) from the PDB file will be read. Otherwise all models will be read. This can be a single number or list of numbers.

set_model_num: Set the model numbers of the loaded molecules. If unset, then the PDB model numbers will be preserved if they exist. This can be a single number or list of numbers.

verbosity: The amount of information to print out. Set to zero to silence the user function, or one to see all messages.

Description

The XYZ files with different models, which defined as an ensemble of the same molecule but with different atomic positions, can be read into relax. If there are several molecules in one xyz file, please separate them into different files and then load them individually. Loading different models and different molecules is controlled by specifying the molecule number read, setting the molecule names, specifying which model to read, and setting the model numbers.

The setting of molecule names is used to name the molecules within the XYZ (within one model). If not set, then the molecules will be named after the file name, with the molecule number appended if more than one exists.

Note that relax will complain if it cannot work out what to do.

Prompt examples

To load all structures from the XYZ file `test.xyz' in the directory `˜/xyz', including all models and all molecules, type one of:

[numbers=none]
relax> structure.read_xyz('test.xyz', '~/xyz')

[numbers=none]
relax> structure.read_xyz(file='test.xyz', dir='xyz')

To load the 10 th model from the file `test.xyz' and naming it `CaM', use one of:

[numbers=none]
relax> structure.read_xyz('test.xyz', read_model=10, set_mol_name='CaM')

[numbers=none]
relax> structure.read_xyz(file='test.xyz', read_model=10, set_mol_name='CaM')

To load models 1 and 5 from the file `test.xyz' as two different structures of the same model, type one of:

[numbers=none]
relax> structure.read_xyz('test.xyz', read_model=[1, 5], set_model_num=[1, 1])

[numbers=none]
relax> structure.read_xyz('test.xyz', set_mol_name=['CaM_1', 'CaM_2'], read_model=[1, 5], set_model_num=[1, 1])

To load the files `test_1.xyz', `test_2.xyz', `test_3.xyz' and `test_4.xyz' as models, type the following sequence of commands:

[numbers=none]
relax> structure.read_xyz('test_1.xyz', set_mol_name='test_1', set_model_num=1)

[numbers=none]
relax> structure.read_xyz('test_2.xyz', set_mol_name='test_2', set_model_num=2)

[numbers=none]
relax> structure.read_xyz('test_3.xyz', set_mol_name='test_3', set_model_num=3)

[numbers=none]
relax> structure.read_xyz('test_4.xyz', set_mol_name='test_4', set_model_num=4)


The relax user manual (PDF), created 2016-10-28.