import numpy as np import math #types1 = np.array( (12.011,12.011,15.999, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008)) #types2 = np.array((12.011, 12.011, 15.999, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 12.011, 12.011, 12.011, 15.999, 15.999, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008, 1.008)) file = open("PLA3.lmp", "r") #This converter is intended for raw LigParGen files to be utilized to create #further LAMMPS data input files #Only error surfaces in the pair coeffs section # LigParGen gives ID value1 value2 # LAMMPS expects ID ID value1 value2 to define LJ well # Read the entire content of the file content = file.read() #Maybe Unnecessary Tools #Masses and types per entry (maybe unnecessary) start = content.find("Masses")+6 stop = content.find("Pair Coeffs") masses = content[start:stop] intermediate = masses.split() types1 = np.array(()) i=1 while(i2)")) -2#(number of additional monomers added to 2) str2 = "" #21 atoms in PLA2 while(i<21-1): #minus 1 prevents last hydrogen from getting added if(forOvito): if(i==10 and k>0): str2 += " " + str(i+1) + " " + str(6) + " " #sets oxygen type to non-hydroxy for polymerization else: if(i<11): str2 += " " + str(i+1) + " " + str(i+1) + " " #gives ID, mol #, and atom type else: #12 should be a hydrogen bound to carbon +5 to 17,18,19 str2 += " " + str(i+1) + " " + str(i+1+5) + " " #gives ID, mol #, and atom type if(i < 11): str2 += str(PLA6Coords[i][0]+xOffset) + " " + str(PLA6Coords[i][1]+yOffset) + " " + str(PLA6Coords[i][2]+zOffset) +" " else: str2 += str(PLA6Coords[i+20][0]+xOffset) + " " + str(PLA6Coords[i+20][1]+yOffset) + " " + str(PLA6Coords[i+20][2]+zOffset) +" " if(i==10 and k>0): str2 += str(atomsInfo[6][2]) + " 1 " #charge else: if(i<10): str2 += str(atomsInfo[i][2]) + " 1 " #charge else: str2 += str(atomsInfo[i+5][2]) + " 1 " #charge plus 5 to account for misallignment PLA2 to PLA3 else: if(i==10 and k>0): str2 += " " + str(i+1) + " " + "1" + " " + str(6) + " " #sets oxygen type to non-hydroxy for polymerization str2 += str(atomsInfo[6][2]) + " " #charge else: if(i<10): str2 += " " + str(i+1) + " " + "1" + " " + str(i+1) + " " #gives ID, mol #, and atom type str2 += str(atomsInfo[i][2]) + " " #charge else: str2 += " " + str(i+1) + " " + "1" + " " + str(i+1+5) + " " #gives ID, mol #, and atom type str2 += str(atomsInfo[i+5][2]) + " " #charge if(i < 11): str2 += str(PLA6Coords[i][0]+xOffset) + " " + str(PLA6Coords[i][1]+yOffset) + " " + str(PLA6Coords[i][2]+zOffset) else: str2 += str(PLA6Coords[i+20][0]+xOffset) + " " + str(PLA6Coords[i+20][1]+yOffset) + " " + str(PLA6Coords[i+20][2]+zOffset) str2 += "\n" i+=1 #print(str2) addedAtoms = np.array([7,8,9,10,11,17,18,19,20]) #reference numbers for atom types to be added for PLA2.lmp #bonds and other interactions detailed in source file #longer polymers changeX = -5.478 #the change cross two monomers in linear section (measured from ovito) changeY = -3.73577 changeZ = 2.70408 j=0 while(j