Commit 13bff076 authored by Sievers's avatar Sievers
Browse files

Added documentation, added an example, avoided position round off, added in...

Added documentation, added an example, avoided position round off, added in compute_pe's compute_scalar, now fix produces per-atom array instead of global array
parent 95de4f38
Loading
Loading
Loading
Loading
+78 −0
Original line number Diff line number Diff line
.. index:: fix numdiff

fix numdiff command
====================

Syntax
""""""


.. parsed-literal::

   fix ID group-ID numdiff Nevery Delta

* ID, group-ID are documented in :doc:`fix <fix>` command
* numdiff = style name of this fix command
* Nevery = calculate force by finite difference every this many timesteps
* Delta = finite difference displacement length (distance units)
  

Examples
""""""""


.. parsed-literal::

   fix 1 all numdiff 1 0.0001
   fix 1 all numdiff 10 1e-6
   fix 1 all numdiff 100 0.01

Description
"""""""""""

Calculate forces through finite difference of energy versus position.
The resulting per-atom forces can be used by :doc:`dump custom <dump>`.

The group specified with the command means only atoms within the group
have their averages computed.  Results are set to 0.0 for atoms not in
the group.


----------


The *Nevery*\ argument specifies on what timesteps the force will 
be used calculated by finite difference.

The *Delta*\ argument specifies the positional displacement each
atom will undergo.


----------


**Restart, fix\_modify, output, run start/stop, minimize info:**

No information about this fix is written to :doc:`binary restart files <restart>`.  None of the :doc:`fix_modify <fix_modify>` options
are relevant to this fix.  No global scalar or vector quantities are
stored by this fix for access by various :doc:`output commands <Howto_output>`.

This fix produces a per-atom array which can be accessed by
various :doc:`output commands <Howto_output>`.  .  This fix produces
a per-atom array of the forces calculated by finite difference. The
per-atom values should only be accessed on timesteps that are multiples
of *Nfreq* since that is when the finite difference forces are calculated.

No parameter of this fix can be used with the *start/stop* keywords of
the :doc:`run <run>` command.  This fix is invoked during :doc:`energy minimization <minimize>`.

Restrictions
""""""""""""
 none

Related commands
""""""""""""""""

:doc:`dynamical_matrix <dynamical_matrix>`,

**Default:** none
+13 −0
Original line number Diff line number Diff line
# LAMMPS FIX NUMDIFF EXAMPLE

## Numerical Difference Fix

This directory contains the ingredients to run an NVE simulation using the numerical difference fix and calculate error in forces.

Example:
```
NP=4 #number of processors
mpirun -np $NP lmp_mpi -in.numdiff
```

## Required LAMMPS packages: MOLECULE package
+886 −0

File added.

Preview size limit exceeded, changes collapsed.

+20 −0
Original line number Diff line number Diff line
#############################
#Atoms types - mass - charge#
#############################
#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!#

variable Ar equal 1

#############
#Atom Masses#
#############

mass ${Ar}      39.903

###########################
#Pair Potentials - Tersoff#
###########################

pair_style      lj/cubic
pair_coeff      * * 0.0102701 3.42
+28 −0
Original line number Diff line number Diff line
# Numerical difference calculation of error in forces

units   	metal
atom_style      full

boundary 	p p p
read_data argon.lmp

include ff-argon.lmp

velocity all create 10 2357 mom yes dist gaussian

neighbor 1 bin

timestep 0.001

fix numdiff all numdiff 200 0.0001
fix nve all nve

variable errx atom fx-f_numdiff[1]
variable erry atom fy-f_numdiff[2]
variable errz atom fz-f_numdiff[3]

dump forces all custom 200 force_error.dump v_errx v_erry v_errz
thermo 200
run 2000

Loading