pytraj.topology.topology.
Topology
¶Bases: object
Attributes
angle_indices |
|
angles |
|
atoms |
|
bond_indices |
|
bonds |
|
box |
|
charge |
return a copy of atom charges (numpy 1D array) |
dihedral_indices |
|
dihedrals |
|
filename |
return original filename. This is for testing purpose. |
mass |
return a copy of atom masses (numpy 1D array) |
mols |
|
n_atoms |
|
n_mols |
|
n_residues |
|
n_solvents |
|
residues |
Methods
__call__ |
intended to use with Frame indexing: atm = top('@CA‘) (for internal use) |
add_angles |
add angle for a group of 3 atoms. |
add_atom (self, Atom atom, Residue residue) |
|
add_bonds |
add bond for pairs of atoms. |
add_dihedrals |
add dihedral for a group of 4 atoms. |
atom (self, int idx) |
return an Atom based on idx. Update this Atom will update Topology. |
atom_indices (self, mask, \*args, \*\*kwd) |
return atom indices with given mask |
copy (self, \*args) |
Return a copy of ‘self’ or copy from ‘other’ to ‘self’ |
from_dict (type cls, dict_data) |
internal use for serialize Topology |
has_box (self) |
|
is_empty (self) |
|
join (self, Topology top) |
|
residue (self, int idx, bool atom=False) |
if atom is True, get full list of atoms for idx-th residue. This will be very slow |
save (self[, filename, format]) |
save to given file format (parm7, psf, ...) |
select (self, mask) |
return atom indices |
set_nobox (self) |
|
set_reference (self, Frame frame) |
Set reference frame for distance-based mask |
set_solvent (self, mask) |
set mask as solvent |
simplify (self) |
return a (immutable) lightweight version of Topology for fast iterating. |
start_new_mol (self) |
|
strip (self, mask[, copy]) |
strip atoms with given mask |
summary (...) |
basic info. This information only appears in Ipython or Python shell. |
to_dict (self) |
convert Topology to Python dict |
to_parmed (self) |
try to load to ParmEd’s Structure |
add_angles
¶add angle for a group of 3 atoms.
Parameters: | indices : 2D array_like (must have buffer interface),
|
---|
add_atom
(self, Atom atom, Residue residue)¶add_bonds
¶add bond for pairs of atoms.
Parameters: | bond_indices : 2D array_like (must have buffer interface)
|
---|
add_dihedrals
¶add dihedral for a group of 4 atoms.
Parameters: | indices : 2D array_like (must have buffer interface),
|
---|
angle_indices
¶angles
¶atom
(self, int idx)¶return an Atom based on idx. Update this Atom will update Topology. Make this method private for now.
atom_indices
(self, mask, *args, **kwd)¶return atom indices with given mask To be the same as cpptraj/Ambertools: we mask indexing starts from 1 but the return list/array use 0
Parameters: | mask : str
Returns —— indices : Python array |
---|
atoms
¶bond_indices
¶bonds
¶box
¶charge
¶return a copy of atom charges (numpy 1D array)
copy
(self, *args)¶Return a copy of ‘self’ or copy from ‘other’ to ‘self’ TODO : add more doc
dihedral_indices
¶dihedrals
¶filename
¶return original filename. This is for testing purpose.
from_dict
(type cls, dict_data)¶internal use for serialize Topology
has_box
(self)¶is_empty
(self)¶join
(self, Topology top)¶mass
¶return a copy of atom masses (numpy 1D array)
mols
¶n_atoms
¶n_mols
¶n_residues
¶n_solvents
¶residue
(self, int idx, bool atom=False)¶if atom is True, get full list of atoms for idx-th residue. This will be very slow if atom is False, get ()
residues
¶save
(self, filename=None, format='AMBERPARM') save to given file format (parm7, psf, ...)¶save to given file format (parm7, psf, ...)
select
(self, mask)¶return atom indices
Notes
support openmp for distance-based atommask selction
Examples
>>> import pytraj as pt
>>> traj = pt.datafiles.load_tz2()
>>> atm = traj.top.select("@CA")
>>> atm
array([ 4, 15, 39, ..., 159, 173, 197])
>>> pt.rmsd(traj, mask=atm)
array([ 1.94667955e-07, 2.54596866e+00, 4.22333034e+00, ...,
4.97189564e+00, 5.53947712e+00, 4.83201237e+00])
set_nobox
(self)¶set_reference
(self, Frame frame)¶Set reference frame for distance-based mask
Parameters: | frame : Frame
|
---|
set_solvent
(self, mask)¶set mask
as solvent
simplify
(self)¶return a (immutable) lightweight version of Topology for fast iterating. The API is not stable.
No writing capabibility (you should use ParmEd for Topology editing)
Examples
>>> import pytraj as pt
>>> top = pt.load_topology('data/tz2.parm7')
>>> simp_top = top.simplify()
>>> atom = simp_top.atoms[0]
>>> atom.resname
'SER'
>>> res = simp_top.residues[0]
>>> # get all atoms for 1st residue
>>> atoms = simp_top.atoms[res.first:res.last]
start_new_mol
(self)¶strip
(self, mask, copy=False)¶strip atoms with given mask
summary
(self) basic info. This information only appears in Ipython or Python shell. It does not appear in Jupyter notebook (due to C++ stdout)¶basic info. This information only appears in Ipython or Python shell. It does not appear in Jupyter notebook (due to C++ stdout)
to_dict
(self)¶convert Topology to Python dict
to_parmed
(self)¶try to load to ParmEd’s Structure
pytraj.topology.topology.
ParmFile
¶Bases: object
Methods
filename (self) |
|
read (self[, filename, top, option]) |
top : Topology instance |
write (self, Topology top=<???>[, filename, ...]) |
filename
(self)¶read
(self, filename='', top=<???>, option='') read(Topology top=Topology(), string filename="", "*args) Return : None (update `top`)¶top : Topology instance filename : str, output filename arglist : ArgList instance, optional
write
(self, Topology top=<???>, filename='default.top', ArgList arglist=<???>, format='')¶pytraj.topology.topology.
SimplifiedTopology
¶Bases: object
a lightweight Topology for fast iterating and convenient accessing atom, residue
Notes
cpptraj does not understand this class (use :class:Topology)
pytraj.topology.topology.
SimplifiedAtom
(name, type, element, charge, mass, index, atomic_number, resname, resid, molnum)¶Bases: importlib._bootstrap.SimplifiedAtom
Attributes
atomic_number |
Alias for field number 6 |
charge |
Alias for field number 3 |
element |
Alias for field number 2 |
index |
Alias for field number 5 |
mass |
Alias for field number 4 |
molnum |
Alias for field number 9 |
name |
Alias for field number 0 |
resid |
Alias for field number 8 |
resname |
Alias for field number 7 |
type |
Alias for field number 1 |
Methods
count (...) |
atomic_number
¶Alias for field number 6
charge
¶Alias for field number 3
count
(value) → integer -- return number of occurrences of value¶element
¶Alias for field number 2
index
¶Alias for field number 5
mass
¶Alias for field number 4
molnum
¶Alias for field number 9
name
¶Alias for field number 0
resid
¶Alias for field number 8
resname
¶Alias for field number 7
type
¶Alias for field number 1