Code Monkey home page Code Monkey logo

kaldo's People

Contributors

afiorent avatar dafolkner avatar ddonadio avatar dependabot[bot] avatar gbarbalinardo avatar niklundgren avatar zkc19940412 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaldo's Issues

FileNotFoundError, issue running demo on Google Colab

Hello!

I'm having issues executing a kaldo/lammps demo on Google Colab (https://colab.research.google.com/drive/1kmuLpEJ0Gqj6RULd2w7o7pEagz5_aK27?usp=sharing), any ideas?

2022-10-28 18:10:53,088 - kaldo - INFO - Second order not found. Calculating.
INFO:kaldo:Second order not found. Calculating.
2022-10-28 18:10:53,096 - kaldo - INFO - Calculating second order potential derivatives, finite difference displacement: 1.000e-04 angstrom
INFO:kaldo:Calculating second order potential derivatives, finite difference displacement: 1.000e-04 angstrom
Exception ignored in: <function lammps.__del__ at 0x7f0268a990e0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/lammps.py", line 225, in __del__
    if self.lmp and self.opened:
AttributeError: 'lammps' object has no attribute 'lmp'
Exception ignored in: <function lammps.__del__ at 0x7f0268a990e0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/lammps.py", line 225, in __del__
    if self.lmp and self.opened:
AttributeError: 'lammps' object has no attribute 'lmp'
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/kaldo/observables/secondorder.py](https://7mwtagy0w39-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221026-060043-RC00_483928510#) in calculate(self, calculator, delta_shift, is_storing, is_verbose)
    219                 self.value = SecondOrder.load(folder=self.folder, supercell=self.supercell, format='numpy',
--> 220                                                 is_acoustic_sum=self.is_acoustic_sum).value
    221 

19 frames
FileNotFoundError: [Errno 2] No such file or directory: 'displacement/replicated_atoms.xyz'

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
OSError: libcudart.so.10.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
[/usr/lib/python3.7/ctypes/__init__.py](https://7mwtagy0w39-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20221026-060043-RC00_483928510#) in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: liblammps.so: cannot open shared object file: No such file or directory

Negative conductivity with fcc cell

If one tries to compute the t.c. of carbon diamond (e.g. with the Tersoff potential) with lammps, as in the CNT example, starting from this unit cell:

2
Lattice="0. 1.7830 1.7830 1.7830 0. 1.7830 1.7830 1.7830 0." Properties=species:S:1:pos:R:3
C           0.0000       0.0000       0.0000
C           0.8915       0.8915       0.8915

results are ok but if I use

2
Lattice="1.7830 1.7830 0. 1.7830 0. 1.7830 0. 1.7830 1.7830" Properties=species:S:1:pos:R:3
C           0.0000       0.0000       0.0000
C           0.8915       0.8915       0.8915 

the thermal conductivity turns out negative and nondiagonal. The only difference is the order of the lattice vectors.
The problem must pertain to the group velocities, as the rest looks consistent in the tests that I have run so far.
With 9x9x9 mesh of q-points the thermal conductivity results:

Conductivity from RTA (W/m-K): -1920.894
[[-1281.91249148  -632.56683696  -627.155851  ]
 [ -632.56683696  -946.4288838   -937.115773  ]
 [ -627.155851    -937.115773   -3534.33964947]]

Grid Errors for small systems

In certain cases, e.g. a replicated unitcell like 1x1xn, the detected_grid variable on line 34 in forceconstant.py behaves strangely.

We need a way to better control its behavior for some edge cases.

Questions about the stored binary files "_ps_and_gamma.npy”

Dear developers,

I did some calculation of the 3rd phonon bandwidths for tersoff-Si using the force constants from lammps with kaldo. I had finished the calculation but encounterd some confusing problems. I am writing to seek your help and the following are my questions.

  1. What's the meaning of data stored in file “_ps_and_gamma.npy”? I found that the second column is the phonon bandwidth but the first column is smaller.
  2. Is it possible for kaldo to export the information of generated k points? The Phonons API only defines the number of k points and doesn’t return any information of k points.
  3. I took the primitive cell (not orthogonal) and conventional cell (8 atoms, orthogonal) of diamond silicon respectively but get quite different density of phonon states and bandwidth/lifetime results. I did the test on using different broadening_shape, kpts, temperature, broadening_shape parameters and the situation is the same. Does kaldo have any restrictions for the input cell?

Thank you very much!

Best regards

Problem of calculating third order force constants

Dear developer,

I have successfully installed the modified version of LAMMPS. But when I try to calculate third order force constants using LAMMPS, I got the following errors:

fmt::format_error: invalid format string
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0

I really don't know how to solve this problem. So, I'd like to seek your help. Thanks very much!
Best regards

Sklearn module import

Scikit-learn has switched their KernelDensity module to a location in the sklearn.neighbors module rather than the sklearn.neighbors.kde module. Switching to accomodate this would promote forward compatibility with the newest sklearn package.

Invalid value when calculating velocity

Dear developers,

I try to calculate the thermal conductivity by solving BTE through rta method. My commands are as follows:

print('RTA method \n')
rta_cond = Conductivity(phonons=phonons, method='rta', storage='formatted')
rta_cond.diffusivity_bandwidth = phonons.bandwidth
print('Conductivity from RTA (W/m-K): %.3f' % (np.mean(np.diag(rta_cond.conductivity.sum(axis=0)))))
print(rta_cond.conductivity.sum(axis=0))

It can calculate third order projection successfully, but it then comes out an error as follows:

2023-07-10 17:58:35,973 - kaldo - INFO - ALD_alpha/2_2_2/velocity not found in formatted format, calculating velocity
/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/observables/harmonic_with_q.py:209: RuntimeWarning: invalid value encountered in sqrt
  inverse_sqrt_freq = tf.cast(tf.convert_to_tensor(1 / np.sqrt(frequency)), tf.complex128)
Traceback (most recent call last):
  File "kaldo_DOS_test.py", line 67, in <module>
    print('Conductivity from RTA (W/m-K): %.3f' % (np.mean(np.diag(rta_cond.conductivity.sum(axis=0)))))
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/helpers/storage.py", line 207, in __lazy_property
    loaded_attr = fn(self)
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/conductivity.py", line 167, in conductivity
    lambd = self.mean_free_path
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/helpers/storage.py", line 207, in __lazy_property
    loaded_attr = fn(self)
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/conductivity.py", line 201, in mean_free_path
    cond = self._calculate_mfp_sc()
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/conductivity.py", line 510, in _calculate_mfp_sc
    velocity = phonons.velocity.real.reshape ((phonons.n_k_points, phonons.n_modes, 3))
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/helpers/storage.py", line 207, in __lazy_property
    loaded_attr = fn(self)
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/phonons.py", line 180, in velocity
    velocity[ik] = phonon.velocity
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/helpers/storage.py", line 214, in __lazy_property
    loaded_attr = fn(self)
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/observables/harmonic_with_q.py", line 52, in velocity
    velocity = self.calculate_velocity()
  File "/home/liushiLab/zhouwenjie/software/kaldo_lammps/kaldo/kaldo/observables/harmonic_with_q.py", line 217, in calculate_velocity
    velocity_AF = 1 / (2 * np.pi) * contract('mn,m,n->mn', sij,
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/opt_einsum/contract.py", line 507, in contract
    return _core_contract(operands, contraction_list, backend=backend, **einsum_kwargs)
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/opt_einsum/contract.py", line 591, in _core_contract
    new_view = _einsum(einsum_str, *tmp_operands, backend=backend, **einsum_kwargs)
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/opt_einsum/sharing.py", line 151, in cached_einsum
    return einsum(*args, **kwargs)
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/opt_einsum/contract.py", line 353, in _einsum
    return fn(einsum_str, *operands, **kwargs)
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/home/liushiLab/zhouwenjie/.conda/envs/kaldo2/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 7164, in raise_from_not_ok_status
    raise core._status_to_exception(e) from None  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Einsum as input #1(zero-based) was expected to be a complex128 tensor but is a double tensor [Op:Einsum]

I can not find out the reason. So I seek for your help.
Thanks in advance.

CircleCI

Unit tests pass completion on my own workstation but fail on CircleCI.
Likely that some sort of configuration needs an edit.

Error reading force constants from hiPhive folder

I have tried to calculate kappa for Si using one of your examples but using a potential that I have previously created with hiPhive (that I am sure that is working well). However, I am getting an error reading the hiPhive folder:

kaldo - ERROR - Unable to detect grid type

I attach the modified version of your example.

Thanks in advance
example.zip

Force constant units.

Hello, I want to use force constants calculated elsewhere as an input to kALDo, but I can't find out what the units should be. I presumed it should be eV/A^2 and eV/A^3 for 2nd and 3rd order, but when looking at the examples for silicon I see force constant values that are much larger than they should be if the units are eV/A^2.

When inputting and outputting force constants with kALDo, what are the units?

Thanks.

Different results of thermal conductivity in example 'amorphous_silicon_Tersoff_LAMMPS'

Hi,
I got two different results of thermal conductivity when running the script '2_aSi512_Tersoff_visualize_QHGK_properties.py' in example 'amorphous_silicon_Tersoff_LAMMPS'. The result printed is about 1.24 W/mK. But, the result shown in the figure is about 1.1 W/mK. I found this difference is resulted from the different choice of diffusivity_bandwidth. The former directly uses the bandwidth computed by Phonons object. The latter uses the half of bandwidth computed by Phonons object, according to the line 278 in 'conductivity.py'. Could you tell me which one is correct for QHGK method? Thank you in advance.

Output of kaldo

Dear developers,
I have successfully run the example of Si (silicon_clathrate_Tersoff_LAMMPS) but I encountered some confusing problems regarding the output. So I would like to seek your help.
I got the velocity_0.dat, velocity_1.dat, velocity_2.dat and mean_free_path_0.dat, mean_free_path_1.dat, mean_free_path_2.dat. Is velocity_*.dat the phonon group velocity? Moreover, do the subscripts 1, 2 and 3 represent the x, y and z directions?
Thanks very much!
Best regards,
Junwei

Can KALDo be used for two dimensional material ?

I have repeated an example called "amorphous_silicon_Tersoff_LAMMPS" in KALDo's example file.
So I try to calculate the thermal conductivity of 2D material. Unfortunately, when I use the command "forceconstants = ForceConstants.from_folder(folder='fc_alpha',supercell=supercell,format='lammps')", it comes out an error: "numpy.linalg.LinAlgError: Singular matrix". I think maybe I should specify the length of a, b, c of the unit cell, for the reason that 2D material will have vacuum layer along the c axis.

How can I calculate eigenvalue values?

I aim to calculate eigenvalue values for the vibrational density of states in the CAS system using LAMMPS's dynamical matrix command. But I cannot get a graph like g(w) (arb. unit)- w(THz) Units do not match each other. Is there another way that I can use to calculate Eigenvalues and Eigenvectors?

velocity calculation dtype error

If asking for phonons.velocity on an amorphous system, the sij is cast as a float and an error is thrown.
Inserting the following line fixed it: sij = tf.cast(sij, dtype=tf.complex128), but the values were zero.
Instead, I think we should either explain and return sij if its amorphous, or throw an error.

Error:
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Mul as input 1(zero-based) was expected to be a complex128 tensor but is a double tensor [Op:Mul]

Full logs:
log.txt

different harmonic phonon dispersions computed from kaldo and phonopy

Dear kaldo Team,

I am trying to use the kaldo (wonderful package to do thermal transport simulations) to compute the thermal conductivity of a disordered crystal.

What interesting is that I found the phonon frequency calculated based on the Kaldo and Phonopy has a large difference.
The maximum phonon frequency computed from phonopy is about 8THz, while kaldo only gives about 6THz. I am confused about the source of this difference.

I firstly did the 2nd and 3rd force constants calculations using lammps:

using MLP with lammps to compute the 2nd and 3rd IFCs, here is the input file:

units metal
processors * * *
boundary p p p
atom_style atomic
atom_modify map yes
box tilt large
read_data lmp.data
pair_style nep nep.txt
pair_coeff * *
print 'calculating dynmat'
dynamical_matrix all eskm 1e-06 file Dyn.form binary no
print 'calculating third_order'
third_order all eskm 1e-06 file THIRD binary no

then used the kaldo to compute the harmonic frequency and plot the phonon dispersion with this below code:
image

After doing these, I can successfully get the phonon dispersion and thermal conductivity. However, when I use the phonopy + the same MLP to compute the phonon dispersion, I found there is a large difference between two results from Phonopy and Kaldo, respectively. I attached the figures below for your review:

from kaldo:
image

from Phonopy:
image

I tried to understand this by doing some tests:

  1. I changed the displacement magnitude of the finite difference method in lammps from 1e-6 to 1e-2 (because I know that Phonopy usually moves the atoms with a displacement of 1e-2), but the phonon dispersions are no distinct changes.
  2. I understand that the k-paths are different from two packages to plot the phonon dispersion, while the maximum frequencies at Gamma point are also different from two packages, which is unacceptable.

If it's possible, could you give me some advices to understand this? Many thanks in advance.

Cheers,
zezhu

How to get generalized group velocities and specific heat without 3rd force constants

Hi developers,

I have obtained phonon bandwidths of a big system through extropolating those of a small system using the script in the example "amorphous_si_with_extrapolation". But I cannot use 'ForceConstants.from_folder' method to build the 'Forceconstants' instance with only 2nd order force constants and then 'Phonons' instance. As a result, I cannot get the generalized group velocity and generalized specific heat to calculate the thermal conductivity. I didn't see any clues about achieving it in examples. If you can give me any advice, I will appreacite it very much.

Best regards,
Zhuangli Cai

Exporting 3rd force constants using kaldo

Dear developers,

Is it possible for kaldo to export the 3rd force constants as the file format that can be used in other software, like Phono3py, or hiPhive? Thank you~

QHGK

It is a so nice software!!! Thank you so much!

Store the 3rd order force constants projections

Implementation details:

  • currently, the delta calculation includes the phonon densities. The multiplication by the phonon densities needs to be moved later in the calculations.
  • the projection method should be split into 2 parts so that we can use the sparsity of the delta to store a sparse potential (same triplets of q coordinates as the delta), and use a separate method to complete the calculation and add the phonon densities.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.