atoms_list=[] collected_data={} try: for i in atoms_list1: atoms_list.append(i) except TypeError: atoms_list1=open(ATOMS_DATA_FILE,"r") atoms_list2=atoms_list1.readline().strip().split(" ")[0] atoms_list.append(int(atoms_list2)) atom_count1=1 total_atoms=len(atoms_list) for j in range(START_CHKPT_NUMBER,END_CHKPT_NUMBER,INTERVAL_CHKPT_NUMBER): k=("%08d" %(j)) CUR_LAMMPS_FILE = str(CUR_LAMMPS_FILE_PREFIX)+str(".")+str(k)+str(".dump") cur_atoms = ganisetti_tools.get_atoms_info_from_lammps(CUR_LAMMPS_FILE) output1=open(CUR_LAMMPS_FILE_PREFIX+str("_selected_atoms_from_all_files.")+str(k)+str(".atoms"),'w') output1.write("# MSD processed file; ITEM: ATOMS id type x y z\n\n") output1.write("%d atoms\n" %(total_atoms)) output1.write("%d bonds\n" %(total_atoms-len(atoms_list))) output1.write("0 angles\n0 dihedrals\n0 impropers\n\n") output1.write("10 atom types\n1 bond types\n\n") output1.write("%lf %lf xlo xhi\n" %(cur_atoms.box[0][0],cur_atoms.box[0][1])) output1.write("%lf %lf ylo yhi\n" %(cur_atoms.box[1][0],cur_atoms.box[1][1])) output1.write("%lf %lf zlo zhi\n\n" %(cur_atoms.box[2][0],cur_atoms.box[2][1])) output1.write("Atoms \n\n") if j != START_CHKPT_NUMBER: for i in collected_data.keys(): output1.write("%d %d %d 1.0 %lf %lf %lf \n" %(collected_data[i]["id"],collected_data[i]["molecule_id"],collected_data[i]["type"],collected_data[i]["posx"],collected_data[i]["posy"],collected_data[i]["posz"]))
print( "************************************** S. Ganisetti **************************************" ) print("Error: usage is wrong") print( "correct usage is: python3.6 this_program ChkptFile SelectedAtomsList" ) print( "******************************************************************************************" ) exit() LAMMPS_CHKPT_FILE = sys.argv[1] SELECTED_ATOMS_FILE = sys.argv[2] ganisetti_tools.get_ganisetti_tools_version() ref_atoms = ganisetti_tools.get_atoms_info_from_lammps(LAMMPS_CHKPT_FILE) selected_atoms1 = open(SELECTED_ATOMS_FILE) selected_atoms = [] for line in selected_atoms1: elements = line.strip().split() for each_element in elements: selected_atoms.append(each_element) output1 = open(LAMMPS_CHKPT_FILE + str("_selectedatoms.atoms"), 'w') ganisetti_tools.write_imd_header_custom_property(output1, ref_atoms.box, "EMPTY") for i in selected_atoms: #print(ref_atoms.id[int(i)]) ganisetti_tools.write_imd_atom_custom_property(output1, int(i), ref_atoms, 0)
MAX_NEIGHBOURS=8 MAX_ATOM_TYPES=8 # controlling parameter file_format = "lammps" voxel_length_parameter = 0.5 # for example Si-O bond length is 2.2 Ang, and you want to keep 5 voxels within the Si-O bond # then the voxel_length_parameter you have to provide is 2.2/5 = 0.44 voxel_smoothing_parameter = 6 # if you want to search for neighboring atoms within a separation distance of 2.7 Ang # then the voxel_smoothing_parameter you have to provide is int(2.7/voxel_length_parameter) = int(6.1364) = 6 # ************************************************************************************** # get the atoms information if file_format == "imd": config1 = ganisetti_tools.get_atoms_info_from_imd(IMD_FILE) if file_format == "lammps": config1 = ganisetti_tools.get_atoms_info_from_lammps(LAMMPS_DUMP_FILE) # ************************************************************************************** # compute total atoms of each atom type total_atoms_of_type_sym={} tmp=config1.type.values() tmp=list(tmp) for i in atom_type_sym2num.keys(): total_atoms_of_type_sym[i]=tmp.count(atom_type_sym2num[i]) # ************************************************************************************** # computing nnl config1_nnl = ganisetti_tools.compute_nnl(config1,rc,atom_type_num2sym) #all_clustering_required_atoms=[1759,586,383,524,237,2649,363,465,93,1868]
temp1 = atom_type_sym2num.keys() BG_glass = "no" if "Si" in temp1 and "P" in temp1 and "Na" in temp1 and "Ca" in temp1: BG_glass = "yes" NAPS_glass = "no" if "P" in temp1 and "Al" in temp1 and "Na" in temp1: NAPS_glass = "yes" CMAS_glass = "no" if "Ca" in temp1 and "Mg" in temp1 and "Al" in temp1 and "Si" in temp1: CMAS_glass = "yes" # main loop starts here BASE_FILE = str(read_parameter_file.cur_file) # ************************************************************************************** # get the atoms information ref_config = ganisetti_tools.get_atoms_info_from_lammps( read_parameter_file.input_lammps_dump_file) cur_config = ganisetti_tools.get_atoms_info_from_lammps( read_parameter_file.cur_lammps_dump_file) MAX_ATOM_TYPE = max(ref_config.type.values()) # ************************************************************************************** # compute total atoms of each atom type total_atoms_of_type_sym = {} tmp = ref_config.type.values() tmp = list(tmp) for i in atom_type_sym2num.keys(): total_atoms_of_type_sym[i] = tmp.count(atom_type_sym2num[i]) # ************************************************************************************** # computing nnl ref_config_nnl = ganisetti_tools.compute_nnl(ref_config, rc,