Skip to content

Commit

Permalink
Update modelnac to adapt namd_lmi
Browse files Browse the repository at this point in the history
  • Loading branch information
Ionizing committed Dec 17, 2024
1 parent b9c86f2 commit 5a06ffc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 35 deletions.
41 changes: 9 additions & 32 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,20 @@ jobs:

linux-x86_64:
runs-on: ubuntu-latest
container: centos:7
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v3
- uses: actions-rs/toolchain@v1
with:
node-version: '16'

- name: Install Rust
run: |
sed -i.bak \
-e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://vault.centos.org/centos|g' \
/etc/yum.repos.d/CentOS-Base.repo
yum makecache
yum group install -y 'Development Tools'
yum install -y which
yum install -y epel-release
yum install -y cmake3
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
--family cmake
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
--family cmake
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --target x86_64-unknown-linux-gnu
echo $HOME/.cargo/bin >> $GITHUB_PATH
source $HOME/.cargo/env
which rustup
which cargo
profile: minimal
toolchain: stable
default: true

- name: Build
run: |
cargo build --verbose --release --target x86_64-unknown-linux-gnu
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --target x86_64-unknown-linux-gnu --no-default-features
use-cross: true

- name: Optimize and package binary
run: |
Expand Down
6 changes: 6 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build]
xargo = false
default-target = "x86_64-unknown-linux-gnu"

[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main-centos"
8 changes: 5 additions & 3 deletions src/commands/modelnac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ I suggest providing `gamma_half` argument to avoid confusion.");
// <i|p|j>, transition dipole moment
let mut pijs = na::Array5::<c64>::zeros((nsw, nspin, 3, nbrange, nbrange));

let nspinor = match wav.wavecar_type {
WavecarType::NonCollinear => 2,
_ => 1usize,
let lncl = match wav.wavecar_type {
WavecarType::NonCollinear => true,
_ => false,
};
let nspinor = if lncl { 2usize } else { 1 };
let nplw = wav.nplws[ikpoint - 1] as usize;
let mut phi = na::Array2::<c64>::zeros((nbrange, nplw));
let gvecs = na::arr2(&wav.generate_fft_grid_cart(ikpoint as u64 - 1))
Expand Down Expand Up @@ -192,6 +193,7 @@ I suggest providing `gamma_half` argument to avoid confusion.");

f.new_dataset::<usize>().create("ikpoint")?.write_scalar(&self.ikpoint)?;
f.new_dataset::<usize>().create("nspin")?.write_scalar(&nspin)?;
f.new_dataset::<bool>().create("lncl")?.write_scalar(&lncl)?;
f.new_dataset::<usize>().create("nbands")?.write_scalar(&nbands)?;
f.new_dataset::<usize>().create("ndigit")?.write_scalar(&4)?;
f.new_dataset::<[usize;2]>().create("brange")?.write_scalar(&brange)?;
Expand Down

0 comments on commit 5a06ffc

Please sign in to comment.