System class

class System
__init__()

Default constructor

__init__(sel_str)

Constructor taking selection string as argument.

Parameters:sel_str (str) – Selection string
__init__(other_system)

Constructor taking another system.

Parameters:other_system (System) – Other system to construct from.

Note

Selections associated with the system are not copied!

num_atoms()
Returns:number of atoms in the system
Return type:int
num_frames()
Returns:number of frames in the system
Return type:int
select_all()
Returns:selection object for all atoms in the system
Return type:Selection
select(str)
Parameters:str (string) – selection string
Returns:selection object for given selection string
Return type:Selection
select(ind1, ind2)
Parameters:
  • ind1 (int) – first index
  • ind2 (int) – last index (inclusive)
Returns:

selection object for given range of indexes

Return type:

Selection

select(l)
Parameters:l (sequence) – python list or tuple with selection indexes
Returns:selection object for given indexes
Return type:Selection
load(fname[, b=0[, e=-1[, skip=-1[, on_frame=None]]]])

Load any supported file format from disk (structure or trajectory)

Parameters:
  • fname (string) – file to read
  • b (int) – first frame to read
  • e (int) – last frame to read
  • skip (int) – read each n’s frame
  • on_frame (callable, f(System,int)) – callable object to be called on each frame and passed current system as the first argument and the index of current frame as the second.

Usage:

# Define the callback
def callback(sys,fr):
        print sys.num_atoms(),fr

# Load structure file
sys = System('struct.pdb')
# Load trajectory with callback
sys.load('traj.xtc',on_frame=callback)
frame_dup(fr)

Duplicates given frame and adds it to the end of frame vector

frame_copy(fr1, fr2)

Copy all frame data from fr1 to fr2

frame_delete([b=0[, e=-1]])

Delete specified range of frames. If only b is supplied deletes all frames from b to the end. If only e is supplied deletes all frames from 0 to e.

Parameters:
  • b (int) – first frame to delete
  • e (int) – last frame to delete (inclusive)
getFrame_data(fr)
Returns:whole Frame structure from frame fr.
Return type:Frame object
setFrame_data(fr, data)
Parameters:data (Frame) – Frame object to set as frame fr
getBox(fr)
Returns:Periodic box from frame fr.
Return type:Periodic_box object
setBox(fr, data)
Parameters:data (Periodic_box) – box to set for frame fr
getTime(fr)
Returns:time stamp (in ps) from frame fr.
Return type:float
setTime(fr, t)
Parameters:t (float) – time stamp (in ps) to set for frame fr
getXYZ(ind, fr)
Returns:XYZ coordinates of atom ind from frame fr.
Return type:numpy.array(3)
setXYZ(ind, fr, coord)
Parameters:
  • ind (int) – index of the atom
  • fr (int) – frame to set
  • coord (array-like object of dimension 3 (list, tuple, numpy.array)) – XYZ coordinates
frame_append(frame)
Parameters:frame (Frame) – Frame object to add
assign_resindex()

Assign unique resindexes. This is usually done automatically upon loading a structure from file.

atoms_dup(indexes)
Parameters:indexes (sequence) – list of tuple of atom indexes to duplicate

Warning

This method is slow due to internal convertion between Python and C++ lists!

atoms_dup(atoms, coords)
Parameters:
  • atoms (sequence) – list of tuple of atoms to add
  • coords (sequence) – list of tuple of atom coordinates to add

Warning

This method is slow due to internal convertion between Python and C++ lists!

wrap_all(fr[, dims=(1, 1, 1)])
Parameters:dims (array_like(3)) – dimensions to wrap
append(selection)
append(system)
Returns:selection pointing to added atoms
Return type:Selection
dssp(filename)

Determines secondary structure with DSSP algorithm and writes detailed report to file

dssp()

Determines secondary structure with DSSP algorithm and returns it as a code string. The code is the same as in DSSP program:

structure code
alphahelix “H”
betabridge “B”
strand “E”
helix_3 “G”
helix_5 “I”
turn “T”
bend “S”
loop “” (space)
Returns:DSSP code string
sort_by_resindex()

Sorts atoms by resindex arranging atoms with the same resindexes into contigous pieces. Could be called after atom additions or duplications.

Previous topic

Python bindings for Pteros

Next topic

Selection class

This Page