Skip to content

Commit

Permalink
Merge pull request #163 from ICAMS/update_pressure_convergence
Browse files Browse the repository at this point in the history
Update pressure convergence
  • Loading branch information
srmnitc authored Dec 10, 2024
2 parents 29fd253 + 3076e3a commit f944cfc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.3.12
current_version = 1.3.13
commit = True
tag = True

Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,16 @@ jobs:
matrix:
include:
- operating-system: ubuntu-latest
python-version: 3.9
label: linux-64-py-3-9
prefix: /usr/share/miniconda3/envs/my-env
python-version: 3.11
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge
channel-priority: strict
activate-environment: my-env
use-mamba: true
- name: Set cache date and number
run: |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
cat .github/variables/cache_number.env >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: mamba env update -n my-env -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

environment-file: environment.yml
- name: run tests
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion calphy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from calphy.alchemy import Alchemy
from calphy.routines import MeltingTemp

__version__ = "1.3.12"
__version__ = "1.3.13"

def addtest(a,b):
return a+b
2 changes: 1 addition & 1 deletion calphy/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from ase.io import read, write
import shutil

__version__ = "1.3.12"
__version__ = "1.3.13"

def _check_equal(val):
if not (val[0]==val[1]==val[2]):
Expand Down
22 changes: 15 additions & 7 deletions calphy/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,12 @@ def process_pressure(self,):

#now we can check if it converted
file = os.path.join(self.simfolder, "avg.dat")
lx, ly, lz, ipress = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
lxpc = ipress
#we have to clean the data, so as just the last block is selected
lx, ly, lz, lxpc = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
lx = lx[-ncount+1:]
ly = ly[-ncount+1:]
lz = lx[-ncount+1:]
lxpc = lxpc[-ncount+1:]
mean = np.mean(lxpc)
std = np.std(lxpc)
volatom = np.mean((lx*ly*lz)/self.natoms)
Expand All @@ -612,16 +616,20 @@ def finalise_pressure(self,):
ncount = int(self.calc.md.n_small_steps)//int(self.calc.md.n_every_steps*self.calc.md.n_repeat_steps)

file = os.path.join(self.simfolder, "avg.dat")
lx, ly, lz, ipress = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
lxpc = ipress
lx, ly, lz, lxpc = np.loadtxt(file, usecols=(1, 2, 3, 4), unpack=True)
lx = lx[-ncount+1:]
ly = ly[-ncount+1:]
lz = lx[-ncount+1:]
lxpc = lxpc[-ncount+1:]

mean = np.mean(lxpc)
std = np.std(lxpc)
volatom = np.mean((lx*ly*lz)/self.natoms)

self.calc._pressure = mean
self.lx = np.round(np.mean(lx[-ncount+1:]), decimals=3)
self.ly = np.round(np.mean(ly[-ncount+1:]), decimals=3)
self.lz = np.round(np.mean(lz[-ncount+1:]), decimals=3)
self.lx = np.round(np.mean(lx), decimals=3)
self.ly = np.round(np.mean(ly), decimals=3)
self.lz = np.round(np.mean(lz), decimals=3)
self.volatom = volatom
self.vol = self.lx*self.ly*self.lz
self.rho = self.natoms/(self.lx*self.ly*self.lz)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
packages=find_packages(include=['calphy', 'calphy.*']),
test_suite='tests',
url='https://github.com/ICAMS/calphy',
version='1.3.12',
version='1.3.13',
zip_safe=False,
entry_points={
'console_scripts': [
Expand Down

0 comments on commit f944cfc

Please sign in to comment.