예제 #1
0
 def test_calculate(self):
     calculator1 = EnergyForceStress(ff_settings=self.ff_settings1)
     energy1, forces1, stresses1 = calculator1.calculate([self.struct])[0]
     self.assertTrue(abs(energy1 - (-23.1242962)) < 1e-2)
     np.testing.assert_array_almost_equal(forces1,
                                          np.zeros((len(self.struct), 3)))
     self.assertEqual(len(stresses1), 6)
예제 #2
0
파일: nnp.py 프로젝트: YuTingLiu33/mlearn
    def predict(self, structure):
        """
        Predict energy, forces and stresses of the structure.

        Args:
            structure (Structure): Pymatgen Structure object.

        Returns:
            energy, forces, stress
        """
        calculator = EnergyForceStress(self)
        energy, forces, stress = calculator.calculate(structures=[structure])[0]
        return energy, forces, stress