for i in range(np.size(spin_list)): spin_dict[magnetic_ions[i]] = spin_list[i] print "project name: " + project_name # #read the CIF file to extract a complete unit cell containing the chosen magnetic ions # [atoms, fract_coords] = SMMcalc_lib.CIF_to_cell(file_name = CIF_file, select_atoms = magnetic_ions) # #make sub-variables that only contain cluster atoms and fract_coords # [cluster_atoms, cluster_fract_coords] = \ SMMcalc_lib.cluster_array_maker(cluster_indices = cluster_indices, atoms = atoms, fract_coords = fract_coords) # #store the atoms and fract_coords files in a temporary file so they can be acessed by other processes # SMMcalc_lib.tmp_write(cluster_atoms, cluster_fract_coords, 'TEMP.txt') # #from the cluster_atoms, generate cluster_spins # cluster_spins = np.zeros(np.shape(cluster_atoms)) for i in range(np.size(cluster_atoms)): cluster_spins[i] = spin_dict[cluster_atoms[i]]
spin_dict = {} for i in range(np.size(spin_list)): spin_dict[magnetic_ions[i]] = spin_list[i] print "project name: " + project_name # #read the CIF file to extract a complete unit cell containing the chosen magnetic ions # [atoms, fract_coords] = SMMcalc_lib.CIF_to_cell(file_name = CIF_file, select_atoms = magnetic_ions) # #store the atoms and fract_coords files in a temporary file so they can be acessed by other processes # SMMcalc_lib.tmp_write(atoms, fract_coords, 'TEMP.txt') # #start another process to render the unit cell in real space # if display_plots == 1: subprocess.Popen("SMMcalc_display.py", shell=True) # #choose the atoms to be in the cluster # cluster_indices = SMMcalc_lib.cluster_chooser() # #make sub-variables that only contain cluster atoms and fract_coords #
import os #operating system import re #regular expressions import numpy as np #numeric python from enthought.mayavi import mlab import SMMcalc_lib f = open(r"SMMcalcINPUT.txt", "r").read().splitlines() file_name = f[1] #convert file_name to acceptable format file_name = "file://" + file_name file_name = os.path.normpath(file_name) #read contents of TEMP file [atoms, fract_coords] = SMMcalc_lib.tmp_read('TEMP.txt') #read contents of CIF file cf = CifFile.ReadCif(file_name) sample_name = cf.dictionary.keys()[0] #unit cell in meters (converted from Angstroms) a = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_length_a']))) * 1e-10 b = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_length_b']))) * 1e-10 c = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_length_c']))) * 1e-10 #angles in degrees alpha = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_angle_alpha']))) beta = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_angle_beta']))) gamma = float(re.sub('\)','',re.sub('\(','',cf[sample_name]['_cell_angle_gamma'])))