def load_pdb(filename):
with open(filename) as f:<EOL><INDENT>numbers = []<EOL>coordinates = []<EOL>occupancies = []<EOL>betas = []<EOL>for line in f:<EOL><INDENT>if line.startswith("<STR_LIT>"):<EOL><INDENT>symbol = line[<NUM_LIT>:<NUM_LIT>].strip()<EOL>numbers.append(periodic[symbol].number)<EOL>coordinates.append([float(line[<NUM_LIT:30>:<NUM_LIT>])*angstrom, float(line[<NUM_LIT>:<NUM_LIT>])*angstrom, float(line[<NUM_LIT>:<NUM_LIT>])*angstrom])<EOL>occupancies.append(float(line[<NUM_LIT>:<NUM_LIT>]))<EOL>betas.append(float(line[<NUM_LIT>:<NUM_LIT>]))<EOL><DEDENT><DEDENT><DEDENT>if len(numbers) > <NUM_LIT:0>:<EOL><INDENT>molecule = Molecule(numbers, coordinates)<EOL>molecule.occupancies = np.array(occupancies)<EOL>molecule.betas = np.array(betas)<EOL>return molecule<EOL><DEDENT>else:<EOL><INDENT>raise FileFormatError("<STR_LIT>" % filename)<EOL><DEDENT>
Loads a single molecule from a pdb file.

       This function does support only a small fragment from the pdb specification.
       It assumes that there is only one molecular geometry in the pdb file.