Skip to content

Commit 18bf9a8

Browse files
committed
Merge branch 'release/v.1.0.0'
2 parents 043671e + 66f6609 commit 18bf9a8

File tree

117 files changed

+18226
-4323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+18226
-4323
lines changed

ChangeLog.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# Ver. 1.0.0 (2017-11-21)
2+
3+
## New
4+
5+
- Self-consistent phonon calculation (``MODE = SCPH``)
6+
- Ewald summation for the non-analytic term of the dynamical matrix (``NONANALYTIC = 3``).
7+
- Support of the ``CLASSICAL`` option.
8+
- Python auxiliary script for LAMMPS
9+
10+
## Changes
11+
12+
- P+ and P- are printed seperately in PREFIX.sps when ``SPS = 1``
13+
- Use C++11 standard. From this version, the C++ compiler must support the C++11 standard.
14+
- The **anphon** code symmetrize the Born effective charges
15+
16+
## Fix
17+
18+
- Loosen the tolerance to detect the multiplicity of force constants. This is an important fix for low symmetry structures.
19+
- Fixed a problem of the restart mode of ``MODE = RTA``
20+
21+
122
# Ver. 0.9.8 (2016-7-14)
223

324
## New

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# ALAMODE
2-
### Version 0.9.8 (Beta)
1+
# ALAMODE
2+
3+
[![License][license-image]][license-url]
4+
[![Doc status][docs-image]][docs-url]
5+
6+
### Version 1.0.0
37
![alt ALAMODE](./docs/img/alamode.png)
48

9+
510
- - -
611

712
## Introduction
@@ -20,7 +25,7 @@ linewidth, and other anharmonic phonon properties from first principles.
2025
* Extraction of harmonic and anharmonic force constants based on the supercell approach
2126
* Applicable to any crystal structures and low-dimensional systems
2227
* Accurate treatment of translational and rotational invariance
23-
* Interface to VASP, Quantum-ESPRESSO, and xTAPP codes
28+
* Interface to VASP, Quantum-ESPRESSO, xTAPP, and LAMMPS codes
2429
* Parallelization with MPI+OpenMP
2530

2631
### Harmonic properties
@@ -43,12 +48,15 @@ linewidth, and other anharmonic phonon properties from first principles.
4348
* Phonon linewidth due to 3-phonon interactions
4449
* Phonon frequency shift due to 3- and 4-phonon interactions
4550
* Temperature-dependent effective potential method
51+
* Self-consistent phonon calculation
4652

4753
## Prerequisite
4854
* C++ compiler
49-
* LAPACK libarary
55+
* LAPACK library
5056
* MPI library
5157
* Boost C++ library
58+
* FFT library
59+
* Eigen3 library
5260

5361
## Download
5462

@@ -78,9 +86,23 @@ http://alamode.readthedocs.io
7886

7987

8088
## License
81-
Copyright (c) 2014, 2015, 2016 Terumasa Tadano
89+
Copyright (c) 2014--2017 Terumasa Tadano
8290
This software is released under the MIT license.
8391
For license rights and limitations, see LICENSE.txt file.
8492

8593
## Author
86-
Terumasa Tadano (The University of Tokyo, Japan)
94+
Terumasa Tadano (National Institute for Materials Science, Japan)
95+
96+
## Contributors
97+
98+
* Tatsuro Nishimoto (Univ. Tokyo)
99+
* Yusuke Oba (Univ. Tokyo)
100+
101+
102+
103+
[license-image]: https://img.shields.io/github/license/ttadano/alamode.svg
104+
[license-url]: https://github.com/ttadano/alamode/blob/develop/LICENSE.txt
105+
106+
[docs-image]: https://readthedocs.org/projects/alamode/badge/?version=latest
107+
[docs-url]: https://alamode.readthedocs.io/en/latest/?badge=latest
108+

alm/Makefile.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#-----------------------------------------------
77

88
CXX = icpc
9-
CXXFLAGS = -O2 -xHOST -openmp
9+
CXXFLAGS = -O2 -xHOST -openmp -std=c++11
1010
INCLUDE = -I../include
1111

1212
CXXL = ${CXX}

alm/Makefile.osx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
# Use gcc >= 4.8 to use OpenMP
99
# OpenMP-enabled gcc can be installed via homebrew
10-
CXX = g++-6
11-
CXXFLAGS = -O2 -fopenmp
10+
CXX = g++-7
11+
CXXFLAGS = -O2 -fopenmp -std=c++11
1212
INCLUDE = -I../include
1313

1414
CXXL = ${CXX}

alm/alamode.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ALM::ALM(int narg, char **arg)
7070

7171
finalize();
7272

73-
std::cout << std::endl << " Job finished at "
73+
std::cout << std::endl << " Job finished at "
7474
<< timer->DateAndTime() << std::endl;
7575
}
7676

@@ -116,4 +116,3 @@ void ALM::finalize()
116116
delete writes;
117117
delete memory;
118118
}
119-

alm/constraint.cpp

Lines changed: 81 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
using namespace ALM_NS;
3030

31-
Constraint::Constraint(ALM *alm) : Pointers(alm) {}
31+
Constraint::Constraint(ALM *alm) : Pointers(alm)
32+
{
33+
}
3234

3335
Constraint::~Constraint()
3436
{
@@ -556,25 +558,26 @@ void Constraint::constraint_from_symmetry(std::vector<ConstraintClass> *const_ou
556558
int **xyzcomponent;
557559
int nparams;
558560

561+
double *arr_constraint;
559562
bool has_constraint_from_symm = false;
560-
561563
std::set<FcProperty> list_found;
564+
std::vector<std::vector<double>> const_mat;
562565

563566
for (isym = 0; isym < symmetry->nsym; ++isym) {
564567
if (symmetry->sym_available[isym]) continue;
565568
has_constraint_from_symm = true;
566569
}
567570

568-
for (order = 0; order < maxorder; ++order) {
569-
const_out[order].clear();
570-
}
571+
for (order = 0; order < maxorder; ++order) const_out[order].clear();
571572

572573
if (has_constraint_from_symm) {
573574
std::cout << " Generating constraints from crystal symmetry ..." << std::endl;
574575
}
575576

576577
memory->allocate(index_tmp, maxorder + 1);
577578

579+
const_mat.clear();
580+
578581
for (order = 0; order < maxorder; ++order) {
579582

580583
nparams = fcs->ndup[order].size();
@@ -589,8 +592,7 @@ void Constraint::constraint_from_symmetry(std::vector<ConstraintClass> *const_ou
589592

590593
// Generate temporary list of parameters
591594
list_found.clear();
592-
for (std::vector<FcProperty>::iterator p = fcs->fc_set[order].begin();
593-
p != fcs->fc_set[order].end(); ++p) {
595+
for (auto p = fcs->fc_set[order].begin(); p != fcs->fc_set[order].end(); ++p) {
594596
for (i = 0; i < order + 2; ++i) index_tmp[i] = (*p).elems[i];
595597
list_found.insert(FcProperty(order + 2, (*p).coef,
596598
index_tmp, (*p).mother));
@@ -602,25 +604,33 @@ void Constraint::constraint_from_symmetry(std::vector<ConstraintClass> *const_ou
602604

603605
int nfcs = fcs->fc_set[order].size();
604606

605-
#pragma omp parallel
607+
#ifdef _OPENMP
608+
#pragma omp parallel
609+
#endif
606610
{
611+
int j;
607612
int i_prim;
608-
613+
int loc_nonzero;
609614
int *ind;
610615
int *atm_index, *atm_index_symm;
611616
int *xyz_index;
612617
double c_tmp;
613-
double *arr_constraint;
614618

615619
std::set<FcProperty>::iterator iter_found;
620+
std::vector<double> const_now_omp;
621+
std::vector<std::vector<double>> const_omp;
616622

617-
memory->allocate(arr_constraint, nparams);
618623
memory->allocate(ind, order + 2);
619624
memory->allocate(atm_index, order + 2);
620625
memory->allocate(atm_index_symm, order + 2);
621626
memory->allocate(xyz_index, order + 2);
622627

623-
#pragma omp for private(i, isym, ixyz)
628+
const_omp.clear();
629+
const_now_omp.resize(nparams);
630+
631+
#ifdef _OPENMP
632+
#pragma omp for private(i, isym, ixyz)
633+
#endif
624634
for (int ii = 0; ii < nfcs; ++ii) {
625635
FcProperty list_tmp = fcs->fc_set[order][ii];
626636

@@ -637,9 +647,9 @@ void Constraint::constraint_from_symmetry(std::vector<ConstraintClass> *const_ou
637647
atm_index_symm[i] = symmetry->map_sym[atm_index[i]][isym];
638648
if (!fcs->is_inprim(order + 2, atm_index_symm)) continue;
639649

640-
for (i = 0; i < nparams; ++i) arr_constraint[i] = 0.0;
650+
for (i = 0; i < nparams; ++i) const_now_omp[i] = 0.0;
641651

642-
arr_constraint[list_tmp.mother] = -list_tmp.coef;
652+
const_now_omp[list_tmp.mother] = -list_tmp.coef;
643653

644654
for (ixyz = 0; ixyz < nxyz; ++ixyz) {
645655
for (i = 0; i < order + 2; ++i)
@@ -652,32 +662,64 @@ void Constraint::constraint_from_symmetry(std::vector<ConstraintClass> *const_ou
652662
iter_found = list_found.find(FcProperty(order + 2, 1.0, ind, 1));
653663
if (iter_found != list_found.end()) {
654664
c_tmp = fcs->coef_sym(order + 2, isym, xyz_index, xyzcomponent[ixyz]);
655-
arr_constraint[(*iter_found).mother] += (*iter_found).coef * c_tmp;
665+
const_now_omp[(*iter_found).mother] += (*iter_found).coef * c_tmp;
656666
}
657667
}
658668

659-
if (!is_allzero(nparams, arr_constraint)) {
669+
if (!is_allzero(const_now_omp, loc_nonzero)) {
670+
if (const_now_omp[loc_nonzero] < 0.0) {
671+
for (j = 0; j < nparams; ++j) const_now_omp[j] *= -1.0;
672+
}
673+
const_omp.push_back(const_now_omp);
674+
}
675+
676+
} // close isym loop
677+
678+
679+
// sort-->uniq the array
680+
std::sort(const_omp.begin(), const_omp.end());
681+
const_omp.erase(std::unique(const_omp.begin(), const_omp.end()),
682+
const_omp.end());
683+
684+
// Merge vectors
660685
#pragma omp critical
661-
const_out[order].push_back(ConstraintClass(nparams,
662-
arr_constraint));
686+
{
687+
for (std::vector<std::vector<double>>::iterator it = const_omp.begin();
688+
it != const_omp.end(); ++it) {
689+
const_mat.push_back(*it);
663690
}
664691
}
665-
}
692+
const_omp.clear();
693+
694+
} // close ii loop
666695

667-
memory->deallocate(arr_constraint);
668696
memory->deallocate(ind);
669697
memory->deallocate(atm_index);
670698
memory->deallocate(atm_index_symm);
671699
memory->deallocate(xyz_index);
700+
701+
} // close openmp region
702+
703+
memory->allocate(arr_constraint, nparams);
704+
for (std::vector<std::vector<double>>::reverse_iterator it = const_mat.rbegin();
705+
it != const_mat.rend(); ++it) {
706+
for (i = 0; i < (*it).size(); ++i) {
707+
arr_constraint[i] = (*it)[i];
708+
}
709+
const_out[order].push_back(ConstraintClass(nparams,
710+
arr_constraint));
672711
}
712+
const_mat.clear();
673713

674714
memory->deallocate(xyzcomponent);
715+
memory->deallocate(arr_constraint);
716+
675717
remove_redundant_rows(nparams, const_out[order], eps8);
676718

677719
if (has_constraint_from_symm) {
678720
std::cout << " done." << std::endl;
679721
}
680-
}
722+
} // close loop order
681723

682724
memory->deallocate(index_tmp);
683725

@@ -712,11 +754,11 @@ void Constraint::translational_invariance()
712754
std::vector<int> intlist, data;
713755
std::set<FcProperty> list_found;
714756
std::set<FcProperty>::iterator iter_found;
715-
std::vector<std::vector<int> > data_vec;
757+
std::vector<std::vector<int>> data_vec;
716758
std::vector<FcProperty> list_vec;
717759
std::vector<FcProperty>::iterator iter_vec;
718760
std::vector<int> const_now;
719-
std::vector<std::vector<int> > const_mat;
761+
std::vector<std::vector<int>> const_mat;
720762

721763
std::cout << " Generating constraints for translational invariance ..." << std::endl;
722764

@@ -848,7 +890,7 @@ void Constraint::translational_invariance()
848890
memory->allocate(intarr_omp, order + 2);
849891
memory->allocate(intarr_copy_omp, order + 2);
850892

851-
std::vector<std::vector<int> > const_omp;
893+
std::vector<std::vector<int>> const_omp;
852894
std::vector<int> data_omp;
853895
std::vector<int> const_now_omp;
854896

@@ -913,7 +955,7 @@ void Constraint::translational_invariance()
913955
// Merge vectors
914956
#pragma omp critical
915957
{
916-
for (std::vector<std::vector<int> >::iterator it = const_omp.begin();
958+
for (std::vector<std::vector<int>>::iterator it = const_omp.begin();
917959
it != const_omp.end(); ++it) {
918960
const_mat.push_back(*it);
919961
}
@@ -943,7 +985,7 @@ void Constraint::translational_invariance()
943985
// Copy to constraint class
944986

945987
const_translation[order].clear();
946-
for (std::vector<std::vector<int> >::reverse_iterator it = const_mat.rbegin();
988+
for (std::vector<std::vector<int>>::reverse_iterator it = const_mat.rbegin();
947989
it != const_mat.rend(); ++it) {
948990
for (i = 0; i < (*it).size(); ++i) {
949991
arr_constraint[i] = static_cast<double>((*it)[i]);
@@ -1007,7 +1049,7 @@ void Constraint::rotational_invariance()
10071049
CombinationWithRepetition<int> g;
10081050

10091051
std::vector<int> atom_tmp;
1010-
std::vector<std::vector<int> > cell_dummy;
1052+
std::vector<std::vector<int>> cell_dummy;
10111053
std::set<MinimumDistanceCluster>::iterator iter_cluster;
10121054

10131055
setup_rotation_axis(valid_rotation_axis);
@@ -1614,7 +1656,6 @@ bool Constraint::is_allzero(const std::vector<int> vec, int &loc)
16141656
{
16151657
loc = -1;
16161658
for (int i = 0; i < vec.size(); ++i) {
1617-
// for(std::vector<int>::const_iterator it = vec.begin(); it != vec.end(); ++it){
16181659
if (std::abs(vec[i]) > 0) {
16191660
loc = i;
16201661
return false;
@@ -1623,6 +1664,18 @@ bool Constraint::is_allzero(const std::vector<int> vec, int &loc)
16231664
return true;
16241665
}
16251666

1667+
bool Constraint::is_allzero(const std::vector<double> vec, int &loc)
1668+
{
1669+
loc = -1;
1670+
for (int i = 0; i < vec.size(); ++i) {
1671+
if (std::abs(vec[i]) > eps) {
1672+
loc = i;
1673+
return false;
1674+
}
1675+
}
1676+
return true;
1677+
}
1678+
16261679
void Constraint::setup_rotation_axis(bool flag[3][3])
16271680
{
16281681
unsigned int mu, nu;

alm/constraint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ namespace ALM_NS
131131
void setup_rotation_axis(bool [3][3]);
132132
bool is_allzero(const int, const double *, const int nshift = 0);
133133
bool is_allzero(const std::vector<int>, int &);
134+
bool is_allzero(const std::vector<double>, int &);
134135

135136
void remove_redundant_rows(const int, std::vector<ConstraintClass> &,
136137
const double tolerance = eps12);

0 commit comments

Comments
 (0)