From 5a06ffc144e3e88d802fa40266f0f6d9c2d99e9a Mon Sep 17 00:00:00 2001 From: Ionizing Date: Tue, 17 Dec 2024 19:52:32 +0800 Subject: [PATCH] Update modelnac to adapt namd_lmi --- .github/workflows/release-binaries.yml | 41 ++++++-------------------- Cross.toml | 6 ++++ src/commands/modelnac.rs | 8 +++-- 3 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 Cross.toml diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index febe9d2..503f33b 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -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: | diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..7ee41f9 --- /dev/null +++ b/Cross.toml @@ -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" diff --git a/src/commands/modelnac.rs b/src/commands/modelnac.rs index 2cbb2ec..b1408c0 100644 --- a/src/commands/modelnac.rs +++ b/src/commands/modelnac.rs @@ -141,10 +141,11 @@ I suggest providing `gamma_half` argument to avoid confusion."); // , transition dipole moment let mut pijs = na::Array5::::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::::zeros((nbrange, nplw)); let gvecs = na::arr2(&wav.generate_fft_grid_cart(ikpoint as u64 - 1)) @@ -192,6 +193,7 @@ I suggest providing `gamma_half` argument to avoid confusion."); f.new_dataset::().create("ikpoint")?.write_scalar(&self.ikpoint)?; f.new_dataset::().create("nspin")?.write_scalar(&nspin)?; + f.new_dataset::().create("lncl")?.write_scalar(&lncl)?; f.new_dataset::().create("nbands")?.write_scalar(&nbands)?; f.new_dataset::().create("ndigit")?.write_scalar(&4)?; f.new_dataset::<[usize;2]>().create("brange")?.write_scalar(&brange)?;