def makeWater(this, c, border = 1): #Border is in percentage of free space around water molecules path = this.path; p = this.p; s = this.s; T = this.T; resetRun = this.resetRun; if(path == ""): print "A save directory is needed to create a state"; print "Use setDir(<dirName>) to set a save directory"; return; #end if(s[0] == 0): print "Specify simulation volume"; return; #end if(len(c) != 3 or c[0] == 0): print "Specify number of cells"; return; #end #Removing all data from previous simulations lastSim = len(this.simulations) - 1; simPath = path + "/" + str(lastSim + 1) + "_H2OInit"; resetRun(simPath); os.makedirs(simPath); N = mdi.water(s, c, simPath, T, border); datafilename = simPath + "/init/data.dat"; datafile = open(datafilename, "w"); datafile.write("1 1 1\n"); datafile.write(str(s[0]) + " " + str(s[1]) + " " + str(s[2]) + "\n"); datafile.write("0\n0\n"); datafile.write(str(int(N)) + "\n"); datafile.close(); this.simulations.append(simPath); this.stateNumbers.append(0); this.splitted.append(False); return lastSim + 1;
def makeCristobalite(this, c): resetRun = this.resetRun; path = this.path; p = this.p; s = this.s; T = this.T; if(path == ""): print "A save directory is needed to create a state"; print "Use setDir(<dirName>) to set a save directory"; exit(); #end if(s[0] == 0): print "Specify simulation volume"; exit(); #end if(len(c) != 3 or c[0] == 0): print "Specify number of cells"; exit(); #end lastSim = len(this.simulations) - 1; simPath = path + "/" + str(lastSim + 1) + "_SiO2Init"; resetRun(simPath); os.makedirs(simPath); N = mdi.cristobalite(s, c, T, simPath); datafilename = simPath + "/init/data.dat"; datafile = open(datafilename, "w"); datafile.write("1 1 1\n"); datafile.write(str(s[0]) + " " + str(s[1]) + " " + str(s[2]) + "\n"); datafile.write("0\n0\n"); datafile.write(str(N) + "\n"); datafile.close(); this.simulations.append(simPath); this.stateNumbers.append(0); this.splitted.append(False); return lastSim + 1;