def load(self): self.outputfile = open('T.output', 'w') size = 4.0786 self.dir = [0, 0, 1] self.axis = [7, 8, 8] atom = basisgen.Atom(196.967, 79) #crystal = crystalgen.gen(size, self.dir, self.axis, basisgen.fccBasis(atom), 10, 0.1, -1.75*size) #n = 5 #crystalgen.clearOutOfBounds(crystal, -size * n, size * n, -size * n, size * n) self.addRef([-1, -1, 1]) self.addRef([2, -1, 1]) self.addRef([0, 1, 1]) #self.addRef([-7,-8,8]) ''' self.addRef([1,0,0]) self.addRef([0,0,1]) self.addRef([0,1,0])#''' self.particles.coupling = False self.particles.steps = False self.particles.load('crystal.input') self.points.update(self.particles) self.translateAll([self.width / 2, self.height / 2, 0]) self.scaleAll(15)
def load(self): self.outputfile = open('T.output', 'w') size = 4.09 dir = [0, 0, 1] axis = [0, 0, 1] atom = basisgen.Atom(107.87, 47) #crystalgen.gen(size, dir, axis, basisgen.fccBasis(atom), 6, 0.1, -2.5*size) crystal = crystalgen.gen(size, dir, axis, basisgen.fccBasis(atom), 10, 0.1, -1.75 * size) n = 10 crystalgen.clearOutOfBounds(crystal, -size * n, size * n, -size * n, size * n) self.particles.coupling = False self.particles.steps = False self.particles.load('crystal.input') self.points.update(self.particles) self.translateAll([self.width / 2, self.height / 2, 0]) self.scaleAll(15)
if onlyTop and i!=maxZI: continue px = diff[0] + basis[i][0] py = diff[1] + basis[i][1] pz = diff[2] + basis[i][2] if pz < zBottom: continue site = [px,py,pz,_basis.atoms[i]] if not site in crystal: crystal.append(site) print('Generated Points, Now Clearing Duplicates') n = len(crystal) print(str(n)+ ' Points to check') clearDuplicates(crystal) print('Duplicates Cleared') output = open('crystal.input', 'w') for site in crystal: output.write(str(site[0])+'\t'+str(site[1])+ '\t'+ str(site[2]) \ +'\t'+str(site[3])+'\n') output.close() return crystal if __name__ == '__main__': size = 4.0786 dir = [0,0,1] axis = [1,1,1] atom = basisgen.Atom(196.967,79) crystal = gen(size, dir, axis, basisgen.fccBasis(atom), 10, 0.1, -1.8*size) n = 8.9 clearOutOfBounds(crystal, -size * n, size * n, -size * n, size * n)
self.masses = np.array(masses) self.charges = np.array(charges) self.springs = np.array(springs) self.momenta = np.array(momenta) if not hasMomenta: self.momenta = self.genMomenta(masses) self.randomizePositions() return if __name__ == "__main__": particles = Particles() size = 4.08 dir = [0, 0, 1] axis = [7, 8, 8] atom = basisgen.Atom(196.966570, 79) # crystalgen.gen(size, dir, axis, basisgen.fccBasis(atom), 10, 0.1, -3.5*size) particles.load('crystal.input') particles.step(.01) for i in range(100): particles.step(.01) if i % 20 == 0: print(particles.T()) particles.save('crystal.input') print(".", end='') if (i % 10 == 9): print('') print(particles.positions) print(particles.momenta)