[ase-users] Stress not implemented in NPT

Wang Riping wangriping at outlook.com
Sat Sep 1 15:15:35 CEST 2018


Dear ASE,

I am going to run NPT with stress=True set in MDLogger, but it reports that  stress property not implemented.

The details of inport file and error reports are attached bellow.




Input file:

from ase import units

size = 3
T = 2000

# Set up a crystal
from ase.lattice.cubic import FaceCenteredCubic
atoms = FaceCenteredCubic(directions=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
                          symbol="Cu",
                          size=(size, size, size),
                          pbc=True)

# Describe the interatomic interactions with the Effective Medium Theory
from ase.calculators.emt import EMT
atoms.set_calculator(EMT())

# Set the momenta corresponding to T=300K
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
MaxwellBoltzmannDistribution(atoms, T * units.kB)

#Set the NPT MD
from ase.md.npt import NPT
dyn = NPT(atoms, 5*units.fs, 0, 0, None, None)

#Output MD
from ase.md import MDLogger
dyn.attach(MDLogger(dyn, atoms, logfile='md.log', header=True, stress=True, peratom=False, mode="w"), interval=1)

# Now run the dynamics
dyn.run(20000)

The error is bellow:

WARNING: NPT: Setting the center-of-mass momentum to zero (was 50.9644 19.3334 -23.9347)
Traceback (most recent call last):
  File "Cu_3.py", line 30, in <module>
    dyn.run(20000)
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/md/npt.py", line 248, in run
    self.call_observers()
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/optimize/optimize.py", line 108, in call_observers
    function(*args, **kwargs)
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/md/logger.py", line 97, in __call__
    dat += tuple(self.atoms.get_stress() / units.GPa)
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/atoms.py", line 758, in get_stress
    stress = self._calc.get_stress(self)
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/calculators/calculator.py", line 463, in get_stress
    return self.get_property('stress', atoms)
  File "/BIGDATA1/gyig_rpwang2_1/software/ase-3.16.2/ase/calculators/calculator.py", line 481, in get_property
    .format(name))
ase.calculators.calculator.PropertyNotImplementedError: stress property not implemented


Thank you very much for giving me suggestion.
Best regards.
Riping Wang
2018.9.1


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180901/450cbaf0/attachment.html>


More information about the ase-users mailing list