dralgroup / mlatom

AI-enhanced computational chemistry
http://mlatom.com
Other
59 stars 11 forks source link

Cannot automatically choose optimizer #29

Open crow02531 opened 2 weeks ago

crow02531 commented 2 weeks ago

When running ml.optimize_geometry(model=mymodel, initial_molecule=initmol) it complaints AttributeError: 'optimize_geometry' object has no attribute 'program'. And when I inspected into simulations.py/optimizegeometry.__init_\ I found that:

        if program != None:
            self.program = program
        else:
            if "GAUSS_EXEDIR" in os.environ: self.program = 'Gaussian'
            else:
                try:
                    import geometric
                    self.program = 'geometric'
                # try:
                #     import ase
                #     self.program = 'ASE'
                except:
                    try: import scipy.optimize
                    except: raise ValueError('please set $GAUSS_EXEDIR or install geometric or install scipy')

        # some codes doing nothing to 'self.program'

        if self.program.casefold() == 'Gaussian'.casefold(): self.dump_trajectory_interval = 1 # Gaussian optimizer needs traj file to get the optimization trajectory
        if self.program.casefold() == 'geometric'.casefold(): self.dump_trajectory_interval = 1

which undoubtedly crashed if program was not provided explicitly and "Gaussian" or "geometric" was not installed.

PS: my version is 3.12.0