# Path: pdbtools/helper/geometry.py
# def dist(c1,c2=[0.,0.,0.]):
#     """
#     Calculate the distance between two coordinates in 3d space.  If no c2 is
#     specified it returns the length of the vector.
#     """
# 
#     return sqrt(sum([(c1[i] - c2[i])**2 for i in range(3)]))


from .geometry import dist
from math import sqrt
    import sys
        for line in self.atom_lines:
            if line[21:26] not in residue_list:
                residue_list.append(line[21:26])

        ca_list = []
        n_list = []
        for resid in residue_list:
            resid_atoms = [l for l in self.atom_lines if l[21:26] == resid]

            ca = [l for l in resid_atoms if l[13:16] == "CA "]
            n = [l for l in resid_atoms if l[13:16] == "N  "]
            if len(ca) > 1 or len(n) > 1:
                err = "Residue \"%s\" is duplicated!" % resid
                raise PdbContainerError(err)
            elif len(ca) == 0 or len(n) == 0:
                err = "Residue \"%s\" has missing CA or N atoms!" % resid
                raise PdbContainerError(err)

            ca_list.append(ca[0])
            n_list.append(n[0])

        # Grab coordinates of CA atoms and index of residues indexes of
        # amide nitrogens.
        ca_coord = [[float(l[30+8*i:38+8*i]) for i in range(3)] for l in ca_list]
        res_index = [self.atom_lines.index(n) for n in n_list]

        # Check the distance between every ca carbon and the next.  If these
        # are further apart than dist_cutoff, place in different fragments.
        self.frag_index = []
        for i in range(1,len(ca_list)):

# Path: pdbtools/helper/geometry.py
# def dist(c1,c2=[0.,0.,0.]):
#     """
#     Calculate the distance between two coordinates in 3d space.  If no c2 is
#     specified it returns the length of the vector.
#     """
# 
#     return sqrt(sum([(c1[i] - c2[i])**2 for i in range(3)]))


# Path: pdbtools/helper/container.py
from .geometry import dist
from math import sqrt
    import sys

        for line in self.atom_lines:
            if line[21:26] not in residue_list:
                residue_list.append(line[21:26])

        ca_list = []
        n_list = []
        for resid in residue_list:
            resid_atoms = [l for l in self.atom_lines if l[21:26] == resid]

            ca = [l for l in resid_atoms if l[13:16] == "CA "]
            n = [l for l in resid_atoms if l[13:16] == "N  "]
            if len(ca) > 1 or len(n) > 1:
                err = "Residue \"%s\" is duplicated!" % resid
                raise PdbContainerError(err)
            elif len(ca) == 0 or len(n) == 0:
                err = "Residue \"%s\" has missing CA or N atoms!" % resid
                raise PdbContainerError(err)

            ca_list.append(ca[0])
            n_list.append(n[0])

        # Grab coordinates of CA atoms and index of residues indexes of
        # amide nitrogens.
        ca_coord = [[float(l[30+8*i:38+8*i]) for i in range(3)] for l in ca_list]
        res_index = [self.atom_lines.index(n) for n in n_list]

        # Check the distance between every ca carbon and the next.  If these
        # are further apart than dist_cutoff, place in different fragments.
        self.frag_index = []
        for i in range(1,len(ca_list)):

            if dist(ca_coord[i-1],ca_coord[i]) > dist_cutoff: