-
Notifications
You must be signed in to change notification settings - Fork 27
Description
I'm not entirely sure whether the issue lies with the configuration of the ASE installation or my script setup.The following sections present the script settings and the error content, respectively.
1.my script configuration
import numpy as np
from so3lr import So3lrCalculator
from ase.io import read
from ase.md.npt import NPT
from ase import units
from ase.io.trajectory import Trajectory
import os
atoms = read('input.xyz')
atoms.info['charge'] = -1.0
Create So3lr calculator
calc = So3lrCalculator(
calculate_stress=True,
lr_cutoff=10,
buffer_sr=1.5,
dtype=np.float64,
)
atoms.calc = calc
temperature = 300
pressure = 1.0
timestep = 0.5
md_cycles = 200
md_steps = 1000
Create NPT dynamics simulator
dyn = NPT(atoms,
timestep=timestep * units.fs,
temperature=temperature * units.kB,
externalstress=pressure * units.bar,
ttime=25 * units.fs,
pfactor=75 * units.fs)
Create trajectory file writer
traj = Trajectory('npt_trajectory.traj', 'w', atoms)
Define checkpoint saving function
def save_checkpoint():
"""Save checkpoint"""
checkpoint_data = {
'positions': atoms.get_positions(),
'cell': atoms.get_cell()[:],
'velocities': atoms.get_velocities(),
'time': dyn.get_time()
}
np.savez('checkpoint.npz', **checkpoint_data)
print(f"Checkpoint saved: step {dyn.get_number_of_steps()}, time {dyn.get_time():.1f} fs")
Attach checkpoint saving to the dynamics simulator
dyn.attach(save_checkpoint, interval=md_steps)
Attach trajectory recording to the dynamics simulator
dyn.attach(traj.write, interval=100)
Print initial state
print("Starting NPT simulation")
print(f"Temperature: {temperature} K")
print(f"Pressure: {pressure} bar")
print(f"Timestep: {timestep} fs")
print(f"Total steps: {md_cycles * md_steps}")
print(f"Number of atoms: {len(atoms)}")
Run NPT simulation
for cycle in range(md_cycles):
print(f"Cycle {cycle+1}/{md_cycles}")
# Run specified number of steps
dyn.run(steps=md_steps)
# Get current state information
energy = atoms.get_potential_energy()
temp_current = atoms.get_temperature()
stress = atoms.get_stress()
volume = atoms.get_volume()
print(f" Steps: {dyn.get_number_of_steps()}, "
f"Time: {dyn.get_time():.1f} fs, "
f"Energy: {energy:.3f} eV, "
f"Temperature: {temp_current:.1f} K, "
f"Volume: {volume:.1f} ų")
Close trajectory file
traj.close()
print("NPT simulation completed")
print(f"Final checkpoint saved as: checkpoint.npz")
print(f"Trajectory file: npt_trajectory.traj")
2.error
TypeError: quadratic_neighbor_list() got an unexpected keyword argument 'lr_cutoff'