Example #1
0
    def randomDisplacements(self, POSCAR):
        from os import path

        from aBuild.database.crystal import Crystal

        toRelax = path.join(self.root, 'fitting', 'mtp', 'to_relax.cfg')
        for i in range(1000):
            thisCrystal = Crystal(POSCAR, systemSpecies=self.species)
            thisCrystal.randomDisplace()
            print(thisCrystal.lines('mtprelax'))
            with open(toRelax, 'a+') as f:
                f.writelines('\n'.join(thisCrystal.lines('mtprelax')))
Example #2
0
        for i in dataSet.crystals:
            for j in predictSet.crystals:
                if j.title.strip() == i.title.strip():
                    print("Found match")
                    diffsEnergy.append(i.results["energyF"] - j.results["energyF"])
                    diffsForces.append(average(norm(array(i.results["forces"]) - array(j.results["forces"]), axis = 1)))
        from matplotlib import pyplot
        pyplot.subplot(121)
        pyplot.hist(diffsEnergy,bins = 30)
        pyplot.subplot(122)
        pyplot.hist(diffsForces,bins = 30)
        pyplot.savefig('errorPlot.png')
        #pyplot.savefig('errorForces.png')
        
        

    def randomDisplacements(self,POSCAR):
        from os import path
        
        from aBuild.database.crystal import Crystal

        toRelax = path.join(self.root,'fitting','mtp','to_relax.cfg')
        for i in range(1000):
            thisCrystal = Crystal(POSCAR,systemSpecies = self.species)
            thisCrystal.randomDisplace()
            print(thisCrystal.lines('mtprelax'))
            with open(toRelax, 'a+') as f:
                f.writelines('\n'.join(thisCrystal.lines('mtprelax')))