[ase-users] Stress not implemented in NPT

Ask Hjorth Larsen asklarsen at gmail.com
Sat Sep 1 17:54:23 CEST 2018


Dear Riping Wang,

Den lør. 1. sep. 2018 kl. 15.17 skrev Wang Riping via ase-users
<ase-users at listserv.fysik.dtu.dk>:
>
> 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())

It is the EMT calculator which does not implement stress.  NPT wants a
calculator which implements stress.

So you need a different calculator.  If you want the EMT potential
specifically, asap3 provides one which implements stress.

Best regards
Ask

>
> # 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
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users



More information about the ase-users mailing list