Comments (6)
Please have a look at the docstrings:
phono3py/phono3py/api_phono3py.py
Lines 1480 to 1507 in 19fc8c7
phono3py/phono3py/api_phono3py.py
Lines 1548 to 1561 in 19fc8c7
from phono3py.
I'm afraid that I don't see anything in the docstrings that explains the difference between the values returned by Phonopy and Phono3py for the fc2 (phonon) displacements. Is there a specific item that you think is particularly relevant?
I did just check what happens when I call Phono3py.generate_fc2_displacements()
, with and without is_diagonal=True
, and in every case it also returns 4 displacements, while Phonopy.generate_displacements()
returns only 3.
from phono3py.
Maybe I see your issue.
I didn't consider rerun generate_displacements
(or generate_fc2_displacements
). So with the same Phono3py instance, supercells_with_displacements
(or phonon_supercells_with_displacements
) is not updated. Please see the following scripts and runs. Is this your issue?
Case 1
import phonopy
import phono3py
cell = [
[5.9479774024925023, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 5.9479774024925023, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 5.9479774024925023],
]
nums = [55, 82, 35, 35, 35]
pos = [
[2.9739887012462511, 2.9739887012462511, 2.9739887012462511],
[0.0000000000000000, 0.0000000000000000, 0.0000000000000000],
[2.9739887012462511, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 2.9739887012462511, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 2.9739887012462511],
]
at_ph = phonopy.structure.atoms.PhonopyAtoms(numbers=nums, positions=pos, cell=cell)
print("is_diagonal=True:")
ph3 = phono3py.Phono3py(
at_ph, supercell_matrix=[2, 2, 2], phonon_supercell_matrix=[2, 2, 2]
)
ph3.generate_displacements(distance=0.1, is_diagonal=True)
print(
"number of displacements found by phono3py",
len(ph3.supercells_with_displacements),
)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=True)
print(
"number of phonon displacements found by phono3py",
len(ph3.phonon_supercells_with_displacements),
)
print("is_diagonal=False:")
ph3 = phono3py.Phono3py(
at_ph, supercell_matrix=[2, 2, 2], phonon_supercell_matrix=[2, 2, 2]
)
ph3.generate_displacements(distance=0.1, is_diagonal=False)
print(
"number of displacements found by phono3py",
len(ph3.supercells_with_displacements),
)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=False)
print(
"number of phonon displacements found by phono3py",
len(ph3.phonon_supercells_with_displacements),
)
% python generate-disps.py
is_diagonal=True:
number of displacements found by phono3py 220
number of phonon displacements found by phono3py 3
is_diagonal=False:
number of displacements found by phono3py 300
number of phonon displacements found by phono3py 4
Case 2
import phonopy
import phono3py
cell = [
[5.9479774024925023, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 5.9479774024925023, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 5.9479774024925023],
]
nums = [55, 82, 35, 35, 35]
pos = [
[2.9739887012462511, 2.9739887012462511, 2.9739887012462511],
[0.0000000000000000, 0.0000000000000000, 0.0000000000000000],
[2.9739887012462511, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 2.9739887012462511, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 2.9739887012462511],
]
at_ph = phonopy.structure.atoms.PhonopyAtoms(numbers=nums, positions=pos, cell=cell)
print("is_diagonal=True:")
ph3 = phono3py.Phono3py(
at_ph, supercell_matrix=[2, 2, 2], phonon_supercell_matrix=[2, 2, 2]
)
ph3.generate_displacements(distance=0.1, is_diagonal=True)
print(
"number of displacements found by phono3py",
len(ph3.supercells_with_displacements),
)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=True)
print(
"number of phonon displacements found by phono3py",
len(ph3.phonon_supercells_with_displacements),
)
print("is_diagonal=False:")
ph3.generate_displacements(distance=0.1, is_diagonal=False)
print(
"number of displacements found by phono3py",
len(ph3.supercells_with_displacements),
)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=False)
print(
"number of phonon displacements found by phono3py",
len(ph3.phonon_supercells_with_displacements),
)
% python generate-disps.py
is_diagonal=True:
number of displacements found by phono3py 220
number of phonon displacements found by phono3py 3
is_diagonal=False:
number of displacements found by phono3py 220
number of phonon displacements found by phono3py 3
from phono3py.
Thank you - it does appear that the sequence of operations is indeed the problem. However, I find the behavior even more surprising than your examples show. What looks like a simple access of the attribute ph3.phonon_supercells_with_displacements
, after the call to generate_displacements()
, makes it so the second call, to generate_fc2_displacements()
, does nothing. However, if I just call generate_displacements()
, access onlysupercells_with_displacements
, and then call generate_fc2_displacements()
, then I get the expect number of phonon displacements. The script below shows this behavior.
I think it would be helpful if the documentation was explicit about the allowed calling order, or even better, if the code detected that something has been run before and gave an error, rather than giving inconsistent numbers of displacement configurations depending on the order of calls.
import phonopy
import phono3py
cell = [
[5.9479774024925023, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 5.9479774024925023, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 5.9479774024925023],
]
nums = [55, 82, 35, 35, 35]
pos = [
[2.9739887012462511, 2.9739887012462511, 2.9739887012462511],
[0.0000000000000000, 0.0000000000000000, 0.0000000000000000],
[2.9739887012462511, 0.0000000000000000, 0.0000000000000000],
[0.0000000000000000, 2.9739887012462511, 0.0000000000000000],
[0.0000000000000000, 0.0000000000000000, 2.9739887012462511],
]
at_ph = phonopy.structure.atoms.PhonopyAtoms(numbers=nums, positions=pos, cell=cell)
####################################################################################################
ph3 = phono3py.Phono3py(
at_ph, supercell_matrix=[2, 2, 2], phonon_supercell_matrix=[2, 2, 2]
)
ph3.generate_displacements(distance=0.1, cutoff_pair_distance=4.0, is_diagonal=True)
l1 = len(ph3.supercells_with_displacements)
l2 = len(ph3.phonon_supercells_with_displacements)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=True)
print("number of phonon displacements from")
print(" generate_displacements()")
print(" len(supercells_With_displacements")
print(" len(phonon_supercells_with_displacements)")
print(" generate_fc2_displacements()")
print(" len(phonon_supercells_with_displacements)")
print(len(ph3.phonon_supercells_with_displacements))
print("")
####################################################################################################
ph3 = phono3py.Phono3py(
at_ph, supercell_matrix=[2, 2, 2], phonon_supercell_matrix=[2, 2, 2]
)
ph3.generate_displacements(distance=0.1, cutoff_pair_distance=4.0, is_diagonal=True)
l1 = len(ph3.supercells_with_displacements)
# l2 = len(ph3.phonon_supercells_with_displacements)
ph3.generate_fc2_displacements(distance=0.1, is_diagonal=True)
print("number of phonon displacements from")
print(" generate_displacements()")
print(" len(supercells_with_displacements)")
print(" generate_fc2_displacements()")
print(" len(phonon_supercells_with_displacements")
print(len(ph3.phonon_supercells_with_displacements))
Output:
number of phonon displacements from
generate_displacements()
len(supercells_With_displacements
len(phonon_supercells_with_displacements)
generate_fc2_displacements()
len(phonon_supercells_with_displacements)
4
number of phonon displacements from
generate_displacements()
len(supercells_with_displacements)
generate_fc2_displacements()
len(phonon_supercells_with_displacements
3
from phono3py.
Thanks your inputs. I fix it at PR #65. To run this, you need the develop branch of phonopy. After this fix, your last script results in
number of phonon displacements from
generate_displacements()
len(supercells_With_displacements
len(phonon_supercells_with_displacements)
generate_fc2_displacements()
len(phonon_supercells_with_displacements)
3
number of phonon displacements from
generate_displacements()
len(supercells_with_displacements)
generate_fc2_displacements()
len(phonon_supercells_with_displacements
3
from phono3py.
I close this issue because I think the issue is fixed. Please reopen if you need.
from phono3py.
Related Issues (20)
- compatbility with phono3py-kaccum is broken when using winger option HOT 1
- "disp_fc3.yaml" was not found. HOT 2
- pip install phono3py fails because site.cfg not found HOT 1
- Help: massive number of POSCAR-xxxxx produced by phono3py HOT 4
- Feature request for boundary scattering model HOT 2
- `--cutoff-pair` fails for non-VASP calculators HOT 1
- calculation of gruneisen parameters seems to be broken HOT 3
- Phono3py Installation Problems HOT 4
- magetic structure in phono3py HOT 3
- Another problem with pypy conda package HOT 4
- slow speed in generating displacements HOT 7
- Mistakes in the doc of hdf5 files HOT 13
- phono3py --cf3-file options broken HOT 13
- phono3py-kaccum error importing grid methods HOT 3
- Temperature dependent Phonon band structure HOT 1
- simulating antiferromagetic structure in phono3py HOT 5
- Phono3py installation issues HOT 4
- index # is out of bounds for axis 0 with size # HOT 3
- Cannot pip download source HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phono3py.