Example #1
0
    def __init__(self,atom_id,atom_name,atomic_number,isotope=None, \
                 coords=[0.0,0.0,0.0],force=[0.0,0.0,0.0],velocity=[0.0,0.0,0.0]):
        """Initializes an atom.

        atom_id: ID of the atom, should be unique.

        atom_name: Name of the atom.

        atomic_number: Atomic number.

        isotope: Isotope selection. Default is the most abundant isotope.

        coords: Coordinates of the atom, in a list.

        force: The force acting on the atom, in a list. Default is [0.0,0.0,0.0].

        velocity: The velocity of the atom, in a list. Default is [0.0,0.0,0.0].
        """
        from BioNanoLEGO.Element import get_atomic_mass
        self.atom_id = int(atom_id)
        self.atom_name = atom_name
        self.atomic_number = int(atomic_number)
        self.atomic_mass = get_atomic_mass(atomic_number,isotope)
        self.num_electrons = int(atomic_number)
        # Effective charge
        self.eff_charge = float(self.num_electrons)
        self.coords = array(coords,'d')
        self.force = array(force,'d')
        self.velocity = array(velocity,'d')
        return
Example #2
0
 def rotate(self,R):
     """Performs rotation operation by the rotation matrix R."""
     from BioNanoLEGO.DenseMatrix import dot
     # FIXME: this assignment is ugly in my opinion
     new_coords = dot(R,self.coords)
     self.coords = array([new_coords[0,0],new_coords[0,1],new_coords[0,2]])
     return
Example #3
0
 def setForce(self,force):
     """Sets/updates the force acting on the atom."""
     self.force = array(force,'d')
     return
Example #4
0
 def setVelocity(self,velocity):
     """Sets/updates the velocity of the atom."""
     self.velocity = array(velocity,'d')
     return
Example #5
0
 def setCoords(self,coords):
     """Sets/updates the coordinates."""
     self.coords = array(coords,'d')
     return