JelfsMaterialsGroup / stko

A collection of molecular optimisers and property calculators for use with stk.
https://stko-docs.readthedocs.io/en/latest/
MIT License
22 stars 8 forks source link

Cannot run the 'GULP Metal Optimizer' example code on Linux or Windows, 'gulp_opt.xyz' not found #117

Closed ahgibbons closed 3 years ago

ahgibbons commented 3 years ago

Hello,

I am trying to use the STK and STKO libraries to run the GULP software.

I installed the libraries on Windows, and I installed gulp (version 6) for Windows.

When I ran the example code on this page: https://stko-docs.readthedocs.io/en/latest/stko.optimizers.gulp.html

(I changed the 'path/to/gulp' string to my actual path to gulp.exe)

I got the following error, with the main issue being FileNotFoundError: [Errno 2] No such file or directory: 'gulp_opt.xyz'

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-7-f18d929ee72f> in <module>
     12 gulp_opt.assign_FF(cube)
     13 # Run optimization.
---> 14 cube_opt = gulp_opt.optimize(mol=cube)

~\Anaconda3\lib\site-packages\stko\optimizers\gulp.py in optimize(self, mol)
    728 
    729             # Update from output.
--> 730             mol = mol.with_structure_from_file(output_xyz)
    731 
    732         finally:

~\Anaconda3\lib\site-packages\stk\molecular\molecules\molecule\molecule.py in with_structure_from_file(self, path, extension)
    789             '.coord': updaters._with_structure_from_turbomole,
    790             '.pdb': updaters._with_structure_from_pdb,
--> 791         }[extension](self.clone(), path)
    792 
    793     def with_canonical_atom_ordering(self):

~\Anaconda3\lib\site-packages\stk\molecular\molecules\molecule\utilities\updaters\xyz.py in _with_structure_from_xyz(self, path)
     34     """
     35 
---> 36     with open(path, 'r') as f:
     37         atom_count, _, *content = f.readlines()
     38 

FileNotFoundError: [Errno 2] No such file or directory: 'gulp_opt.xyz'

For what it's worth, I followed the same steps on Linux and got the same issue with gulp (version 5.1)

Thank you

andrewtarzia commented 3 years ago

Hello and welcome!

I am not too surprised that version 6 does not work, as stko was written and tested with version 5.1.

Does stko create the output directory defined when you initialise gulp_opt? (if this argument is not given, then it produces a random string of numbers to make a directory from).

If so, there is a gulp input file in there: gulp_opt.gin (well there should be). Can you try running the /path/to/your/executable < gulp_opt.gin > output_test.ginout in that directory? (please try with both versions) This will test if the problem is with gulp or with stko.

Andrew

ahgibbons commented 3 years ago

Thank you for the reply,

Yes, the program creates an output directory with gulp_opt.gin and gulp_opt.ginout files.

I ran the command you suggested, on Windows I get a missing libgfortran-5.dll error (gulp version 6, there is no Windows download for gulp5.1 other than source code).

On Linux I get STOP GULP terminated with an error (gulp version 5.1)

And the output.out file contains:

********************************************************************************
*                       GENERAL UTILITY LATTICE PROGRAM                        *
*                                 Julian Gale                                  *
*                       Curtin Institute for Computation                       *
*                           Department of Chemistry                            *
*                    Curtin University, Western Australia                      *
********************************************************************************
* Version = 5.1.0 * Last modified = 25th January 2020                          *
********************************************************************************

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! ERROR : could not open library file = uff4mof.lib
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 Program terminated by processor     0 in               setlib
andrewtarzia commented 3 years ago

I am unsure about the first issue with windows as I have never tried to get this working on windows or with that version.

The Linux issue suggests you need to define a path to the lib files. Try the following:

export GULP_LIB='/path/to/gulp-5.1/Libraries/'
export GULP_DOC='/path/to/gulp-5.1/Docs/'
ahgibbons commented 3 years ago

Ok, that seemed to fix it. I won't paste the whole output file but this is the final part, I guess that means it worked? If so, thank you very much for your quick help and where do I go from here? Does this bypass the problem of gulp_opt.xyz File not found?

--------------------------------------------------------------------------------
  Maximum abs         0.126596      0.100827      0.215294      0.000000
--------------------------------------------------------------------------------

  Time to end of optimisation =      15.3707 seconds

  Peak dynamic memory used =       0.96 MB

  Timing analysis for GULP :

--------------------------------------------------------------------------------
  Task / Subroutine                                          Time (Seconds)
--------------------------------------------------------------------------------
  Calculation of real space energy and derivatives               11.7104
  Calculation of three-body energy and derivatives                2.5834
  Calculation of four-body energy and derivatives                 1.0126
  Calculation of molecules and connectivity                       0.0002
  Global summation overhead                                       0.0030
--------------------------------------------------------------------------------
  Total CPU time                                                 15.3707
--------------------------------------------------------------------------------

  Job Finished at 17:06.17 22nd August     2021
andrewtarzia commented 3 years ago

Yes, that suggests it worked - now to check it works within stko! ahah.

Glad I could help, sorry about the problem with the new version, I will add an Issue and work on that in the future.

Happy to help in the future as you build more things with stk/stko!

ahgibbons commented 3 years ago

Ok, I ran the Python example code again with the environment variables set and there were no errors, and the output folder now contains a 'gulp_opt.xyz' file.

andrewtarzia commented 3 years ago

Excellent! I hope the structures are well optimised ahah/