NetSci
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Atoms Class Reference

Public Member Functions

 Atoms ()
 Default constructor for Atoms.
 
void addAtom (Atom *atom)
 Add an Atom to the Atoms collection.
 
int numAtoms () const
 Get the number of Atoms in the collection.
 
Atomat (int atomIndex)
 Get the Atom with the specified index.
 
int numUniqueTags () const
 Get the number of unique Atom tags.
 
std::vector< Atom * > & atoms ()
 Get a reference to the vector of Atoms.
 

Private Attributes

std::vector< Atom * > atoms_
 
std::set< std::string > uniqueTags_
 

Constructor & Destructor Documentation

◆ Atoms()

Atoms::Atoms ( )

Default constructor for Atoms.

Constructs an empty Atoms object.

Member Function Documentation

◆ addAtom()

void Atoms::addAtom ( Atom atom)

Add an Atom to the Atoms collection.

Adds the specified Atom to the collection of Atoms.

Parameters
atomPointer to the Atom to add.

◆ at()

Atom * Atoms::at ( int  atomIndex)

Get the Atom with the specified index.

Returns a pointer to the Atom with the specified index.

Parameters
atomIndexThe index of the Atom.
Returns
A pointer to the Atom with the specified index.

Python Example

from netchem import Network, data_files
"""
1000 frame Molecular Dynamics trajectory of a pyrophosphatase system.
The dcd is a binary coordinate file, and the pdb is a single frame
topology file.
"""
dcd, pdb = data_files('pyro')
"""
Construct a network using the entire trajectory.
If you want to use only a subset of the trajectory, you can specify
the first frame, last frame, and stride.
"""
network = Network()
network.init(
trajectoryFile=str(dcd), # Convert the dcd Path object to a string
topologyFile=str(pdb), # Convert the pdb Path object to a string
firstFrame=0,
lastFrame=999,
stride=1
)
"""
Get the Network's Atoms class object using the Network atoms method.
"""
atoms = network.atoms()
"""
The Atoms class is a container like class for Atom objects.
The reason for using a custom container class to store Atom objects
instead of using an Atom vector is to have more control over memory
management.
"""
"""
The Atoms at method can be used to get the Atom object with an
atom index equal to the provided index.
"""
atom = atoms.at(0)
print(atom)
Definition network.h:12

◆ atoms()

std::vector< Atom * > & Atoms::atoms ( )

Get a reference to the vector of Atoms.

Returns a reference to the vector of Atoms.

Returns
A reference to the vector of Atoms.

Python Example

from netchem import Network, data_files
"""
1000 frame Molecular Dynamics trajectory of a pyrophosphatase system.
The dcd is a binary coordinate file, and the pdb is a single frame
topology file.
"""
dcd, pdb = data_files('pyro')
"""
Construct a network using the entire trajectory.
If you want to use only a subset of the trajectory, you can specify
the first frame, last frame, and stride.
"""
network = Network()
network.init(
trajectoryFile=str(dcd), # Convert the dcd Path object to a string
topologyFile=str(pdb), # Convert the pdb Path object to a string
firstFrame=0,
lastFrame=999,
stride=1
)
"""
Get the Network's Atoms class object using the Network atoms method.
The Atoms class is a container like class for Atom objects.
The reason for using a custom container class to store Atom objects
instead of using an Atom vector is to have more control over memory
management.
"""
atoms = network.atoms()
"""
Use the Atoms atoms method to return a vector of Atom objects.
"""
atom_vector = atoms.atoms()
for atom in atom_vector:
print(atom)
print("-"*80)

◆ numAtoms()

int Atoms::numAtoms ( ) const

Get the number of Atoms in the collection.

Returns the number of Atoms in the collection.

Returns
The number of Atoms.

Python Example

from netchem import Network, data_files
"""
1000 frame Molecular Dynamics trajectory of a pyrophosphatase system.
The dcd is a binary coordinate file, and the pdb is a single frame
topology file.
"""
dcd, pdb = data_files('pyro')
"""
Construct a network using the entire trajectory.
If you want to use only a subset of the trajectory, you can specify
the first frame, last frame, and stride.
"""
network = Network()
network.init(
trajectoryFile=str(dcd), # Convert the dcd Path object to a string
topologyFile=str(pdb), # Convert the pdb Path object to a string
firstFrame=0,
lastFrame=999,
stride=1
)
"""
Get the Network's Atoms class object using the Network atoms method.
The Atoms class is a container like class for Atom objects.
The reason for using a custom container class to store Atom objects
instead of using an Atom vector is to have more control over memory
management.
"""
atoms = network.atoms()
"""
Use the Atoms numAtoms method to get the number of atoms in the Atoms
object.
"""
num_atoms = atoms.numAtoms()
print(num_atoms)

◆ numUniqueTags()

int Atoms::numUniqueTags ( ) const

Get the number of unique Atom tags.

Returns the number of unique Atom tags. Atoms with the same tag belong to the same Node.

Returns
The number of unique Atom tags.

The documentation for this class was generated from the following file: