qzhu2017 / CSP_BO

Crystal Structure Prediction with Bayesian Optimization
0 stars 1 forks source link

vasp optimization #34

Open qzhu2017 opened 3 years ago

qzhu2017 commented 3 years ago

@yanxon

Check out my latest updates on pyxtal. I just changed it a bit.

If you want to do optimization, use the following,

from pyxtal.interface.vasp import optimize
strucs, energies, times, error = optimize(struc, path=dir1)  

if you want to do single point energy

from pyxtal.interface.vasp import single_point
eng, forces = single_point(struc, path=dir1)

In both case, the input struc is the pyxtal structure. dir1 specifies the path of vasp calculation directory

yanxon commented 3 years ago

Hi @qzhu2017,

Did you try to install CSP_BO on stampede2? I couldn't figure out about the mpi4py issue.

First, I tried to run python setup.py install, the installation stuck at:

compiler_compat/ld: cannot find -lvt-mpi

Second, I tried to install mpi4py separately. The mpi4py got installed in ~/anaconda3/envs/tf/lib/python3.8/site-packages/mpi4py directory which is expected.

However, when the cspbo tried to call from mpi4py import MPI, I obtained this error:

ImportError: dynamic module does not define module export function (PyInit_MPI)

Lastly, I further checked by trying to see which mpi4py is used:

(tf) login2.stampede2(1110)$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpi4py
>>> mpi4py.__file__
'/opt/apps/intel18/impi18_0/python2/2.7.15/lib/python2.7/site-packages/mpi4py/__init__.py'

As you see, it insists on using the python2 mpi4py.

yanxon commented 3 years ago

@qzhu2017

Anyway, I don't think this is a big deal. I will just modify the CSP_BO code to get rid of the MPI function for now. According to the CSP_BO/GULP benchmark, the GPR performance is acceptable.

yanxon commented 3 years ago

example_validate.py with Stampede2

Processed 50 structures
------Gaussian Process Regression------
Kernel: 6.245**2 *RBF(length=0.561) 25 energy (0.008) 82 forces (0.163)

Loss:       27.177  6.245  0.561  0.008 
Loss:      650.862  6.908  0.100  0.010 
Loss:       30.785  6.331  0.501  0.008 
Loss:       27.176  6.247  0.560  0.008 
load the GP model from  models/Si.json
Train Energy [  25]: R2 0.9996 MAE  0.005 RMSE  0.006
Train Forces [ 246]: R2 0.9910 MAE  0.091 RMSE  0.125
   1 E: -5.310 -> -5.312  F_MSE:  0.000 S_MSE:  2.459
   2 E: -5.358 -> -5.354  F_MSE:  0.000 S_MSE:  2.060
   3 E: -5.406 -> -5.409  F_MSE:  0.000 S_MSE:  1.310
   4 E: -5.418 -> -5.421  F_MSE:  0.000 S_MSE:  0.840
   5 E: -5.415 -> -5.425  F_MSE:  0.000 S_MSE:  0.234
   6 E: -5.413 -> -5.422  F_MSE:  0.000 S_MSE:  0.475
   7 E: -5.406 -> -5.411  F_MSE:  0.000 S_MSE:  0.921
   8 E: -5.394 -> -5.393  F_MSE:  0.000 S_MSE:  1.383
   9 E: -5.378 -> -5.370  F_MSE:  0.000 S_MSE:  1.830
  10 E: -5.359 -> -5.342  F_MSE:  0.000 S_MSE:  2.259
Test Energy [  10]: R2 0.9450 MAE  0.006 RMSE  0.008
Test Forces [1920]: R2 1.0000 MAE  0.000 RMSE  0.000
488.699 seconds elapsed
save the figure to  E.png
save the figure to  F.png
Test Stress [  60]: R2 0.8971 MAE  0.913 RMSE  1.556
save the figure to  S.png
yanxon commented 3 years ago

@qzhu2017

idev command:

idev -p development/normal -N 1 -n 36 -m 120