mir-group / phoebe

A high-performance framework for solving phonon and electron Boltzmann equations
https://mir-group.github.io/phoebe/
MIT License
85 stars 19 forks source link

Using Phoebe to calculate band structure is inconsistent with phonopy #200

Closed Yuanwz00 closed 4 months ago

Yuanwz00 commented 1 year ago

I use Phoebe to calculate band structure of 3C-SiC,but it is inconsistent with phonopy. I tried to use QE's force constant (sic444.fc), phonopy's force constant (FORCE CONSTANT.hdf5) and phono3py's force constant(fc2.hdf5) as phFC2File, but it didn't work. All of them failed to provide a right phonon band structure with nac correction.

jcoulter12 commented 1 year ago

Hi @Yuanwz00,

Thanks very much for reporting this. I actually think I know exactly the cause of this, and can likely fix it in just a few minutes.

Would you mind sending me by email your sic444.fc file at jcoulter@g.harvard.edu, so that I can confirm I have the right idea of what is going wrong before releasing the fix?

Additionally, can I see the phonon dispersion plots? Thanks again, Jenny

jcoulter12 commented 1 year ago

Hi @Yuanwz00 --

Thanks for sending over the files, indeed, I know how to fix the problem, so it's very quick -- it appears we introduced an error in which the dielectric matrix is off by a factor of 1/2 during the parsing from QE. Here below, you can see the correct result using sic444.fc.

Before I release the fix to this problem to the main branch of the repository, would you confirm for me that when you use the Phonopy force constants, you are also supplying a BORN file to Phoebe using the phonopyBORNFileName?

This will help me determine if the mistake arose in the QE parser or the part of the code that applies the NAC.

I really appreciate that you reported this issue, as it helped me by confirm this problem, which I also noticed a couple days ago but haven't had time to fully test the bug fix for yet. Jenny

image

Yuanwz00 commented 1 year ago

Hi Jenny -- Thanks for testing this issue. Yes, when I use the Phonopy force constants, I am also supplying a BORN file to Phoebe using the phonopyBORNFileName.

Yuan Weizhe @.***

 

------------------ 原始邮件 ------------------ 发件人: "mir-group/phoebe" @.>; 发送时间: 2023年10月12日(星期四) 中午12:59 @.>; 抄送: "Yuan @.**@.>; 主题: Re: [mir-group/phoebe] Using Phoebe to calculate band structure is inconsistent with phonopy (Issue #200)

Hi @Yuanwz00 --

Thanks for sending over the files, indeed, I know how to fix the problem, so it's very quick -- it appears we introduced an error in which the dielectric matrix is off by a factor of 1/2 during the parsing from QE. Here below, you can see the correct result using sic444.fc.

Before I release the fix to this problem to the main branch of the repository, would you confirm for me that when you use the Phonopy force constants, you are also supplying a BORN file to Phoebe using the phonopyBORNFileName?

This will help me determine if the mistake arose in the QE parser or the part of the code that applies the NAC.

I really appreciate that you reported this issue, as it helped me by confirm this problem, which I also noticed a couple days ago but haven't had time to fully test the bug fix for yet. Jenny

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jcoulter12 commented 1 year ago

Hi @Yuanwz00 --

I've pushed a fix to this, would you mind checking it on your phonopy files? Alternatively, you can send them to me and I can check those as well.

If you want to check for yourself, cd into your phoebe directory, and type:

git pull 
git checkout lotoFix
cd build
make -j 2 phoebe

and then you should be able to use the code with the minor fix. Let me know, Jenny

Yuanwz00 commented 1 year ago

I try to make -j 2 phoebe, but with error below: CMake Error at lib/CMakeLists.txt:2 (add_subdirectory):   The source directory

    /home/user/phoebe/lib/kokkos-kernels

  does not contain a CMakeLists.txt file. Call Stack (most recent call first):   CMakeLists.txt:56 (include)

Yuan Weizhe @.***

 

------------------ 原始邮件 ------------------ 发件人: "mir-group/phoebe" @.>; 发送时间: 2023年10月13日(星期五) 凌晨4:08 @.>; 抄送: "Yuan @.**@.>; 主题: Re: [mir-group/phoebe] Using Phoebe to calculate band structure is inconsistent with phonopy (Issue #200)

Hi @Yuanwz00 --

I've pushed a fix to this, would you mind checking it on your phonopy files? Alternatively, you can send them to me and I can check those as well.

If you want to check for yourself, cd into your phoebe directory, and type: git pull git checkout lotoFix cd build make -j 2 phoebe
and then you should be able to use the code with the minor fix. Let me know, Jenny

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

jcoulter12 commented 1 year ago

Ah, I apologize -- there's one extra step I needed to include, because we very recently (yesterday) switched to use kokkos-kernels to further accelerate electron-phonon calculations.

You can fix this by running:

git submodule update --init
make -j 2 phoebe
jcoulter12 commented 1 year ago

Hi @Yuanwz00,

I actually have to apologize a second time - the kokkos-kernels addition does make things slightly more complicated on the rebuild, and I sent you the instructions too quickly.

You probably need to rebuild the code entirely by doing, after running the submodule line from the last message: 

cd build rm -r * cmake ../ make -j2 phoebe #(Or more than two if your system has more processors available)

Basically, adding kokkos-kernels requires us to run cmake again. Fortunately, if you are doing an elph calculation, this will also make it faster.  Sorry to add this extra bit of confusion, and thanks for your patience. Jenny

ZhunyunTang commented 11 months ago

Hi Jenny

I'm also experiencing the same problem of not being able to install properly: CMake Error at lib/CMakeLists.txt:1 (add_subdirectory): The source directory

/home/soft/phoebe-develop/conda-new/phoebe-develop/lib/kokkos does not contain a CMakeLists.txt file. Call Stack (most recent call first). CMakeLists.txt:56 (include)

CMake Error at lib/CMakeLists.txt:2 (add_subdirectory). The source directory

/home/soft/phoebe-develop/conda-new/phoebe-develop/lib/kokkos-kernels does not contain a CMakeLists.txt file. Call Stack (most recent call first). CMakeLists.txt:56 (include)

The problem also occurs when running “git submodule update --init” at the above prompt: fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

best regards, Tang

jcoulter12 commented 11 months ago

Hi @xtutzy,

Thanks for your interest in using Phoebe! I think it sounds like there's a few things could be wrong here, let's see if I can help you figure this out.

First, I would definitely try to install Phoebe the traditional way, rather than in a python env, which can cause additional/unexpected issues.

Second, regarding this git problem -- is this a copy of Phoebe you cloned recently, or one you're trying to update with new changes from git?

Either way, my recommendation is to cd into your phoebe directory and run git submodule update --init as you tried to do.

If you're getting:

fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

this probably means either 1) the git information in your Phoebe directory was deleted, or 2) you forgot to cd into your phoebe directory, or 3) you are trying to build phoebe from some direct download of the package, rather than as a repository cloned from git.

Let me know what happens after you check a few of these potential issues, and I'll provide some more recommendations. Jenny

ZhunyunTang commented 11 months ago

Hi Jenny

Depending on your answer, my mistake may have been the third point you mentioned. I did download the package directly, not a cloned git repository. Because my terminal could not establish a connection with the git URL.

best regards

ZhunyunTang commented 11 months ago

The above problem has been solved but a new error has appeared: ... -- Using the multi-header code from /home/tzy/soft/phoebe-develop/conda-new/1/1/phoebe/build/json_src/include/ -- Found MPI_C: /home/tzy/anaconda3/envs/phoebe/lib/libmpi.so (found version "3.1") -- Found MPI_CXX: /home/tzy/anaconda3/envs/phoebe/lib/libmpi.so (found version "3.1") -- Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS) CMake Error at /home/tzy/anaconda3/envs/phoebe/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1") Call Stack (most recent call first): /home/tzy/anaconda3/envs/phoebe/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /home/tzy/anaconda3/envs/phoebe/share/cmake-3.27/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args) CMakeLists.txt:85 (find_package)

-- Configuring incomplete, errors occurred

jcoulter12 commented 11 months ago

Hi @xtutzy,

As you can see, CMake cannot find the required MPI dependency, Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1")

To build Phoebe, you'll need at the bare minimum, a compiler (we've tested GCC, Clang, and Intel, but others may work), a version of MPI (openmpi, mpavich, etc), and ideally, a copy of parallel HDF5, though there are also installation instructions for serial HDF5.

I suspect what has happened here is you're building this with a conda env activated, and therefore, the conda env comes first on your system path, and obscures the normal MPI version. As you can see, you're using an anaconda version of CMake.

What kind of system are you attempting to build the code on? These dependencies (a compiler, MPI, and HDF5) can be found on almost all clusters, and can be easily set up on standard linux systems.

Best, Jenny

ZhunyunTang commented 11 months ago

Hi jenny,

I did set up a new environment to install phoebe on. my system is centos7.

Best Tang

jcoulter12 commented 11 months ago

Hi Tang,

Can you try deactivating the conda environment, and using the regular system copies of things? This is the standard way to build codes. Make sure you delete everything in your build directory so that CMake can start over without earlier information getting in the way.

If this is a cluster, which I suspect given the centos7 OS -- is it slurm based? If so, can you try the standard method of building codes on slurm machines, as attached below? Building Phoebe on slurm systems

I'm happy to help with this, but I need some knowledge of your environment. If you build a copy in a conda env, it might work, but I feel there is no guarantee of best performance.

Let me know, Jenny

jcoulter12 commented 4 months ago

Unless someone reports another case of this, I'm closing the issue for now. Thanks!