Example #1
0
    def run(self, geom, multiplicity, state, verbose=False):

        #print('running!')
        #sys.stdout.flush()
        coords = manage_xyz.xyz_to_np(geom)

        # convert to bohr
        positions = coords * units.ANGSTROM_TO_AU
        calc = Calculator(get_method("GFN2-xTB"),
                          self.numbers,
                          positions,
                          charge=self.charge)
        calc.set_output('lot_jobs_{}.txt'.format(self.node_id))
        res = calc.singlepoint()  # energy printed is only the electronic part
        calc.release_output()

        # energy in hartree
        self._Energies[(multiplicity,
                        state)] = self.Energy(res.get_energy(), 'Hartree')

        # grad in Hatree/Bohr
        self._Gradients[(multiplicity,
                         state)] = self.Gradient(res.get_gradient(),
                                                 'Hartree/Bohr')

        # write E to scratch
        self.write_E_to_file()

        self.hasRanForCurrentCoords = True

        return res
Example #2
0
    def run(self, coords, multiplicity, state, verbose=False):

        #print('running!')
        #sys.stdout.flush()

        self.E = []
        self.grada = []

        # convert to angstrom
        positions = coords * units.ANGSTROM_TO_AU

        calc = Calculator(get_method("GFN2-xTB"), self.numbers, positions)
        calc.set_output('lot_jobs_{}.txt'.format(self.node_id))
        res = calc.singlepoint()  # energy printed is only the electronic part
        calc.release_output()

        # energy in hartree
        self.E.append((multiplicity, state, res.get_energy()))

        # grad in Hatree/Bohr
        self.grada.append((multiplicity, state, res.get_gradient()))

        # write E to scratch
        with open('scratch/E_{}.txt'.format(self.node_id), 'w') as f:
            for E in self.E:
                f.write('{} {:9.7f}\n'.format(E[0], E[2]))
        self.hasRanForCurrentCoords = True

        return res