Open main menu

Changes

# Open file for writing
f = open('cluster_residues.txt'cluster_file, 'w')
# Make a list to count number of models
resi_models = []
for spin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True):
# Write models to file
f.write( str(spin_id) + " ; " + str(spin.model) + " ; " + str(spin._res_namemol_name) + " ; " + str(res_num) + " ; " + str(res_name) + "\n" )
# Append models to list
resi_models.append(spin.model)
# Count resi_models
c_resi_models = dict((i,resi_models.count(i)) for i in resi_models)
print c_resi_models
# Write count result to file
for key, val in c_resi_models.items():
f.write( "# ; " + str(key) + " ; " + str(val) + "\n" )
#Close the file
f.close()
</source>
Trusted, Bureaucrats
1,382

edits