示例#1
0
文件: fields.py 项目: jorgehog/pyMD
    def update(self):    
        
        if (self.when[0] <= self.counter <= self.when[1]):
#            for atom in self.region.atoms:
#                print atom.pos
#                
#            raw_input()
            for boundary in self.where:
                
                i = self.boundaryIndexMap[boundary]
                j = (i + 1)%2
                
                r = self.region.getShape()
                
                boundaryAtoms = self.region.extractBoundary(boundary, width=r[i]*self.dr[i])
                for atom in boundaryAtoms:
#                    print "atom at", atom.pos*1E9, "found in region", self.region.description, " at boundary", boundary, "with width", r[i]*self.dr[i]
#                    raw_input()
                    self.apply(atom, r[j], self.normalVectors[boundary])
#            print "----------------------------------"
            

        
        self.P = sampler.getPressure(self.region.atoms, V=self.region.volume)
        self.counter += 1
示例#2
0
文件: atoms.py 项目: jorgehog/pyMD
 def getPressure(self):
     
     return sampler.getPressure(self.atoms, N=self.nFree, V=self.mesh.volume, T=self.T, virial=self.virial)