diff --git a/doc/Makefile b/doc/Makefile index 4072e01c4a..6e6f36a378 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,7 +21,7 @@ HAS_VIRTUALENV = YES endif SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') -SOURCES=$(wildcard src/*.txt) +SOURCES=$(filter-out src/lammps_commands.txt src/lammps_tutorials.txt,$(wildcard src/*.txt)) OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst) .PHONY: help clean-all clean epub html pdf old venv spelling anchor_check diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt index 1a4d2eb779..ac6bfee64a 100644 --- a/doc/src/Manual.txt +++ b/doc/src/Manual.txt @@ -1,9 +1,9 @@ LAMMPS Users Manual - + - + @@ -21,7 +21,7 @@

LAMMPS Documentation :c,h3 -17 Jan 2018 version :c,h4 +22 Feb 2018 version :c,h4 Version info: :h4 @@ -176,11 +176,11 @@ END_RST --> 5.1 "Measuring performance"_acc_1 :ulb,b 5.2 "Algorithms and code options to boost performace"_acc_2 :b 5.3 "Accelerator packages with optimized styles"_acc_3 :b - 5.3.1 "GPU package"_accelerate_gpu.html :ulb,b + 5.3.1 "GPU package"_accelerate_gpu.html :b 5.3.2 "USER-INTEL package"_accelerate_intel.html :b 5.3.3 "KOKKOS package"_accelerate_kokkos.html :b 5.3.4 "USER-OMP package"_accelerate_omp.html :b - 5.3.5 "OPT package"_accelerate_opt.html :ule,b + 5.3.5 "OPT package"_accelerate_opt.html :b 5.4 "Comparison of various accelerator packages"_acc_4 :ule,b "How-to discussions"_Section_howto.html :l 6.1 "Restarting a simulation"_howto_1 :ulb,b diff --git a/doc/src/PDF/colvars-refman-lammps.pdf b/doc/src/PDF/colvars-refman-lammps.pdf index daa1393269..2d28758819 100644 Binary files a/doc/src/PDF/colvars-refman-lammps.pdf and b/doc/src/PDF/colvars-refman-lammps.pdf differ diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index 02ce6f2882..faf254f93d 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -978,6 +978,7 @@ KOKKOS, o = USER-OMP, t = OPT. "lj/cut/coul/long (gikot)"_pair_lj.html, "lj/cut/coul/long/cs"_pair_lj.html, "lj/cut/coul/msm (go)"_pair_lj.html, +"lj/cut/coul/wolf (o)"_pair_lj.html, "lj/cut/dipole/cut (go)"_pair_dipole.html, "lj/cut/dipole/long"_pair_dipole.html, "lj/cut/tip4p/cut (o)"_pair_lj.html, @@ -1011,7 +1012,7 @@ KOKKOS, o = USER-OMP, t = OPT. "reax"_pair_reax.html, "rebo (oi)"_pair_airebo.html, "resquared (go)"_pair_resquared.html, -"snap"_pair_snap.html, +"snap (k)"_pair_snap.html, "soft (go)"_pair_soft.html, "sw (giko)"_pair_sw.html, "table (gko)"_pair_table.html, diff --git a/doc/src/Section_intro.txt b/doc/src/Section_intro.txt index bfb6ef3901..604df6c1ae 100644 --- a/doc/src/Section_intro.txt +++ b/doc/src/Section_intro.txt @@ -507,11 +507,15 @@ we'll be pleased to add them to the "Movies"_http://lammps.sandia.gov/movies.html pages of the LAMMPS WWW site. -The core group of LAMMPS developers is at Sandia National Labs: +The primary LAMMPS developers are at Sandia National Labs and Temple University: Steve Plimpton, sjplimp at sandia.gov Aidan Thompson, athomps at sandia.gov -Paul Crozier, pscrozi at sandia.gov :ul +Stan Moore, stamoor at sandia.gov +Axel Kohlmeyer, akohlmey at gmail.com :ul + +Past primary developers include Paul Crozier and Mark Stevens, +both at Sandia, and Ray Shan, now at Materials Design. The following folks are responsible for significant contributions to the code, or other aspects of the LAMMPS development effort. Many of @@ -519,19 +523,20 @@ the packages they have written are somewhat unique to LAMMPS and the code would not be as general-purpose as it is without their expertise and efforts. -Axel Kohlmeyer (Temple U), akohlmey at gmail.com, SVN and Git repositories, indefatigable mail list responder, USER-CGSDK and USER-OMP packages +Axel Kohlmeyer (Temple U), akohlmey at gmail.com, SVN and Git repositories, indefatigable mail list responder, USER-CGSDK, USER-OMP, USER-COLVARS, USER-MOLFILE, USER-QMMM, USER-TALLY, and COMPRESS packages Roy Pollock (LLNL), Ewald and PPPM solvers -Mike Brown (ORNL), brownw at ornl.gov, GPU package +Mike Brown (ORNL), brownw at ornl.gov, GPU and USER-INTEL package Greg Wagner (Sandia), gjwagne at sandia.gov, MEAM package for MEAM potential Mike Parks (Sandia), mlparks at sandia.gov, PERI package for Peridynamics Rudra Mukherjee (JPL), Rudranarayan.M.Mukherjee at jpl.nasa.gov, POEMS package for articulated rigid body motion Reese Jones (Sandia) and collaborators, rjones at sandia.gov, USER-ATC package for atom/continuum coupling Ilya Valuev (JIHT), valuev at physik.hu-berlin.de, USER-AWPMD package for wave-packet MD -Christian Trott (U Tech Ilmenau), christian.trott at tu-ilmenau.de, USER-CUDA package +Christian Trott (U Tech Ilmenau), christian.trott at tu-ilmenau.de, USER-CUDA and KOKKOS packages Andres Jaramillo-Botero (Caltech), ajaramil at wag.caltech.edu, USER-EFF package for electron force field Christoph Kloss (JKU), Christoph.Kloss at jku.at, USER-LIGGGHTS package for granular models and granular/fluid coupling Metin Aktulga (LBL), hmaktulga at lbl.gov, USER-REAXC package for C version of ReaxFF -Georg Gunzenmuller (EMI), georg.ganzenmueller at emi.fhg.de, USER-SPH package :ul +Georg Gunzenmuller (EMI), georg.ganzenmueller at emi.fhg.de, USER-SMD and USER-SPH packages +Colin Denniston (U Western Ontario), cdennist at uwo.ca, USER-LB package :ul As discussed in "Section 13"_Section_history.html, LAMMPS originated as a cooperative project between DOE labs and industrial diff --git a/doc/src/Section_start.txt b/doc/src/Section_start.txt index affcae1e54..6473c346dc 100644 --- a/doc/src/Section_start.txt +++ b/doc/src/Section_start.txt @@ -803,6 +803,10 @@ currently installed. For those that are installed, it will list any files that are different in the src directory and package sub-directory. +Typing "make package-installed" or "make pi" will list which packages are +currently installed, without listing the status of packages that are not +installed. + Typing "make package-update" or "make pu" will overwrite src files with files from the package sub-directories if the package is installed. It should be used after a patch has been applied, since diff --git a/doc/src/Section_tools.txt b/doc/src/Section_tools.txt index 24c32c478a..e85c0d818f 100644 --- a/doc/src/Section_tools.txt +++ b/doc/src/Section_tools.txt @@ -184,7 +184,7 @@ doxygen tool :h4,link(doxygen) The tools/doxygen directory contains a shell script called doxygen.sh which can generate a call graph and API lists using -the "Doxygen"_http://doxygen.org software. +the "Doxygen software"_http://doxygen.org. See the included README file for details. diff --git a/doc/src/USER/atc/man_add_molecule.html b/doc/src/USER/atc/man_add_molecule.html index 99270c7276..8d9625e1bd 100644 --- a/doc/src/USER/atc/man_add_molecule.html +++ b/doc/src/USER/atc/man_add_molecule.html @@ -7,24 +7,22 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC add_molecule

-syntax

+

fix_modify AtC add_molecule

+syntax

fix_modify_AtC add_molecule <small|large> <TAG> <GROUP_NAME>

-

-examples

+

+examples

group WATERGROUP type 1 2
fix_modify AtC add_molecule small water WATERGROUP

-

-description

+

+description

Associates a tag with all molecules corresponding to a specified group.

-

-restrictions

-

-related

-

-default

+

+restrictions

+

+related

+

+default

No defaults for this command.


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_add_species.html b/doc/src/USER/atc/man_add_species.html index 95192034d9..9beded1b16 100644 --- a/doc/src/USER/atc/man_add_species.html +++ b/doc/src/USER/atc/man_add_species.html @@ -7,24 +7,22 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC add_species

-syntax

+

fix_modify AtC add_species

+syntax

fix_modify_AtC add_species <TAG> <group|type> <ID>

    @@ -35,21 +33,21 @@ syntax
  • <ID> = name of group or type number
-

-examples

+

+examples

fix_modify AtC add_species gold type 1
group GOLDGROUP type 1
fix_modify AtC add_species gold group GOLDGROUP

-

-description

+

+description

Associates a tag with all atoms of a specified type or within a specified group.

-

-restrictions

-

-related

-

-default

+

+restrictions

+

+related

+

+default

No defaults for this command.


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_atom_element_map.html b/doc/src/USER/atc/man_atom_element_map.html index 3073c0f920..6725170928 100644 --- a/doc/src/USER/atc/man_atom_element_map.html +++ b/doc/src/USER/atc/man_atom_element_map.html @@ -7,42 +7,40 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC atom_element_map

-syntax

+

fix_modify AtC atom_element_map

+syntax

fix_modify AtC atom_element_map <eulerian|lagrangian> <frequency>

  • frequency (int) : frequency of updating atom-to-continuum maps based on the current configuration - only for eulerian
-

-examples

+

+examples

fix_modify atc atom_element_map eulerian 100

-

-description

+

+description

Changes frame of reference from eulerian to lagrangian and sets the frequency for which the map from atoms to elements is reformed and all the attendant data is recalculated.

-

-restrictions

+

+restrictions

Cannot change map type after initialization.

-

-related

-

-default

+

+related

+

+default

lagrangian


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_atom_weight.html b/doc/src/USER/atc/man_atom_weight.html index 18b0dcae6e..28bc90fa01 100644 --- a/doc/src/USER/atc/man_atom_weight.html +++ b/doc/src/USER/atc/man_atom_weight.html @@ -7,24 +7,22 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC atom_weight

-syntax

+

fix_modify AtC atom_weight

+syntax

fix_modify AtC atom_weight <method> <arguments>

  • <method> =
    @@ -36,22 +34,22 @@ syntax read_in: list of values for atoms are read-in from specified file
-

-examples

+

+examples

fix_modify atc atom_weight constant myatoms 11.8
fix_modify atc atom_weight lattice
fix_modify atc atom_weight read-in atm_wt_file.txt

-

-description

+

+description

Command for assigning the value of atomic weights used for atomic integration in atom-continuum coupled simulations.

-

-restrictions

+

+restrictions

Use of lattice option requires a lattice type and parameter is already specified.

-

-related

-

-default

+

+related

+

+default

lattice


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_atomic_charge.html b/doc/src/USER/atc/man_atomic_charge.html index 718f8a433f..ef787f53ac 100644 --- a/doc/src/USER/atc/man_atomic_charge.html +++ b/doc/src/USER/atc/man_atomic_charge.html @@ -7,41 +7,39 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC atomic_charge

-syntax

+

fix_modify AtC atomic_charge

+syntax

fix_modify AtC <include | omit> atomic_charge

  • <include | omit> = switch to activiate/deactiviate inclusion of intrinsic atomic charge in ATC
-

-examples

+

+examples

fix_modify atc compute include atomic_charge

-

-description

+

+description

Determines whether AtC tracks the total charge as a finite element field

-

-restrictions

+

+restrictions

Required for: electrostatics

-

-related

-

-default

+

+related

+

+default

if the atom charge is defined, default is on, otherwise default is off


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_boundary.html b/doc/src/USER/atc/man_boundary.html index 3e877355f1..61596d3b31 100644 --- a/doc/src/USER/atc/man_boundary.html +++ b/doc/src/USER/atc/man_boundary.html @@ -7,38 +7,36 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC boundary

-syntax

+

fix_modify AtC boundary

+syntax

fix_modify AtC boundary type <atom-type-id>

  • <atom-type-id> = type id for atoms that represent a ficticious boundary internal to the FE mesh
-

-examples

+

+examples

fix_modify AtC boundary type ghost_atoms

-

-description

+

+description

Command to define the atoms that represent the ficticious boundary internal to the FE mesh. For fully overlapped MD/FE domains with periodic boundary conditions no boundary atoms should be defined.

-

-restrictions

-

-default

+

+restrictions

+

+default

none


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_boundary_dynamics.html b/doc/src/USER/atc/man_boundary_dynamics.html index 87696b8b43..40b82f3f61 100644 --- a/doc/src/USER/atc/man_boundary_dynamics.html +++ b/doc/src/USER/atc/man_boundary_dynamics.html @@ -7,36 +7,34 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC boundary_dynamics

-syntax

+

fix_modify AtC boundary_dynamics

+syntax

fix_modify AtC boundary_dynamics < on | damped_harmonic | prescribed | coupled | none > [args]

-

-description

+

+description

Sets different schemes for controlling boundary atoms. On will integrate the boundary atoms using the velocity-verlet algorithm. Damped harmonic uses a mass/spring/dashpot for the boundary atoms with added arguments of the damping and spring constants followed by the ratio of the boundary type mass to the desired mass. Prescribed forces the boundary atoms to follow the finite element displacement. Coupled does the same.

-

-restrictions

+

+restrictions

Boundary atoms must be specified. When using swaps between internal and boundary atoms, the initial configuration must have already correctly partitioned the two.

-

-related

-

-default

+

+related

+

+default

prescribed on


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_boundary_faceset.html b/doc/src/USER/atc/man_boundary_faceset.html index 2e96330d6c..7eb950f78e 100644 --- a/doc/src/USER/atc/man_boundary_faceset.html +++ b/doc/src/USER/atc/man_boundary_faceset.html @@ -7,38 +7,36 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC boundary_faceset

-syntax

+

fix_modify AtC boundary_faceset

+syntax

fix_modify AtC boundary_faceset <is | add> [args]

-

-examples

+

+examples

fix_modify AtC boundary_faceset is obndy

-

-description

+

+description

This command species the faceset name when using a faceset to compute the MD/FE boundary fluxes. The faceset must already exist.

-

-restrictions

+

+restrictions

This is only valid when fe_md_boundary is set to faceset.

-

-related

-

-default

+

+related

+

+default


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_boundary_integral.html b/doc/src/USER/atc/man_boundary_integral.html index 3e78f12963..0663dba176 100644 --- a/doc/src/USER/atc/man_boundary_integral.html +++ b/doc/src/USER/atc/man_boundary_integral.html @@ -7,43 +7,41 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC output boundary_integral

-syntax

+

fix_modify AtC output boundary_integral

+syntax

fix_modify AtC output boundary_integral [field] faceset [name]

  • field (string) : name of hardy field
  • name (string) : name of faceset
-

-examples

+

+examples

fix_modify AtC output boundary_integral stress faceset loop1

-

-description

+

+description

Calculates a surface integral of the given field dotted with the outward normal of the faces and puts output in the "GLOBALS" file

-

-restrictions

-

Must be used with the hardy/field type of AtC fix ( see fix atc command )

-

-related

-

-default

+

+restrictions

+

Must be used with the hardy/field type of AtC fix ( see fix atc command )

+

+related

+

+default

none


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_consistent_fe_initialization.html b/doc/src/USER/atc/man_consistent_fe_initialization.html index f4c33f5076..a731b09116 100644 --- a/doc/src/USER/atc/man_consistent_fe_initialization.html +++ b/doc/src/USER/atc/man_consistent_fe_initialization.html @@ -7,41 +7,39 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC consistent_fe_initialization

-syntax

+

fix_modify AtC consistent_fe_initialization

+syntax

fix_modify AtC consistent_fe_initialization <on | off>

  • <on|off> = switch to activiate/deactiviate the initial setting of FE intrinsic field to match the projected MD field
-

-examples

+

+examples

fix_modify atc consistent_fe_initialization on

-

-description

+

+description

Determines whether AtC initializes FE intrinsic fields (e.g., temperature) to match the projected MD values. This is particularly useful for fully overlapping simulations.

-

-restrictions

+

+restrictions

Can be used with: thermal, two_temperature. Cannot be used with time filtering on. Does not include boundary nodes.

-

-related

-

-default

+

+related

+

+default

Default is off


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_contour_integral.html b/doc/src/USER/atc/man_contour_integral.html index c321605e88..690f0fcc98 100644 --- a/doc/src/USER/atc/man_contour_integral.html +++ b/doc/src/USER/atc/man_contour_integral.html @@ -7,44 +7,42 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC output contour_integral

-syntax

+

fix_modify AtC output contour_integral

+syntax

fix_modify AtC output contour_integral [field] faceset [name] <axis [x | y | z ]>

  • field (string) : name of hardy field
  • name (string) : name of faceset
  • axis (string) : x or y or z
-

-examples

+

+examples

fix_modify AtC output contour_integral stress faceset loop1

-

-description

+

+description

Calculates a surface integral of the given field dotted with the outward normal of the faces and puts output in the "GLOBALS" file

-

-restrictions

-

Must be used with the hardy/field type of AtC fix ( see fix atc command )

-

-related

-

-default

+

+restrictions

+

Must be used with the hardy/field type of AtC fix ( see fix atc command )

+

+related

+

+default

none


Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_control.html b/doc/src/USER/atc/man_control.html index af0236f30e..900952ba0b 100644 --- a/doc/src/USER/atc/man_control.html +++ b/doc/src/USER/atc/man_control.html @@ -7,24 +7,22 @@ +
+ LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
+ +
+ + -
-

fix_modify AtC control

-syntax

+

fix_modify AtC control

+syntax

fix_modify AtC control <physics_type> <solution_parameter>


@@ -46,22 +44,22 @@ syntax
  • tolerance (float) = relative tolerance to which matrix equations will be solved
  • -

    -examples

    +

    +examples

    fix_modify AtC control thermal max_iterations 10
    fix_modify AtC control momentum tolerance 1.e-5

    -

    -description

    +

    +description

    Sets the numerical parameters for the matrix solvers used in the specified control algorithm. Many solution approaches require iterative solvers, and these methods enable users to provide the maximum number of iterations and the relative tolerance.

    -

    -restrictions

    +

    +restrictions

    only for be used with specific controllers : thermal, momentum
    They are ignored if a lumped solution is requested

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    max_iterations is the number of rows in the matrix
    tolerance is 1.e-10

    diff --git a/doc/src/USER/atc/man_control_momentum.html b/doc/src/USER/atc/man_control_momentum.html index 805c12567a..8f4f486595 100644 --- a/doc/src/USER/atc/man_control_momentum.html +++ b/doc/src/USER/atc/man_control_momentum.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control momentum

    -syntax

    +

    fix_modify AtC control momentum

    +syntax

    fix_modify AtC control momentum none

    fix_modify AtC control momentum rescale <frequency>
    @@ -44,21 +42,21 @@ syntax

  • face_set_id (string) = id of boundary face set, if not specified (or not possible when the atomic domain does not line up with mesh boundaries) defaults to an atomic-quadrature approximate evaulation
  • -

    -examples

    +

    +examples

    fix_modify AtC control momentum glc_velocity
    fix_modify AtC control momentum flux faceset bndy_faces

    -

    -description

    -

    -restrictions

    +

    +description

    +

    +restrictions

    only to be used with specific transfers : elastic
    rescale not valid with time filtering activated

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_control_thermal.html b/doc/src/USER/atc/man_control_thermal.html index 301297f306..eab186f715 100644 --- a/doc/src/USER/atc/man_control_thermal.html +++ b/doc/src/USER/atc/man_control_thermal.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control thermal

    -syntax

    +

    fix_modify AtC control thermal

    +syntax

    fix_modify AtC control thermal <control_type> <optional_args>

    • control_type (string) = none | rescale | hoover | flux
      @@ -46,25 +44,25 @@ syntax
    • face_set_id (string), optional = id of boundary face set, if not specified (or not possible when the atomic domain does not line up with mesh boundaries) defaults to an atomic-quadrature approximate evaulation, does not work with interpolate
    -

    -examples

    +

    +examples

    fix_modify AtC control thermal none
    fix_modify AtC control thermal rescale 10
    fix_modify AtC control thermal hoover
    fix_modify AtC control thermal flux
    fix_modify AtC control thermal flux faceset bndy_faces

    -

    -description

    +

    +description

    Sets the energy exchange mechansim from the finite elements to the atoms, managed through a control algorithm. Rescale computes a scale factor for each atom to match the finite element temperature. Hoover is a Gaussian least-constraint isokinetic thermostat enforces that the nodal restricted atomic temperature matches the finite element temperature. Flux is a similar mode, but rather adds energy to the atoms based on conservation of energy. Hoover and flux allows the prescription of sources or fixed temperatures on the atoms.

    -

    -restrictions

    +

    +restrictions

    only for be used with specific transfers : thermal (rescale, hoover, flux), two_temperature (flux)
    rescale not valid with time filtering activated

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    none
    rescale frequency is 1
    flux boundary_integration_type is interpolate

    diff --git a/doc/src/USER/atc/man_control_thermal_correction_max_iterations.html b/doc/src/USER/atc/man_control_thermal_correction_max_iterations.html index 8a511019f9..a337a495e0 100644 --- a/doc/src/USER/atc/man_control_thermal_correction_max_iterations.html +++ b/doc/src/USER/atc/man_control_thermal_correction_max_iterations.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control thermal correction_max_iterations

    -syntax

    +

    fix_modify AtC control thermal correction_max_iterations

    +syntax

    fix_modify AtC control thermal correction_max_iterations <max_iterations>

    • max_iterations (int) = maximum number of iterations that will be used by iterative matrix solvers
    -

    -examples

    +

    +examples

    fix_modify AtC control thermal correction_max_iterations 10

    -

    -description

    +

    +description

    Sets the maximum number of iterations to compute the 2nd order in time correction term for lambda with the fractional step method. The method uses the same tolerance as the controller's matrix solver.

    -

    -restrictions

    +

    +restrictions

    only for use with thermal physics using the fractional step method.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    correction_max_iterations is 20


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_decomposition.html b/doc/src/USER/atc/man_decomposition.html index 15725073d3..d54a201034 100644 --- a/doc/src/USER/atc/man_decomposition.html +++ b/doc/src/USER/atc/man_decomposition.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC decomposition

    -syntax

    +

    fix_modify AtC decomposition

    +syntax

    fix_modify AtC decomposition <type>

    • <type> =
      @@ -32,20 +30,20 @@ syntax distributed_memory: only owned nodal information on processor
    -

    -examples

    +

    +examples

    fix_modify atc decomposition distributed_memory

    -

    -description

    +

    +description

    Command for assigning the distribution of work and memory for parallel runs.

    -

    -restrictions

    +

    +restrictions

    replicated_memory is appropriate for simulations were the number of nodes << number of atoms

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    replicated_memory


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_electron_integration.html b/doc/src/USER/atc/man_electron_integration.html index b14c14d86d..ab454c16d2 100644 --- a/doc/src/USER/atc/man_electron_integration.html +++ b/doc/src/USER/atc/man_electron_integration.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC extrinsic electron_integration

    -syntax

    +

    fix_modify AtC extrinsic electron_integration

    +syntax

    fix_modify AtC extrinsic electron_integration <integration_type> <num_subcyle_steps(optional)>

      @@ -32,20 +30,20 @@ syntax
    • num_subcycle_steps (int), optional = number of subcycle steps for the electron time integration
    -

    -examples

    +

    +examples

    fix_modify AtC extrinsic electron_integration implicit
    fix_modify AtC extrinsic electron_integration explicit 100

    -

    -description

    +

    +description

    Switches between integration scheme for the electron temperature. The number of subcyling steps used to integrate the electron temperature 1 LAMMPS timestep can be manually adjusted to capture fast electron dynamics.

    -

    -restrictions

    -

    For use only with two_temperature type of AtC fix ( see fix atc command )
    +

    +restrictions

    +

    For use only with two_temperature type of AtC fix ( see fix atc command )

    -

    -default

    +

    +default

    implicit
    subcycle_steps = 1

    diff --git a/doc/src/USER/atc/man_equilibrium_start.html b/doc/src/USER/atc/man_equilibrium_start.html index 3723cf98bf..d01253c4b3 100644 --- a/doc/src/USER/atc/man_equilibrium_start.html +++ b/doc/src/USER/atc/man_equilibrium_start.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC equilibrium_start

    -syntax

    +

    fix_modify AtC equilibrium_start

    +syntax

    fix_modify AtC equilibrium_start <on|off>

    -

    -examples

    +

    +examples

    fix_modify atc equilibrium_start on

    -

    -description

    +

    +description

    Starts filtered calculations assuming they start in equilibrium, i.e. perfect finite element force balance.

    -

    -restrictions

    +

    +restrictions

    only needed before filtering is begun

    -

    -related

    +

    +related

    see fix_modify AtC filter

    -

    -default

    +

    +default

    on


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_extrinsic_exchange.html b/doc/src/USER/atc/man_extrinsic_exchange.html index 8f6533ad64..4f1f5962d9 100644 --- a/doc/src/USER/atc/man_extrinsic_exchange.html +++ b/doc/src/USER/atc/man_extrinsic_exchange.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC extrinsic exchange

    -syntax

    +

    fix_modify AtC extrinsic exchange

    +syntax

    fix_modify AtC extrinsic exchange <on|off>

    -

    -examples

    +

    +examples

    fix_modify AtC extrinsic exchange on

    -

    -description

    +

    +description

    Switches energy exchange between the MD system and electron system on and off

    -

    -restrictions

    +

    +restrictions

    Only valid for use with two_temperature type of AtC fix.

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +related

    +

    see fix atc command

    +

    +default

    on


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_fe_md_boundary.html b/doc/src/USER/atc/man_fe_md_boundary.html index 06bca2b337..e517dd4855 100644 --- a/doc/src/USER/atc/man_fe_md_boundary.html +++ b/doc/src/USER/atc/man_fe_md_boundary.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC fe_md_boundary

    -syntax

    +

    fix_modify AtC fe_md_boundary

    +syntax

    fix_modify AtC fe_md_boundary <faceset | interpolate | no_boundary> [args]

    -

    -examples

    +

    +examples

    fix_modify atc fe_md_boundary interpolate

    -

    -description

    +

    +description

    Specifies different methods for computing fluxes between between the MD and FE integration regions. Faceset defines a faceset separating the MD and FE regions and uses finite element face quadrature to compute the flux. Interpolate uses a reconstruction scheme to approximate the flux, which is more robust but less accurate if the MD/FE boundary does correspond to a faceset. No boundary results in no fluxes between the systems being computed.

    -

    -restrictions

    +

    +restrictions

    If faceset is used, all the AtC non-boundary atoms must lie within and completely fill the domain enclosed by the faceset.

    -

    -related

    +

    +related

    see for how to specify the faceset name.

    -

    -default

    +

    +default

    Interpolate.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_fem_mesh.html b/doc/src/USER/atc/man_fem_mesh.html index 2abd84d6ce..b8ba584816 100644 --- a/doc/src/USER/atc/man_fem_mesh.html +++ b/doc/src/USER/atc/man_fem_mesh.html @@ -1,24 +1,45 @@ - - + + + + ATC: fix_modify AtC fem create mesh - - - -

    fix_modify AtC fem create mesh

    -syntax

    + + + + +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + + +
    + +

    fix_modify AtC fem create mesh

    +syntax

    fix_modify AtC fem create mesh <nx> <ny> <nz> <region-id> <f|p> <f|p> <f|p>
    • nx ny nz = number of elements in x, y, z
    • region-id = id of region that is to be meshed
    • f p p = perioidicity flags for x, y, z
    -

    -examples

    - fix_modify AtC fem create mesh 10 1 1 feRegion p p p

    -description

    -Creates a uniform mesh in a rectangular region

    -restrictions

    -creates only uniform rectangular grids in a rectangular region

    -related

    -

    -default

    -none
    Generated on Mon Aug 17 09:35:16 2009 for ATC by  +

    +examples

    +

    fix_modify AtC fem create mesh 10 1 1 feRegion p p p
    +

    +

    +description

    +

    Creates a uniform mesh in a rectangular region

    +

    +restrictions

    +

    creates only uniform rectangular grids in a rectangular region

    +

    +related

    +

    +default

    +none +
    Generated on Mon Aug 17 09:35:16 2009 for ATC by  doxygen 1.3.9.1
    diff --git a/doc/src/USER/atc/man_filter_scale.html b/doc/src/USER/atc/man_filter_scale.html index 975f87e949..7a871f5c81 100644 --- a/doc/src/USER/atc/man_filter_scale.html +++ b/doc/src/USER/atc/man_filter_scale.html @@ -7,45 +7,43 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC filter scale

    -syntax

    +

    fix_modify AtC filter scale

    +syntax

    fix_modify AtC filter scale <scale>

    • scale (real) = characteristic time scale of the filter
    -

    -examples

    +

    +examples

    fix_modify AtC filter scale 10.0

    -

    -description

    +

    +description

    Filters the MD dynamics to construct a more appropriate continuous field. Equilibrating first filters the time derivatives without changing the dynamics to provide a better initial condition to the filtered dynamics

    -

    -restrictions

    +

    +restrictions

    only for be used with specific transfers: thermal, two_temperature

    -

    -related

    +

    +related

    fix_modify AtC filter fix_modify AtC filter type

    -

    -default

    +

    +default

    0.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_filter_type.html b/doc/src/USER/atc/man_filter_type.html index 8d9dbd3d12..2711d128e9 100644 --- a/doc/src/USER/atc/man_filter_type.html +++ b/doc/src/USER/atc/man_filter_type.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC filter type

    -syntax

    +

    fix_modify AtC filter type

    +syntax

    fix_modify AtC filter type <exponential | step | no_filter>

    -

    -examples

    +

    +examples

    fix_modify AtC filter type exponential

    -

    -description

    +

    +description

    Specifies the type of time filter used.

    -

    -restrictions

    +

    +restrictions

    only for be used with specific transfers: thermal, two_temperature

    -

    -related

    +

    +related

    fix_modify AtC filter fix_modify AtC filter scale

    -

    -default

    +

    +default

    No default.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_fix_atc.html b/doc/src/USER/atc/man_fix_atc.html index e710c28ed2..7cc6cfea5b 100644 --- a/doc/src/USER/atc/man_fix_atc.html +++ b/doc/src/USER/atc/man_fix_atc.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix atc command

    -syntax

    +

    fix atc command

    +syntax

    fix <fixID> <group> atc <type> <parameter_file>

    • fixID = name of fix
    • @@ -38,15 +36,15 @@ syntax
    • parameter_file = name of the file with material parameters.
      note: Neither hardy nor field requires a parameter file
    -

    -examples

    +

    +examples

    fix AtC internal atc thermal Ar_thermal.dat
    fix AtC internal atc two_temperature Ar_ttm.mat
    fix AtC internal atc hardy
    fix AtC internal atc field

    -

    -description

    +

    +description

    This fix is the beginning to creating a coupled FE/MD simulation and/or an on-the-fly estimation of continuum fields. The coupled versions of this fix do Verlet integration and the /post-processing does not. After instantiating this fix, several other fix_modify commands will be needed to set up the problem, e.g. define the finite element mesh and prescribe initial and boundary conditions.

    The following coupling example is typical, but non-exhaustive:

    @@ -134,16 +132,16 @@ description

    Please refer to the standard finite element (FE) texts, e.g. T.J.R Hughes The finite element method , Dover 2003, for the basics of FE simulation.

    -

    -restrictions

    +

    +restrictions

    Thermal and two_temperature (coupling) types use a Verlet time-integration algorithm. The hardy type does not contain its own time-integrator and must be used with a separate fix that does contain one, e.g. nve, nvt, etc.

    Currently,

    • the coupling is restricted to thermal physics
    • the FE computations are done in serial on each processor.
    -

    -related

    +

    +related

    fix_modify commands for setup:

    Note: a set of example input files with the attendant material files are included with this package

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_fix_flux.html b/doc/src/USER/atc/man_fix_flux.html index d8369a8785..42815def6b 100644 --- a/doc/src/USER/atc/man_fix_flux.html +++ b/doc/src/USER/atc/man_fix_flux.html @@ -7,44 +7,42 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC fix_flux

    -syntax

    +

    fix_modify AtC fix_flux

    +syntax

    fix_modify AtC fix_flux <field> <face_set> <value | function>

    • <field> = field name valid for type of physics, temperature | electron_temperature
    • <face_set> = name of set of element faces
    -

    -examples

    +

    +examples

    fix_modify atc fix_flux temperature faceSet 10.0

    -

    -description

    +

    +description

    Command for fixing normal fluxes e.g. heat_flux. This command only prescribes the normal component of the physical flux, e.g. heat (energy) flux. The units are in AtC units, i.e. derived from the LAMMPS length, time, and mass scales.

    -

    -restrictions

    +

    +restrictions

    Only normal fluxes (Neumann data) can be prescribed.

    -

    -related

    +

    +related

    see fix_modify AtC unfix_flux

    -

    -default

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_fix_nodes.html b/doc/src/USER/atc/man_fix_nodes.html index cf5c93590a..03cf86eb92 100644 --- a/doc/src/USER/atc/man_fix_nodes.html +++ b/doc/src/USER/atc/man_fix_nodes.html @@ -7,46 +7,44 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC fix

    -syntax

    +

    fix_modify AtC fix

    +syntax

    fix_modify AtC fix <field> <nodeset> <constant | function>

    • <field> = field name valid for type of physics
    • <nodeset> = name of set of nodes to apply boundary condition
    • <constant | function> = value or name of function followed by its parameters
    -

    -examples

    +

    +examples

    fix_modify AtC fix temperature groupNAME 10.
    fix_modify AtC fix temperature groupNAME 0 0 0 10.0 0 0 1.0

    -

    -description

    +

    +description

    Creates a constraint on the values of the specified field at specified nodes.

    -

    -restrictions

    +

    +restrictions

    keyword 'all' reserved in nodeset name

    -

    -related

    +

    +related

    see fix_modify AtC unfix

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_hardy_computes.html b/doc/src/USER/atc/man_hardy_computes.html index c16550742b..b45b7dfb01 100644 --- a/doc/src/USER/atc/man_hardy_computes.html +++ b/doc/src/USER/atc/man_hardy_computes.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC computes

    -syntax

    +

    fix_modify AtC computes

    +syntax

    fix_modify AtC computes <add | delete> [per-atom compute id] <volume | number>

      @@ -35,8 +33,8 @@ syntax
    • volume | number (keyword) = field created is a per-unit-volume quantity or a per-atom quantity as weighted by kernel functions
    -

    -examples

    +

    +examples

    compute virial all stress/atom
    fix_modify AtC computes add virial volume
    fix_modify AtC computes delete virial
    @@ -44,20 +42,20 @@ examples compute centrosymmetry all centro/atom
    fix_modify AtC computes add centrosymmetry number

    -

    -description

    +

    +description

    Calculates continuum fields corresponding to specified per-atom computes created by LAMMPS

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix ( see fix atc command )
    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix ( see fix atc command )
    Per-atom compute must be specified before corresponding continuum field can be requested

    -

    -related

    +

    +related

    See manual page for compute

    -

    -default

    +

    +default

    No defaults exist for this command


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_hardy_fields.html b/doc/src/USER/atc/man_hardy_fields.html index 1f55fd5e37..17903aabd0 100644 --- a/doc/src/USER/atc/man_hardy_fields.html +++ b/doc/src/USER/atc/man_hardy_fields.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC fields

    -syntax

    +

    fix_modify AtC fields

    +syntax

    fix_modify AtC fields <all | none>
    fix_modify AtC fields <add | delete> <list_of_fields>

    @@ -56,24 +54,24 @@ syntax type_concentration: volume fraction of a specific atom type
    -

    -examples

    +

    +examples

    fix_modify AtC fields add velocity temperature

    -

    -description

    +

    +description

    Allows modification of the fields calculated and output by the transfer class. The commands are cumulative, e.g.
    fix_modify AtC fields none
    followed by
    fix_modify AtC fields add velocity temperature
    will only output the velocity and temperature fields.

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix, see fix atc command. Currently, the stress and heat flux formulas are only correct for central force potentials, e.g. Lennard-Jones and EAM but not Stillinger-Weber.

    -

    -related

    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix, see fix atc command. Currently, the stress and heat flux formulas are only correct for central force potentials, e.g. Lennard-Jones and EAM but not Stillinger-Weber.

    +

    +related

    See fix_modify AtC gradients , fix_modify AtC rates and fix_modify AtC computes

    -

    -default

    +

    +default

    By default, no fields are output


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_hardy_gradients.html b/doc/src/USER/atc/man_hardy_gradients.html index 708fecbca1..00935f0ae2 100644 --- a/doc/src/USER/atc/man_hardy_gradients.html +++ b/doc/src/USER/atc/man_hardy_gradients.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC gradients

    -syntax

    +

    fix_modify AtC gradients

    +syntax

    fix_modify AtC gradients <add | delete> <list_of_fields>

      @@ -33,21 +31,21 @@ syntax
    • fields (keyword) =
      gradients can be calculated for all fields listed in fix_modify AtC fields
    -

    -examples

    +

    +examples

    fix_modify AtC gradients add temperature velocity stress
    fix_modify AtC gradients delete velocity

    -

    -description

    +

    +description

    Requests calculation and ouput of gradients of the fields from the transfer class. These gradients will be with regard to spatial or material coordinate for eulerian or lagrangian analysis, respectively, as specified by atom_element_map (see fix_modify AtC atom_element_map )

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    -

    -related

    -

    -default

    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    +

    +related

    +

    +default

    No gradients are calculated by default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_hardy_kernel.html b/doc/src/USER/atc/man_hardy_kernel.html index 3d81b367dd..f97037784c 100644 --- a/doc/src/USER/atc/man_hardy_kernel.html +++ b/doc/src/USER/atc/man_hardy_kernel.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC kernel

    -syntax

    +

    fix_modify AtC kernel

    +syntax

    fix_modify AtC kernel <type> <parameters>

    • type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere, quartic_bar, quartic_cylinder, quartic_sphere
      @@ -40,22 +38,22 @@ syntax quartic_sphere = radius (double)
    -

    -examples

    +

    +examples

    fix_modify AtC kernel cell 1.0 1.0 1.0
    fix_modify AtC kernel quartic_sphere 10.0

    -

    -description

    -

    -restrictions

    +

    +description

    +

    +restrictions

    Must be used with the hardy AtC fix
    For bar kernel types, half-width oriented along x-direction
    For cylinder kernel types, cylindrical axis is assumed to be in z-direction
    - ( see fix atc command )

    -

    -related

    -

    -default

    + ( see fix atc command )

    +

    +related

    +

    +default

    No default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_hardy_on_the_fly.html b/doc/src/USER/atc/man_hardy_on_the_fly.html index d140cf6840..79c1006c97 100644 --- a/doc/src/USER/atc/man_hardy_on_the_fly.html +++ b/doc/src/USER/atc/man_hardy_on_the_fly.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC on_the_fly

    -syntax

    +

    fix_modify AtC on_the_fly

    +syntax

    fix_modify AtC on_the_fly <bond | kernel> <optional on | off>
    - bond | kernel (keyword) = specifies on-the-fly calculation of bond or kernel matrix elements

    @@ -32,24 +30,24 @@ syntax
  • on | off (keyword) = activate or discontinue on-the-fly mode
  • -

    -examples

    +

    +examples

    fix_modify AtC on_the_fly bond on
    fix_modify AtC on_the_fly kernel
    fix_modify AtC on_the_fly kernel off

    -

    -description

    +

    +description

    Overrides normal mode of pre-calculating and storing bond pair-to-node a nd kernel atom-to-node matrices. If activated, will calculate elements of t hese matrices during repeated calls of field computations (i.e. "on-the-fly") and not store them for future use.
    on flag is optional - if omitted, on_the_fly will be activated for the s pecified matrix. Can be deactivated using off flag.

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    -

    -related

    -

    -default

    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    +

    +related

    +

    +default

    By default, on-the-fly calculation is not active (i.e. off). However, code does a memory allocation check to determine if it can store all needed bond and kernel matrix ele ments. If this allocation fails, on-the-fly is activated.

    diff --git a/doc/src/USER/atc/man_hardy_rates.html b/doc/src/USER/atc/man_hardy_rates.html index ab0315cb65..e51cbc9873 100644 --- a/doc/src/USER/atc/man_hardy_rates.html +++ b/doc/src/USER/atc/man_hardy_rates.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC rates

    -syntax

    +

    fix_modify AtC rates

    +syntax

    fix_modify AtC rates <add | delete> <list_of_fields>

      @@ -33,22 +31,22 @@ syntax
    • fields (keyword) =
      rates can be calculated for all fields listed in fix_modify AtC fields
    -

    -examples

    +

    +examples

    fix_modify AtC rates add temperature velocity stress
    fix_modify AtC rates delete stress

    -

    -description

    +

    +description

    Requests calculation and ouput of rates (time derivatives) of the fields from the transfer class. For eulerian analysis (see fix_modify AtC atom_element_map ), these rates are the partial time derivatives of the nodal fields, not the full (material) time derivatives.

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    -

    -related

    -

    -default

    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    +

    +related

    +

    +default

    No rates are calculated by default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_initial.html b/doc/src/USER/atc/man_initial.html index c0a0be3852..41ae06eb8c 100644 --- a/doc/src/USER/atc/man_initial.html +++ b/doc/src/USER/atc/man_initial.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC initial

    -syntax

    +

    fix_modify AtC initial

    +syntax

    fix_modify AtC initial <field> <nodeset> <constant | function>

    • <field> = field name valid for type of physics, temperature | electron_temperature
    • <nodeset> = name of set of nodes to apply initial condition
    • <constant | function> = value or name of function followed by its parameters
    -

    -examples

    +

    +examples

    fix_modify atc initial temperature groupNAME 10.

    -

    -description

    +

    +description

    Sets the initial values for the specified field at the specified nodes.

    -

    -restrictions

    +

    +restrictions

    keyword 'all' reserved in nodeset name

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_internal_atom_integrate.html b/doc/src/USER/atc/man_internal_atom_integrate.html index b15bf71aad..dfa19474e5 100644 --- a/doc/src/USER/atc/man_internal_atom_integrate.html +++ b/doc/src/USER/atc/man_internal_atom_integrate.html @@ -7,30 +7,28 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC internal_atom_integrate

    -syntax

    +

    fix_modify AtC internal_atom_integrate

    +syntax

    fix_modify AtC internal_atom_integrate <on | off> fix_modify AtC internal_atom_integrate on

    -

    -description

    +

    +description

    Has AtC perform time integration for the atoms in the group on which it operates. This does not include boundary atoms.

    -

    -default

    +

    +default

    on for coupling methods, off for post-processors off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_internal_element_set.html b/doc/src/USER/atc/man_internal_element_set.html index 31bee57860..849e8f0671 100644 --- a/doc/src/USER/atc/man_internal_element_set.html +++ b/doc/src/USER/atc/man_internal_element_set.html @@ -7,42 +7,40 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC internal_element_set

    -syntax

    +

    fix_modify AtC internal_element_set

    +syntax

    fix_modify AtC internal_element_set <element-set-name>

    • <element-set-name> = name of element set defining internal region, or off
    -

    -examples

    +

    +examples

    fix_modify AtC internal_element_set myElementSet fix_modify AtC internal_element_set off

    -

    -description

    +

    +description

    Enables AtC to base the region for internal atoms to be an element set. If no ghost atoms are used, all the AtC atoms must be constrained to remain in this element set by the user, e.g., with walls. If boundary atoms are used in conjunction with Eulerian atom maps AtC will partition all atoms of a boundary or internal type to be of type internal if they are in the internal region or to be of type boundary otherwise.

    -

    -restrictions

    +

    +restrictions

    If boundary atoms are used in conjunction with Eulerian atom maps, the Eulerian reset frequency must be an integer multiple of the Lammps reneighbor frequency

    -

    -related

    +

    +related

    see atom_element_map_type and boundary

    -

    -default

    +

    +default

    off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_internal_quadrature.html b/doc/src/USER/atc/man_internal_quadrature.html index 172187c298..7f10e17076 100644 --- a/doc/src/USER/atc/man_internal_quadrature.html +++ b/doc/src/USER/atc/man_internal_quadrature.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC internal_quadrature

    -syntax

    +

    fix_modify AtC internal_quadrature

    +syntax

    fix_modify atc internal_quadrature <on | off> [region]

    -

    -examples

    +

    +examples

    fix_modify atc internal_quadrature off

    -

    -description

    +

    +description

    Command to use or not use atomic quadrature on internal elements fully filled with atoms. By turning the internal quadrature off these elements do not contribute to the governing PDE and the fields at the internal nodes follow the weighted averages of the atomic data.

    -

    -optional

    +

    +optional

    Optional region tag specifies which finite element nodes will be treated as being within the MD region. This option is only valid with internal_quadrature off.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    on


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_kernel_function.html b/doc/src/USER/atc/man_kernel_function.html index 08ec827dec..92db590198 100644 --- a/doc/src/USER/atc/man_kernel_function.html +++ b/doc/src/USER/atc/man_kernel_function.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC kernel

    -syntax

    +

    fix_modify AtC kernel

    +syntax

    fix_modify AtC kernel <type> <parameters>

    • type (keyword) = step, cell, cubic_bar, cubic_cylinder, cubic_sphere, quartic_bar, quartic_cylinder, quartic_sphere
      @@ -40,21 +38,21 @@ syntax quartic_sphere = radius (double)
    -

    -examples

    +

    +examples

    fix_modify AtC kernel cell 1.0 1.0 1.0 fix_modify AtC kernel quartic_sphere 10.0

    -

    -description

    -

    -restrictions

    +

    +description

    +

    +restrictions

    Must be used with the hardy AtC fix
    For bar kernel types, half-width oriented along x-direction
    For cylinder kernel types, cylindrical axis is assumed to be in z-direction
    - ( see fix atc command )

    -

    -related

    -

    -default

    + ( see fix atc command )

    +

    +related

    +

    +default

    No default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_localized_lambda.html b/doc/src/USER/atc/man_localized_lambda.html index 5dadb9d730..fd845d0a71 100644 --- a/doc/src/USER/atc/man_localized_lambda.html +++ b/doc/src/USER/atc/man_localized_lambda.html @@ -7,38 +7,36 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control localized_lambda

    -syntax

    +

    fix_modify AtC control localized_lambda

    +syntax

    fix_modify AtC control localized_lambda <on|off>

    -

    -examples

    +

    +examples

    fix_modify atc control localized_lambda on

    -

    -description

    +

    +description

    Turns on localization algorithms for control algorithms to restrict the influence of FE coupling or boundary conditions to a region near the boundary of the MD region. Control algorithms will not affect atoms in elements not possessing faces on the boundary of the region. Flux-based control is localized via row-sum lumping while quantity control is done by solving a truncated matrix equation.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    Default is off.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_lumped_lambda_solve.html b/doc/src/USER/atc/man_lumped_lambda_solve.html index bb3f8cfde8..ade780ddee 100644 --- a/doc/src/USER/atc/man_lumped_lambda_solve.html +++ b/doc/src/USER/atc/man_lumped_lambda_solve.html @@ -7,38 +7,36 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control lumped_lambda_solve

    -syntax

    +

    fix_modify AtC control lumped_lambda_solve

    +syntax

    fix_modify AtC control lumped_lambda_solve <on|off>

    -

    -examples

    +

    +examples

    fix_modify atc control lumped_lambda_solve on

    -

    -description

    +

    +description

    Command to use or not use lumped matrix for lambda solve

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mask_direction.html b/doc/src/USER/atc/man_mask_direction.html index 01ca9d192b..31c18b4f1f 100644 --- a/doc/src/USER/atc/man_mask_direction.html +++ b/doc/src/USER/atc/man_mask_direction.html @@ -7,38 +7,36 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC control mask_direction

    -syntax

    +

    fix_modify AtC control mask_direction

    +syntax

    fix_modify AtC control mask_direction <direction> <on|off>

    -

    -examples

    +

    +examples

    fix_modify atc control mask_direction 0 on

    -

    -description

    +

    +description

    Command to mask out certain dimensions from the atomic regulator

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mass_matrix.html b/doc/src/USER/atc/man_mass_matrix.html index 5f543fc20c..140b745f09 100644 --- a/doc/src/USER/atc/man_mass_matrix.html +++ b/doc/src/USER/atc/man_mass_matrix.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mass_matrix

    -syntax

    +

    fix_modify AtC mass_matrix

    +syntax

    fix_modify AtC mass_matrix <fe | md_fe>

    • <fe | md_fe> = activiate/deactiviate using the FE mass matrix in the MD region
    -

    -examples

    +

    +examples

    fix_modify atc mass_matrix fe

    -

    -description

    +

    +description

    Determines whether AtC uses the FE mass matrix based on Gaussian quadrature or based on atomic quadrature in the MD region. This is useful for fully overlapping simulations to improve efficiency.

    -

    -restrictions

    +

    +restrictions

    Should not be used unless the FE region is contained within the MD region, otherwise the method will be unstable and inaccurate

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    Default is off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_material.html b/doc/src/USER/atc/man_material.html index 9867e90f77..c31ab4938d 100644 --- a/doc/src/USER/atc/man_material.html +++ b/doc/src/USER/atc/man_material.html @@ -7,39 +7,37 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC material

    -syntax

    +

    fix_modify AtC material

    +syntax

    fix_modify AtC material [elementset_name] [material_id]

    -

    -examples

    +

    +examples

    fix_modify AtC material gap_region 2

    -

    -description

    +

    +description

    Sets the material model in elementset_name to be of type material_id.

    -

    -restrictions

    +

    +restrictions

    The element set must already be created and the material must be specified in the material file given the the atc fix on construction

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    All elements default to the first material in the material file.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_add_to_nodeset.html b/doc/src/USER/atc/man_mesh_add_to_nodeset.html index cf5ad52f60..25a5c2cdae 100644 --- a/doc/src/USER/atc/man_mesh_add_to_nodeset.html +++ b/doc/src/USER/atc/man_mesh_add_to_nodeset.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh add_to_nodeset

    -syntax

    +

    fix_modify AtC mesh add_to_nodeset

    +syntax

    fix_modify AtC mesh add_to_nodeset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>

    • <id> = id of FE nodeset to be added to
    • <xmin> <xmax> <ymin> <ymax> <zmin> <zmax> = coordinates of the bounding box that contains the desired nodes to be added
    -

    -examples

    +

    +examples

    fix_modify AtC mesh add_to_nodeset lbc -11.9 -11 -12 12 -12 12

    -

    -description

    +

    +description

    Command to add nodes to an already existing FE nodeset.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    Coordinates are assumed to be in lattice units.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_create.html b/doc/src/USER/atc/man_mesh_create.html index efaf7f4307..a7ee112614 100644 --- a/doc/src/USER/atc/man_mesh_create.html +++ b/doc/src/USER/atc/man_mesh_create.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh create

    -syntax

    +

    fix_modify AtC mesh create

    +syntax

    fix_modify AtC mesh create <nx> <ny> <nz> <region-id> <f|p> <f|p> <f|p>

      @@ -32,21 +30,21 @@ syntax
    • region-id = id of region that is to be meshed
    • f p p = periodicity flags for x, y, z
    -

    -examples

    +

    +examples

    fix_modify AtC mesh create 10 1 1 feRegion p p p

    -

    -description

    +

    +description

    Creates a uniform mesh in a rectangular region

    -

    -restrictions

    +

    +restrictions

    Creates only uniform rectangular grids in a rectangular region

    -

    -related

    +

    +related

    fix_modify AtC mesh quadrature

    -

    -default

    +

    +default

    When created, mesh defaults to gauss2 (2-point Gaussian) quadrature. Use "mesh quadrature" command to change quadrature style.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_create_elementset.html b/doc/src/USER/atc/man_mesh_create_elementset.html index 51bdae4faa..2ac383a974 100644 --- a/doc/src/USER/atc/man_mesh_create_elementset.html +++ b/doc/src/USER/atc/man_mesh_create_elementset.html @@ -7,42 +7,40 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh create_elementset

    -syntax

    +

    fix_modify AtC mesh create_elementset

    +syntax

    fix_modify AtC create_elementset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>

    • <id> = id to assign to the collection of FE element
    • <xmin> <xmax> <ymin> <ymax> <zmin> <zmax> = coordinates of the bounding box that contains only the desired elements
    -

    -examples

    +

    +examples

    fix_modify AtC mesh create_elementset middle -4.1 4.1 -100 100 -100 1100

    -

    -description

    +

    +description

    Command to assign an id to a set of FE elements to be used subsequently in defining material and mesh-based operations.

    -

    -restrictions

    +

    +restrictions

    Only viable for rectangular grids.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    Coordinates are assumed to be in lattice units.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_create_faceset_box.html b/doc/src/USER/atc/man_mesh_create_faceset_box.html index 163a6b442c..e62a827a78 100644 --- a/doc/src/USER/atc/man_mesh_create_faceset_box.html +++ b/doc/src/USER/atc/man_mesh_create_faceset_box.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh create_faceset box

    -syntax

    +

    fix_modify AtC mesh create_faceset box

    +syntax

    fix_modify AtC mesh create_faceset <id> box <xmin> <xmax> <ymin> <ymax> <zmin> <zmax> <in|out> [units]

    • <id> = id to assign to the collection of FE faces
    • @@ -32,19 +30,19 @@ syntax
    • <in|out> = "in" gives inner faces to the box, "out" gives the outer faces to the box
    • units = option to specify real as opposed to lattice units
    -

    -examples

    +

    +examples

    fix_modify AtC mesh create_faceset obndy box -4.0 4.0 -12 12 -12 12 out

    -

    -description

    +

    +description

    Command to assign an id to a set of FE faces.

    -

    -restrictions

    +

    +restrictions

    Only viable for rectangular grids.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    The default options are units = lattice and the use of outer faces


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_create_faceset_plane.html b/doc/src/USER/atc/man_mesh_create_faceset_plane.html index 3ca1108d1a..b1969cb79d 100644 --- a/doc/src/USER/atc/man_mesh_create_faceset_plane.html +++ b/doc/src/USER/atc/man_mesh_create_faceset_plane.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh create_faceset plane

    -syntax

    +

    fix_modify AtC mesh create_faceset plane

    +syntax

    fix_modify AtC mesh create_faceset <id> plane <x|y|z> <val1> <x|y|z> <lval2> <uval2> [units]

    • <id> = id to assign to the collection of FE faces
    • @@ -32,19 +30,19 @@ syntax
    • <val1>,<lval2>,<uval2> = plane is specified as the x|y|z=val1 plane bounded by the segments x|y|z = [lval2,uval2]
    • units = option to specify real as opposed to lattice units
    -

    -examples

    +

    +examples

    fix_modify AtC mesh create_faceset xyplane plane y 0 x -4 0

    -

    -description

    +

    +description

    Command to assign an id to a set of FE faces.

    -

    -restrictions

    +

    +restrictions

    Only viable for rectangular grids.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    The default option is units = lattice.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_create_nodeset.html b/doc/src/USER/atc/man_mesh_create_nodeset.html index 9d5d155654..39bfffd119 100644 --- a/doc/src/USER/atc/man_mesh_create_nodeset.html +++ b/doc/src/USER/atc/man_mesh_create_nodeset.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh create_nodeset

    -syntax

    +

    fix_modify AtC mesh create_nodeset

    +syntax

    fix_modify AtC mesh create_nodeset <id> <xmin> <xmax> <ymin> <ymax> <zmin> <zmax>

    • <id> = id to assign to the collection of FE nodes
    • <xmin> <xmax> <ymin> <ymax> <zmin> <zmax> = coordinates of the bounding box that contains only the desired nodes
    -

    -examples

    +

    +examples

    fix_modify AtC mesh create_nodeset lbc -12.1 -11.9 -12 12 -12 12

    -

    -description

    +

    +description

    Command to assign an id to a set of FE nodes to be used subsequently in defining boundary conditions.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    Coordinates are assumed to be in lattice units.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_delete_elements.html b/doc/src/USER/atc/man_mesh_delete_elements.html index cc269c8e65..60a2fe59a1 100644 --- a/doc/src/USER/atc/man_mesh_delete_elements.html +++ b/doc/src/USER/atc/man_mesh_delete_elements.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh delete_elements

    -syntax

    +

    fix_modify AtC mesh delete_elements

    +syntax

    fix_modify AtC mesh delete_elements <element_set>

    • <element_set> = name of an element set
    -

    -examples

    +

    +examples

    fix_modify AtC delete_elements gap

    -

    -description

    +

    +description

    Deletes a group of elements from the mesh.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_nodeset_to_elementset.html b/doc/src/USER/atc/man_mesh_nodeset_to_elementset.html index 45d03fc986..d05429ebab 100644 --- a/doc/src/USER/atc/man_mesh_nodeset_to_elementset.html +++ b/doc/src/USER/atc/man_mesh_nodeset_to_elementset.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh nodeset_to_elementset

    -syntax

    +

    fix_modify AtC mesh nodeset_to_elementset

    +syntax

    fix_modify AtC nodeset_to_elementset <nodeset_id> <elementset_id> <max/min>

    • <nodeset_id> = id of desired nodeset from which to create elementset
    • <elementset_id> = id to assign to the collection of FE element
    • <max/min> = flag to choose either the maximal or minimal elementset
    -

    -examples

    +

    +examples

    fix_modify AtC mesh nodeset_to_elementset myNodeset myElementset min

    -

    -description

    +

    +description

    Command to create an elementset from an existing nodeset. Either the minimal element set of elements with all nodes in the set, or maximal element set with all elements with at least one node in the set, can be created

    -

    -restrictions

    +

    +restrictions

    None.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    Unless specified, the maximal element set is created


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_output.html b/doc/src/USER/atc/man_mesh_output.html index be1b4c194f..f768a29c41 100644 --- a/doc/src/USER/atc/man_mesh_output.html +++ b/doc/src/USER/atc/man_mesh_output.html @@ -7,39 +7,37 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh output

    -syntax

    +

    fix_modify AtC mesh output

    +syntax

    fix_modify AtC mesh output <file_prefix>

    -

    -examples

    +

    +examples

    fix_modify AtC mesh output meshData

    -

    -description

    +

    +description

    Command to output mesh and associated data: nodesets, facesets, and elementsets. This data is only output once upon initialization since currently the mesh is static. Creates (binary, "gold" format) Ensight output of mesh data.

    -

    -restrictions

    +

    +restrictions

    none

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_quadrature.html b/doc/src/USER/atc/man_mesh_quadrature.html index d5291d99db..46487fdce7 100644 --- a/doc/src/USER/atc/man_mesh_quadrature.html +++ b/doc/src/USER/atc/man_mesh_quadrature.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh quadrature

    -syntax

    +

    fix_modify AtC mesh quadrature

    +syntax

    fix_modify AtC mesh quadrature <quad>

    • quad = one of <nodal|gauss1|gauss2|gauss3|face> --- when a mesh is created it defaults to gauss2, use this call to change it after the fact
    -

    -examples

    +

    +examples

    fix_modify AtC mesh quadrature face

    -

    -description

    +

    +description

    (Re-)assigns the quadrature style for the existing mesh.

    -

    -restrictions

    -

    -related

    +

    +restrictions

    +

    +related

    fix_modify AtC mesh create

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_read.html b/doc/src/USER/atc/man_mesh_read.html index a497a2ed04..e0571ccf88 100644 --- a/doc/src/USER/atc/man_mesh_read.html +++ b/doc/src/USER/atc/man_mesh_read.html @@ -7,42 +7,40 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh read

    -syntax

    +

    fix_modify AtC mesh read

    +syntax

    fix_modify AtC mesh read <filename> <f|p> <f|p> <f|p>

    • filename = name of file containing mesh to be read
    • f p p = periodicity flags for x, y, z
    -

    -examples

    +

    +examples

    fix_modify AtC mesh read myComponent.mesh p p p
    fix_modify AtC mesh read myOtherComponent.exo

    -

    -description

    +

    +description

    Reads a mesh from a text or exodus file, and assigns periodic boundary conditions if needed.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    periodicity flags are false by default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_mesh_write.html b/doc/src/USER/atc/man_mesh_write.html index 21754a1e68..756cf49922 100644 --- a/doc/src/USER/atc/man_mesh_write.html +++ b/doc/src/USER/atc/man_mesh_write.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC mesh write

    -syntax

    +

    fix_modify AtC mesh write

    +syntax

    fix_modify AtC mesh write <filename>

    • filename = name of file to write mesh
    -

    -examples

    +

    +examples

    fix_modify AtC mesh write myMesh.mesh

    -

    -description

    +

    +description

    Writes a mesh to a text file.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_momentum_time_integration.html b/doc/src/USER/atc/man_momentum_time_integration.html index 3b987f70ef..60fbfcd888 100644 --- a/doc/src/USER/atc/man_momentum_time_integration.html +++ b/doc/src/USER/atc/man_momentum_time_integration.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC time_integration (momentum)

    -syntax

    +

    fix_modify AtC time_integration (momentum)

    +syntax

    fix_modify AtC time_integration <descriptor>

      @@ -33,24 +31,24 @@ syntax

    various time integration methods for the finite elements

    -

    -description

    +

    +description

    verlet - atomic velocity update with 2nd order Verlet, nodal temperature update with 2nd order Verlet, kinetostats based on controlling force
    fractional_step - atomic velocity update with 2nd order Verlet, mixed nodal momentum update, 2nd order Verlet for continuum and exact 2nd order Verlet for atomic contributions, kinetostats based on controlling discrete momentum changes
    gear - atomic velocity update with 2nd order Verlet, nodal temperature update with 3rd or 4th order Gear, kinetostats based on controlling power

    -

    -examples

    +

    +examples

    fix_modify atc time_integration verlet
    fix_modify atc time_integration fractional_step

    -

    -description

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +description

    +

    +related

    +

    see fix atc command

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_output.html b/doc/src/USER/atc/man_output.html index 3129ff30c9..aec1d5d55a 100644 --- a/doc/src/USER/atc/man_output.html +++ b/doc/src/USER/atc/man_output.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC output

    -syntax

    +

    fix_modify AtC output

    +syntax

    fix_modify AtC output <filename_prefix> <frequency> [text | full_text | binary | vector_components | tensor_components ] fix_modify AtC output index [step | time ]

    • filename_prefix (string) = prefix for data files
    • @@ -37,23 +35,23 @@ syntax tensor_components = outputs tensor as scalar components (use this for Paraview)
    -

    -examples

    +

    +examples

    fix_modify AtC output heatFE 100
    fix_modify AtC output hardyFE 1 text tensor_components
    fix_modify AtC output hardyFE 10 text binary tensor_components
    fix_modify AtC output index step

    -

    -description

    +

    +description

    Creates text and/or binary (Ensight, "gold" format) output of nodal/mesh data which is transfer/physics specific. Output indexed by step or time is possible.

    -

    -restrictions

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +restrictions

    +

    +related

    +

    see fix atc command

    +

    +default

    no default format output indexed by time


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_output_elementset.html b/doc/src/USER/atc/man_output_elementset.html index be259388ba..54079027c5 100644 --- a/doc/src/USER/atc/man_output_elementset.html +++ b/doc/src/USER/atc/man_output_elementset.html @@ -7,44 +7,42 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC output elementset

    -syntax

    +

    fix_modify AtC output elementset

    +syntax

    fix_modify AtC output volume_integral <eset_name> <field> {`

    • set_name (string) = name of elementset to be integrated over
    • fieldname (string) = name of field to integrate csum = creates nodal sum over nodes in specified nodeset
    -

    -examples

    +

    +examples

    fix_modify AtC output eset1 mass_density

    -

    -description

    +

    +description

    Performs volume integration of specified field over elementset and outputs resulting variable values to GLOBALS file.

    -

    -restrictions

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +restrictions

    +

    +related

    +

    see fix atc command

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_output_nodeset.html b/doc/src/USER/atc/man_output_nodeset.html index db76c8008e..2fc6e02681 100644 --- a/doc/src/USER/atc/man_output_nodeset.html +++ b/doc/src/USER/atc/man_output_nodeset.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC output nodeset

    -syntax

    +

    fix_modify AtC output nodeset

    +syntax

    fix_modify AtC output nodeset <nodeset_name> <operation>

    • nodeset_name (string) = name of nodeset to be operated on
    • @@ -32,20 +30,20 @@ syntax sum = creates nodal sum over nodes in specified nodeset
    -

    -examples

    +

    +examples

    fix_modify AtC output nodeset nset1 sum

    -

    -description

    +

    +description

    Performs operation over the nodes belonging to specified nodeset and outputs resulting variable values to GLOBALS file.

    -

    -restrictions

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +restrictions

    +

    +related

    +

    see fix atc command

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_pair_interactions.html b/doc/src/USER/atc/man_pair_interactions.html index d46dcb1234..2cb2cb6113 100644 --- a/doc/src/USER/atc/man_pair_interactions.html +++ b/doc/src/USER/atc/man_pair_interactions.html @@ -7,40 +7,38 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC pair_interactions/bond_interactions

    -syntax

    +

    fix_modify AtC pair_interactions/bond_interactions

    +syntax

    fix_modify AtC pair_interactions <on|off>
    fix_modify AtC bond_interactions <on|off>

    -

    -examples

    +

    +examples

    fix_modify AtC bond_interactions on

    -

    -description

    +

    +description

    include bonds and/or pairs in the stress and heat flux computations

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    pair interactions: on, bond interactions: off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_poisson_solver.html b/doc/src/USER/atc/man_poisson_solver.html index d69d74db1a..b6fabbb27c 100644 --- a/doc/src/USER/atc/man_poisson_solver.html +++ b/doc/src/USER/atc/man_poisson_solver.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC poisson_solver

    -syntax

    +

    fix_modify AtC poisson_solver

    +syntax

    fix_modify AtC poisson_solver mesh create <nx> <ny> <nz> <region-id> <f|p> <f|p> <f|p>

    • nx ny nz = number of elements in x, y, z
    • region-id = id of region that is to be meshed
    • f p p = perioidicity flags for x, y, z
    -

    -examples

    +

    +examples

    fix_modify AtC poisson_solver mesh create 10 1 1 feRegion p p p

    -

    -description

    +

    +description

    Creates a uniform mesh in a rectangular region

    -

    -restrictions

    +

    +restrictions

    creates only uniform rectangular grids in a rectangular region

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_read_restart.html b/doc/src/USER/atc/man_read_restart.html index 96168fccc7..5fc21282f6 100644 --- a/doc/src/USER/atc/man_read_restart.html +++ b/doc/src/USER/atc/man_read_restart.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC read_restart

    -syntax

    +

    fix_modify AtC read_restart

    +syntax

    fix_modify AtC read_restart [file_name]

    -

    -examples

    +

    +examples

    fix_modify AtC read_restart ATC_state

    -

    -description

    +

    +description

    Reads the current state of the fields from a named text-based restart file.

    -

    -restrictions

    +

    +restrictions

    The restart file only contains fields and their time derivatives. The reference positions of the atoms and the commands that initialize the fix are not saved e.g. an identical mesh containing the same atoms will have to be recreated.

    -

    -related

    +

    +related

    see write_restart fix_modify AtC write_restart

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_remove_molecule.html b/doc/src/USER/atc/man_remove_molecule.html index 054291efda..e6ad418de6 100644 --- a/doc/src/USER/atc/man_remove_molecule.html +++ b/doc/src/USER/atc/man_remove_molecule.html @@ -7,44 +7,42 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC remove_molecule

    -syntax

    +

    fix_modify AtC remove_molecule

    +syntax

    fix_modify_AtC remove_molecule <TAG>

    • <TAG> = tag for tracking a molecule type
    -

    -examples

    +

    +examples

    fix_modify AtC remove_molecule water

    -

    -description

    +

    +description

    Removes tag designated for tracking a specified set of molecules.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    No defaults for this command.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_remove_source.html b/doc/src/USER/atc/man_remove_source.html index d1d249eb76..acea7a5607 100644 --- a/doc/src/USER/atc/man_remove_source.html +++ b/doc/src/USER/atc/man_remove_source.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC remove_source

    -syntax

    +

    fix_modify AtC remove_source

    +syntax

    fix_modify AtC remove_source <field> <element_set>

    • <field> = field name valid for type of physics
    • <element_set> = name of set of elements
    -

    -examples

    +

    +examples

    fix_modify atc remove_source temperature groupNAME

    -

    -description

    +

    +description

    Remove a domain source.

    -

    -restrictions

    +

    +restrictions

    keyword 'all' reserved in element_set name

    -

    -related

    +

    +related

    see fix_modify AtC source

    -

    -default

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_remove_species.html b/doc/src/USER/atc/man_remove_species.html index ba94a52658..561364518f 100644 --- a/doc/src/USER/atc/man_remove_species.html +++ b/doc/src/USER/atc/man_remove_species.html @@ -7,44 +7,42 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC remove_species

    -syntax

    +

    fix_modify AtC remove_species

    +syntax

    fix_modify_AtC delete_species <TAG>

    • <TAG> = tag for tracking a species
    -

    -examples

    +

    +examples

    fix_modify AtC remove_species gold

    -

    -description

    +

    +description

    Removes tag designated for tracking a specified species.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default

    No defaults for this command.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_reset_atomic_reference_positions.html b/doc/src/USER/atc/man_reset_atomic_reference_positions.html index cb82f61bbb..88e6748001 100644 --- a/doc/src/USER/atc/man_reset_atomic_reference_positions.html +++ b/doc/src/USER/atc/man_reset_atomic_reference_positions.html @@ -7,39 +7,37 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC reset_atomic_reference_positions

    -syntax

    +

    fix_modify AtC reset_atomic_reference_positions

    +syntax

    fix_modify AtC reset_atomic_reference_positions

    -

    -examples

    +

    +examples

    fix_modify atc reset_atomic_reference_positions

    -

    -description

    +

    +description

    Resets the atomic positions ATC uses to perform point to field operations. In can be used to use perfect lattice sites in ATC but a thermalized or deformed lattice in LAMMPS.

    -

    -restrictions

    +

    +restrictions

    -

    -related

    +

    +related

    -

    -default

    +

    +default

    Default is off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_reset_time.html b/doc/src/USER/atc/man_reset_time.html index 35d75ccb97..a6429bf6d6 100644 --- a/doc/src/USER/atc/man_reset_time.html +++ b/doc/src/USER/atc/man_reset_time.html @@ -7,55 +7,53 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC reset_time

    -syntax

    +

    fix_modify AtC reset_time

    +syntax

    fix_modify AtC reset_time

    -

    -examples

    +

    +examples

    fix_modify atc reset_time 0.0

    -

    -description

    +

    +description

    Resets the simulation time counter.

    -

    -restrictions

    -

    -related

    -

    -default

    -

    -syntax

    +

    +restrictions

    +

    +related

    +

    +default

    +

    +syntax

    fix_modify AtC kernel_bandwidth

    -

    -examples

    +

    +examples

    fix_modify atc reset_time 8

    -

    -description

    +

    +description

    Sets a maximum parallel bandwidth for the kernel functions during parallel communication. If the command is not issued, the default will be to assume the bandwidth of the kernel matrix corresponds to the number of sampling locations.

    -

    -restrictions

    +

    +restrictions

    Only is used if kernel functions are being used.

    -

    -related

    -

    -default

    +

    +related

    +

    +default

    Number of sample locations.


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_sample_frequency.html b/doc/src/USER/atc/man_sample_frequency.html index 13f468b222..4e48c4bb29 100644 --- a/doc/src/USER/atc/man_sample_frequency.html +++ b/doc/src/USER/atc/man_sample_frequency.html @@ -7,42 +7,40 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC sample_frequency

    -syntax

    +

    fix_modify AtC sample_frequency

    +syntax

    fix_modify AtC sample_frequency [freq]

    • freq (int) : frequency to sample field in number of steps
    -

    -examples

    +

    +examples

    fix_modify AtC sample_frequency 10

    -

    -description

    +

    +description

    Specifies a frequency at which fields are computed for the case where time filters are being applied.

    -

    -restrictions

    -

    Must be used with the hardy/field AtC fix ( see fix atc command ) and is only relevant when time filters are being used.

    -

    -related

    +

    +restrictions

    +

    Must be used with the hardy/field AtC fix ( see fix atc command ) and is only relevant when time filters are being used.

    +

    +related

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_set.html b/doc/src/USER/atc/man_set.html index d104e535b6..cf775c9b36 100644 --- a/doc/src/USER/atc/man_set.html +++ b/doc/src/USER/atc/man_set.html @@ -7,46 +7,44 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC set

    -syntax

    +

    fix_modify AtC set

    +syntax

    fix_modify AtC set reference_potential_energy <value_or_filename(optional)>

    • value (double) : optional user specified zero point for PE in native LAMMPS energy units
    • filename (string) : optional user specified string for file of nodal PE values to be read-in
    -

    -examples

    +

    +examples

    fix_modify AtC set reference_potential_energy
    fix_modify AtC set reference_potential_energy -0.05
    fix_modify AtC set reference_potential_energy myPEvalues

    -

    -description

    +

    +description

    Used to set various quantities for the post-processing algorithms. It sets the zero point for the potential energy density using the value provided for all nodes, or from the current configuration of the lattice if no value is provided, or values provided within the specified filename.

    -

    -restrictions

    -

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    -

    -related

    -

    -default

    +

    +restrictions

    +

    Must be used with the hardy/field type of AtC fix ( see fix atc command )

    +

    +related

    +

    +default

    Defaults to lammps zero point i.e. isolated atoms


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_source.html b/doc/src/USER/atc/man_source.html index 833b2a866f..c7239f2c41 100644 --- a/doc/src/USER/atc/man_source.html +++ b/doc/src/USER/atc/man_source.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC source

    -syntax

    +

    fix_modify AtC source

    +syntax

    fix_modify AtC source <field> <element_set> <value | function>

    • <field> = field name valid for type of physics
    • <element_set> = name of set of elements
    -

    -examples

    +

    +examples

    fix_modify atc source temperature middle temporal_ramp 10. 0.

    -

    -description

    +

    +description

    Add domain sources to the mesh. The units are consistent with LAMMPS's units for mass, length and time and are defined by the PDE being solved, e.g. for thermal transfer the balance equation is for energy and source is energy per time.

    -

    -restrictions

    +

    +restrictions

    keyword 'all' reserved in element_set name

    -

    -related

    +

    +related

    see fix_modify AtC remove_source

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_source_integration.html b/doc/src/USER/atc/man_source_integration.html index 70f62d2e57..3f43340af8 100644 --- a/doc/src/USER/atc/man_source_integration.html +++ b/doc/src/USER/atc/man_source_integration.html @@ -7,36 +7,34 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_temperature_definition.html b/doc/src/USER/atc/man_temperature_definition.html index f4fb21471c..a07ba29cab 100644 --- a/doc/src/USER/atc/man_temperature_definition.html +++ b/doc/src/USER/atc/man_temperature_definition.html @@ -7,37 +7,35 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC temperature_definition

    -syntax

    +

    fix_modify AtC temperature_definition

    +syntax

    fix_modify AtC temperature_definition <kinetic|total>

    -

    -examples

    +

    +examples

    fix_modify atc temperature_definition kinetic

    -

    -description

    +

    +description

    Change the definition for the atomic temperature used to create the finite element temperature. The kinetic option is based only on the kinetic energy of the atoms while the total option uses the total energy (kinetic + potential) of an atom.

    -

    -restrictions

    +

    +restrictions

    This command is only valid when using thermal coupling. Also, while not a formal restriction, the user should ensure that associating a potential energy with each atom makes physical sense for the total option to be meaningful.

    -

    -default

    +

    +default

    kinetic


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_thermal_time_integration.html b/doc/src/USER/atc/man_thermal_time_integration.html index c2f636134f..fe293138be 100644 --- a/doc/src/USER/atc/man_thermal_time_integration.html +++ b/doc/src/USER/atc/man_thermal_time_integration.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC time_integration (thermal)

    -syntax

    +

    fix_modify AtC time_integration (thermal)

    +syntax

    fix_modify AtC time_integration <descriptor>

      @@ -33,23 +31,23 @@ syntax

    various time integration methods for the finite elements

    -

    -description

    +

    +description

    gear - atomic velocity update with 2nd order Verlet, nodal temperature update with 3rd or 4th order Gear, thermostats based on controlling power
    fractional_step - atomic velocity update with 2nd order Verlet, mixed nodal temperature update, 3/4 Gear for continuum and 2 Verlet for atomic contributions, thermostats based on controlling discrete energy changes

    -

    -examples

    +

    +examples

    fix_modify atc time_integration gear
    fix_modify atc time_integration fractional_step

    -

    -description

    -

    -related

    -

    see fix atc command

    -

    -default

    +

    +description

    +

    +related

    +

    see fix atc command

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_time_filter.html b/doc/src/USER/atc/man_time_filter.html index ec70fed871..732eaa3a36 100644 --- a/doc/src/USER/atc/man_time_filter.html +++ b/doc/src/USER/atc/man_time_filter.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC filter

    -syntax

    +

    fix_modify AtC filter

    +syntax

    fix_modify AtC filter <on | off | equilibrate>

      @@ -32,22 +30,22 @@ syntax
    • equilibrate = runs dynamics without filtering but initializes filtered quantities
    -

    -examples

    +

    +examples

    fix_modify atc transfer filter on

    -

    -description

    +

    +description

    Filters the MD dynamics to construct a more appropriate continuous field. Equilibrating first filters the time derivatives without changing the dynamics to provide a better initial condition to the filtered dynamics

    -

    -restrictions

    +

    +restrictions

    only for be used with specific transfers: thermal, two_temperature

    -

    -related

    +

    +related

    fix_modify AtC filter scale
    fix_modify AtC equilibrium_start

    -

    -default

    +

    +default

    off


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_track_displacement.html b/doc/src/USER/atc/man_track_displacement.html index 8f729cffe3..f5410816d7 100644 --- a/doc/src/USER/atc/man_track_displacement.html +++ b/doc/src/USER/atc/man_track_displacement.html @@ -7,38 +7,36 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC track_displacement

    -syntax

    +

    fix_modify AtC track_displacement

    +syntax

    fix_modify AtC track_displacement <on/off>

    -

    -examples

    +

    +examples

    fix_modify atc track_displacement on

    -

    -description

    +

    +description

    Determines whether displacement is tracked or not. For solids problems this is a useful quantity, but for fluids it is not relevant.

    -

    -restrictions

    +

    +restrictions

    Some constitutive models require the displacement field

    -

    -default

    +

    +default

    on


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_unfix_flux.html b/doc/src/USER/atc/man_unfix_flux.html index b2a19a7fd0..95e1f4be5a 100644 --- a/doc/src/USER/atc/man_unfix_flux.html +++ b/doc/src/USER/atc/man_unfix_flux.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC unfix_flux

    -syntax

    +

    fix_modify AtC unfix_flux

    +syntax

    fix_modify AtC fix_flux <field> <face_set> <value | function>

    • <field> = field name valid for type of physics, temperature | electron_temperature
    • <face_set> = name of set of element faces
    -

    -examples

    +

    +examples

    fix_modify atc unfix_flux temperature faceSet

    -

    -description

    +

    +description

    Command for removing prescribed normal fluxes e.g. heat_flux, stress.

    -

    -restrictions

    -

    -related

    +

    +restrictions

    +

    +related

    see fix_modify AtC unfix_flux

    -

    -default

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_unfix_nodes.html b/doc/src/USER/atc/man_unfix_nodes.html index 498d549f9e..78495c928a 100644 --- a/doc/src/USER/atc/man_unfix_nodes.html +++ b/doc/src/USER/atc/man_unfix_nodes.html @@ -7,43 +7,41 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC unfix

    -syntax

    +

    fix_modify AtC unfix

    +syntax

    fix_modify AtC unfix <field> <nodeset>

    • <field> = field name valid for type of physics
    • <nodeset> = name of set of nodes
    -

    -examples

    +

    +examples

    fix_modify AtC unfix temperature groupNAME

    -

    -description

    +

    +description

    Removes constraint on field values for specified nodes.

    -

    -restrictions

    +

    +restrictions

    keyword 'all' reserved in nodeset name

    -

    -related

    +

    +related

    see fix_modify AtC fix

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_write_atom_weights.html b/doc/src/USER/atc/man_write_atom_weights.html index 939506a28e..8a0e5b62a8 100644 --- a/doc/src/USER/atc/man_write_atom_weights.html +++ b/doc/src/USER/atc/man_write_atom_weights.html @@ -7,24 +7,22 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC write_atom_weights

    -syntax

    +

    fix_modify AtC write_atom_weights

    +syntax

    fix_modify AtC write_atom_weights <filename> <frequency>

    • <filename> = name of file that atomic weights are written to
      @@ -32,19 +30,19 @@ syntax
    • <frequency> = how often writes will occur
    -

    -examples

    +

    +examples

    fix_modify atc write_atom_weights atm_wt_file.txt 10

    -

    -description

    +

    +description

    Command for writing the values of atomic weights to a specified file.

    -

    -restrictions

    -

    -related

    -

    -default

    +

    +restrictions

    +

    +related

    +

    +default


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/USER/atc/man_write_restart.html b/doc/src/USER/atc/man_write_restart.html index 6ea350d5e8..6dca57673b 100644 --- a/doc/src/USER/atc/man_write_restart.html +++ b/doc/src/USER/atc/man_write_restart.html @@ -7,41 +7,39 @@ +
    + LAMMPS Website     + LAMMPS Manual     + USER-AtC Manual     + Commands +
    + +
    + + -
    -

    fix_modify AtC write_restart

    -syntax

    +

    fix_modify AtC write_restart

    +syntax

    fix_modify AtC write_restart [file_name]

    -

    -examples

    +

    +examples

    fix_modify AtC write_restart restart.mydata

    -

    -description

    +

    +description

    Dumps the current state of the fields to a named text-based restart file. This done when the command is invoked and not repeated, unlike the similar lammps command.

    -

    -restrictions

    +

    +restrictions

    The restart file only contains fields and their time derivatives. The reference positions of the atoms and the commands that initialize the fix are not saved e.g. an identical mesh containing the same atoms will have to be recreated.

    -

    -related

    +

    +related

    see read_restart fix_modify AtC read_restart

    -

    -default

    +

    +default

    none


    Generated on 21 Aug 2013 for ATC by  diff --git a/doc/src/body.txt b/doc/src/body.txt index 54ec157c74..344e5b1d65 100644 --- a/doc/src/body.txt +++ b/doc/src/body.txt @@ -6,7 +6,7 @@ :line -Body particles :h3 +Body particles :h1 [Overview:] diff --git a/doc/src/fix_atc.txt b/doc/src/fix_atc.txt index 75a82f063a..49014f0591 100644 --- a/doc/src/fix_atc.txt +++ b/doc/src/fix_atc.txt @@ -90,13 +90,11 @@ likewise for this post-processing example: run 1000 :pre the mesh's linear interpolation functions can be used as the localization function - by using the field option: +by using the field option: fix AtC internal atc field - fix_modify AtC mesh create 1 1 1 box p p p - - ... + ... :pre Note coupling and post-processing can be combined in the same simulations using separate fixes. @@ -108,11 +106,10 @@ No information about this fix is written to "binary restart files"_restart.html. [Restrictions:] -Thermal and two_temperature (coupling) types use a Verlet time-integration algorithm. The hardy type does not contain its own time-integrator and must be used with a separate fix that does contain one, e.g. nve, nvt, etc. +Thermal and two_temperature (coupling) types use a Verlet time-integration algorithm. The hardy type does not contain its own time-integrator and must be used with a separate fix that does contain one, e.g. nve, nvt, etc. In addition, currently: -Currently, -- the coupling is restricted to thermal physics -- the FE computations are done in serial on each processor. :ul +the coupling is restricted to thermal physics :ulb,l +the FE computations are done in serial on each processor. :l,ule [Related commands:] diff --git a/doc/src/fix_gcmc.txt b/doc/src/fix_gcmc.txt index c78142a999..38f0fb95ce 100644 --- a/doc/src/fix_gcmc.txt +++ b/doc/src/fix_gcmc.txt @@ -95,8 +95,8 @@ which will result in roughly one MC move per atom or molecule per MC cycle. All inserted particles are always added to two groups: the default -group "all" and the fix group specified in the fix command (which can -also be "all"). In addition, particles are also added to any groups +group "all" and the fix group specified in the fix command. +In addition, particles are also added to any groups specified by the {group} and {grouptype} keywords. If inserted particles are individual atoms, they are assigned the atom type given by the type argument. If they are molecules, the type argument has no @@ -104,6 +104,12 @@ effect and must be set to zero. Instead, the type of each atom in the inserted molecule is specified in the file read by the "molecule"_molecule.html command. +NOTE: Care should be taken to apply fix gcmc only to +a group that contains only those atoms and molecules +that you wish to manipulate using Monte Carlo. +Hence it is generally not a good idea to specify +the default group "all" in the fix command, although it is allowed. + This fix cannot be used to perform GCMC insertions of gas atoms or molecules other than the exchanged type, but GCMC deletions, and MC translations, and rotations can be performed on any atom/molecule in diff --git a/doc/src/group.txt b/doc/src/group.txt index afa218c5a3..dddb0459e3 100644 --- a/doc/src/group.txt +++ b/doc/src/group.txt @@ -13,11 +13,13 @@ group command :h3 group ID style args :pre ID = user-defined name of the group :ulb,l -style = {delete} or {region} or {type} or {id} or {molecule} or {variable} or \ +style = {delete} or {clear} or {empty} or {region} or \ + {type} or {id} or {molecule} or {variable} or \ {include} or {subtract} or {union} or {intersect} or \ {dynamic} or {static} :l {delete} = no args {clear} = no args + {empty} = no args {region} args = region-ID {type} or {id} or {molecule} args = list of one or more atom types, atom IDs, or molecule IDs @@ -41,6 +43,7 @@ style = {delete} or {region} or {type} or {id} or {molecule} or {variable} or \ keyword = {region} or {var} or {every} {region} value = region-ID {var} value = name of variable + {property} value = name of per-atom property {every} value = N = update group every this many timesteps {static} = no args :pre :ule @@ -99,6 +102,10 @@ e.g. using the "run every"_run.html command if a fix or compute or other operation expects the atoms in the group to remain constant, but LAMMPS does not check for this. +The {empty} style creates an empty group, which is useful for commands +like "fix gcmc"_fix_gcmc.html or with complex scripts that add atoms +to a group. + The {region} style puts all atoms in the region volume into the group. Note that this is a static one-time assignment. The atoms remain assigned (or not assigned) to the group even in they later move out of @@ -215,7 +222,11 @@ conditions are applied. If the {region} keyword is used, atoms not in the specified region are removed from the dynamic group. If the {var} keyword is used, the variable name must be an atom-style or atomfile-style variable. The variable is evaluated and atoms whose -per-atom values are 0.0, are removed from the dynamic group. +per-atom values are 0.0, are removed from the dynamic group. If the {property} +keyword is used, the per-atom property name must be a previously defined +per-atom property. The per-atom property is evaluated and atoms whose +values are 0.0 are removed from the dynamic group, otherwise they +are added to the group. The assignment of atoms to a dynamic group is done at the beginning of each run and on every timestep that is a multiple of {N}, which is the diff --git a/doc/src/lammps.book b/doc/src/lammps.book index d4e73453b0..878e4ad355 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -20,6 +20,7 @@ Section_python.html Section_errors.html Section_history.html +lammps_tutorials.html tutorial_bash_on_windows.html tutorial_drude.html tutorial_github.html @@ -28,6 +29,7 @@ tutorial_pylammps.html body.html manifolds.html +lammps_commands.html angle_coeff.html angle_style.html atom_modify.html @@ -138,7 +140,6 @@ fix_adapt_fep.html fix_addforce.html fix_addtorque.html fix_append_atoms.html -fix_atc.html fix_atom_swap.html fix_ave_atom.html fix_ave_chunk.html @@ -276,6 +277,7 @@ fix_spring_self.html fix_srd.html fix_store_force.html fix_store_state.html +fix_surface_global.html fix_temp_berendsen.html fix_temp_csvr.html fix_temp_rescale.html @@ -422,11 +424,13 @@ pair_airebo.html pair_awpmd.html pair_beck.html pair_body.html +pair_body_rounded_polygon.html pair_bop.html pair_born.html pair_brownian.html pair_buck.html pair_buck_long.html +pair_buck6d_coul_gauss.html pair_charmm.html pair_class2.html pair_colloid.html @@ -538,6 +542,7 @@ bond_zero.html angle_charmm.html angle_class2.html angle_cosine.html +angle_cosine_buck6d.html angle_cosine_delta.html angle_cosine_periodic.html angle_cosine_shift.html @@ -577,11 +582,13 @@ improper_distance.html improper_fourier.html improper_harmonic.html improper_hybrid.html +improper_inversion_harmonic.html improper_none.html improper_ring.html improper_umbrella.html improper_zero.html +fix_atc.html USER/atc/man_add_molecule.html USER/atc/man_add_species.html USER/atc/man_atom_element_map.html diff --git a/doc/src/lammps_commands.txt b/doc/src/lammps_commands.txt new file mode 100644 index 0000000000..f9c2e7366a --- /dev/null +++ b/doc/src/lammps_commands.txt @@ -0,0 +1,10 @@ + +LAMMPS Commands :h1 + +The following pages contain the detailed documentation of all +LAMMPS commands included in this version of LAMMPS. Generic +commands are listed first (in alphabetical order) followed by +command categories like compute styles or pair styles and so on. + +The documentation for the USER-ATC package fix_modify commands +follow at the very end of this manual. diff --git a/doc/src/lammps_tutorials.txt b/doc/src/lammps_tutorials.txt new file mode 100644 index 0000000000..5ceda65b60 --- /dev/null +++ b/doc/src/lammps_tutorials.txt @@ -0,0 +1,6 @@ + +Tutorials :h2 + +The following pages contain some in-depth tutorials for +selected topics, that did not fit into any other place +in the manual. diff --git a/doc/src/manifolds.txt b/doc/src/manifolds.txt index c9bb1ce57f..36c6caacb7 100644 --- a/doc/src/manifolds.txt +++ b/doc/src/manifolds.txt @@ -6,7 +6,7 @@ :line -Manifolds (surfaces) :h3 +Manifolds (surfaces) :h1 [Overview:] diff --git a/doc/src/pair_lj.txt b/doc/src/pair_lj.txt index 058d54fb59..e297d479bc 100644 --- a/doc/src/pair_lj.txt +++ b/doc/src/pair_lj.txt @@ -32,6 +32,8 @@ pair_style lj/cut/coul/long/omp command :h3 pair_style lj/cut/coul/msm command :h3 pair_style lj/cut/coul/msm/gpu command :h3 pair_style lj/cut/coul/msm/omp command :h3 +pair_style lj/cut/coul/wolf command :h3 +pair_style lj/cut/coul/wolf/omp command :h3 pair_style lj/cut/tip4p/cut command :h3 pair_style lj/cut/tip4p/cut/omp command :h3 pair_style lj/cut/tip4p/long command :h3 @@ -63,6 +65,10 @@ args = list of arguments for a particular style :ul {lj/cut/coul/msm} args = cutoff (cutoff2) cutoff = global cutoff for LJ (and Coulombic if only 1 arg) (distance units) cutoff2 = global cutoff for Coulombic (optional) (distance units) + {lj/cut/coul/wolf} args = alpha cutoff (cutoff2) + alpha = damping parameter (inverse distance units) + cutoff = global cutoff for LJ (and Coulombic if only 2 arg) (distance units) + cutoff2 = global cutoff for Coulombic (optional) (distance units) {lj/cut/tip4p/cut} args = otype htype btype atype qdist cutoff (cutoff2) otype,htype = atom types for TIP4P O and H btype,atype = bond and angle types for TIP4P waters @@ -115,6 +121,10 @@ pair_style lj/cut/tip4p/cut 1 2 7 8 0.15 12.0 10.0 pair_coeff * * 100.0 3.0 pair_coeff 1 1 100.0 3.5 9.0 :pre +pair_style lj/cut/coul/wolf 0.2 5. 10.0 +pair_coeff * * 1.0 1.0 +pair_coeff 1 1 1.0 1.0 2.5 :pre + pair_style lj/cut/tip4p/long 1 2 7 8 0.15 12.0 pair_style lj/cut/tip4p/long 1 2 7 8 0.15 12.0 10.0 pair_coeff * * 100.0 3.0 @@ -179,6 +189,24 @@ that a term is added for the "core/shell model"_Section_howto.html#howto_25 to allow charges on core and shell particles to be separated by r = 0.0. +Style {coul/wolf} adds a Coulombic pairwise interaction via the Wolf +summation method, described in "Wolf"_#Wolf1, given by: + +:c,image(Eqs/pair_coul_wolf.jpg) + +where {alpha} is the damping parameter, and erfc() is the +complementary error-function terms. This potential +is essentially a short-range, spherically-truncated, +charge-neutralized, shifted, pairwise {1/r} summation. With a +manipulation of adding and subtracting a self term (for i = j) to the +first and second term on the right-hand-side, respectively, and a +small enough {alpha} damping parameter, the second term shrinks and +the potential becomes a rapidly-converging real-space summation. With +a long enough cutoff and small enough alpha parameter, the energy and +forces calculated by the Wolf summation method approach those of the +Ewald sum. So it is a means of getting effective long-range +interactions with a short-range potential. + Styles {lj/cut/tip4p/cut} and {lj/cut/tip4p/long} implement the TIP4P water model of "(Jorgensen)"_#Jorgensen2, which introduces a massless site located a short distance away from the oxygen atom along the diff --git a/doc/src/read_data.txt b/doc/src/read_data.txt index 8c9aa02e22..fd297e36c1 100644 --- a/doc/src/read_data.txt +++ b/doc/src/read_data.txt @@ -15,10 +15,11 @@ read_data file keyword args ... :pre file = name of data file to read in :ulb,l zero or more keyword/arg pairs may be appended :l keyword = {add} or {offset} or {shift} or {extra/atom/types} or {extra/bond/types} or {extra/angle/types} or {extra/dihedral/types} or {extra/improper/types} or {extra/bond/per/atom} or {extra/angle/per/atom} or {extra/dihedral/per/atom} or {extra/improper/per/atom} or {group} or {nocoeff} or {fix} :l - {add} arg = {append} or {Nstart} or {merge} - append = add new atoms with IDs appended to current IDs - Nstart = add new atoms with IDs starting with Nstart - merge = add new atoms with their IDs unchanged + {add} arg = {append} or {IDoffset} or {IDoffset MOLoffset} or {merge} + append = add new atoms with atom IDs appended to current IDs + IDoffset = add new atoms with atom IDs having IDoffset added + MOLoffset = add new atoms with molecule IDs having MOLoffset added (only when molecule IDs are enabled) + merge = add new atoms with their atom IDs (and molecule IDs) unchanged {offset} args = toff boff aoff doff ioff toff = offset to add to atom types boff = offset to add to bond types @@ -120,20 +121,26 @@ boundary, then the atoms may become far apart if the box size grows. This will separate the atoms in the bond, which can lead to "lost" bond atoms or bad dynamics. -The three choices for the {add} argument affect how the IDs of atoms -in the data file are treated. If {append} is specified, atoms in the -data file are added to the current system, with their atom IDs reset -so that an atomID = M in the data file becomes atomID = N+M, where N -is the largest atom ID in the current system. This rule is applied to -all occurrences of atom IDs in the data file, e.g. in the Velocity or -Bonds section. If {Nstart} is specified, then {Nstart} is a numeric -value is given, e.g. 1000, so that an atomID = M in the data file -becomes atomID = 1000+M. If {merge} is specified, the data file atoms +The three choices for the {add} argument affect how the atom IDs and +molecule IDs of atoms in the data file are treated. If {append} is +specified, atoms in the data file are added to the current system, +with their atom IDs reset so that an atomID = M in the data file +becomes atomID = N+M, where N is the largest atom ID in the current +system. This rule is applied to all occurrences of atom IDs in the +data file, e.g. in the Velocity or Bonds section. This is also done +for molecule IDs, if the atom style does support molecule IDs or +they are enabled via fix property/atom. If {IDoffset} is specified, +then {IDoffset} is a numeric value is given, e.g. 1000, so that an +atomID = M in the data file becomes atomID = 1000+M. For systems +with enabled molecule IDs, another numerical argument {MOLoffset} +is required representing the equivalent offset for molecule IDs. +If {merge} is specified, the data file atoms are added to the current system without changing their IDs. They are assumed to merge (without duplication) with the currently defined atoms. It is up to you to insure there are no multiply defined atom IDs, as LAMMPS only performs an incomplete check that this is the case -by insuring the resulting max atomID >= the number of atoms. +by insuring the resulting max atomID >= the number of atoms. For +molecule IDs, there is no check done at all. The {offset} and {shift} keywords can only be used if the {add} keyword is also specified. @@ -547,7 +554,7 @@ charge: atom-ID atom-type q x y z dipole: atom-ID atom-type q x y z mux muy muz dpd: atom-ID atom-type theta x y z edpd: atom-ID atom-type edpd_temp edpd_cv x y z -mdpd: atom-ID atom-type x y z +mdpd: atom-ID atom-type rho x y z tdpd: atom-ID atom-type x y z cc1 cc2 ... ccNspecies electron: atom-ID atom-type q spin eradius x y z ellipsoid: atom-ID atom-type ellipsoidflag density x y z diff --git a/doc/src/tutorial_pylammps.txt b/doc/src/tutorial_pylammps.txt index 52eb6415db..11cddb3cbf 100644 --- a/doc/src/tutorial_pylammps.txt +++ b/doc/src/tutorial_pylammps.txt @@ -6,14 +6,14 @@ :line -PyLammps Tutorial :h1 +PyLammps Tutorial :h3 -Overview :h2 +Overview :h4 PyLammps is a Python wrapper class which can be created on its own or use an existing lammps Python object. It creates a simpler, Python-like interface to @@ -23,16 +23,16 @@ C++ code implementation. Finally, the IPyLammps wrapper builds on top of PyLammps and adds some additional features for IPython integration into IPython notebooks, e.g. for embedded visualization output from dump/image. -Comparison of lammps and PyLammps interfaces :h3 +Comparison of lammps and PyLammps interfaces :h5 -lammps.lammps :h4 +lammps.lammps :h6 uses C-Types direct memory access to native C++ data provides functions to send and receive data to LAMMPS requires knowledge of how LAMMPS internally works (C pointers, etc) :ul -lammps.PyLammps :h4 +lammps.PyLammps :h6 higher-level abstraction built on top of original C-Types interface manipulation of Python objects @@ -41,11 +41,11 @@ shorter, more concise Python better IPython integration, designed for quick prototyping :ul -Quick Start :h2 +Quick Start :h4 -System-wide Installation :h3 +System-wide Installation :h5 -Step 1: Building LAMMPS as a shared library :h4 +Step 1: Building LAMMPS as a shared library :h6 To use LAMMPS inside of Python it has to be compiled as shared library. This library is then loaded by the Python interface. In this example we enable the @@ -60,7 +60,7 @@ make yes-MOLECULE :pre # compile shared library using Makefile make mpi mode=shlib LMP_INC="-DLAMMPS_PNG -DLAMMPS_JPEG -DLAMMPS_FFMPEG -DLAMMPS_EXCEPTIONS" JPG_LIB="-lpng -ljpeg" :pre -Step 2: Installing the LAMMPS Python package :h4 +Step 2: Installing the LAMMPS Python package :h6 PyLammps is part of the lammps Python package. To install it simply install that package into your current Python installation. @@ -71,12 +71,12 @@ python install.py :pre NOTE: Recompiling the shared library requires reinstalling the Python package -Installation inside of a virtualenv :h3 +Installation inside of a virtualenv :h5 You can use virtualenv to create a custom Python environment specifically tuned for your workflow. -Benefits of using a virtualenv :h4 +Benefits of using a virtualenv :h6 isolation of your system Python installation from your development installation installation can happen in your user directory without root access (useful for HPC clusters) @@ -87,7 +87,7 @@ you can even install specific old versions of a package if necessary :ul apt-get install python-virtualenv :pre -Creating a virtualenv with lammps installed :h4 +Creating a virtualenv with lammps installed :h6 # create virtualenv name 'testing' :pre @@ -107,7 +107,7 @@ source testing/bin/activate :pre (testing) deactivate :pre -Creating a new instance of PyLammps :h2 +Creating a new instance of PyLammps :h4 To create a PyLammps object you need to first import the class from the lammps module. By using the default constructor, a new {lammps} instance is created. @@ -121,7 +121,7 @@ from lammps import lammps, PyLammps lmp = lammps() L = PyLammps(ptr=lmp) :pre -Commands :h2 +Commands :h4 Sending a LAMMPS command with the existing library interfaces is done using the command method of the lammps object instance. @@ -155,7 +155,7 @@ them automatically to a final command string. L.region("box block", xlo, xhi, ylo, yhi, zlo, zhi) :pre -System state :h2 +System state :h4 In addition to dispatching commands directly through the PyLammps object, it also provides several properties which allow you to query the system state. @@ -208,7 +208,7 @@ List of groups present in the current system :dd :dle -Working with LAMMPS variables :h2 +Working with LAMMPS variables :h4 LAMMPS variables can be both defined and accessed via the PyLammps interface. @@ -229,7 +229,7 @@ property of this object. print(a.value) a.value = 4 :pre -Retrieving the value of an arbitrary LAMMPS expressions :h2 +Retrieving the value of an arbitrary LAMMPS expressions :h4 LAMMPS expressions can be immediately evaluated by using the eval method. The passed string parameter can be any expression containing global thermo values, @@ -240,7 +240,7 @@ result = L.eval("pe") # potential energy :pre result = L.eval("v_t/2.0") :pre -Accessing atom data :h2 +Accessing atom data :h4 All atoms in the current simulation can be accessed by using the L.atoms list. Each element of this list is an object which exposes its properties (id, type, @@ -263,7 +263,7 @@ L.atoms\[0\].position = (1.0, 0.0) :pre # set position in 3D simulation L.atoms\[0\].position = (1.0, 0.0, 1.) :pre -Evaluating thermo data :h2 +Evaluating thermo data :h4 Each simulation run usually produces thermo output based on system state, computes, fixes or variables. The trajectories of these values can be queried @@ -291,7 +291,7 @@ steps = L.runs\[0\].step ke = L.runs\[0\].ke plt.plot(steps, ke) :pre -Error handling with PyLammps :h2 +Error handling with PyLammps :h4 Compiling the shared library with C++ exception support provides a better error handling experience. Without exceptions the LAMMPS code will terminate the @@ -304,7 +304,7 @@ current LAMMPS process is in an illegal state and must be terminated. It is advised to save your data and terminate the Python instance as quickly as possible. -Using PyLammps in IPython notebooks and Jupyter :h2 +Using PyLammps in IPython notebooks and Jupyter :h4 If the LAMMPS Python package is installed for the same Python interpreter as IPython, you can use PyLammps directly inside of an IPython notebook inside of @@ -320,7 +320,7 @@ Python environment (this assumes you followed the Quick Start instructions): jupyter notebook :pre -IPyLammps Examples :h2 +IPyLammps Examples :h4 Examples of IPython notebooks can be found in the python/examples/pylammps subdirectory. To open these notebooks launch {jupyter notebook} inside this @@ -328,7 +328,7 @@ directory and navigate to one of them. If you compiled and installed a LAMMPS shared library with exceptions, PNG, JPEG and FFMPEG support you should be able to rerun all of these notebooks. -Validating a dihedral potential :h3 +Validating a dihedral potential :h5 This example showcases how an IPython Notebook can be used to compare a simple LAMMPS simulation of a harmonic dihedral potential to its analytical solution. @@ -353,7 +353,7 @@ plot inside the IPython notebook. :c,image(JPG/pylammps_dihedral.jpg) -Running a Monte Carlo relaxation :h3 +Running a Monte Carlo relaxation :h5 This second example shows how to use PyLammps to create a 2D Monte Carlo Relaxation simulation, computing and plotting energy terms and even embedding video output. @@ -424,7 +424,7 @@ The energies of each iteration are collected in a Python list and finally plotte The IPython notebook also shows how to use dump commands and embed video files inside of the IPython notebook. -Using PyLammps and mpi4py (Experimental) :h2 +Using PyLammps and mpi4py (Experimental) :h4 PyLammps can be run in parallel using mpi4py. This python package can be installed using @@ -451,7 +451,7 @@ mpirun -np 4 python melt.py :pre IMPORTANT NOTE: Any command must be executed by all MPI processes. However, evaluations and querying the system state is only available on rank 0. -Feedback and Contributing :h2 +Feedback and Contributing :h4 If you find this Python interface useful, please feel free to provide feedback and ideas on how to improve it to Richard Berger (richard.berger@temple.edu). We also diff --git a/doc/src/variable.txt b/doc/src/variable.txt index e3b7c5de0d..c0851464c3 100644 --- a/doc/src/variable.txt +++ b/doc/src/variable.txt @@ -689,7 +689,7 @@ increase in increments of z, starting at x, until a is reached. At that point the timestep increases in increments of c, from a to b, then after b, increments by z are resumed until y is reached. For any current timestep, the next timestep in the sequence is returned. Thus -if stride(1000,2000,100,1350,1360,1) is used in a variable by the +if stride2(1000,2000,100,1350,1360,1) is used in a variable by the "dump_modify every"_dump_modify.html command, it will generate the sequence of output timesteps: diff --git a/examples/USER/meso/edpd/in.edpd b/examples/USER/meso/edpd/in.edpd index 316099bce3..af1a79d73d 100644 --- a/examples/USER/meso/edpd/in.edpd +++ b/examples/USER/meso/edpd/in.edpd @@ -1,54 +1,54 @@ -######################################################################## -### Heat conduction analog of periodic Poiseuille flow problem ### -### using energy-conserving DPD (eDPD) simulation ### -### ### -### Created : Zhen Li (zhen_li@brown.edu) ### -### Division of Applied Mathematics, Brown University. ### -### ### -### mDPD system setup follows Fig.12 in the publication: ### -### Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. ### -### "Energy-conserving dissipative particle dynamics with ### -### temperature-dependent properties". J. Comput. Phys., ### -### 2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 ### -######################################################################## -units lj -dimension 3 -boundary p p p -neighbor 0.2 bin -neigh_modify every 1 delay 0 check yes - -atom_style edpd - -region edpd block -10 10 -10 10 -5 5 units box -create_box 1 edpd -create_atoms 1 random 16000 276438 NULL -mass 1 1.0 -set atom * edpd/temp 1.0 -set atom * edpd/cv 1.0E5 - -pair_style edpd 1.58 9872598 -#pair_coeff 1 1 18.75 4.5 0.41 1.58 1.45E-5 2.0 1.58 -pair_coeff 1 1 18.75 4.5 0.41 1.58 1.41E-5 2.0 1.58 & - power 10.54 -3.66 3.44 -4.10 & - kappa -0.44 -3.21 5.04 0.00 - -compute mythermo all temp -thermo 100 -thermo_modify temp mythermo -thermo_modify flush yes - -velocity all create 1.0 432982 loop local dist gaussian - -fix mvv all mvv/edpd 0.5 -fix upper all edpd/source cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 -fix lower all edpd/source cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 - -timestep 0.01 -run 500 -reset_timestep 0 - -compute temp all edpd/temp/atom -compute ccT all chunk/atom bin/1d y 0.0 1.0 -fix stat all ave/chunk 1 500 500 ccT c_temp density/number norm sample file temp.profile - -run 500 +######################################################################## +### Heat conduction analog of periodic Poiseuille flow problem ### +### using energy-conserving DPD (eDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### mDPD system setup follows Fig.12 in the publication: ### +### Z. Li, Y.-H. Tang, H. Lei, B. Caswell and G.E. Karniadakis. ### +### "Energy-conserving dissipative particle dynamics with ### +### temperature-dependent properties". J. Comput. Phys., ### +### 2014, 265: 113-127. DOI: 10.1016/j.jcp.2014.02.003 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style edpd + +region edpd block -10 10 -10 10 -5 5 units box +create_box 1 edpd +create_atoms 1 random 16000 276438 NULL +mass 1 1.0 +set atom * edpd/temp 1.0 +set atom * edpd/cv 1.0E5 + +pair_style edpd 1.58 9872598 +#pair_coeff 1 1 18.75 4.5 0.41 1.58 1.45E-5 2.0 1.58 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.41E-5 2.0 1.58 & + power 10.54 -3.66 3.44 -4.10 & + kappa -0.44 -3.21 5.04 0.00 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/edpd 0.5 +fix upper all edpd/source cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower all edpd/source cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 + +timestep 0.01 +run 500 +reset_timestep 0 + +compute temp all edpd/temp/atom +compute ccT all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 500 500 ccT c_temp density/number norm sample file temp.profile + +run 500 diff --git a/examples/USER/meso/mdpd/in.mdpd b/examples/USER/meso/mdpd/in.mdpd index 201b4a340e..b0740c8227 100644 --- a/examples/USER/meso/mdpd/in.mdpd +++ b/examples/USER/meso/mdpd/in.mdpd @@ -1,52 +1,52 @@ -######################################################################## -#### 3D droplet oscilation using many-body DPD simulation ### -#### ### -#### Created : Zhen Li (zhen_li@brown.edu) ### -#### Division of Applied Mathematics, Brown University. ### -#### ### -#### mDPD parameters follow the choice of the publication: ### -#### Z. Li et al. "Three dimensional flow structures in a moving ### -#### droplet on substrate: a dissipative particle dynamics study" ### -#### Physics of Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 ### -######################################################################## -units lj -dimension 3 -boundary p p p -neighbor 0.3 bin -neigh_modify every 1 delay 0 check yes - -atom_style mdpd - -region mdpd block -25 25 -10 10 -10 10 units box -create_box 1 mdpd - -lattice fcc 6 -region film block -20 20 -7.5 7.5 -2.0 2.0 units box -create_atoms 1 region film - -pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 9872598 -pair_coeff 1 1 mdpd/rhosum 0.75 -pair_coeff 1 1 mdpd -40 25 18.0 1.0 0.75 -mass 1 1.0 - -compute mythermo all temp -thermo 100 -thermo_modify temp mythermo -thermo_modify flush yes - -velocity all create 1.0 38497 loop local dist gaussian - -fix mvv all mvv/dpd - -#dump mydump all atom 100 atom.lammpstrj - -#dump jpg all image 200 image.*.jpg type type zoom 5 adiam 0.5 & -# view 90 90 box no 0 size 600 200 -#dump_modify jpg pad 4 - -#dump avi all movie 200 movie.avi type type zoom 5 adiam 0.5 & -# view 90 90 box no 0 size 600 200 -#dump_modify avi pad 4 - -timestep 0.01 -run 4000 +######################################################################## +#### 3D droplet oscilation using many-body DPD simulation ### +#### ### +#### Created : Zhen Li (zhen_li@brown.edu) ### +#### Division of Applied Mathematics, Brown University. ### +#### ### +#### mDPD parameters follow the choice of the publication: ### +#### Z. Li et al. "Three dimensional flow structures in a moving ### +#### droplet on substrate: a dissipative particle dynamics study" ### +#### Physics of Fluids, 2013, 25: 072103. DOI: 10.1063/1.4812366 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.3 bin +neigh_modify every 1 delay 0 check yes + +atom_style mdpd + +region mdpd block -25 25 -10 10 -10 10 units box +create_box 1 mdpd + +lattice fcc 6 +region film block -20 20 -7.5 7.5 -2.0 2.0 units box +create_atoms 1 region film + +pair_style hybrid/overlay mdpd/rhosum mdpd 1.0 1.0 9872598 +pair_coeff 1 1 mdpd/rhosum 0.75 +pair_coeff 1 1 mdpd -40 25 18.0 1.0 0.75 +mass 1 1.0 + +compute mythermo all temp +thermo 100 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 38497 loop local dist gaussian + +fix mvv all mvv/dpd + +#dump mydump all atom 100 atom.lammpstrj + +#dump jpg all image 200 image.*.jpg type type zoom 5 adiam 0.5 & +# view 90 90 box no 0 size 600 200 +#dump_modify jpg pad 4 + +#dump avi all movie 200 movie.avi type type zoom 5 adiam 0.5 & +# view 90 90 box no 0 size 600 200 +#dump_modify avi pad 4 + +timestep 0.01 +run 4000 diff --git a/examples/USER/meso/tdpd/in.tdpd b/examples/USER/meso/tdpd/in.tdpd index 748a4f5077..5107e7a454 100644 --- a/examples/USER/meso/tdpd/in.tdpd +++ b/examples/USER/meso/tdpd/in.tdpd @@ -1,54 +1,54 @@ -######################################################################## -### Pure diffusion with a reaction source term analog of a periodic ### -### Poiseuille flow problem using transport DPD (tDPD) simulation ### -### ### -### Created : Zhen Li (zhen_li@brown.edu) ### -### Division of Applied Mathematics, Brown University. ### -### ### -### tDPD system setup follows Fig.1 in the publication: ### -### Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. ### -### "Transport dissipative particle dynamics model for mesoscopic ### -### advection-diffusion-reaction problems. J. Chem. Phys., ### -### 2015, 143: 014101. DOI: 10.1063/1.4923254 ### -######################################################################## -units lj -dimension 3 -boundary p p p -neighbor 0.2 bin -neigh_modify every 1 delay 0 check yes - -atom_style tdpd 2 - -region tdpd block -10 10 -10 10 -5 5 units box -create_box 1 tdpd -create_atoms 1 random 16000 276438 NULL -mass 1 1.0 -set atom * cc 1 1.0 -set atom * cc 2 1.0 - -pair_style tdpd 1.0 1.58 9872598 -pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 - -compute mythermo all temp -thermo 50 -thermo_modify temp mythermo -thermo_modify flush yes - -velocity all create 1.0 432982 loop local dist gaussian - -fix mvv all mvv/tdpd 0.5 -fix upper1 all tdpd/source 1 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 -fix lower1 all tdpd/source 1 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 -fix upper2 all tdpd/source 2 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 -0.01 -fix lower2 all tdpd/source 2 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 0.01 - -timestep 0.01 -run 500 -reset_timestep 0 - -compute cc1 all tdpd/cc/atom 1 -compute cc2 all tdpd/cc/atom 2 -compute bin all chunk/atom bin/1d y 0.0 1.0 -fix stat all ave/chunk 1 100 100 bin c_cc1 c_cc2 norm sample file cc.profile - -run 100 +######################################################################## +### Pure diffusion with a reaction source term analog of a periodic ### +### Poiseuille flow problem using transport DPD (tDPD) simulation ### +### ### +### Created : Zhen Li (zhen_li@brown.edu) ### +### Division of Applied Mathematics, Brown University. ### +### ### +### tDPD system setup follows Fig.1 in the publication: ### +### Z. Li, A. Yazdani, A. Tartakovsky and G.E. Karniadakis. ### +### "Transport dissipative particle dynamics model for mesoscopic ### +### advection-diffusion-reaction problems. J. Chem. Phys., ### +### 2015, 143: 014101. DOI: 10.1063/1.4923254 ### +######################################################################## +units lj +dimension 3 +boundary p p p +neighbor 0.2 bin +neigh_modify every 1 delay 0 check yes + +atom_style tdpd 2 + +region tdpd block -10 10 -10 10 -5 5 units box +create_box 1 tdpd +create_atoms 1 random 16000 276438 NULL +mass 1 1.0 +set atom * cc 1 1.0 +set atom * cc 2 1.0 + +pair_style tdpd 1.0 1.58 9872598 +pair_coeff 1 1 18.75 4.5 0.41 1.58 1.58 1.0 1.0E-5 2.0 3.0 1.0E-5 2.0 + +compute mythermo all temp +thermo 50 +thermo_modify temp mythermo +thermo_modify flush yes + +velocity all create 1.0 432982 loop local dist gaussian + +fix mvv all mvv/tdpd 0.5 +fix upper1 all tdpd/source 1 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 0.01 +fix lower1 all tdpd/source 1 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 -0.01 +fix upper2 all tdpd/source 2 cuboid 0.0 5.0 0.0 20.0 10.0 10.0 -0.01 +fix lower2 all tdpd/source 2 cuboid 0.0 -5.0 0.0 20.0 10.0 10.0 0.01 + +timestep 0.01 +run 500 +reset_timestep 0 + +compute cc1 all tdpd/cc/atom 1 +compute cc2 all tdpd/cc/atom 2 +compute bin all chunk/atom bin/1d y 0.0 1.0 +fix stat all ave/chunk 1 100 100 bin c_cc1 c_cc2 norm sample file cc.profile + +run 100 diff --git a/examples/USER/mgpt/log.lammps b/examples/USER/mgpt/log.lammps deleted file mode 100644 index 9485c36e47..0000000000 --- a/examples/USER/mgpt/log.lammps +++ /dev/null @@ -1,78 +0,0 @@ -LAMMPS (23 Oct 2015) -# script for mgpt t=0 eos with relaxed vacancy in bcc structure: -# input for relaxed vacancy formation energy at constant pressure - -echo screen -Lattice spacing in x,y,z = 6.23812 6.23812 6.23812 -Created orthogonal box = (0 0 0) to (31.1906 31.1906 31.1906) - 1 by 1 by 1 MPI processor grid -Created 250 atoms -Deleted 1 atoms, new total = 249 -Reading potential file Ta6.8x.mgpt.potin with DATE: 2015-07-30 -Neighbor list info ... - 2 neighbor list requests - update every 1 steps, delay 0 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 13.1712 - ghost atom cutoff = 13.1712 - binsize = 6.58562 -> bins = 5 5 5 -Memory usage per processor = 4.66978 Mbytes -Step Volume Temp PotEng TotEng Press - 0 30343.887 0 -73.994511 -73.994511 -1.0504398e+09 - 10 30343.887 0 -74.002332 -74.002332 -1.107516e+09 - 20 30343.887 0 -74.00485 -74.00485 -1.1316373e+09 - 30 30343.887 0 -74.005762 -74.005762 -1.143304e+09 - 40 30343.887 0 -74.006116 -74.006116 -1.149395e+09 - 50 30343.887 0 -74.006262 -74.006262 -1.1527914e+09 - 60 30343.887 0 -74.006323 -74.006323 -1.1547677e+09 - 70 30343.887 0 -74.00635 -74.00635 -1.1559529e+09 - 80 30343.887 0 -74.006361 -74.006361 -1.1566763e+09 - 90 30343.887 0 -74.006366 -74.006366 -1.1571256e+09 - 100 30343.887 0 -74.006369 -74.006369 -1.1574093e+09 - 110 30343.887 0 -74.00637 -74.00637 -1.1575908e+09 - 120 30343.887 0 -74.00637 -74.00637 -1.1577083e+09 - 130 30343.887 0 -74.00637 -74.00637 -1.1577849e+09 - 139 30343.887 0 -74.006371 -74.006371 -1.1578311e+09 -Loop time of 4.33109 on 1 procs for 139 steps with 249 atoms - -92.4% CPU use with 1 MPI tasks x no OpenMP threads - -Minimization stats: - Stopping criterion = energy tolerance - Energy initial, next-to-last, final = - -73.9945109564 -74.0063705487 -74.0063705557 - Force two-norm initial, final = 0.0366227 8.09081e-05 - Force max component initial, final = 0.00730948 8.05242e-06 - Final line search alpha, max atom move = 1 8.05242e-06 - Iterations, force evaluations = 139 139 - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 4.3064 | 4.3064 | 4.3064 | 0.0 | 99.43 -Neigh | 0.019113 | 0.019113 | 0.019113 | 0.0 | 0.44 -Comm | 0.0017624 | 0.0017624 | 0.0017624 | 0.0 | 0.04 -Output | 0.00084376 | 0.00084376 | 0.00084376 | 0.0 | 0.02 -Modify | 0 | 0 | 0 | 0.0 | 0.00 -Other | | 0.00297 | | | 0.07 - -Nlocal: 249 ave 249 max 249 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1479 ave 1479 max 1479 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 7936 ave 7936 max 7936 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -FullNghs: 15872 ave 15872 max 15872 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 15872 -Ave neighs/atom = 63.743 -Neighbor list builds = 4 -Dangerous builds = 0 -number of atoms = 249 -atomic volume (a.u.) = 121.863 -total energy (ry/atom) = -0.594428679162064 -pressure (gpa) = -1.15783109519801 -249 121.863 -148.012741111354 -1.15783109519801 -121.863 -0.594428679162064 -1.15783109519801 -Total wall time: 0:00:04 diff --git a/examples/gcmc/in.gcmc.co2 b/examples/gcmc/in.gcmc.co2 index 128f05b489..bb6916fc48 100644 --- a/examples/gcmc/in.gcmc.co2 +++ b/examples/gcmc/in.gcmc.co2 @@ -58,21 +58,21 @@ timestep 1.0 # rigid constraints with thermostat -fix myrigidnvt all rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol +fix myrigidnvt co2 rigid/nvt/small molecule temp ${temp} ${temp} 100 mol co2mol fix_modify myrigidnvt dynamic/dof no # gcmc variable tfac equal 5.0/3.0 # (3 trans + 2 rot)/(3 trans) -fix mygcmc all gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol & +fix mygcmc co2 gcmc 100 100 0 0 54341 ${temp} ${mu} ${disp} mol & co2mol tfac_insert ${tfac} group co2 rigid myrigidnvt # atom counts variable carbon atom "type==1" variable oxygen atom "type==2" -group carbon dynamic all var carbon -group oxygen dynamic all var oxygen +group carbon dynamic co2 var carbon +group oxygen dynamic co2 var oxygen variable nC equal count(carbon) variable nO equal count(oxygen) diff --git a/examples/gcmc/in.gcmc.lj b/examples/gcmc/in.gcmc.lj index 3fe78efb25..a1c7c6eb10 100644 --- a/examples/gcmc/in.gcmc.lj +++ b/examples/gcmc/in.gcmc.lj @@ -29,14 +29,18 @@ create_box 1 box pair_coeff * * 1.0 1.0 mass * 1.0 +# we recommend setting up a dedicated group for gcmc + +group gcmcgroup type 1 + # gcmc -fix mygcmc all gcmc 1 100 100 1 29494 ${temp} ${mu} ${disp} +fix mygcmc gcmcgroup gcmc 1 100 100 1 29494 ${temp} ${mu} ${disp} # atom count variable type1 atom "type==1" -group type1 dynamic all var type1 +group type1 dynamic gcmcgroup var type1 variable n1 equal count(type1) # averaging diff --git a/examples/latte/latte.in b/examples/latte/latte.in index 7df354a742..b8b214b78b 100644 --- a/examples/latte/latte.in +++ b/examples/latte/latte.in @@ -12,7 +12,7 @@ CONTROL{ xControl= 1 BASISTYPE= NONORTHO COORDSFILE= "./coords.dat" - PARAMPATH= "/home/user/LATTE/TBparam" + PARAMPATH= "./TBparam" KBT= 0.0 ENTROPYKIND= 1 PPOTON= 1 diff --git a/lib/colvars/colvar.cpp b/lib/colvars/colvar.cpp index ce76b3b9eb..5a4e8b617a 100644 --- a/lib/colvars/colvar.cpp +++ b/lib/colvars/colvar.cpp @@ -195,7 +195,7 @@ int colvar::init(std::string const &conf) // - it is homogeneous // - all cvcs are periodic // - all cvcs have the same period - if (cvcs[0]->b_periodic) { // TODO make this a CVC feature + if (is_enabled(f_cv_homogeneous) && cvcs[0]->b_periodic) { // TODO make this a CVC feature bool b_periodic = true; period = cvcs[0]->period; for (i = 1; i < cvcs.size(); i++) { diff --git a/lib/colvars/colvar.h b/lib/colvars/colvar.h index 20dad2771b..32c329460d 100644 --- a/lib/colvars/colvar.h +++ b/lib/colvars/colvar.h @@ -11,8 +11,6 @@ #define COLVAR_H #include -#include -#include #include "colvarmodule.h" #include "colvarvalue.h" @@ -60,10 +58,13 @@ public: /// \brief Current actual value (not extended DOF) colvarvalue const & actual_value() const; - + + /// \brief Current running average (if calculated as set by analysis flag) + colvarvalue const & run_ave() const; + /// \brief Force constant of the spring cvm::real const & force_constant() const; - + /// \brief Current velocity (previously set by calc() or by read_traj()) colvarvalue const & velocity() const; @@ -516,7 +517,7 @@ public: // collective variable component base class class cvc; - // currently available collective variable components + // list of available collective variable components // scalar colvar components class distance; @@ -611,12 +612,15 @@ inline colvarvalue const & colvar::value() const return x_reported; } - inline colvarvalue const & colvar::actual_value() const { return x; } +inline colvarvalue const & colvar::run_ave() const +{ + return runave; +} inline colvarvalue const & colvar::velocity() const { diff --git a/lib/colvars/colvar_UIestimator.h b/lib/colvars/colvar_UIestimator.h index 7fc7f870a1..36ed938119 100644 --- a/lib/colvars/colvar_UIestimator.h +++ b/lib/colvars/colvar_UIestimator.h @@ -45,7 +45,7 @@ namespace UIestimator { this->width = width; this->dimension = lowerboundary.size(); this->y_size = y_size; // keep in mind the internal (spare) matrix is stored in diagonal form - this->y_total_size = int(pow(double(y_size), dimension) + EPSILON); + this->y_total_size = int(std::pow(double(y_size), double(dimension)) + EPSILON); // the range of the matrix is [lowerboundary, upperboundary] x_total_size = 1; @@ -121,7 +121,7 @@ namespace UIestimator { int index = 0; for (i = 0; i < dimension; i++) { if (i + 1 < dimension) - index += temp[i] * int(pow(double(y_size), dimension - i - 1) + EPSILON); + index += temp[i] * int(std::pow(double(y_size), double(dimension - i - 1)) + EPSILON); else index += temp[i]; } diff --git a/lib/colvars/colvaratoms.cpp b/lib/colvars/colvaratoms.cpp index d2a0f0a807..1be6f42e59 100644 --- a/lib/colvars/colvaratoms.cpp +++ b/lib/colvars/colvaratoms.cpp @@ -8,9 +8,11 @@ // Colvars repository at GitHub. #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvarparse.h" #include "colvaratoms.h" + cvm::atom::atom() { index = -1; diff --git a/lib/colvars/colvaratoms.h b/lib/colvars/colvaratoms.h index 71c587e230..0dda6ab792 100644 --- a/lib/colvars/colvaratoms.h +++ b/lib/colvars/colvaratoms.h @@ -11,6 +11,7 @@ #define COLVARATOMS_H #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvarparse.h" #include "colvardeps.h" diff --git a/lib/colvars/colvarbias.cpp b/lib/colvars/colvarbias.cpp index 301e83e730..29620fbee8 100644 --- a/lib/colvars/colvarbias.cpp +++ b/lib/colvars/colvarbias.cpp @@ -8,6 +8,7 @@ // Colvars repository at GitHub. #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvarvalue.h" #include "colvarbias.h" #include "colvargrid.h" diff --git a/lib/colvars/colvarbias_abf.cpp b/lib/colvars/colvarbias_abf.cpp index e4aea8eb86..b3b5b3eb16 100644 --- a/lib/colvars/colvarbias_abf.cpp +++ b/lib/colvars/colvarbias_abf.cpp @@ -8,6 +8,7 @@ // Colvars repository at GitHub. #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvar.h" #include "colvarbias_abf.h" @@ -18,16 +19,18 @@ colvarbias_abf::colvarbias_abf(char const *key) b_CZAR_estimator(false), system_force(NULL), gradients(NULL), + pmf(NULL), samples(NULL), z_gradients(NULL), z_samples(NULL), czar_gradients(NULL), + czar_pmf(NULL), last_gradients(NULL), - last_samples(NULL) + last_samples(NULL), + pabf_freq(0) { } - int colvarbias_abf::init(std::string const &conf) { colvarbias::init(conf); @@ -91,7 +94,7 @@ int colvarbias_abf::init(std::string const &conf) // ************* checking the associated colvars ******************* - if (colvars.size() == 0) { + if (num_variables() == 0) { cvm::error("Error: no collective variables specified for the ABF bias.\n"); return COLVARS_ERROR; } @@ -102,7 +105,8 @@ int colvarbias_abf::init(std::string const &conf) } bool b_extended = false; - for (size_t i = 0; i < colvars.size(); i++) { + size_t i; + for (i = 0; i < num_variables(); i++) { if (colvars[i]->value().type() != colvarvalue::type_scalar) { cvm::error("Error: ABF bias can only use scalar-type variables.\n"); @@ -132,10 +136,10 @@ int colvarbias_abf::init(std::string const &conf) } if (get_keyval(conf, "maxForce", max_force)) { - if (max_force.size() != colvars.size()) { + if (max_force.size() != num_variables()) { cvm::error("Error: Number of parameters to maxForce does not match number of colvars."); } - for (size_t i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { if (max_force[i] < 0.0) { cvm::error("Error: maxForce should be non-negative."); } @@ -145,9 +149,9 @@ int colvarbias_abf::init(std::string const &conf) cap_force = false; } - bin.assign(colvars.size(), 0); - force_bin.assign(colvars.size(), 0); - system_force = new cvm::real [colvars.size()]; + bin.assign(num_variables(), 0); + force_bin.assign(num_variables(), 0); + system_force = new cvm::real [num_variables()]; // Construct empty grids based on the colvars if (cvm::debug()) { @@ -159,14 +163,14 @@ int colvarbias_abf::init(std::string const &conf) gradients->samples = samples; samples->has_parent_data = true; - // Data for eABF z-based estimator - if (b_extended) { + // Data for eAB F z-based estimator + if ( b_extended ) { get_keyval(conf, "CZARestimator", b_CZAR_estimator, true); // CZAR output files for stratified eABF get_keyval(conf, "writeCZARwindowFile", b_czar_window_file, false, colvarparse::parse_silent); - z_bin.assign(colvars.size(), 0); + z_bin.assign(num_variables(), 0); z_samples = new colvar_grid_count(colvars); z_samples->request_actual_value(); z_gradients = new colvar_grid_gradient(colvars); @@ -176,6 +180,27 @@ int colvarbias_abf::init(std::string const &conf) czar_gradients = new colvar_grid_gradient(colvars); } + // For now, we integrate on-the-fly iff the grid is < 3D + if ( num_variables() <= 3 ) { + pmf = new integrate_potential(colvars, gradients); + if ( b_CZAR_estimator ) { + czar_pmf = new integrate_potential(colvars, czar_gradients); + } + get_keyval(conf, "integrate", b_integrate, true); // Integrate for output + if ( num_variables() > 1 ) { + // Projected ABF + get_keyval(conf, "pABFintegrateFreq", pabf_freq, 0); + // Parameters for integrating initial (and final) gradient data + get_keyval(conf, "integrateInitSteps", integrate_initial_steps, 1e4); + get_keyval(conf, "integrateInitTol", integrate_initial_tol, 1e-6); + // for updating the integrated PMF on the fly + get_keyval(conf, "integrateSteps", integrate_steps, 100); + get_keyval(conf, "integrateTol", integrate_tol, 1e-4); + } + } else { + b_integrate = false; + } + // For shared ABF, we store a second set of grids. // This used to be only if "shared" was defined, // but now we allow calling share externally (e.g. from Tcl). @@ -188,6 +213,8 @@ int colvarbias_abf::init(std::string const &conf) // If custom grids are provided, read them if ( input_prefix.size() > 0 ) { read_gradients_samples(); + // Update divergence to account for input data + pmf->set_div(); } // if extendedLangrangian is on, then call UI estimator @@ -202,7 +229,7 @@ int colvarbias_abf::init(std::string const &conf) bool UI_restart = (input_prefix.size() > 0); - for (size_t i = 0; i < colvars.size(); i++) + for (i = 0; i < num_variables(); i++) { UI_lowerboundary.push_back(colvars[i]->lower_boundary); UI_upperboundary.push_back(colvars[i]->upper_boundary); @@ -238,6 +265,11 @@ colvarbias_abf::~colvarbias_abf() gradients = NULL; } + if (pmf) { + delete pmf; + pmf = NULL; + } + if (z_samples) { delete z_samples; z_samples = NULL; @@ -253,6 +285,11 @@ colvarbias_abf::~colvarbias_abf() czar_gradients = NULL; } + if (czar_pmf) { + delete czar_pmf; + czar_pmf = NULL; + } + // shared ABF // We used to only do this if "shared" was defined, // but now we can call shared externally @@ -278,44 +315,48 @@ colvarbias_abf::~colvarbias_abf() int colvarbias_abf::update() { + int iter; + if (cvm::debug()) cvm::log("Updating ABF bias " + this->name); - if (cvm::step_relative() == 0) { + size_t i; + for (i = 0; i < num_variables(); i++) { + bin[i] = samples->current_bin_scalar(i); + } + if (cvm::proxy->total_forces_same_step()) { + // e.g. in LAMMPS, total forces are current + force_bin = bin; + } - // At first timestep, do only: - // initialization stuff (file operations relying on n_abf_biases - // compute current value of colvars + if (cvm::step_relative() > 0 || cvm::proxy->total_forces_same_step()) { - for (size_t i = 0; i < colvars.size(); i++) { - bin[i] = samples->current_bin_scalar(i); - } + if (update_bias) { +// if (b_adiabatic_reweighting) { +// // Update gradients non-locally based on conditional distribution of +// // fictitious variable TODO +// +// } else + if (samples->index_ok(force_bin)) { + // Only if requested and within bounds of the grid... - } else { - - for (size_t i = 0; i < colvars.size(); i++) { - bin[i] = samples->current_bin_scalar(i); - } - - if ( update_bias && samples->index_ok(force_bin) ) { - // Only if requested and within bounds of the grid... - - for (size_t i = 0; i < colvars.size(); i++) { - // get total forces (lagging by 1 timestep) from colvars - // and subtract previous ABF force if necessary - update_system_force(i); + for (i = 0; i < num_variables(); i++) { + // get total forces (lagging by 1 timestep) from colvars + // and subtract previous ABF force if necessary + update_system_force(i); + } + gradients->acc_force(force_bin, system_force); + if ( b_integrate ) { + pmf->update_div_neighbors(force_bin); + } } - if (cvm::proxy->total_forces_same_step()) { - // e.g. in LAMMPS, total forces are current - force_bin = bin; - } - gradients->acc_force(force_bin, system_force); } + if ( z_gradients && update_bias ) { - for (size_t i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { z_bin[i] = z_samples->current_bin_scalar(i); } if ( z_samples->index_ok(z_bin) ) { - for (size_t i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { // If we are outside the range of xi, the force has not been obtained above // the function is just an accessor, so cheap to call again anyway update_system_force(i); @@ -323,6 +364,14 @@ int colvarbias_abf::update() z_gradients->acc_force(z_bin, system_force); } } + + if ( b_integrate ) { + if ( pabf_freq && cvm::step_relative() % pabf_freq == 0 ) { + cvm::real err; + iter = pmf->integrate(integrate_steps, integrate_tol, err); + pmf->set_zero_minimum(); // TODO: do this only when necessary + } + } } if (!cvm::proxy->total_forces_same_step()) { @@ -332,14 +381,14 @@ int colvarbias_abf::update() } // Reset biasing forces from previous timestep - for (size_t i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { colvar_forces[i].reset(); } // Compute and apply the new bias, if applicable if (is_enabled(f_cvb_apply_force) && samples->index_ok(bin)) { - size_t count = samples->value(bin); + cvm::real count = samples->value(bin); cvm::real fact = 1.0; // Factor that ensures smooth introduction of the force @@ -348,21 +397,34 @@ int colvarbias_abf::update() (cvm::real(count - min_samples)) / (cvm::real(full_samples - min_samples)); } - const cvm::real * grad = &(gradients->value(bin)); + std::vector grad(num_variables()); + if ( pabf_freq ) { + // In projected ABF, the force is the PMF gradient estimate + pmf->vector_gradient_finite_diff(bin, grad); + } else { + // Normal ABF + gradients->vector_value(bin, grad); + } + +// if ( b_adiabatic_reweighting) { +// // Average of force according to conditional distribution of fictitious variable +// // need freshly integrated PMF, gradient TODO +// } else if ( fact != 0.0 ) { - if ( (colvars.size() == 1) && colvars[0]->periodic_boundaries() ) { + if ( (num_variables() == 1) && colvars[0]->periodic_boundaries() ) { // Enforce a zero-mean bias on periodic, 1D coordinates // in other words: boundary condition is that the biasing potential is periodic - colvar_forces[0].real_value = fact * (grad[0] / cvm::real(count) - gradients->average()); + // This is enforced naturally if using integrated PMF + colvar_forces[0].real_value = fact * (grad[0] - gradients->average ()); } else { - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { // subtracting the mean force (opposite of the FE gradient) means adding the gradient - colvar_forces[i].real_value = fact * grad[i] / cvm::real(count); + colvar_forces[i].real_value = fact * grad[i]; } } if (cap_force) { - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { if ( colvar_forces[i].real_value * colvar_forces[i].real_value > max_force[i] * max_force[i] ) { colvar_forces[i].real_value = (colvar_forces[i].real_value > 0 ? max_force[i] : -1.0 * max_force[i]); } @@ -407,9 +469,9 @@ int colvarbias_abf::update() // update UI estimator every step if (b_UI_estimator) { - std::vector x(colvars.size(),0); - std::vector y(colvars.size(),0); - for (size_t i = 0; i < colvars.size(); i++) + std::vector x(num_variables(),0); + std::vector y(num_variables(),0); + for (size_t i = 0; i < num_variables(); i++) { x[i] = colvars[i]->actual_value(); y[i] = colvars[i]->value(); @@ -509,26 +571,60 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app cvm::proxy->output_stream(samples_out_name, mode); if (!samples_os) { cvm::error("Error opening ABF samples file " + samples_out_name + " for writing"); + return; } samples->write_multicol(*samples_os); cvm::proxy->close_output_stream(samples_out_name); + // In dimension higher than 2, dx is easier to handle and visualize + if (num_variables() > 2) { + std::string samples_dx_out_name = prefix + ".count.dx"; + std::ostream *samples_dx_os = cvm::proxy->output_stream(samples_dx_out_name, mode); + if (!samples_os) { + cvm::error("Error opening samples file " + samples_dx_out_name + " for writing"); + return; + } + samples->write_opendx(*samples_dx_os); + *samples_dx_os << std::endl; + cvm::proxy->close_output_stream(samples_dx_out_name); + } + std::ostream *gradients_os = cvm::proxy->output_stream(gradients_out_name, mode); if (!gradients_os) { cvm::error("Error opening ABF gradient file " + gradients_out_name + " for writing"); + return; } gradients->write_multicol(*gradients_os); cvm::proxy->close_output_stream(gradients_out_name); - if (colvars.size() == 1) { - // Do numerical integration and output a PMF + if (b_integrate) { + // Do numerical integration (to high precision) and output a PMF + cvm::real err; + pmf->integrate(integrate_initial_steps, integrate_initial_tol, err); + pmf->set_zero_minimum(); + std::string pmf_out_name = prefix + ".pmf"; std::ostream *pmf_os = cvm::proxy->output_stream(pmf_out_name, mode); if (!pmf_os) { cvm::error("Error opening pmf file " + pmf_out_name + " for writing"); + return; } - gradients->write_1D_integral(*pmf_os); + pmf->write_multicol(*pmf_os); + + // In dimension higher than 2, dx is easier to handle and visualize + if (num_variables() > 2) { + std::string pmf_dx_out_name = prefix + ".pmf.dx"; + std::ostream *pmf_dx_os = cvm::proxy->output_stream(pmf_dx_out_name, mode); + if (!pmf_dx_os) { + cvm::error("Error opening pmf file " + pmf_dx_out_name + " for writing"); + return; + } + pmf->write_opendx(*pmf_dx_os); + *pmf_dx_os << std::endl; + cvm::proxy->close_output_stream(pmf_dx_out_name); + } + *pmf_os << std::endl; cvm::proxy->close_output_stream(pmf_out_name); } @@ -542,6 +638,7 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app cvm::proxy->output_stream(z_samples_out_name, mode); if (!z_samples_os) { cvm::error("Error opening eABF z-histogram file " + z_samples_out_name + " for writing"); + return; } z_samples->write_multicol(*z_samples_os); cvm::proxy->close_output_stream(z_samples_out_name); @@ -553,6 +650,7 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app cvm::proxy->output_stream(z_gradients_out_name, mode); if (!z_gradients_os) { cvm::error("Error opening eABF z-gradient file " + z_gradients_out_name + " for writing"); + return; } z_gradients->write_multicol(*z_gradients_os); cvm::proxy->close_output_stream(z_gradients_out_name); @@ -563,8 +661,7 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app czar_gradients->index_ok(ix); czar_gradients->incr(ix)) { for (size_t n = 0; n < czar_gradients->multiplicity(); n++) { czar_gradients->set_value(ix, z_gradients->value_output(ix, n) - - cvm::temperature() * cvm::boltzmann() * z_samples->log_gradient_finite_diff(ix, n), - n); + - cvm::temperature() * cvm::boltzmann() * z_samples->log_gradient_finite_diff(ix, n), n); } } @@ -574,17 +671,39 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app cvm::proxy->output_stream(czar_gradients_out_name, mode); if (!czar_gradients_os) { cvm::error("Error opening CZAR gradient file " + czar_gradients_out_name + " for writing"); + return; } czar_gradients->write_multicol(*czar_gradients_os); cvm::proxy->close_output_stream(czar_gradients_out_name); - if (colvars.size() == 1) { - // Do numerical integration and output a PMF + if (b_integrate) { + // Do numerical integration (to high precision) and output a PMF + cvm::real err; + czar_pmf->set_div(); + czar_pmf->integrate(integrate_initial_steps, integrate_initial_tol, err); + czar_pmf->set_zero_minimum(); + std::string czar_pmf_out_name = prefix + ".czar.pmf"; - std::ostream *czar_pmf_os = - cvm::proxy->output_stream(czar_pmf_out_name, mode); - if (!czar_pmf_os) cvm::error("Error opening CZAR pmf file " + czar_pmf_out_name + " for writing"); - czar_gradients->write_1D_integral(*czar_pmf_os); + std::ostream *czar_pmf_os = cvm::proxy->output_stream(czar_pmf_out_name, mode); + if (!czar_pmf_os) { + cvm::error("Error opening CZAR pmf file " + czar_pmf_out_name + " for writing"); + return; + } + czar_pmf->write_multicol(*czar_pmf_os); + + // In dimension higher than 2, dx is easier to handle and visualize + if (num_variables() > 2) { + std::string czar_pmf_dx_out_name = prefix + ".czar.pmf.dx"; + std::ostream *czar_pmf_dx_os = cvm::proxy->output_stream(czar_pmf_dx_out_name, mode); + if (!czar_pmf_dx_os) { + cvm::error("Error opening CZAR pmf file " + czar_pmf_dx_out_name + " for writing"); + return; + } + czar_pmf->write_opendx(*czar_pmf_dx_os); + *czar_pmf_dx_os << std::endl; + cvm::proxy->close_output_stream(czar_pmf_dx_out_name); + } + *czar_pmf_os << std::endl; cvm::proxy->close_output_stream(czar_pmf_out_name); } @@ -708,6 +827,10 @@ std::istream & colvarbias_abf::read_state_data(std::istream& is) if (! gradients->read_raw(is)) { return is; } + if (b_integrate) { + // Update divergence to account for restart data + pmf->set_div(); + } if (b_CZAR_estimator) { diff --git a/lib/colvars/colvarbias_abf.h b/lib/colvars/colvarbias_abf.h index 1defe72268..0260401292 100644 --- a/lib/colvars/colvarbias_abf.h +++ b/lib/colvars/colvarbias_abf.h @@ -40,28 +40,44 @@ private: /// Base filename(s) for reading previous gradient data (replaces data from restart file) std::vector input_prefix; - bool update_bias; - bool hide_Jacobian; - size_t full_samples; - size_t min_samples; + bool update_bias; + bool hide_Jacobian; + bool b_integrate; + + size_t full_samples; + size_t min_samples; /// frequency for updating output files - int output_freq; + int output_freq; /// Write combined files with a history of all output data? - bool b_history_files; + bool b_history_files; /// Write CZAR output file for stratified eABF (.zgrad) - bool b_czar_window_file; - size_t history_freq; + bool b_czar_window_file; + size_t history_freq; /// Umbrella Integration estimator of free energy from eABF UIestimator::UIestimator eabf_UI; - // Run UI estimator? - bool b_UI_estimator; - // Run CZAR estimator? - bool b_CZAR_estimator; + /// Run UI estimator? + bool b_UI_estimator; + /// Run CZAR estimator? + bool b_CZAR_estimator; - /// Cap applied biasing force? + /// Frequency for updating pABF PMF (if zero, pABF is not used) + int pabf_freq; + /// Max number of CG iterations for integrating PMF at startup and for file output + int integrate_initial_steps; + /// Tolerance for integrating PMF at startup and for file output + cvm::real integrate_initial_tol; + /// Max number of CG iterations for integrating PMF at on-the-fly pABF updates + int integrate_steps; + /// Tolerance for integrating PMF at on-the-fly pABF updates + cvm::real integrate_tol; + + /// Cap the biasing force to be applied? bool cap_force; std::vector max_force; + // Frequency for updating 2D gradients + int integrate_freq; + // Internal data and methods std::vector bin, force_bin, z_bin; @@ -71,12 +87,16 @@ private: colvar_grid_gradient *gradients; /// n-dim grid of number of samples colvar_grid_count *samples; + /// n-dim grid of pmf (dimension 1 to 3) + integrate_potential *pmf; /// n-dim grid: average force on "real" coordinate for eABF z-based estimator colvar_grid_gradient *z_gradients; /// n-dim grid of number of samples on "real" coordinate for eABF z-based estimator colvar_grid_count *z_samples; /// n-dim grid contining CZAR estimator of "real" free energy gradients colvar_grid_gradient *czar_gradients; + /// n-dim grid of CZAR pmf (dimension 1 to 3) + integrate_potential *czar_pmf; inline int update_system_force(size_t i) { @@ -96,9 +116,9 @@ private: } // shared ABF - bool shared_on; - size_t shared_freq; - int shared_last_step; + bool shared_on; + size_t shared_freq; + int shared_last_step; // Share between replicas -- may be called independently of update virtual int replica_share(); @@ -114,12 +134,12 @@ private: //// Give the count at a given bin index. virtual int bin_count(int bin_index); - /// Write human-readable FE gradients and sample count - void write_gradients_samples(const std::string &prefix, bool append = false); - void write_last_gradients_samples(const std::string &prefix, bool append = false); + /// Write human-readable FE gradients and sample count, and DX file in dim > 2 + void write_gradients_samples(const std::string &prefix, bool append = false); + void write_last_gradients_samples(const std::string &prefix, bool append = false); /// Read human-readable FE gradients and sample count (if not using restart) - void read_gradients_samples(); + void read_gradients_samples(); std::istream& read_state_data(std::istream&); std::ostream& write_state_data(std::ostream&); diff --git a/lib/colvars/colvarbias_alb.cpp b/lib/colvars/colvarbias_alb.cpp index 124a15c5da..187ecc363a 100644 --- a/lib/colvars/colvarbias_alb.cpp +++ b/lib/colvars/colvarbias_alb.cpp @@ -7,13 +7,11 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. -#include -#include -#include +#include #include "colvarmodule.h" -#include "colvarbias_alb.h" #include "colvarbias.h" +#include "colvarbias_alb.h" #ifdef _MSC_VER #if _MSC_VER <= 1700 @@ -45,22 +43,22 @@ int colvarbias_alb::init(std::string const &conf) size_t i; // get the initial restraint centers - colvar_centers.resize(colvars.size()); + colvar_centers.resize(num_variables()); - means.resize(colvars.size()); - ssd.resize(colvars.size()); //sum of squares of differences from mean + means.resize(num_variables()); + ssd.resize(num_variables()); //sum of squares of differences from mean //setup force vectors - max_coupling_range.resize(colvars.size()); - max_coupling_rate.resize(colvars.size()); - coupling_accum.resize(colvars.size()); - set_coupling.resize(colvars.size()); - current_coupling.resize(colvars.size()); - coupling_rate.resize(colvars.size()); + max_coupling_range.resize(num_variables()); + max_coupling_rate.resize(num_variables()); + coupling_accum.resize(num_variables()); + set_coupling.resize(num_variables()); + current_coupling.resize(num_variables()); + coupling_rate.resize(num_variables()); enable(f_cvb_apply_force); - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { colvar_centers[i].type(colvars[i]->value()); //zero moments means[i] = ssd[i] = 0; @@ -70,7 +68,7 @@ int colvarbias_alb::init(std::string const &conf) } if (get_keyval(conf, "centers", colvar_centers, colvar_centers)) { - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { colvar_centers[i].apply_constraints(); } } else { @@ -78,7 +76,7 @@ int colvarbias_alb::init(std::string const &conf) cvm::fatal_error("Error: must define the initial centers of adaptive linear bias .\n"); } - if (colvar_centers.size() != colvars.size()) + if (colvar_centers.size() != num_variables()) cvm::fatal_error("Error: number of centers does not match " "that of collective variables.\n"); @@ -100,17 +98,17 @@ int colvarbias_alb::init(std::string const &conf) //initial guess if (!get_keyval(conf, "forceConstant", set_coupling, set_coupling)) - for (i =0 ; i < colvars.size(); i++) + for (i =0 ; i < num_variables(); i++) set_coupling[i] = 0.; //how we're going to increase to that point - for (i = 0; i < colvars.size(); i++) + for (i = 0; i < num_variables(); i++) coupling_rate[i] = (set_coupling[i] - current_coupling[i]) / update_freq; if (!get_keyval(conf, "forceRange", max_coupling_range, max_coupling_range)) { //set to default - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { if (cvm::temperature() > 0) max_coupling_range[i] = 3 * cvm::temperature() * cvm::boltzmann(); else @@ -120,7 +118,7 @@ int colvarbias_alb::init(std::string const &conf) if (!get_keyval(conf, "rateMax", max_coupling_rate, max_coupling_rate)) { //set to default - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { max_coupling_rate[i] = max_coupling_range[i] / (10 * update_freq); } } @@ -151,7 +149,7 @@ int colvarbias_alb::update() // Force and energy calculation bool finished_equil_flag = 1; cvm::real delta; - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { colvar_forces[i] = -1.0 * restraint_force(restraint_convert_k(current_coupling[i], colvars[i]->width), colvars[i], colvar_centers[i]); @@ -168,7 +166,9 @@ int colvarbias_alb::update() } else { //check if we've reached the setpoint - if (coupling_rate[i] == 0 || pow(current_coupling[i] - set_coupling[i],2) < pow(coupling_rate[i],2)) { + cvm::real const coupling_diff = current_coupling[i] - set_coupling[i]; + if ((coupling_rate[i] == 0) || + ((coupling_diff*coupling_diff) < (coupling_rate[i]*coupling_rate[i]))) { finished_equil_flag &= 1; //we continue equilibrating as long as we haven't reached all the set points } else { @@ -209,7 +209,7 @@ int colvarbias_alb::update() cvm::real temp; //reset means and sum of squares of differences - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { temp = 2. * (means[i] / (static_cast (colvar_centers[i])) - 1) * ssd[i] / (update_calls - 1); @@ -222,7 +222,7 @@ int colvarbias_alb::update() ssd[i] = 0; //stochastic if we do that update or not - if (colvars.size() == 1 || rand() < RAND_MAX / ((int) colvars.size())) { + if (num_variables() == 1 || rand() < RAND_MAX / ((int) num_variables())) { coupling_accum[i] += step_size * step_size; current_coupling[i] = set_coupling[i]; set_coupling[i] += max_coupling_range[i] / sqrt(coupling_accum[i]) * step_size; @@ -284,37 +284,37 @@ std::string const colvarbias_alb::get_state_params() const std::ostringstream os; os << " setCoupling "; size_t i; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << set_coupling[i] << "\n"; } os << " currentCoupling "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << current_coupling[i] << "\n"; } os << " maxCouplingRange "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << max_coupling_range[i] << "\n"; } os << " couplingRate "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << coupling_rate[i] << "\n"; } os << " couplingAccum "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << coupling_accum[i] << "\n"; } os << " mean "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << means[i] << "\n"; } os << " ssd "; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { os << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << ssd[i] << "\n"; } @@ -350,7 +350,7 @@ std::ostream & colvarbias_alb::write_traj_label(std::ostream &os) } if (b_output_centers) - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { size_t const this_cv_width = (colvars[i]->value()).output_width(cvm::cv_width); os << " x0_" << cvm::wrap_string(colvars[i]->name, this_cv_width-3); @@ -378,7 +378,7 @@ std::ostream & colvarbias_alb::write_traj(std::ostream &os) if (b_output_centers) - for (size_t i = 0; i < colvars.size(); i++) { + for (size_t i = 0; i < num_variables(); i++) { os << " " << std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width) << colvar_centers[i]; diff --git a/lib/colvars/colvarbias_histogram.cpp b/lib/colvars/colvarbias_histogram.cpp index 0722e6384d..329b1d9dc0 100644 --- a/lib/colvars/colvarbias_histogram.cpp +++ b/lib/colvars/colvarbias_histogram.cpp @@ -8,10 +8,10 @@ // Colvars repository at GitHub. #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvar.h" #include "colvarbias_histogram.h" -/// Histogram "bias" constructor colvarbias_histogram::colvarbias_histogram(char const *key) : colvarbias(key), @@ -44,7 +44,7 @@ int colvarbias_histogram::init(std::string const &conf) get_keyval(conf, "gatherVectorColvars", colvar_array, colvar_array); if (colvar_array) { - for (i = 0; i < colvars.size(); i++) { // should be all vector + for (i = 0; i < num_variables(); i++) { // should be all vector if (colvars[i]->value().type() != colvarvalue::type_vector) { cvm::error("Error: used gatherVectorColvars with non-vector colvar.\n", INPUT_ERROR); return INPUT_ERROR; @@ -63,7 +63,7 @@ int colvarbias_histogram::init(std::string const &conf) } } } else { - for (i = 0; i < colvars.size(); i++) { // should be all scalar + for (i = 0; i < num_variables(); i++) { // should be all scalar if (colvars[i]->value().type() != colvarvalue::type_scalar) { cvm::error("Error: only scalar colvars are supported when gatherVectorColvars is off.\n", INPUT_ERROR); return INPUT_ERROR; @@ -77,7 +77,7 @@ int colvarbias_histogram::init(std::string const &conf) get_keyval(conf, "weights", weights, weights); } - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { colvars[i]->enable(f_cv_grid); } @@ -116,7 +116,7 @@ int colvarbias_histogram::update() } // assign a valid bin size - bin.assign(colvars.size(), 0); + bin.assign(num_variables(), 0); if (out_name.size() == 0) { // At the first timestep, we need to assign out_name since @@ -137,7 +137,7 @@ int colvarbias_histogram::update() if (colvar_array_size == 0) { // update indices for scalar values size_t i; - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { bin[i] = grid->current_bin_scalar(i); } @@ -148,7 +148,7 @@ int colvarbias_histogram::update() // update indices for vector/array values size_t iv, i; for (iv = 0; iv < colvar_array_size; iv++) { - for (i = 0; i < colvars.size(); i++) { + for (i = 0; i < num_variables(); i++) { bin[i] = grid->current_bin_scalar(i, iv); } diff --git a/lib/colvars/colvarbias_meta.cpp b/lib/colvars/colvarbias_meta.cpp index b0d154dfc9..f3ae3631a0 100644 --- a/lib/colvars/colvarbias_meta.cpp +++ b/lib/colvars/colvarbias_meta.cpp @@ -27,7 +27,8 @@ #define PATHSEP "/" #endif - +#include "colvarmodule.h" +#include "colvarproxy.h" #include "colvar.h" #include "colvarbias_meta.h" diff --git a/lib/colvars/colvarbias_restraint.cpp b/lib/colvars/colvarbias_restraint.cpp index 23534f56eb..4ed1a95f94 100644 --- a/lib/colvars/colvarbias_restraint.cpp +++ b/lib/colvars/colvarbias_restraint.cpp @@ -7,7 +7,10 @@ // If you wish to distribute your changes, please submit them to the // Colvars repository at GitHub. +#include + #include "colvarmodule.h" +#include "colvarproxy.h" #include "colvarvalue.h" #include "colvarbias_restraint.h" @@ -150,13 +153,14 @@ colvarbias_restraint_k::colvarbias_restraint_k(char const *key) : colvarbias(key), colvarbias_ti(key), colvarbias_restraint(key) { force_k = -1.0; + check_positive_k = true; } int colvarbias_restraint_k::init(std::string const &conf) { get_keyval(conf, "forceConstant", force_k, (force_k > 0.0 ? force_k : 1.0)); - if (force_k < 0.0) { + if (check_positive_k && (force_k < 0.0)) { cvm::error("Error: undefined or invalid force constant.\n", INPUT_ERROR); return INPUT_ERROR; } @@ -177,6 +181,7 @@ colvarbias_restraint_moving::colvarbias_restraint_moving(char const *key) target_nstages = 0; target_nsteps = 0; stage = 0; + acc_work = 0.0; b_chg_centers = false; b_chg_force_k = false; } @@ -203,6 +208,14 @@ int colvarbias_restraint_moving::init(std::string const &conf) cvm::error("Error: targetNumStages and lambdaSchedule are incompatible.\n", INPUT_ERROR); return cvm::get_error(); } + + get_keyval_feature(this, conf, "outputAccumulatedWork", + f_cvb_output_acc_work, + is_enabled(f_cvb_output_acc_work)); + if (is_enabled(f_cvb_output_acc_work) && (target_nstages > 0)) { + return cvm::error("Error: outputAccumulatedWork and targetNumStages " + "are incompatible.\n", INPUT_ERROR); + } } return COLVARS_OK; @@ -246,8 +259,6 @@ colvarbias_restraint_centers_moving::colvarbias_restraint_centers_moving(char co { b_chg_centers = false; b_output_centers = false; - b_output_acc_work = false; - acc_work = 0.0; } @@ -288,9 +299,6 @@ int colvarbias_restraint_centers_moving::init(std::string const &conf) 0.5); } - get_keyval(conf, "outputAccumulatedWork", b_output_acc_work, - b_output_acc_work); // TODO this conflicts with stages - } else { target_centers.clear(); } @@ -382,12 +390,14 @@ int colvarbias_restraint_centers_moving::update() int colvarbias_restraint_centers_moving::update_acc_work() { - if (b_output_acc_work) { - if ((cvm::step_relative() > 0) && - (cvm::step_absolute() <= target_nsteps)) { - for (size_t i = 0; i < num_variables(); i++) { - // project forces on the calculated increments at this step - acc_work += colvar_forces[i] * centers_incr[i]; + if (b_chg_centers) { + if (is_enabled(f_cvb_output_acc_work)) { + if ((cvm::step_relative() > 0) && + (cvm::step_absolute() <= target_nsteps)) { + for (size_t i = 0; i < num_variables(); i++) { + // project forces on the calculated increments at this step + acc_work += colvar_forces[i] * centers_incr[i]; + } } } } @@ -410,7 +420,7 @@ std::string const colvarbias_restraint_centers_moving::get_state_params() const } os << "\n"; - if (b_output_acc_work) { + if (is_enabled(f_cvb_output_acc_work)) { os << "accumulatedWork " << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << acc_work << "\n"; @@ -429,7 +439,7 @@ int colvarbias_restraint_centers_moving::set_state_params(std::string const &con // cvm::log ("Reading the updated restraint centers from the restart.\n"); if (!get_keyval(conf, "centers", colvar_centers)) cvm::error("Error: restraint centers are missing from the restart.\n"); - if (b_output_acc_work) { + if (is_enabled(f_cvb_output_acc_work)) { if (!get_keyval(conf, "accumulatedWork", acc_work)) cvm::error("Error: accumulatedWork is missing from the restart.\n"); } @@ -449,7 +459,7 @@ std::ostream & colvarbias_restraint_centers_moving::write_traj_label(std::ostrea } } - if (b_output_acc_work) { + if (b_chg_centers && is_enabled(f_cvb_output_acc_work)) { os << " W_" << cvm::wrap_string(this->name, cvm::en_width-2); } @@ -468,7 +478,7 @@ std::ostream & colvarbias_restraint_centers_moving::write_traj(std::ostream &os) } } - if (b_output_acc_work) { + if (b_chg_centers && is_enabled(f_cvb_output_acc_work)) { os << " " << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << acc_work; @@ -488,10 +498,11 @@ colvarbias_restraint_k_moving::colvarbias_restraint_k_moving(char const *key) { b_chg_force_k = false; target_equil_steps = 0; - target_force_k = 0.0; - starting_force_k = 0.0; + target_force_k = -1.0; + starting_force_k = -1.0; force_k_exp = 1.0; restraint_FE = 0.0; + force_k_incr = 0.0; } @@ -569,14 +580,13 @@ int colvarbias_restraint_k_moving::update() if (target_equil_steps == 0 || cvm::step_absolute() % target_nsteps >= target_equil_steps) { // Start averaging after equilibration period, if requested - // Square distance normalized by square colvar width - cvm::real dist_sq = 0.0; + // Derivative of energy with respect to force_k + cvm::real dU_dk = 0.0; for (size_t i = 0; i < num_variables(); i++) { - dist_sq += d_restraint_potential_dk(i); + dU_dk += d_restraint_potential_dk(i); } - - restraint_FE += 0.5 * force_k_exp * std::pow(lambda, force_k_exp - 1.0) - * (target_force_k - starting_force_k) * dist_sq; + restraint_FE += force_k_exp * std::pow(lambda, force_k_exp - 1.0) + * (target_force_k - starting_force_k) * dU_dk; } // Finish current stage... @@ -607,10 +617,13 @@ int colvarbias_restraint_k_moving::update() } else if (cvm::step_absolute() <= target_nsteps) { + // update force constant (slow growth) lambda = cvm::real(cvm::step_absolute()) / cvm::real(target_nsteps); + cvm::real const force_k_old = force_k; force_k = starting_force_k + (target_force_k - starting_force_k) * std::pow(lambda, force_k_exp); + force_k_incr = force_k - force_k_old; } } @@ -618,6 +631,23 @@ int colvarbias_restraint_k_moving::update() } +int colvarbias_restraint_k_moving::update_acc_work() +{ + if (b_chg_force_k) { + if (is_enabled(f_cvb_output_acc_work)) { + if (cvm::step_relative() > 0) { + cvm::real dU_dk = 0.0; + for (size_t i = 0; i < num_variables(); i++) { + dU_dk += d_restraint_potential_dk(i); + } + acc_work += dU_dk * force_k_incr; + } + } + } + return COLVARS_OK; +} + + std::string const colvarbias_restraint_k_moving::get_state_params() const { std::ostringstream os; @@ -626,6 +656,12 @@ std::string const colvarbias_restraint_k_moving::get_state_params() const os << "forceConstant " << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) << force_k << "\n"; + + if (is_enabled(f_cvb_output_acc_work)) { + os << "accumulatedWork " + << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) + << acc_work << "\n"; + } } return os.str(); } @@ -639,6 +675,10 @@ int colvarbias_restraint_k_moving::set_state_params(std::string const &conf) // cvm::log ("Reading the updated force constant from the restart.\n"); if (!get_keyval(conf, "forceConstant", force_k, force_k)) cvm::error("Error: force constant is missing from the restart.\n"); + if (is_enabled(f_cvb_output_acc_work)) { + if (!get_keyval(conf, "accumulatedWork", acc_work)) + cvm::error("Error: accumulatedWork is missing from the restart.\n"); + } } return COLVARS_OK; @@ -647,12 +687,21 @@ int colvarbias_restraint_k_moving::set_state_params(std::string const &conf) std::ostream & colvarbias_restraint_k_moving::write_traj_label(std::ostream &os) { + if (b_chg_force_k && is_enabled(f_cvb_output_acc_work)) { + os << " W_" + << cvm::wrap_string(this->name, cvm::en_width-2); + } return os; } std::ostream & colvarbias_restraint_k_moving::write_traj(std::ostream &os) { + if (b_chg_force_k && is_enabled(f_cvb_output_acc_work)) { + os << " " + << std::setprecision(cvm::en_prec) << std::setw(cvm::en_width) + << acc_work; + } return os; } @@ -765,6 +814,7 @@ int colvarbias_restraint_harmonic::update() // update accumulated work using the current forces error_code |= colvarbias_restraint_centers_moving::update_acc_work(); + error_code |= colvarbias_restraint_k_moving::update_acc_work(); return error_code; } @@ -876,8 +926,8 @@ colvarbias_restraint_harmonic_walls::colvarbias_restraint_harmonic_walls(char co colvarbias_restraint_moving(key), colvarbias_restraint_k_moving(key) { - lower_wall_k = 0.0; - upper_wall_k = 0.0; + lower_wall_k = -1.0; + upper_wall_k = -1.0; } @@ -887,26 +937,6 @@ int colvarbias_restraint_harmonic_walls::init(std::string const &conf) colvarbias_restraint_moving::init(conf); colvarbias_restraint_k_moving::init(conf); - get_keyval(conf, "lowerWallConstant", lower_wall_k, - (lower_wall_k > 0.0) ? lower_wall_k : force_k); - get_keyval(conf, "upperWallConstant", upper_wall_k, - (upper_wall_k > 0.0) ? upper_wall_k : force_k); - - if (lower_wall_k * upper_wall_k > 0.0) { - for (size_t i = 0; i < num_variables(); i++) { - if (variables(i)->width != 1.0) - cvm::log("The lower and upper wall force constants for colvar \""+ - variables(i)->name+ - "\" will be rescaled to "+ - cvm::to_str(lower_wall_k / - (variables(i)->width * variables(i)->width))+ - " and "+ - cvm::to_str(upper_wall_k / - (variables(i)->width * variables(i)->width))+ - " according to the specified width.\n"); - } - } - enable(f_cvb_scalar_variables); size_t i; @@ -942,16 +972,23 @@ int colvarbias_restraint_harmonic_walls::init(std::string const &conf) } if ((lower_walls.size() == 0) && (upper_walls.size() == 0)) { - cvm::error("Error: no walls provided.\n", INPUT_ERROR); - return INPUT_ERROR; + return cvm::error("Error: no walls provided.\n", INPUT_ERROR); + } + + if (lower_walls.size() > 0) { + get_keyval(conf, "lowerWallConstant", lower_wall_k, + (lower_wall_k > 0.0) ? lower_wall_k : force_k); + } + if (upper_walls.size() > 0) { + get_keyval(conf, "upperWallConstant", upper_wall_k, + (upper_wall_k > 0.0) ? upper_wall_k : force_k); } if ((lower_walls.size() == 0) || (upper_walls.size() == 0)) { for (i = 0; i < num_variables(); i++) { if (variables(i)->is_enabled(f_cv_periodic)) { - cvm::error("Error: at least one variable is periodic, " - "both walls must be provided.\n", INPUT_ERROR); - return INPUT_ERROR; + return cvm::error("Error: at least one variable is periodic, " + "both walls must be provided.\n", INPUT_ERROR); } } } @@ -972,19 +1009,49 @@ int colvarbias_restraint_harmonic_walls::init(std::string const &conf) INPUT_ERROR); return INPUT_ERROR; } - force_k = lower_wall_k * upper_wall_k; - // transform the two constants to relative values + force_k = std::sqrt(lower_wall_k * upper_wall_k); + // transform the two constants to relative values using gemetric mean as ref + // to preserve force_k if provided as single parameter // (allow changing both via force_k) lower_wall_k /= force_k; upper_wall_k /= force_k; + } else { + // If only one wall is defined, need to rescale as well + if (lower_walls.size() > 0) { + force_k = lower_wall_k; + lower_wall_k = 1.0; + } + if (upper_walls.size() > 0) { + force_k = upper_wall_k; + upper_wall_k = 1.0; + } } - for (i = 0; i < num_variables(); i++) { - if (variables(i)->width != 1.0) - cvm::log("The force constant for colvar \""+variables(i)->name+ - "\" will be rescaled to "+ - cvm::to_str(force_k / (variables(i)->width * variables(i)->width))+ - " according to the specified width.\n"); + // Initialize starting value of the force constant (in case it's changing) + starting_force_k = force_k; + + if (lower_walls.size() > 0) { + for (i = 0; i < num_variables(); i++) { + if (variables(i)->width != 1.0) + cvm::log("The lower wall force constant for colvar \""+ + variables(i)->name+ + "\" will be rescaled to "+ + cvm::to_str(lower_wall_k * force_k / + (variables(i)->width * variables(i)->width))+ + " according to the specified width.\n"); + } + } + + if (upper_walls.size() > 0) { + for (i = 0; i < num_variables(); i++) { + if (variables(i)->width != 1.0) + cvm::log("The upper wall force constant for colvar \""+ + variables(i)->name+ + "\" will be rescaled to "+ + cvm::to_str(upper_wall_k * force_k / + (variables(i)->width * variables(i)->width))+ + " according to the specified width.\n"); + } } return COLVARS_OK; @@ -1001,6 +1068,8 @@ int colvarbias_restraint_harmonic_walls::update() error_code |= colvarbias_restraint::update(); + error_code |= colvarbias_restraint_k_moving::update_acc_work(); + return error_code; } @@ -1134,6 +1203,7 @@ colvarbias_restraint_linear::colvarbias_restraint_linear(char const *key) colvarbias_restraint_centers_moving(key), colvarbias_restraint_k_moving(key) { + check_positive_k = false; } @@ -1177,6 +1247,7 @@ int colvarbias_restraint_linear::update() // update accumulated work using the current forces error_code |= colvarbias_restraint_centers_moving::update_acc_work(); + error_code |= colvarbias_restraint_k_moving::update_acc_work(); return error_code; } diff --git a/lib/colvars/colvarbias_restraint.h b/lib/colvars/colvarbias_restraint.h index b10649cab1..3ee999c262 100644 --- a/lib/colvars/colvarbias_restraint.h +++ b/lib/colvars/colvarbias_restraint.h @@ -89,8 +89,12 @@ public: virtual int change_configuration(std::string const &conf); protected: + /// \brief Restraint force constant cvm::real force_k; + + /// \brief Whether the force constant should be positive + bool check_positive_k; }; @@ -129,6 +133,9 @@ protected: /// \brief Number of steps required to reach the target force constant /// or restraint centers long target_nsteps; + + /// \brief Accumulated work (computed when outputAccumulatedWork == true) + cvm::real acc_work; }; @@ -157,8 +164,7 @@ protected: /// \brief Initial value of the restraint centers std::vector initial_centers; - /// \brief Amplitude of the restraint centers' increment at each step - /// towards the new values (calculated from target_nsteps) + /// \brief Increment of the restraint centers at each step std::vector centers_incr; /// \brief Update the centers by interpolating between initial and target @@ -167,12 +173,6 @@ protected: /// Whether to write the current restraint centers to the trajectory file bool b_output_centers; - /// Whether to write the current accumulated work to the trajectory file - bool b_output_acc_work; - - /// \brief Accumulated work - cvm::real acc_work; - /// Update the accumulated work int update_acc_work(); }; @@ -212,6 +212,12 @@ protected: /// \brief Equilibration steps for restraint FE calculation through TI cvm::real target_equil_steps; + + /// \brief Increment of the force constant at each step + cvm::real force_k_incr; + + /// Update the accumulated work + int update_acc_work(); }; diff --git a/lib/colvars/colvarcomp.h b/lib/colvars/colvarcomp.h index b94d798be9..52078a3a30 100644 --- a/lib/colvars/colvarcomp.h +++ b/lib/colvars/colvarcomp.h @@ -20,52 +20,48 @@ // simple_scalar_dist_functions (derived_class) -#include -#include - - #include "colvarmodule.h" #include "colvar.h" #include "colvaratoms.h" -/// \brief Colvar component (base class); most implementations of -/// \link cvc \endlink utilize one or more \link -/// colvarmodule::atom \endlink or \link colvarmodule::atom_group -/// \endlink objects to access atoms. +/// \brief Colvar component (base class for collective variables) /// /// A \link cvc \endlink object (or an object of a -/// cvc-derived class) specifies how to calculate a collective -/// variable, its gradients and other related physical quantities -/// which do not depend only on the numeric value (the \link colvar -/// \endlink class already serves this purpose). +/// cvc-derived class) implements the calculation of a collective +/// variable, its gradients and any other related physical quantities +/// that depend on microscopic degrees of freedom. /// -/// No restriction is set to what kind of calculation a \link -/// cvc \endlink object performs (usually calculate an -/// analytical function of atomic coordinates). The only constraint -/// is that the value calculated is implemented as a \link colvarvalue -/// \endlink object. This serves to provide a unique way to calculate -/// scalar and non-scalar collective variables, and specify if and how -/// they can be combined together by the parent \link colvar \endlink -/// object. +/// No restriction is set to what kind of calculation a \link cvc \endlink +/// object performs (usually an analytical function of atomic coordinates). +/// The only constraints are that: \par +/// +/// - The value is calculated by the \link calc_value() \endlink +/// method, and is an object of \link colvarvalue \endlink class. This +/// provides a transparent way to treat scalar and non-scalar variables +/// alike, and allows an automatic selection of the applicable algorithms. +/// +/// - The object provides an implementation \link apply_force() \endlink to +/// apply forces to atoms. Typically, one or more \link cvm::atom_group +/// \endlink objects are used, but this is not a requirement for as long as +/// the \link cvc \endlink object communicates with the simulation program. /// /// If you wish to implement a new collective variable component, you /// should write your own class by inheriting directly from \link -/// cvc \endlink, or one of its derived classes (for instance, -/// \link distance \endlink is frequently used, because it provides +/// colvar::cvc \endlink, or one of its derived classes (for instance, +/// \link colvar::distance \endlink is frequently used, because it provides /// useful data and function members for any colvar based on two -/// atom groups). The steps are: \par -/// 1. add the name of this class under colvar.h \par -/// 2. add a call to the parser in colvar.C, within the function colvar::colvar() \par -/// 3. declare the class in colvarcomp.h \par -/// 4. implement the class in one of the files colvarcomp_*.C +/// atom groups). +/// +/// The steps are: \par +/// 1. Declare the new class as a derivative of \link colvar::cvc \endlink +/// in the file \link colvarcomp.h \endlink +/// 2. Implement the new class in a file named colvarcomp_.cpp +/// 3. Declare the name of the new class inside the \link colvar \endlink class +/// in \link colvar.h \endlink (see "list of available components") +/// 4. Add a call for the new class in colvar::init_components() +//// (file: colvar.cpp) /// -/// -/// The cvm::atom and cvm::atom_group classes are available to -/// transparently communicate with the simulation program. However, -/// they are not strictly needed, as long as all the degrees of -/// freedom associated to the cvc are properly evolved by a simple -/// call to e.g. apply_force(). class colvar::cvc : public colvarparse, public colvardeps @@ -155,7 +151,7 @@ public: /// \brief Calculate the atomic gradients, to be reused later in /// order to apply forces - virtual void calc_gradients() = 0; + virtual void calc_gradients() {} /// \brief Calculate the atomic fit gradients void calc_fit_gradients(); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index ce8055843f..9911f4c87e 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -581,6 +581,12 @@ colvar::distance_inv::distance_inv(std::string const &conf) } } + if (is_enabled(f_cvc_debug_gradient)) { + cvm::log("Warning: debugGradients will not give correct results " + "for distanceInv, because its value and gradients are computed " + "simultaneously.\n"); + } + x.type(colvarvalue::type_scalar); } @@ -601,11 +607,9 @@ void colvar::distance_inv::calc_value() for (cvm::atom_iter ai2 = group2->begin(); ai2 != group2->end(); ai2++) { cvm::rvector const dv = ai2->pos - ai1->pos; cvm::real const d2 = dv.norm2(); - cvm::real dinv = 1.0; - for (int ne = 0; ne < exponent/2; ne++) - dinv *= 1.0/d2; + cvm::real const dinv = cvm::integer_power(d2, -1*(exponent/2)); x.real_value += dinv; - cvm::rvector const dsumddv = -(cvm::real(exponent)) * dinv/d2 * dv; + cvm::rvector const dsumddv = -1.0*(exponent/2) * dinv/d2 * 2.0 * dv; ai1->grad += -1.0 * dsumddv; ai2->grad += dsumddv; } @@ -615,11 +619,9 @@ void colvar::distance_inv::calc_value() for (cvm::atom_iter ai2 = group2->begin(); ai2 != group2->end(); ai2++) { cvm::rvector const dv = cvm::position_distance(ai1->pos, ai2->pos); cvm::real const d2 = dv.norm2(); - cvm::real dinv = 1.0; - for (int ne = 0; ne < exponent/2; ne++) - dinv *= 1.0/d2; + cvm::real const dinv = cvm::integer_power(d2, -1*(exponent/2)); x.real_value += dinv; - cvm::rvector const dsumddv = -(cvm::real(exponent)) * dinv/d2 * dv; + cvm::rvector const dsumddv = -1.0*(exponent/2) * dinv/d2 * 2.0 * dv; ai1->grad += -1.0 * dsumddv; ai2->grad += dsumddv; } @@ -627,13 +629,11 @@ void colvar::distance_inv::calc_value() } x.real_value *= 1.0 / cvm::real(group1->size() * group2->size()); - x.real_value = std::pow(x.real_value, -1.0/(cvm::real(exponent))); -} + x.real_value = std::pow(x.real_value, -1.0/cvm::real(exponent)); - -void colvar::distance_inv::calc_gradients() -{ - cvm::real const dxdsum = (-1.0/(cvm::real(exponent))) * std::pow(x.real_value, exponent+1) / cvm::real(group1->size() * group2->size()); + cvm::real const dxdsum = (-1.0/(cvm::real(exponent))) * + cvm::integer_power(x.real_value, exponent+1) / + cvm::real(group1->size() * group2->size()); for (cvm::atom_iter ai1 = group1->begin(); ai1 != group1->end(); ai1++) { ai1->grad *= dxdsum; } @@ -643,6 +643,11 @@ void colvar::distance_inv::calc_gradients() } +void colvar::distance_inv::calc_gradients() +{ +} + + void colvar::distance_inv::apply_force(colvarvalue const &force) { if (!group1->noforce) diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index ac906e7be7..a058ad55c2 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -8,10 +8,16 @@ // Colvars repository at GitHub. +#include "colvarmodule.h" +#include "colvarproxy.h" #include "colvardeps.h" + colvardeps::colvardeps() - : time_step_factor (1) {} +{ + time_step_factor = 1; +} + colvardeps::~colvardeps() { size_t i; @@ -416,6 +422,9 @@ void colvardeps::init_cvb_requires() { init_feature(f_cvb_get_total_force, "obtain total force", f_type_dynamic); f_req_children(f_cvb_get_total_force, f_cv_total_force); + init_feature(f_cvb_output_acc_work, "output accumulated work", f_type_user); + f_req_self(f_cvb_output_acc_work, f_cvb_apply_force); + init_feature(f_cvb_history_dependent, "history-dependent", f_type_static); init_feature(f_cvb_time_dependent, "time-dependent", f_type_static); diff --git a/lib/colvars/colvardeps.h b/lib/colvars/colvardeps.h index bd892fbca8..940eefb01b 100644 --- a/lib/colvars/colvardeps.h +++ b/lib/colvars/colvardeps.h @@ -225,6 +225,8 @@ public: f_cvb_apply_force, /// \brief requires total forces f_cvb_get_total_force, + /// \brief whether this bias should record the accumulated work + f_cvb_output_acc_work, /// \brief depends on simulation history f_cvb_history_dependent, /// \brief depends on time diff --git a/lib/colvars/colvargrid.cpp b/lib/colvars/colvargrid.cpp index 9016e2c23a..1ac4aae133 100644 --- a/lib/colvars/colvargrid.cpp +++ b/lib/colvars/colvargrid.cpp @@ -14,6 +14,7 @@ #include "colvarcomp.h" #include "colvargrid.h" +#include colvar_grid_count::colvar_grid_count() : colvar_grid() @@ -22,43 +23,37 @@ colvar_grid_count::colvar_grid_count() } colvar_grid_count::colvar_grid_count(std::vector const &nx_i, - size_t const &def_count) + size_t const &def_count) : colvar_grid(nx_i, def_count, 1) {} colvar_grid_count::colvar_grid_count(std::vector &colvars, - size_t const &def_count) - : colvar_grid(colvars, def_count, 1) + size_t const &def_count, + bool margin) + : colvar_grid(colvars, def_count, 1, margin) {} colvar_grid_scalar::colvar_grid_scalar() - : colvar_grid(), samples(NULL), grad(NULL) + : colvar_grid(), samples(NULL) {} colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g) - : colvar_grid(g), samples(NULL), grad(NULL) + : colvar_grid(g), samples(NULL) { - grad = new cvm::real[nd]; } colvar_grid_scalar::colvar_grid_scalar(std::vector const &nx_i) - : colvar_grid(nx_i, 0.0, 1), samples(NULL), grad(NULL) + : colvar_grid(nx_i, 0.0, 1), samples(NULL) { - grad = new cvm::real[nd]; } colvar_grid_scalar::colvar_grid_scalar(std::vector &colvars, bool margin) - : colvar_grid(colvars, 0.0, 1, margin), samples(NULL), grad(NULL) + : colvar_grid(colvars, 0.0, 1, margin), samples(NULL) { - grad = new cvm::real[nd]; } colvar_grid_scalar::~colvar_grid_scalar() { - if (grad) { - delete [] grad; - grad = NULL; - } } cvm::real colvar_grid_scalar::maximum_value() const @@ -143,18 +138,18 @@ void colvar_grid_gradient::write_1D_integral(std::ostream &os) os << "# xi A(xi)\n"; - if ( cv.size() != 1 ) { + if (cv.size() != 1) { cvm::error("Cannot write integral for multi-dimensional gradient grids."); return; } integral = 0.0; - int_vals.push_back( 0.0 ); + int_vals.push_back(0.0); min = 0.0; // correction for periodic colvars, so that the PMF is periodic cvm::real corr; - if ( periodic[0] ) { + if (periodic[0]) { corr = average(); } else { corr = 0.0; @@ -171,7 +166,7 @@ void colvar_grid_gradient::write_1D_integral(std::ostream &os) } if ( integral < min ) min = integral; - int_vals.push_back( integral ); + int_vals.push_back(integral); } bin = 0.0; @@ -192,3 +187,670 @@ void colvar_grid_gradient::write_1D_integral(std::ostream &os) +integrate_potential::integrate_potential(std::vector &colvars, colvar_grid_gradient * gradients) + : colvar_grid_scalar(colvars, true), + gradients(gradients) +{ + // parent class colvar_grid_scalar is constructed with margin option set to true + // hence PMF grid is wider than gradient grid if non-PBC + + if (nd > 1) { + divergence.resize(nt); + + // Compute inverse of Laplacian diagonal for Jacobi preconditioning + // For now all code related to preconditioning is commented out + // until a method better than Jacobi is implemented +// cvm::log("Preparing inverse diagonal for preconditioning..."); +// inv_lap_diag.resize(nt); +// std::vector id(nt), lap_col(nt); +// for (int i = 0; i < nt; i++) { +// if (i % (nt / 100) == 0) +// cvm::log(cvm::to_str(i)); +// id[i] = 1.; +// atimes(id, lap_col); +// id[i] = 0.; +// inv_lap_diag[i] = 1. / lap_col[i]; +// } +// cvm::log("Done."); + } +} + + +int integrate_potential::integrate(const int itmax, const cvm::real &tol, cvm::real & err) +{ + int iter = 0; + + if (nd == 1) { + + cvm::real sum = 0.0; + cvm::real corr; + if ( periodic[0] ) { + corr = gradients->average(); // Enforce PBC by subtracting average gradient + } else { + corr = 0.0; + } + + std::vector ix; + // Iterate over valid indices in gradient grid + for (ix = new_index(); gradients->index_ok(ix); incr(ix)) { + set_value(ix, sum); + sum += (gradients->value_output(ix) - corr) * widths[0]; + } + if (index_ok(ix)) { + // This will happen if non-periodic: then PMF grid has one extra bin wrt gradient grid + set_value(ix, sum); + } + + } else if (nd <= 3) { + + nr_linbcg_sym(divergence, data, tol, itmax, iter, err); + cvm::log("Integrated in " + cvm::to_str(iter) + " steps, error: " + cvm::to_str(err)); + + } else { + cvm::error("Cannot integrate PMF in dimension > 3\n"); + } + + return iter; +} + + +void integrate_potential::set_div() +{ + if (nd == 1) return; + for (std::vector ix = new_index(); index_ok(ix); incr(ix)) { + update_div_local(ix); + } +} + + +void integrate_potential::update_div_neighbors(const std::vector &ix0) +{ + std::vector ix(ix0); + int i, j, k; + + // If not periodic, expanded grid ensures that neighbors of ix0 are valid grid points + if (nd == 1) { + return; + + } else if (nd == 2) { + + update_div_local(ix); + ix[0]++; wrap(ix); + update_div_local(ix); + ix[1]++; wrap(ix); + update_div_local(ix); + ix[0]--; wrap(ix); + update_div_local(ix); + + } else if (nd == 3) { + + for (i = 0; i<2; i++) { + ix[1] = ix0[1]; + for (j = 0; j<2; j++) { + ix[2] = ix0[2]; + for (k = 0; k<2; k++) { + wrap(ix); + update_div_local(ix); + ix[2]++; + } + ix[1]++; + } + ix[0]++; + } + } +} + +void integrate_potential::get_grad(cvm::real * g, std::vector &ix) +{ + size_t count, i; + bool edge = gradients->wrap_edge(ix); // Detect edge if non-PBC + + if (gradients->samples) { + count = gradients->samples->value(ix); + } else { + count = 1; + } + + if (!edge && count) { + cvm::real const *grad = &(gradients->value(ix)); + cvm::real const fact = 1.0 / count; + for ( i = 0; i &ix0) +{ + const int linear_index = address(ix0); + int i, j, k; + std::vector ix = ix0; + const cvm::real * g; + + if (nd == 2) { + // gradients at grid points surrounding the current scalar grid point + cvm::real g00[2], g01[2], g10[2], g11[2]; + + get_grad(g11, ix); + ix[0] = ix0[0] - 1; + get_grad(g01, ix); + ix[1] = ix0[1] - 1; + get_grad(g00, ix); + ix[0] = ix0[0]; + get_grad(g10, ix); + + divergence[linear_index] = ((g10[0]-g00[0] + g11[0]-g01[0]) / widths[0] + + (g01[1]-g00[1] + g11[1]-g10[1]) / widths[1]) * 0.5; + } else if (nd == 3) { + cvm::real gc[24]; // stores 3d gradients in 8 contiguous bins + int index = 0; + + ix[0] = ix0[0] - 1; + for (i = 0; i<2; i++) { + ix[1] = ix0[1] - 1; + for (j = 0; j<2; j++) { + ix[2] = ix0[2] - 1; + for (k = 0; k<2; k++) { + get_grad(gc + index, ix); + index += 3; + ix[2]++; + } + ix[1]++; + } + ix[0]++; + } + + divergence[linear_index] = + ((gc[3*4]-gc[0] + gc[3*5]-gc[3*1] + gc[3*6]-gc[3*2] + gc[3*7]-gc[3*3]) + / widths[0] + + (gc[3*2+1]-gc[0+1] + gc[3*3+1]-gc[3*1+1] + gc[3*6+1]-gc[3*4+1] + gc[3*7+1]-gc[3*5+1]) + / widths[1] + + (gc[3*1+2]-gc[0+2] + gc[3*3+2]-gc[3*2+2] + gc[3*5+2]-gc[3*4+2] + gc[3*7+2]-gc[3*6+2]) + / widths[2]) * 0.25; + } +} + + +/// Multiplication by sparse matrix representing Laplacian +/// NOTE: Laplacian must be symmetric for solving with CG +void integrate_potential::atimes(const std::vector &A, std::vector &LA) +{ + if (nd == 2) { + // DIMENSION 2 + + size_t index, index2; + int i, j; + cvm::real fact; + const cvm::real ffx = 1.0 / (widths[0] * widths[0]); + const cvm::real ffy = 1.0 / (widths[1] * widths[1]); + const int h = nx[1]; + const int w = nx[0]; + // offsets for 4 reference points of the Laplacian stencil + int xm = -h; + int xp = h; + int ym = -1; + int yp = 1; + + // NOTE on performance: this version is slightly sub-optimal because + // it contains two double loops on the core of the array (for x and y terms) + // The slightly faster version is in commit 0254cb5a2958cb2e135f268371c4b45fad34866b + // yet it is much uglier, and probably horrible to extend to dimension 3 + // All terms in the matrix are assigned (=) during the x loops, then updated (+=) + // with the y (and z) contributions + + + // All x components except on x edges + index = h; // Skip first column + + // Halve the term on y edges (if any) to preserve symmetry of the Laplacian matrix + // (Long Chen, Finite Difference Methods, UCI, 2017) + fact = periodic[1] ? 1.0 : 0.5; + + for (i=1; i &b, std::vector &x) +{ + for (size_t i=0; i &b, std::vector &x, const cvm::real &tol, + const int itmax, int &iter, cvm::real &err) +{ + cvm::real ak,akden,bk,bkden,bknum,bnrm; + const cvm::real EPS=1.0e-14; + int j; + std::vector p(nt), r(nt), z(nt); + + iter=0; + atimes(x,r); + for (j=0;j &colvars, - size_t const &def_count = 0); + size_t const &def_count = 0, + bool margin = false); /// Increment the counter at given position inline void incr_count(std::vector const &ix) @@ -1210,12 +1236,13 @@ public: int A0, A1, A2; std::vector ix = ix0; + // TODO this can be rewritten more concisely with wrap_edge() if (periodic[n]) { ix[n]--; wrap(ix); - A0 = data[address(ix)]; + A0 = value(ix); ix = ix0; ix[n]++; wrap(ix); - A1 = data[address(ix)]; + A1 = value(ix); if (A0 * A1 == 0) { return 0.; // can't handle empty bins } else { @@ -1224,10 +1251,10 @@ public: } } else if (ix[n] > 0 && ix[n] < nx[n]-1) { // not an edge ix[n]--; - A0 = data[address(ix)]; + A0 = value(ix); ix = ix0; ix[n]++; - A1 = data[address(ix)]; + A1 = value(ix); if (A0 * A1 == 0) { return 0.; // can't handle empty bins } else { @@ -1238,9 +1265,9 @@ public: // edge: use 2nd order derivative int increment = (ix[n] == 0 ? 1 : -1); // move right from left edge, or the other way around - A0 = data[address(ix)]; - ix[n] += increment; A1 = data[address(ix)]; - ix[n] += increment; A2 = data[address(ix)]; + A0 = value(ix); + ix[n] += increment; A1 = value(ix); + ix[n] += increment; A2 = value(ix); if (A0 * A1 * A2 == 0) { return 0.; // can't handle empty bins } else { @@ -1249,6 +1276,49 @@ public: } } } + + /// \brief Return the gradient of discrete count from finite differences + /// on the *same* grid for dimension n + inline cvm::real gradient_finite_diff(const std::vector &ix0, + int n = 0) + { + int A0, A1, A2; + std::vector ix = ix0; + + // FIXME this can be rewritten more concisely with wrap_edge() + if (periodic[n]) { + ix[n]--; wrap(ix); + A0 = value(ix); + ix = ix0; + ix[n]++; wrap(ix); + A1 = value(ix); + if (A0 * A1 == 0) { + return 0.; // can't handle empty bins + } else { + return cvm::real(A1 - A0) / (widths[n] * 2.); + } + } else if (ix[n] > 0 && ix[n] < nx[n]-1) { // not an edge + ix[n]--; + A0 = value(ix); + ix = ix0; + ix[n]++; + A1 = value(ix); + if (A0 * A1 == 0) { + return 0.; // can't handle empty bins + } else { + return cvm::real(A1 - A0) / (widths[n] * 2.); + } + } else { + // edge: use 2nd order derivative + int increment = (ix[n] == 0 ? 1 : -1); + // move right from left edge, or the other way around + A0 = value(ix); + ix[n] += increment; A1 = value(ix); + ix[n] += increment; A2 = value(ix); + return (-1.5 * cvm::real(A0) + 2. * cvm::real(A1) + - 0.5 * cvm::real(A2)) * increment / widths[n]; + } + } }; @@ -1289,27 +1359,57 @@ public: has_data = true; } - /// Return the gradient of the scalar field from finite differences - inline const cvm::real * gradient_finite_diff( const std::vector &ix0 ) + /// \brief Return the gradient of the scalar field from finite differences + /// Input coordinates are those of gradient grid, shifted wrt scalar grid + /// Should not be called on edges of scalar grid, provided the latter has margins + /// wrt gradient grid + inline void vector_gradient_finite_diff( const std::vector &ix0, std::vector &grad) { cvm::real A0, A1; std::vector ix; - if (nd != 2) { - cvm::error("Finite differences available in dimension 2 only."); - return grad; - } - for (unsigned int n = 0; n < nd; n++) { + size_t i, j, k, n; + + if (nd == 2) { + for (n = 0; n < 2; n++) { + ix = ix0; + A0 = value(ix); + ix[n]++; wrap(ix); + A1 = value(ix); + ix[1-n]++; wrap(ix); + A1 += value(ix); + ix[n]--; wrap(ix); + A0 += value(ix); + grad[n] = 0.5 * (A1 - A0) / widths[n]; + } + } else if (nd == 3) { + + cvm::real p[8]; // potential values within cube, indexed in binary (4 i + 2 j + k) ix = ix0; - A0 = data[address(ix)]; - ix[n]++; wrap(ix); - A1 = data[address(ix)]; - ix[1-n]++; wrap(ix); - A1 += data[address(ix)]; - ix[n]--; wrap(ix); - A0 += data[address(ix)]; - grad[n] = 0.5 * (A1 - A0) / widths[n]; + int index = 0; + for (i = 0; i<2; i++) { + ix[1] = ix0[1]; + for (j = 0; j<2; j++) { + ix[2] = ix0[2]; + for (k = 0; k<2; k++) { + wrap(ix); + p[index++] = value(ix); + ix[2]++; + } + ix[1]++; + } + ix[0]++; + } + + // The following would be easier to read using binary literals + // 100 101 110 111 000 001 010 011 + grad[0] = 0.25 * ((p[4] + p[5] + p[6] + p[7]) - (p[0] + p[1] + p[2] + p[3])) / widths[0]; + // 010 011 110 111 000 001 100 101 + grad[1] = 0.25 * ((p[2] + p[3] + p[6] + p[7]) - (p[0] + p[1] + p[4] + p[5])) / widths[0]; + // 001 011 101 111 000 010 100 110 + grad[2] = 0.25 * ((p[1] + p[3] + p[5] + p[7]) - (p[0] + p[2] + p[4] + p[6])) / widths[0]; + } else { + cvm::error("Finite differences available in dimension 2 and 3 only."); } - return grad; } /// \brief Return the value of the function at ix divided by its @@ -1373,10 +1473,6 @@ public: /// \brief Assuming that the map is a normalized probability density, /// calculates the entropy (uses widths if they are defined) cvm::real entropy() const; - -private: - // gradient - cvm::real * grad; }; @@ -1390,6 +1486,10 @@ public: /// should be divided colvar_grid_count *samples; + /// \brief Provide the floating point weights by which each binned value + /// should be divided (alternate to samples, only one should be non-null) + colvar_grid_scalar *weights; + /// Default constructor colvar_grid_gradient(); @@ -1403,6 +1503,29 @@ public: /// Constructor from a vector of colvars colvar_grid_gradient(std::vector &colvars); + /// \brief Get a vector with the binned value(s) indexed by ix, normalized if applicable + inline void vector_value(std::vector const &ix, std::vector &v) const + { + cvm::real const * p = &value(ix); + if (samples) { + int count = samples->value(ix); + if (count) { + cvm::real invcount = 1.0 / count; + for (size_t i = 0; i < mult; i++) { + v[i] = invcount * p[i]; + } + } else { + for (size_t i = 0; i < mult; i++) { + v[i] = 0.0; + } + } + } else { + for (size_t i = 0; i < mult; i++) { + v[i] = p[i]; + } + } + } + /// \brief Accumulate the value inline void acc_value(std::vector const &ix, std::vector const &values) { for (size_t imult = 0; imult < mult; imult++) { @@ -1412,15 +1535,6 @@ public: samples->incr_count(ix); } - /// \brief Accumulate the gradient - inline void acc_grad(std::vector const &ix, cvm::real const *grads) { - for (size_t imult = 0; imult < mult; imult++) { - data[address(ix) + imult] += grads[imult]; - } - if (samples) - samples->incr_count(ix); - } - /// \brief Accumulate the gradient based on the force (i.e. sums the /// opposite of the force) inline void acc_force(std::vector const &ix, cvm::real const *forces) { @@ -1431,6 +1545,17 @@ public: samples->incr_count(ix); } + /// \brief Accumulate the gradient based on the force (i.e. sums the + /// opposite of the force) with a non-integer weight + inline void acc_force_weighted(std::vector const &ix, + cvm::real const *forces, + cvm::real weight) { + for (size_t imult = 0; imult < mult; imult++) { + data[address(ix) + imult] -= forces[imult] * weight; + } + weights->acc_value(ix, weight); + } + /// \brief Return the value of the function at ix divided by its /// number of samples (if the count grid is defined) virtual inline cvm::real value_output(std::vector const &ix, @@ -1498,5 +1623,70 @@ public: }; + +/// Integrate (1D, 2D or 3D) gradients + +class integrate_potential : public colvar_grid_scalar +{ + public: + + integrate_potential(); + + virtual ~integrate_potential() + {} + + /// Constructor from a vector of colvars + gradient grid + integrate_potential (std::vector &colvars, colvar_grid_gradient * gradients); + + /// \brief Calculate potential from divergence (in 2D); return number of steps + int integrate (const int itmax, const cvm::real & tol, cvm::real & err); + + /// \brief Update matrix containing divergence and boundary conditions + /// based on new gradient point value, in neighboring bins + void update_div_neighbors(const std::vector &ix); + + /// \brief Set matrix containing divergence and boundary conditions + /// based on complete gradient grid + void set_div(); + + /// \brief Add constant to potential so that its minimum value is zero + /// Useful e.g. for output + inline void set_zero_minimum() { + add_constant(-1.0 * minimum_value()); + } + + protected: + + // Reference to gradient grid + colvar_grid_gradient *gradients; + + /// Array holding divergence + boundary terms (modified Neumann) if not periodic + std::vector divergence; + +// std::vector inv_lap_diag; // Inverse of the diagonal of the Laplacian; for conditioning + + /// \brief Update matrix containing divergence and boundary conditions + /// called by update_div_neighbors + void update_div_local(const std::vector &ix); + + /// Obtain the gradient vector at given location ix, if available + /// or zero if it is on the edge of the gradient grid + /// ix gets wrapped in PBC + void get_grad(cvm::real * g, std::vector &ix); + + /// \brief Solve linear system based on CG, valid for symmetric matrices only + void nr_linbcg_sym(const std::vector &b, std::vector &x, + const cvm::real &tol, const int itmax, int &iter, cvm::real &err); + + /// l2 norm of a vector + cvm::real l2norm(const std::vector &x); + + /// Multiplication by sparse matrix representing Lagrangian (or its transpose) + void atimes(const std::vector &x, std::vector &r); + +// /// Inversion of preconditioner matrix +// void asolve(const std::vector &b, std::vector &x); +}; + #endif diff --git a/lib/colvars/colvarmodule.cpp b/lib/colvars/colvarmodule.cpp index 200c2d6848..9898e2d5e8 100644 --- a/lib/colvars/colvarmodule.cpp +++ b/lib/colvars/colvarmodule.cpp @@ -24,6 +24,7 @@ #include "colvaratoms.h" #include "colvarcomp.h" + colvarmodule::colvarmodule(colvarproxy *proxy_in) { depth_s = 0; @@ -417,10 +418,10 @@ int colvarmodule::parse_biases(std::string const &conf) "Please ensure that their forces do not counteract each other.\n"); } - if (biases.size() || use_scripted_forces) { + if (num_biases() || use_scripted_forces) { cvm::log(cvm::line_marker); cvm::log("Collective variables biases initialized, "+ - cvm::to_str(biases.size())+" in total.\n"); + cvm::to_str(num_biases())+" in total.\n"); } else { if (!use_scripted_forces) { cvm::log("No collective variables biases were defined.\n"); @@ -431,12 +432,37 @@ int colvarmodule::parse_biases(std::string const &conf) } +int colvarmodule::num_variables() const +{ + return colvars.size(); +} + + +int colvarmodule::num_variables_feature(int feature_id) const +{ + size_t n = 0; + for (std::vector::const_iterator cvi = colvars.begin(); + cvi != colvars.end(); + cvi++) { + if ((*cvi)->is_enabled(feature_id)) { + n++; + } + } + return n; +} + + +int colvarmodule::num_biases() const +{ + return biases.size(); +} + + int colvarmodule::num_biases_feature(int feature_id) const { - colvarmodule *cv = cvm::main(); size_t n = 0; - for (std::vector::iterator bi = cv->biases.begin(); - bi != cv->biases.end(); + for (std::vector::const_iterator bi = biases.begin(); + bi != biases.end(); bi++) { if ((*bi)->is_enabled(feature_id)) { n++; @@ -448,10 +474,9 @@ int colvarmodule::num_biases_feature(int feature_id) const int colvarmodule::num_biases_type(std::string const &type) const { - colvarmodule *cv = cvm::main(); size_t n = 0; - for (std::vector::iterator bi = cv->biases.begin(); - bi != cv->biases.end(); + for (std::vector::const_iterator bi = biases.begin(); + bi != biases.end(); bi++) { if ((*bi)->bias_type == type) { n++; @@ -465,7 +490,7 @@ std::vector const colvarmodule::time_dependent_biases() const { size_t i; std::vector biases_names; - for (i = 0; i < biases.size(); i++) { + for (i = 0; i < num_biases(); i++) { if (biases[i]->is_enabled(colvardeps::f_cvb_apply_force) && biases[i]->is_enabled(colvardeps::f_cvb_active) && (biases[i]->is_enabled(colvardeps::f_cvb_history_dependent) || @@ -790,7 +815,7 @@ int colvarmodule::calc_biases() { // update the biases and communicate their forces to the collective // variables - if (cvm::debug() && biases.size()) + if (cvm::debug() && num_biases()) cvm::log("Updating collective variable biases.\n"); std::vector::iterator bi; @@ -852,7 +877,7 @@ int colvarmodule::update_colvar_forces() std::vector::iterator bi; // sum the forces from all biases for each collective variable - if (cvm::debug() && biases.size()) + if (cvm::debug() && num_biases()) cvm::log("Collecting forces from all biases.\n"); cvm::increase_depth(); for (bi = biases_active()->begin(); bi != biases_active()->end(); bi++) { @@ -1073,8 +1098,6 @@ int colvarmodule::reset() int colvarmodule::setup_input() { - if (this->size() == 0) return cvm::get_error(); - std::string restart_in_name(""); // read the restart configuration, if available @@ -1107,14 +1130,12 @@ int colvarmodule::setup_input() } } - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return cvm::get_error(); } int colvarmodule::setup_output() { - if (this->size() == 0) return cvm::get_error(); - int error_code = COLVARS_OK; // output state file (restart) @@ -1123,7 +1144,8 @@ int colvarmodule::setup_output() std::string(""); if (restart_out_name.size()) { - cvm::log("The restart output state file will be \""+restart_out_name+"\".\n"); + cvm::log("The restart output state file will be \""+ + restart_out_name+"\".\n"); } output_prefix() = proxy->output_prefix(); @@ -1154,7 +1176,7 @@ int colvarmodule::setup_output() set_error_bits(FILE_ERROR); } - return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK); + return cvm::get_error(); } @@ -1738,6 +1760,89 @@ int cvm::load_coords_xyz(char const *filename, } + +// Wrappers to proxy functions: these may go in the future + +cvm::real cvm::unit_angstrom() +{ + return proxy->unit_angstrom(); +} + + +cvm::real cvm::boltzmann() +{ + return proxy->boltzmann(); +} + + +cvm::real cvm::temperature() +{ + return proxy->temperature(); +} + + +cvm::real cvm::dt() +{ + return proxy->dt(); +} + + +void cvm::request_total_force() +{ + proxy->request_total_force(true); +} + +cvm::rvector cvm::position_distance(atom_pos const &pos1, + atom_pos const &pos2) +{ + return proxy->position_distance(pos1, pos2); +} + +cvm::real cvm::position_dist2(cvm::atom_pos const &pos1, + cvm::atom_pos const &pos2) +{ + return proxy->position_dist2(pos1, pos2); +} + +cvm::real cvm::rand_gaussian(void) +{ + return proxy->rand_gaussian(); +} + + + +bool cvm::replica_enabled() +{ + return proxy->replica_enabled(); +} + +int cvm::replica_index() +{ + return proxy->replica_index(); +} + +int cvm::replica_num() +{ + return proxy->replica_num(); +} + +void cvm::replica_comm_barrier() +{ + return proxy->replica_comm_barrier(); +} + +int cvm::replica_comm_recv(char* msg_data, int buf_len, int src_rep) +{ + return proxy->replica_comm_recv(msg_data,buf_len,src_rep); +} + +int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep) +{ + return proxy->replica_comm_send(msg_data,msg_len,dest_rep); +} + + + // shared pointer to the proxy object colvarproxy *colvarmodule::proxy = NULL; diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index 14e5d56701..64a98b77a0 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -39,16 +39,14 @@ You can browse the class hierarchy or the list of source files. #define FILE_ERROR (1<<4) #define MEMORY_ERROR (1<<5) #define FATAL_ERROR (1<<6) // Should be set, or not, together with other bits -#define DELETE_COLVARS (1<<7) // Instruct the caller to delete cvm +//#define DELETE_COLVARS (1<<7) // Instruct the caller to delete cvm #define COLVARS_NO_SUCH_FRAME (1<<8) // Cannot load the requested frame #include #include -#include -#include -#include #include -#include +#include +#include #include #include @@ -84,12 +82,18 @@ public: /// Defining an abstract real number allows to switch precision typedef double real; - /// Override std::pow with a product for n positive integer - static inline real integer_power(real x, int n) + /// Override std::pow with a product for n integer + static inline real integer_power(real const &x, int const n) { - real result = 1.0; - for (int i = 0; i < n; i++) result *= x; - return result; + // Original code: math_special.h in LAMMPS + double yy, ww; + if (x == 0.0) return 0.0; + int nn = (n > 0) ? n : -n; + ww = x; + for (yy = 1.0; nn != 0; nn >>= 1, ww *=ww) { + if (nn & 1) yy *= ww; + } + return (n > 0) ? yy : 1.0/yy; } /// Residue identifier @@ -301,13 +305,23 @@ private: public: + /// Return how many variables are defined + int num_variables() const; + + /// Return how many variables have this feature enabled + int num_variables_feature(int feature_id) const; + + /// Return how many biases are defined + int num_biases() const; + /// Return how many biases have this feature enabled int num_biases_feature(int feature_id) const; - /// Return how many biases are defined with this type + /// Return how many biases of this type are defined int num_biases_type(std::string const &type) const; - /// Return the names of time-dependent biases with forces enabled + /// Return the names of time-dependent biases with forces enabled (ABF, + /// metadynamics, etc) std::vector const time_dependent_biases() const; private: @@ -602,16 +616,14 @@ public: typedef colvarmodule cvm; -#include "colvartypes.h" - std::ostream & operator << (std::ostream &os, cvm::rvector const &v); std::istream & operator >> (std::istream &is, cvm::rvector &v); template std::string cvm::to_str(T const &x, - size_t const &width, - size_t const &prec) { + size_t const &width, + size_t const &prec) { std::ostringstream os; if (width) os.width(width); if (prec) { @@ -622,9 +634,10 @@ template std::string cvm::to_str(T const &x, return os.str(); } + template std::string cvm::to_str(std::vector const &x, - size_t const &width, - size_t const &prec) { + size_t const &width, + size_t const &prec) { if (!x.size()) return std::string(""); std::ostringstream os; if (prec) { @@ -645,70 +658,4 @@ template std::string cvm::to_str(std::vector const &x, } -#include "colvarproxy.h" - - -inline cvm::real cvm::unit_angstrom() -{ - return proxy->unit_angstrom(); -} - -inline cvm::real cvm::boltzmann() -{ - return proxy->boltzmann(); -} - -inline cvm::real cvm::temperature() -{ - return proxy->temperature(); -} - -inline cvm::real cvm::dt() -{ - return proxy->dt(); -} - -// Replica exchange commands -inline bool cvm::replica_enabled() { - return proxy->replica_enabled(); -} -inline int cvm::replica_index() { - return proxy->replica_index(); -} -inline int cvm::replica_num() { - return proxy->replica_num(); -} -inline void cvm::replica_comm_barrier() { - return proxy->replica_comm_barrier(); -} -inline int cvm::replica_comm_recv(char* msg_data, int buf_len, int src_rep) { - return proxy->replica_comm_recv(msg_data,buf_len,src_rep); -} -inline int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep) { - return proxy->replica_comm_send(msg_data,msg_len,dest_rep); -} - - -inline void cvm::request_total_force() -{ - proxy->request_total_force(true); -} - -inline cvm::rvector cvm::position_distance(atom_pos const &pos1, - atom_pos const &pos2) -{ - return proxy->position_distance(pos1, pos2); -} - -inline cvm::real cvm::position_dist2(cvm::atom_pos const &pos1, - cvm::atom_pos const &pos2) -{ - return proxy->position_dist2(pos1, pos2); -} - -inline cvm::real cvm::rand_gaussian(void) -{ - return proxy->rand_gaussian(); -} - #endif diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index 9f333b7b76..43c8c69c04 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -553,7 +553,8 @@ bool colvarparse::key_lookup(std::string const &conf, size_t *save_pos) { if (cvm::debug()) { - cvm::log("Looking for the keyword \""+std::string(key_in)+"\" and its value.\n"); + cvm::log("Looking for the keyword \""+std::string(key_in)+ + "\" and its value.\n"); } // add this keyword to the register (in its camelCase version) diff --git a/lib/colvars/colvarproxy.cpp b/lib/colvars/colvarproxy.cpp index 8160144c6b..8767d5f459 100644 --- a/lib/colvars/colvarproxy.cpp +++ b/lib/colvars/colvarproxy.cpp @@ -14,6 +14,11 @@ #include #endif +#if defined(NAMD_TCL) || defined(VMDTCL) +#define COLVARS_TCL +#include +#endif + #include "colvarmodule.h" #include "colvarproxy.h" #include "colvarscript.h" @@ -420,8 +425,10 @@ colvarproxy_script::colvarproxy_script() colvarproxy_script::~colvarproxy_script() {} -char *colvarproxy_script::script_obj_to_str(unsigned char *obj) +char const *colvarproxy_script::script_obj_to_str(unsigned char *obj) { + cvm::error("Error: trying to print a script object without a scripting " + "language interface.\n", BUG_ERROR); return reinterpret_cast(obj); } @@ -451,6 +458,140 @@ int colvarproxy_script::run_colvar_gradient_callback( +colvarproxy_tcl::colvarproxy_tcl() +{ + _tcl_interp = NULL; +} + + +colvarproxy_tcl::~colvarproxy_tcl() +{ +} + + +void colvarproxy_tcl::init_tcl_pointers() +{ + cvm::error("Error: Tcl support is currently unavailable " + "outside NAMD or VMD.\n", COLVARS_NOT_IMPLEMENTED); +} + + +char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj) +{ +#if defined(COLVARS_TCL) + return Tcl_GetString(reinterpret_cast(obj)); +#else + return NULL; +#endif +} + + +int colvarproxy_tcl::tcl_run_force_callback() +{ +#if defined(COLVARS_TCL) + Tcl_Interp *const tcl_interp = reinterpret_cast(_tcl_interp); + std::string cmd = std::string("calc_colvar_forces ") + + cvm::to_str(cvm::step_absolute()); + int err = Tcl_Eval(tcl_interp, cmd.c_str()); + if (err != TCL_OK) { + cvm::log(std::string("Error while executing calc_colvar_forces:\n")); + cvm::error(Tcl_GetStringResult(tcl_interp)); + return COLVARS_ERROR; + } + return cvm::get_error(); +#else + return COLVARS_NOT_IMPLEMENTED; +#endif +} + + +int colvarproxy_tcl::tcl_run_colvar_callback( + std::string const &name, + std::vector const &cvc_values, + colvarvalue &value) +{ +#if defined(COLVARS_TCL) + + Tcl_Interp *const tcl_interp = reinterpret_cast(_tcl_interp); + size_t i; + std::string cmd = std::string("calc_") + name; + for (i = 0; i < cvc_values.size(); i++) { + cmd += std::string(" {") + (*(cvc_values[i])).to_simple_string() + + std::string("}"); + } + int err = Tcl_Eval(tcl_interp, cmd.c_str()); + const char *result = Tcl_GetStringResult(tcl_interp); + if (err != TCL_OK) { + return cvm::error(std::string("Error while executing ") + + cmd + std::string(":\n") + + std::string(Tcl_GetStringResult(tcl_interp)), COLVARS_ERROR); + } + std::istringstream is(result); + if (value.from_simple_string(is.str()) != COLVARS_OK) { + cvm::log("Error parsing colvar value from script:"); + cvm::error(result); + return COLVARS_ERROR; + } + return cvm::get_error(); + +#else + + return COLVARS_NOT_IMPLEMENTED; + +#endif +} + + +int colvarproxy_tcl::tcl_run_colvar_gradient_callback( + std::string const &name, + std::vector const &cvc_values, + std::vector > &gradient) +{ +#if defined(COLVARS_TCL) + + Tcl_Interp *const tcl_interp = reinterpret_cast(_tcl_interp); + size_t i; + std::string cmd = std::string("calc_") + name + "_gradient"; + for (i = 0; i < cvc_values.size(); i++) { + cmd += std::string(" {") + (*(cvc_values[i])).to_simple_string() + + std::string("}"); + } + int err = Tcl_Eval(tcl_interp, cmd.c_str()); + if (err != TCL_OK) { + return cvm::error(std::string("Error while executing ") + + cmd + std::string(":\n") + + std::string(Tcl_GetStringResult(tcl_interp)), COLVARS_ERROR); + } + Tcl_Obj **list; + int n; + Tcl_ListObjGetElements(tcl_interp, Tcl_GetObjResult(tcl_interp), + &n, &list); + if (n != int(gradient.size())) { + cvm::error("Error parsing list of gradient values from script: found " + + cvm::to_str(n) + " values instead of " + + cvm::to_str(gradient.size())); + return COLVARS_ERROR; + } + for (i = 0; i < gradient.size(); i++) { + std::istringstream is(Tcl_GetString(list[i])); + if (gradient[i].from_simple_string(is.str()) != COLVARS_OK) { + cvm::log("Gradient matrix size: " + cvm::to_str(gradient[i].size())); + cvm::log("Gradient string: " + cvm::to_str(Tcl_GetString(list[i]))); + cvm::error("Error parsing gradient value from script", COLVARS_ERROR); + return COLVARS_ERROR; + } + } + + return cvm::get_error(); + +#else + + return COLVARS_NOT_IMPLEMENTED; + +#endif +} + + colvarproxy_io::colvarproxy_io() {} @@ -541,6 +682,7 @@ colvarproxy::colvarproxy() { colvars = NULL; b_simulation_running = true; + b_delete_requested = false; } @@ -556,6 +698,14 @@ int colvarproxy::reset() } +int colvarproxy::request_deletion() +{ + return cvm::error("Error: \"delete\" command is only available in VMD; " + "please use \"reset\" instead.\n", + COLVARS_NOT_IMPLEMENTED); +} + + int colvarproxy::setup() { return COLVARS_OK; @@ -579,13 +729,3 @@ size_t colvarproxy::restart_frequency() return 0; } - - - - - - - - - - diff --git a/lib/colvars/colvarproxy.h b/lib/colvars/colvarproxy.h index e51ddfbe3b..bf29048270 100644 --- a/lib/colvars/colvarproxy.h +++ b/lib/colvars/colvarproxy.h @@ -415,7 +415,7 @@ public: }; -/// Method for scripting language interface (Tcl or Python) +/// Methods for scripting language interface (Tcl or Python) class colvarproxy_script { public: @@ -427,7 +427,7 @@ public: virtual ~colvarproxy_script(); /// Convert a script object (Tcl or Python call argument) to a C string - virtual char *script_obj_to_str(unsigned char *obj); + virtual char const *script_obj_to_str(unsigned char *obj); /// Pointer to the scripting interface object /// (does not need to be allocated in a new interface) @@ -454,6 +454,46 @@ public: }; +/// Methods for using Tcl within Colvars +class colvarproxy_tcl { + +public: + + /// Constructor + colvarproxy_tcl(); + + /// Destructor + virtual ~colvarproxy_tcl(); + + /// Is Tcl available? (trigger initialization if needed) + int tcl_available(); + + /// Tcl implementation of script_obj_to_str() + char const *tcl_obj_to_str(unsigned char *obj); + + /// Run a user-defined colvar forces script + int tcl_run_force_callback(); + + int tcl_run_colvar_callback( + std::string const &name, + std::vector const &cvcs, + colvarvalue &value); + + int tcl_run_colvar_gradient_callback( + std::string const &name, + std::vector const &cvcs, + std::vector > &gradient); + +protected: + + /// Pointer to Tcl interpreter object + void *_tcl_interp; + + /// Set Tcl pointers + virtual void init_tcl_pointers(); +}; + + /// Methods for data input/output class colvarproxy_io { @@ -540,6 +580,7 @@ class colvarproxy public colvarproxy_smp, public colvarproxy_replicas, public colvarproxy_script, + public colvarproxy_tcl, public colvarproxy_io { @@ -554,6 +595,15 @@ public: /// Destructor virtual ~colvarproxy(); + /// Request deallocation of the module (currently only implemented by VMD) + virtual int request_deletion(); + + /// Whether deallocation was requested + inline bool delete_requested() + { + return b_delete_requested; + } + /// \brief Reset proxy state, e.g. requested atoms virtual int reset(); @@ -591,6 +641,9 @@ protected: /// Whether a simulation is running (warn against irrecovarable errors) bool b_simulation_running; + /// Whether the entire module should be deallocated by the host engine + bool b_delete_requested; + }; diff --git a/lib/colvars/colvars_version.h b/lib/colvars/colvars_version.h index a92a776f8a..dc4b8bd07e 100644 --- a/lib/colvars/colvars_version.h +++ b/lib/colvars/colvars_version.h @@ -1,5 +1,5 @@ #ifndef COLVARS_VERSION -#define COLVARS_VERSION "2017-10-20" +#define COLVARS_VERSION "2018-01-17" // This file is part of the Collective Variables module (Colvars). // The original version of Colvars and its updates are located at: // https://github.com/colvars/colvars diff --git a/lib/colvars/colvarscript.cpp b/lib/colvars/colvarscript.cpp index 9570acd832..0977496b9e 100644 --- a/lib/colvars/colvarscript.cpp +++ b/lib/colvars/colvarscript.cpp @@ -74,7 +74,9 @@ int colvarscript::run(int objc, unsigned char *const objv[]) } if (objc < 2) { - return exec_command(cv_help, NULL, objc, objv); + set_str_result("No commands given: use \"cv help\" " + "for a list of commands."); + return COLVARSCRIPT_ERROR; } std::string const cmd(obj_to_str(objv[1])); @@ -123,8 +125,7 @@ int colvarscript::run(int objc, unsigned char *const objv[]) if (cmd == "delete") { // Note: the delete bit may be ignored by some backends // it is mostly useful in VMD - colvars->set_error_bits(DELETE_COLVARS); - return COLVARS_OK; + return proxy->request_deletion(); } if (cmd == "update") { @@ -272,6 +273,11 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[]) return COLVARS_OK; } + if (subcmd == "run_ave") { + result = (cv->run_ave()).to_simple_string(); + return COLVARS_OK; + } + if (subcmd == "width") { result = cvm::to_str(cv->width, 0, cvm::cv_prec); return COLVARS_OK; diff --git a/lib/gpu/Opencl.makefile b/lib/gpu/Opencl.makefile index f116508ae5..bb07151447 100644 --- a/lib/gpu/Opencl.makefile +++ b/lib/gpu/Opencl.makefile @@ -65,7 +65,8 @@ OBJS = $(OBJ_DIR)/lal_atom.o $(OBJ_DIR)/lal_answer.o \ $(OBJ_DIR)/lal_coul.o $(OBJ_DIR)/lal_coul_ext.o \ $(OBJ_DIR)/lal_coul_debye.o $(OBJ_DIR)/lal_coul_debye_ext.o \ $(OBJ_DIR)/lal_zbl.o $(OBJ_DIR)/lal_zbl_ext.o \ - $(OBJ_DIR)/lal_lj_cubic.o $(OBJ_DIR)/lal_lj_cubic_ext.o + $(OBJ_DIR)/lal_lj_cubic.o $(OBJ_DIR)/lal_lj_cubic_ext.o \ + $(OBJ_DIR)/lal_ufm.o $(OBJ_DIR)/lal_ufm_ext.o KERS = $(OBJ_DIR)/device_cl.h $(OBJ_DIR)/atom_cl.h \ $(OBJ_DIR)/neighbor_cpu_cl.h $(OBJ_DIR)/pppm_cl.h \ @@ -93,7 +94,8 @@ KERS = $(OBJ_DIR)/device_cl.h $(OBJ_DIR)/atom_cl.h \ $(OBJ_DIR)/tersoff_cl.h $(OBJ_DIR)/tersoff_zbl_cl.h \ $(OBJ_DIR)/tersoff_mod_cl.h $(OBJ_DIR)/coul_cl.h \ $(OBJ_DIR)/coul_debye_cl.h $(OBJ_DIR)/zbl_cl.h \ - $(OBJ_DIR)/lj_cubic_cl.h $(OBJ_DIR)/vashishta_cl.h + $(OBJ_DIR)/lj_cubic_cl.h $(OBJ_DIR)/vashishta_cl.h \ + $(OBJ_DIR)/ufm_cl.h OCL_EXECS = $(BIN_DIR)/ocl_get_devices @@ -577,6 +579,15 @@ $(OBJ_DIR)/lal_lj_cubic.o: $(ALL_H) lal_lj_cubic.h lal_lj_cubic.cpp $(OBJ_DIR)/ $(OBJ_DIR)/lal_lj_cubic_ext.o: $(ALL_H) lal_lj_cubic.h lal_lj_cubic_ext.cpp lal_base_atomic.h $(OCL) -o $@ -c lal_lj_cubic_ext.cpp -I$(OBJ_DIR) +$(OBJ_DIR)/ufm_cl.h: lal_ufm.cu $(PRE1_H) + $(BSH) ./geryon/file_to_cstr.sh ufm $(PRE1_H) lal_ufm.cu $(OBJ_DIR)/ufm_cl.h; + +$(OBJ_DIR)/lal_ufm.o: $(ALL_H) lal_ufm.h lal_ufm.cpp $(OBJ_DIR)/ufm_cl.h $(OBJ_DIR)/ufm_cl.h $(OBJ_DIR)/lal_base_atomic.o + $(OCL) -o $@ -c lal_ufm.cpp -I$(OBJ_DIR) + +$(OBJ_DIR)/lal_ufm_ext.o: $(ALL_H) lal_ufm.h lal_ufm_ext.cpp lal_base_atomic.h + $(OCL) -o $@ -c lal_ufm_ext.cpp -I$(OBJ_DIR) + $(BIN_DIR)/ocl_get_devices: ./geryon/ucl_get_devices.cpp $(OCL) -o $@ ./geryon/ucl_get_devices.cpp -DUCL_OPENCL $(OCL_LINK) diff --git a/python/lammps.py b/python/lammps.py index 0492876476..c895037c00 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -406,7 +406,7 @@ class lammps(object): # returned data is a 1d vector - doc how it is ordered? # NOTE: how could we insure are converting to correct Python type # e.g. for Python list or NumPy, etc - # ditto for extact_atom() above + # ditto for extract_atom() above def gather_atoms(self,name,type,count): if name: name = name.encode() diff --git a/src/.gitignore b/src/.gitignore index f6cb63f613..659ae557a8 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -15,6 +15,8 @@ /*_kokkos.cpp /*_omp.h /*_omp.cpp +/*_opt.h +/*_opt.cpp /*_tally.h /*_tally.cpp /*_rx.h @@ -693,16 +695,10 @@ /pair_dsmc.h /pair_eam.cpp /pair_eam.h -/pair_eam_opt.cpp -/pair_eam_opt.h /pair_eam_alloy.cpp /pair_eam_alloy.h -/pair_eam_alloy_opt.cpp -/pair_eam_alloy_opt.h /pair_eam_fs.cpp /pair_eam_fs.h -/pair_eam_fs_opt.cpp -/pair_eam_fs_opt.h /pair_edip.cpp /pair_edip.h /pair_edip_multi.cpp @@ -746,8 +742,6 @@ /pair_lj_charmm_coul_charmm_implicit.h /pair_lj_charmm_coul_long.cpp /pair_lj_charmm_coul_long.h -/pair_lj_charmm_coul_long_opt.cpp -/pair_lj_charmm_coul_long_opt.h /pair_lj_charmm_coul_long_soft.cpp /pair_lj_charmm_coul_long_soft.h /pair_lj_charmm_coul_msm.cpp @@ -770,8 +764,6 @@ /pair_lj_cut_tip4p_cut.h /pair_lj_cut_coul_long.cpp /pair_lj_cut_coul_long.h -/pair_lj_cut_coul_long_opt.cpp -/pair_lj_cut_coul_long_opt.h /pair_lj_cut_coul_long_soft.cpp /pair_lj_cut_coul_long_soft.h /pair_lj_cut_coul_msm.cpp @@ -786,20 +778,14 @@ /pair_lj_cut_soft.h /pair_lj_cut_tip4p_long.cpp /pair_lj_cut_tip4p_long.h -/pair_lj_cut_tip4p_long_opt.cpp -/pair_lj_cut_tip4p_long_opt.h /pair_lj_cut_tip4p_long_soft.cpp /pair_lj_cut_tip4p_long_soft.h /pair_lj_long_coul_long.cpp /pair_lj_long_coul_long.h -/pair_lj_long_coul_long_opt.cpp -/pair_lj_long_coul_long_opt.h /pair_lj_long_dipole_long.cpp /pair_lj_long_dipole_long.h /pair_lj_long_tip4p_long.cpp /pair_lj_long_tip4p_long.h -/pair_lj_cut_opt.cpp -/pair_lj_cut_opt.h /pair_lj_cut_tgpu.cpp /pair_lj_cut_tgpu.h /pair_lj_sdk.cpp @@ -824,8 +810,6 @@ /pair_meam_spline.h /pair_meam_sw_spline.cpp /pair_meam_sw_spline.h -/pair_morse_opt.cpp -/pair_morse_opt.h /pair_morse_soft.cpp /pair_morse_soft.h /pair_nb3b_harmonic.cpp diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 5d2ae891d0..9278703e2a 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -66,6 +66,7 @@ PairLJClass2CoulLong::~PairLJClass2CoulLong() memory->destroy(offset); } } + if (ftable) free_tables(); } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_snap_kokkos_impl.h b/src/KOKKOS/pair_snap_kokkos_impl.h index b2c8bbcd99..6165c3e9f7 100644 --- a/src/KOKKOS/pair_snap_kokkos_impl.h +++ b/src/KOKKOS/pair_snap_kokkos_impl.h @@ -188,7 +188,7 @@ void PairSNAPKokkos::compute(int eflag_in, int vflag_in) int team_size_max = Kokkos::TeamPolicy::team_size_max(*this); int vector_length = 8; #ifdef KOKKOS_ENABLE_CUDA - int team_size = 20;//max_neighs; + int team_size = 32;//max_neighs; if (team_size*vector_length > team_size_max) team_size = team_size_max/vector_length; #else diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 5fa03a0989..b2b107284e 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -119,7 +119,7 @@ void VerletKokkos::setup(int flag) atomKK->modified(Host,ALL_MASK); - neighbor->build(); + neighbor->build(1); neighbor->ncalls = 0; // compute all forces @@ -222,7 +222,7 @@ void VerletKokkos::setup_minimal(int flag) atomKK->modified(Host,ALL_MASK); - neighbor->build(); + neighbor->build(1); neighbor->ncalls = 0; } @@ -378,7 +378,7 @@ void VerletKokkos::run(int n) modify->pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); } diff --git a/src/KOKKOS/verlet_kokkos.h b/src/KOKKOS/verlet_kokkos.h index 7b140b6f81..1e36b1cf6e 100644 --- a/src/KOKKOS/verlet_kokkos.h +++ b/src/KOKKOS/verlet_kokkos.h @@ -31,7 +31,7 @@ class VerletKokkos : public Verlet { public: VerletKokkos(class LAMMPS *, int, char **); ~VerletKokkos() {} - void setup(int flag=1); + void setup(int); void setup_minimal(int); void run(int); diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index f74b05624f..4594f26f8f 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -38,7 +38,8 @@ extern "C" { void latte(int *, int *, double *, int *, int *, double *, double *, double *, double *, double *, double *, double *, int*, - double *, double *, double *, double * ); + double *, double *, double *, double *, bool *); + int latte_abiversion(); } #define INVOKED_PERATOM 8 @@ -54,6 +55,9 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : if (comm->nprocs != 1) error->all(FLERR,"Fix latte currently runs only in serial"); + if (20180207 != latte_abiversion()) + error->all(FLERR,"LAMMPS is linked against incompatible LATTE library"); + if (narg != 4) error->all(FLERR,"Illegal fix latte command"); scalar_flag = 1; @@ -267,7 +271,7 @@ void FixLatte::post_force(int vflag) flags[1] = coulombflag; // 1 for LAMMPS computes Coulombics, 0 for LATTE flags[2] = eflag_atom; // 1 to return per-atom energies, 0 for no flags[3] = vflag_global && thermo_virial; // 1 to return global/per-atom - flags[4] = vflag_atom && thermo_virial; // virial, 0 for no + flags[4] = vflag_atom && thermo_virial; // virial, 0 for no flags[5] = neighflag; // 1 to pass neighbor list to LATTE, 0 for no // setup LATTE arguments @@ -279,16 +283,17 @@ void FixLatte::post_force(int vflag) double *mass = &atom->mass[1]; double *boxlo = domain->boxlo; double *boxhi = domain->boxhi; - double *forces; + bool latteerror = 0; if (coulomb) forces = &flatte[0][0]; else forces = &atom->f[0][0]; - int maxiter = -1; - + latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi,&domain->xy, - &domain->xz,&domain->yz, - forces,&maxiter,&latte_energy,&atom->v[0][0],&update->dt,virial); + &domain->xz,&domain->yz,forces,&maxiter,&latte_energy, + &atom->v[0][0],&update->dt,virial,&latteerror); + + if (latteerror) error->all(FLERR,"Internal LATTE problem"); // sum LATTE forces to LAMMPS forces // e.g. LAMMPS may compute Coulombics at some point diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 80bebefec0..6500707bf3 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -316,7 +316,7 @@ void FixAtomSwap::pre_exchange() comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); energy_stored = energy_full(); @@ -366,7 +366,7 @@ int FixAtomSwap::attempt_semi_grand() comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); } else { comm->forward_comm_fix(this); } @@ -408,7 +408,7 @@ int FixAtomSwap::attempt_semi_grand() comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); } else { comm->forward_comm_fix(this); } @@ -447,7 +447,7 @@ int FixAtomSwap::attempt_swap() comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); } else { comm->forward_comm_fix(this); } @@ -489,7 +489,7 @@ int FixAtomSwap::attempt_swap() comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); } else { comm->forward_comm_fix(this); } diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index a50ca0fd21..61629aa30d 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -72,7 +72,8 @@ enum{MOVEATOM,MOVEMOL}; // movemode FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), idregion(NULL), full_flag(0), ngroups(0), groupstrings(NULL), ngrouptypes(0), grouptypestrings(NULL), - grouptypebits(NULL), grouptypes(NULL), local_gas_list(NULL), molcoords(NULL), random_equal(NULL), random_unequal(NULL), + grouptypebits(NULL), grouptypes(NULL), local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), + random_equal(NULL), random_unequal(NULL), fixrigid(NULL), fixshake(NULL), idrigid(NULL), idshake(NULL) { if (narg < 11) error->all(FLERR,"Illegal fix gcmc command"); @@ -199,8 +200,8 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : if (exchmode == EXCHATOM) natoms_per_molecule = 1; else natoms_per_molecule = onemols[imol]->natoms; - nmaxmolcoords = natoms_per_molecule; - memory->create(molcoords,nmaxmolcoords,3,"gcmc:molcoords"); + nmaxmolatoms = natoms_per_molecule; + grow_molecule_arrays(nmaxmolatoms); // compute the number of MC cycles that occur nevery timesteps @@ -513,7 +514,7 @@ void FixGCMC::init() "Fix gcmc cannot exchange individual atoms belonging to a molecule"); } - // if molecules are exchanged are moves, check for unset mol IDs + // if molecules are exchanged or moved, check for unset mol IDs if (exchmode == EXCHMOL || movemode == MOVEMOL) { tagint *molecule = atom->molecule; @@ -683,6 +684,12 @@ void FixGCMC::init() imagezero = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; + // warning if group id is "all" + + if (groupbit & 1) + error->warning(FLERR, "Fix gcmc is being applied " + "to the default group all"); + // construct group bitmask for all new atoms // aggregated over all group keywords @@ -707,6 +714,12 @@ void FixGCMC::init() } } + // Current implementation is broken using + // full_flag on molecules on more than one processor. + // Print error if this is the current mode + if (full_flag && (exchmode == EXCHMOL || movemode == MOVEMOL) && comm->nprocs > 1) + error->all(FLERR,"fix gcmc does currently not support full_energy option with molecules on more than 1 MPI process."); + } /* ---------------------------------------------------------------------- @@ -1153,10 +1166,8 @@ void FixGCMC::attempt_molecule_rotation() } } - if (nmolcoords > nmaxmolcoords) { - nmaxmolcoords = nmolcoords; - molcoords = memory->grow(molcoords,nmaxmolcoords,3,"gcmc:molcoords"); - } + if (nmolcoords > nmaxmolatoms) + grow_molecule_arrays(nmolcoords); double com[3]; com[0] = com[1] = com[2] = 0.0; @@ -1816,10 +1827,8 @@ void FixGCMC::attempt_molecule_rotation_full() } } - if (nmolcoords > nmaxmolcoords) { - nmaxmolcoords = nmolcoords; - molcoords = memory->grow(molcoords,nmaxmolcoords,3,"gcmc:molcoords"); - } + if (nmolcoords > nmaxmolatoms) + grow_molecule_arrays(nmolcoords); double com[3]; com[0] = com[1] = com[2] = 0.0; @@ -1844,14 +1853,14 @@ void FixGCMC::attempt_molecule_rotation_full() double **x = atom->x; imageint *image = atom->image; - imageint image_orig[natoms_per_molecule]; + int n = 0; for (int i = 0; i < atom->nlocal; i++) { if (mask[i] & molecule_group_bit) { molcoords[n][0] = x[i][0]; molcoords[n][1] = x[i][1]; molcoords[n][2] = x[i][2]; - image_orig[n] = image[i]; + molimage[n] = image[i]; double xtmp[3]; domain->unmap(x[i],image[i],xtmp); xtmp[0] -= com[0]; @@ -1884,7 +1893,7 @@ void FixGCMC::attempt_molecule_rotation_full() x[i][0] = molcoords[n][0]; x[i][1] = molcoords[n][1]; x[i][2] = molcoords[n][2]; - image[i] = image_orig[n]; + image[i] = molimage[n]; n++; } } @@ -1906,8 +1915,17 @@ void FixGCMC::attempt_molecule_deletion_full() double energy_before = energy_stored; + // check nmolq, grow arrays if necessary + + int nmolq = 0; + for (int i = 0; i < atom->nlocal; i++) + if (atom->molecule[i] == deletion_molecule) + if (atom->q_flag) nmolq++; + + if (nmolq > nmaxmolatoms) + grow_molecule_arrays(nmolq); + int m = 0; - double q_tmp[natoms_per_molecule]; int tmpmask[atom->nlocal]; for (int i = 0; i < atom->nlocal; i++) { if (atom->molecule[i] == deletion_molecule) { @@ -1915,7 +1933,7 @@ void FixGCMC::attempt_molecule_deletion_full() atom->mask[i] = exclusion_group_bit; toggle_intramolecular(i); if (atom->q_flag) { - q_tmp[m] = atom->q[i]; + molq[m] = atom->q[i]; m++; atom->q[i] = 0.0; } @@ -1948,7 +1966,7 @@ void FixGCMC::attempt_molecule_deletion_full() atom->mask[i] = tmpmask[i]; toggle_intramolecular(i); if (atom->q_flag) { - atom->q[i] = q_tmp[m]; + atom->q[i] = molq[m]; m++; } } @@ -2238,7 +2256,7 @@ double FixGCMC::energy_full() comm->borders(); if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); int eflag = 1; int vflag = 0; @@ -2521,3 +2539,10 @@ void FixGCMC::restart(char *buf) next_reneighbor = static_cast (list[n++]); } + +void FixGCMC::grow_molecule_arrays(int nmolatoms) { + nmaxmolatoms = nmolatoms; + molcoords = memory->grow(molcoords,nmaxmolatoms,3,"gcmc:molcoords"); + molq = memory->grow(molq,nmaxmolatoms,"gcmc:molq"); + molimage = memory->grow(molimage,nmaxmolatoms,"gcmc:molimage"); +} diff --git a/src/MC/fix_gcmc.h b/src/MC/fix_gcmc.h index fc6021efea..77dda17fda 100644 --- a/src/MC/fix_gcmc.h +++ b/src/MC/fix_gcmc.h @@ -57,7 +57,8 @@ class FixGCMC : public Fix { double memory_usage(); void write_restart(FILE *); void restart(char *); - + void grow_molecule_arrays(int); + private: int molecule_group,molecule_group_bit; int molecule_group_inversebit; @@ -78,7 +79,7 @@ class FixGCMC : public Fix { bool full_flag; // true if doing full system energy calculations int natoms_per_molecule; // number of atoms in each inserted molecule - int nmaxmolcoords; // number of atoms allocated for molcoords + int nmaxmolatoms; // number of atoms allocated for molecule arrays int groupbitall; // group bitmask for inserted atoms int ngroups; // number of group-ids for inserted atoms @@ -114,6 +115,8 @@ class FixGCMC : public Fix { int *local_gas_list; double **cutsq; double **molcoords; + double *molq; + imageint *molimage; imageint imagezero; double overlap_cutoffsq; // square distance cutoff for overlap int overlap_flag; @@ -224,6 +227,12 @@ W: Energy of old configuration in fix gcmc is > MAXENERGYTEST. This probably means that a pair of atoms are closer than the overlap cutoff distance for keyword overlap_cutoff. +W: Fix gcmc is being applied to the default group all + +This is allowed, but it will result in Monte Carlo moves +being performed on all the atoms in the system, which is +often not what is intended. + E: Invalid atom type in fix gcmc command The atom type specified in the gcmc command does not exist. diff --git a/src/MISC/xdr_compat.h b/src/MISC/xdr_compat.h index ac318aa58c..605374c47f 100644 --- a/src/MISC/xdr_compat.h +++ b/src/MISC/xdr_compat.h @@ -60,7 +60,7 @@ extern "C" { typedef int bool_t; -#if defined(__MINGW32__) +#if defined(__MINGW32__) || defined(__APPLE__) typedef char * caddr_t; typedef unsigned int u_int; #endif diff --git a/src/Makefile b/src/Makefile index e0f0db77fe..03f4072132 100644 --- a/src/Makefile +++ b/src/Makefile @@ -100,6 +100,7 @@ help: @echo '' @echo 'make package list available packages and their dependencies' @echo 'make package-status (ps) status of all packages' + @echo 'make package-installed (pi) list of installed packages' @echo 'make yes-package install a single pgk in src dir' @echo 'make no-package remove a single pkg from src dir' @echo 'make yes-all install all pgks in src dir' @@ -260,6 +261,7 @@ package: @echo 'make package list available packages' @echo 'make package list available packages' @echo 'make package-status (ps) status of all packages' + @echo 'make package-installed (pi) list of installed packages' @echo 'make yes-package install a single pgk in src dir' @echo 'make no-package remove a single pkg from src dir' @echo 'make yes-all install all pgks in src dir' @@ -354,6 +356,7 @@ lib-%: fi; touch main.cpp # status = list src files that differ from package files +# installed = list of installed packages # update = replace src files with newer package files # overwrite = overwrite package files with newer src files # diff = show differences between src and package files @@ -364,6 +367,10 @@ package-status ps: @echo '' @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p status; done +package-installed pi: + @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p installed; done + @for p in $(PACKUSERUC); do $(SHELL) Package.sh $$p installed; done + package-update pu: purge @for p in $(PACKAGEUC); do $(SHELL) Package.sh $$p update; done @echo '' diff --git a/src/Package.sh b/src/Package.sh index ce3819b590..72e8761e21 100644 --- a/src/Package.sh +++ b/src/Package.sh @@ -34,6 +34,13 @@ if (test $2 = "status") then echo "Installed NO: package $1" fi +# installed, list only if installed + +elif (test $2 = "installed") then + if (test $installed = 1) then + echo "Installed YES: package $1" + fi + # update, only if installed # perform a re-install, but only if the package is already installed diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 757eae5dd2..b9dfbdae19 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -362,6 +362,7 @@ int FixQEq::CG( double *b, double *x ) i = ilist[ii]; if (atom->mask[i] & groupbit) d[i] = r[i] * Hdia_inv[i]; + else d[i] = 0.0; } b_norm = parallel_norm( b, inum ); @@ -594,6 +595,7 @@ double FixQEq::parallel_norm( double *v, int n ) ilist = list->ilist; my_sum = 0.0; + norm_sqr = 0.0; for( ii = 0; ii < n; ++ii ) { i = ilist[ii]; if (atom->mask[i] & groupbit) diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index 98e5539872..33f834a140 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -425,10 +425,14 @@ void FixNEB::min_post_force(int vflag) tangent[i][0] = vmax*delxn + vmin*delxp; tangent[i][1] = vmax*delyn + vmin*delyp; tangent[i][2] = vmax*delzn + vmin*delzp; - } else { + } else if (vnext < vprev) { tangent[i][0] = vmin*delxn + vmax*delxp; tangent[i][1] = vmin*delyn + vmax*delyp; tangent[i][2] = vmin*delzn + vmax*delzp; + } else { // vnext == vprev, e.g. for potentials that do not compute an energy + tangent[i][0] = delxn + delxp; + tangent[i][1] = delyn + delyp; + tangent[i][2] = delzn + delzp; } } diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 14eeac8d66..f7d369cee6 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -293,7 +293,7 @@ void PRD::command(int narg, char **arg) update->whichflag = 1; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); if (temp_flag == 0) { if (universe->iworld == 0) temp_dephase = temperature->compute_scalar(); @@ -390,7 +390,7 @@ void PRD::command(int narg, char **arg) update->whichflag = 1; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); timer->barrier_start(); @@ -545,7 +545,7 @@ void PRD::dynamics(int nsteps, double &time_category) update->nsteps = nsteps; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); // this may be needed if don't do full init //modify->addstep_compute_all(update->ntimestep); bigint ncalls = neighbor->ncalls; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index 347cd3ba67..958a57e4e8 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -264,7 +264,7 @@ void TAD::command(int narg, char **arg) update->whichflag = 1; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); // main loop: look for events until out of time // (1) dynamics, store state, quench, check event, restore state @@ -342,7 +342,7 @@ void TAD::command(int narg, char **arg) update->whichflag = 1; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); // write restart file of hot coords @@ -448,7 +448,7 @@ void TAD::dynamics() update->nsteps = t_event; lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); // this may be needed if don't do full init //modify->addstep_compute_all(update->ntimestep); int ncalls = neighbor->ncalls; diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 667f2893c6..d7e8c981bb 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -212,7 +212,7 @@ void Temper::command(int narg, char **arg) if (me_universe == 0 && universe->uscreen) fprintf(universe->uscreen,"Setting up tempering ...\n"); - update->integrate->setup(); + update->integrate->setup(1); if (me_universe == 0) { if (universe->uscreen) { diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index 4572170f34..e47965d1c3 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -239,13 +239,13 @@ void VerletSplit::init() servant partition only sets up KSpace calculation ------------------------------------------------------------------------- */ -void VerletSplit::setup() +void VerletSplit::setup(int flag) { if (comm->me == 0 && screen) fprintf(screen,"Setting up Verlet/split run ...\n"); if (!master) force->kspace->setup(); - else Verlet::setup(); + else Verlet::setup(flag); } /* ---------------------------------------------------------------------- @@ -344,7 +344,7 @@ void VerletSplit::run(int n) if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost); timer->stamp(Timer::COMM); if (n_pre_neighbor) modify->pre_neighbor(); - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); } } diff --git a/src/REPLICA/verlet_split.h b/src/REPLICA/verlet_split.h index 2d25131df3..b3ee87e580 100644 --- a/src/REPLICA/verlet_split.h +++ b/src/REPLICA/verlet_split.h @@ -29,7 +29,7 @@ class VerletSplit : public Verlet { VerletSplit(class LAMMPS *, int, char **); ~VerletSplit(); void init(); - void setup(); + void setup(int); void setup_minimal(int); void run(int); bigint memory_usage(); diff --git a/src/SNAP/pair_snap.h b/src/SNAP/pair_snap.h index 9d330f0d6f..e0d7c45063 100644 --- a/src/SNAP/pair_snap.h +++ b/src/SNAP/pair_snap.h @@ -37,8 +37,11 @@ public: virtual double init_one(int, int); virtual double memory_usage(); + double rcutfac, quadraticflag; // declared public to workaround gcc 4.9 + int ncoeff; // compiler bug, manifest in KOKKOS package + protected: - int ncoeff, ncoeffq, ncoeffall; + int ncoeffq, ncoeffall; double **bvec, ***dbvec; class SNA** sna; int nmax; @@ -97,8 +100,8 @@ protected: double *wjelem; // elements weights double **coeffelem; // element bispectrum coefficients int *map; // mapping from atom types to elements - int twojmax, diagonalstyle, switchflag, bzeroflag, quadraticflag; - double rcutfac, rfac0, rmin0, wj1, wj2; + int twojmax, diagonalstyle, switchflag, bzeroflag; + double rfac0, rmin0, wj1, wj2; int rcutfacflag, twojmaxflag; // flags for required parameters }; diff --git a/src/USER-COLVARS/colvarproxy_lammps_version.h b/src/USER-COLVARS/colvarproxy_lammps_version.h index 45ecea867f..79f77dad4e 100644 --- a/src/USER-COLVARS/colvarproxy_lammps_version.h +++ b/src/USER-COLVARS/colvarproxy_lammps_version.h @@ -1,5 +1,5 @@ #ifndef COLVARPROXY_VERSION -#define COLVARPROXY_VERSION "2017-10-20" +#define COLVARPROXY_VERSION "2017-12-01" // This file is part of the Collective Variables module (Colvars). // The original version of Colvars and its updates are located at: // https://github.com/colvars/colvars diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index 39b7ba2224..2b7a69503a 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -529,7 +529,7 @@ while (ct-- > 0) { void FixShardlow::initial_integrate(int vflag) { - int i,ii,inum; + int ii; int *ilist; int nlocal = atom->nlocal; @@ -592,9 +592,7 @@ void FixShardlow::initial_integrate(int vflag) // Allocate memory for v_t0 to hold the initial velocities for the ghosts v_t0 = (double (*)[3]) memory->smalloc(sizeof(double)*3*nghost, "FixShardlow:v_t0"); - inum = list->inum; ilist = list->ilist; - dtsqrt = sqrt(update->dt); // process neighbors in the local AIR diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index ce50f7603a..ba90ebc465 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -85,8 +85,6 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) tagint *molecule = atom->molecule; tagint **special = atom->special; int **nspecial = atom->nspecial; - int nlocal = atom->nlocal; - if (includegroup) nlocal = atom->nfirst; int *molindex = atom->molindex; int *molatom = atom->molatom; @@ -168,7 +166,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) for (int subphase = 0; subphase < 4; subphase++) { int s_ybin = ybin + ((subphase & 0x2) ? ns_ssa->sy : 0); int s_xbin = xbin + ((subphase & 0x1) ? ns_ssa->sx : 0); - int ibin, ct; + int ibin; if ((s_ybin < lbinylo) || (s_ybin >= lbinyhi)) continue; if ((s_xbin < lbinxlo) || (s_xbin >= lbinxhi)) continue; diff --git a/src/USER-INTEL/verlet_lrt_intel.cpp b/src/USER-INTEL/verlet_lrt_intel.cpp index 9ff5f85176..1b9c305e9c 100644 --- a/src/USER-INTEL/verlet_lrt_intel.cpp +++ b/src/USER-INTEL/verlet_lrt_intel.cpp @@ -142,7 +142,7 @@ void VerletLRTIntel::setup(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); neighbor->ncalls = 0; // compute all forces @@ -276,7 +276,7 @@ void VerletLRTIntel::run(int n) modify->pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); } diff --git a/src/USER-INTEL/verlet_lrt_intel.h b/src/USER-INTEL/verlet_lrt_intel.h index 0d7154ff64..7380cc6376 100644 --- a/src/USER-INTEL/verlet_lrt_intel.h +++ b/src/USER-INTEL/verlet_lrt_intel.h @@ -41,7 +41,7 @@ class VerletLRTIntel : public Verlet { VerletLRTIntel(class LAMMPS *, int, char **); virtual ~VerletLRTIntel(); virtual void init(); - virtual void setup(int flag = 1); + virtual void setup(int flag); virtual void run(int); protected: diff --git a/src/USER-MESO/atom_vec_mdpd.cpp b/src/USER-MESO/atom_vec_mdpd.cpp index 0a4d302c36..0d2350a645 100644 --- a/src/USER-MESO/atom_vec_mdpd.cpp +++ b/src/USER-MESO/atom_vec_mdpd.cpp @@ -43,9 +43,9 @@ AtomVecMDPD::AtomVecMDPD(LAMMPS *lmp) : AtomVec(lmp) size_reverse = 3 + 1; // 3 + drho size_border = 6 + 4; // 6 + rho + vest[3] size_velocity = 3; - size_data_atom = 5; + size_data_atom = 6; size_data_vel = 4; - xcol_data = 3; + xcol_data = 4; atom->rho_flag = 1; atom->vest_flag = 1; @@ -817,7 +817,7 @@ void AtomVecMDPD::data_atom(double *coord, imageint imagetmp, char **values) { vest[nlocal][1] = 0.0; vest[nlocal][2] = 0.0; - rho[nlocal] = 0.0; + rho[nlocal] = atof(values[2]); drho[nlocal] = 0.0; atom->nlocal++; diff --git a/src/USER-MESO/fix_mvv_dpd.cpp b/src/USER-MESO/fix_mvv_dpd.cpp index 77a67273f6..299f453ea7 100644 --- a/src/USER-MESO/fix_mvv_dpd.cpp +++ b/src/USER-MESO/fix_mvv_dpd.cpp @@ -61,6 +61,9 @@ int FixMvvDPD::setmask() void FixMvvDPD::init() { + if (!atom->vest_flag) + error->all(FLERR,"Fix mvv/dpd requires atom attribute vest"); + dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; } diff --git a/src/USER-MESO/pair_mdpd.cpp b/src/USER-MESO/pair_mdpd.cpp index bf78ea5af7..ba72304ddb 100644 --- a/src/USER-MESO/pair_mdpd.cpp +++ b/src/USER-MESO/pair_mdpd.cpp @@ -282,6 +282,9 @@ void PairMDPD::init_style() if (comm->ghost_velocity == 0) error->all(FLERR,"Pair mdpd requires ghost atoms store velocity"); + if (!atom->rho_flag) + error->all(FLERR,"Pair style mdpd requires atom attribute rho"); + // if newton off, forces between atoms ij will be double computed // using different random numbers diff --git a/src/USER-MESO/pair_mdpd_rhosum.cpp b/src/USER-MESO/pair_mdpd_rhosum.cpp index 9c4d6f804f..d2a4ad33d8 100644 --- a/src/USER-MESO/pair_mdpd_rhosum.cpp +++ b/src/USER-MESO/pair_mdpd_rhosum.cpp @@ -62,7 +62,11 @@ PairMDPDRhoSum::~PairMDPDRhoSum() { init specific to this pair style ------------------------------------------------------------------------- */ -void PairMDPDRhoSum::init_style() { +void PairMDPDRhoSum::init_style() +{ + if (!atom->rho_flag) + error->all(FLERR,"Pair style mdpd/rhosum requires atom attribute rho"); + // need a full neighbor list int irequest = neighbor->request(this,instance_me); neighbor->requests[irequest]->half = 0; diff --git a/src/USER-MESO/pair_tdpd.cpp b/src/USER-MESO/pair_tdpd.cpp index 1f2bd4eb6c..42904d2b5a 100644 --- a/src/USER-MESO/pair_tdpd.cpp +++ b/src/USER-MESO/pair_tdpd.cpp @@ -315,13 +315,17 @@ void PairTDPD::coeff(int narg, char **arg) void PairTDPD::init_style() { if (comm->ghost_velocity == 0) - error->all(FLERR,"Pair tdpd requires ghost atoms store velocity"); + error->all(FLERR,"Pair style tdpd requires ghost atoms store velocity"); + + if (!atom->tdpd_flag) + error->all(FLERR,"Pair style tdpd requires atom properties cc/cc_flux"); // if newton off, forces between atoms ij will be double computed // using different random numbers - if (force->newton_pair == 0 && comm->me == 0) error->warning(FLERR, - "Pair tdpd needs newton pair on for momentum conservation"); + if (force->newton_pair == 0 && comm->me == 0) + error->warning(FLERR,"Pair tdpd needs newton pair on " + "for momentum conservation"); neighbor->request(this,instance_me); } diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index e1e5f579b8..aeaf2f78ba 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -304,7 +304,7 @@ void FixSRP::setup_pre_force(int zz) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); neighbor->ncalls = 0; // new atom counts diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index d52b2e4a47..3345549ae3 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -364,7 +364,7 @@ void PairEDIPMulti::edip_fc(double r, Param *param, double &f, double &fdr) double c = param->cutoffC; double alpha = param->alpha; double x; - double v1, v2, v3; + double v1, v2; if(r < c + 1E-6) { diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 6ce7da8d6a..9e5a4c5c3b 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -214,7 +214,7 @@ void TemperGrem::command(int narg, char **arg) if (me_universe == 0 && universe->uscreen) fprintf(universe->uscreen,"Setting up tempering ...\n"); - update->integrate->setup(); + update->integrate->setup(1); if (me_universe == 0) { if (universe->uscreen) { diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 572a52b1a9..60f9313fdd 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -101,9 +101,9 @@ void TemperNPT::command(int narg, char **arg) // change the volume. This currently only applies to fix npt and // fix rigid/npt variants - if ((strncmp(modify->fix[whichfix]->style,"npt",3) == 0) - || (strncmp(modify->fix[whichfix]->style,"rigid/npt",9) == 0)) - error->universe_all(FLERR,"Tempering temperature fix is not supported"); + if ((strncmp(modify->fix[whichfix]->style,"npt",3) != 0) + && (strncmp(modify->fix[whichfix]->style,"rigid/npt",9) != 0)) + error->universe_all(FLERR,"Tempering temperature and pressure fix is not supported"); // setup for long tempering run @@ -190,7 +190,7 @@ void TemperNPT::command(int narg, char **arg) if (me_universe == 0 && universe->uscreen) fprintf(universe->uscreen,"Setting up tempering ...\n"); - update->integrate->setup(); + update->integrate->setup(1); if (me_universe == 0) { if (universe->uscreen) { diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 37f343736d..9c0c15f1ee 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -107,7 +107,7 @@ extern "C" { * J. Phys. Chem., 68, 441 - 452, 1964, * except the value for H, which is taken from R.S. Rowland & R. Taylor, * J.Phys.Chem., 100, 7384 - 7391, 1996. Radii that are not available in - * either of these publications have RvdW = 2.00 Å. + * either of these publications have RvdW = 2.00 \AA. * The radii for Ions (Na, K, Cl, Ca, Mg, and Cs are based on the CHARMM27 * Rmin/2 parameters for (SOD, POT, CLA, CAL, MG, CES) by default. */ diff --git a/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp b/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp index 6a1cb46ea6..fc101a33d2 100644 --- a/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_size_bin_newtoff_omp.cpp @@ -49,7 +49,7 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,m,n,nn,ibin; + int i,j,k,n,ibin; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -58,7 +58,6 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/USER-OMP/npair_half_size_bin_newton_omp.cpp b/src/USER-OMP/npair_half_size_bin_newton_omp.cpp index d8e1e6da44..1f0dca79ac 100644 --- a/src/USER-OMP/npair_half_size_bin_newton_omp.cpp +++ b/src/USER-OMP/npair_half_size_bin_newton_omp.cpp @@ -48,14 +48,13 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,m,n,nn,ibin; + int i,j,k,n,ibin; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/USER-OMP/npair_half_size_nsq_newtoff_omp.cpp b/src/USER-OMP/npair_half_size_nsq_newtoff_omp.cpp index 3c7b6b118f..1615effad3 100644 --- a/src/USER-OMP/npair_half_size_nsq_newtoff_omp.cpp +++ b/src/USER-OMP/npair_half_size_nsq_newtoff_omp.cpp @@ -51,14 +51,13 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,m,n,nn; + int i,j,n; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/USER-OMP/npair_half_size_nsq_newton_omp.cpp b/src/USER-OMP/npair_half_size_nsq_newton_omp.cpp index 37a4181af7..e5de57aa51 100644 --- a/src/USER-OMP/npair_half_size_nsq_newton_omp.cpp +++ b/src/USER-OMP/npair_half_size_nsq_newton_omp.cpp @@ -52,7 +52,7 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,m,n,nn,itag,jtag; + int i,j,n,itag,jtag; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp new file mode 100644 index 0000000000..f5dc03e368 --- /dev/null +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -0,0 +1,204 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + This software is distributed under the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#include +#include "pair_lj_cut_coul_wolf_omp.h" +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" + +#include "suffix.h" +#include "math_const.h" +using namespace LAMMPS_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- */ + +PairLJCutCoulWolfOMP::PairLJCutCoulWolfOMP(LAMMPS *lmp) : + PairLJCutCoulWolf(lmp), ThrOMP(lmp, THR_PAIR) +{ + suffix_flag |= Suffix::OMP; + respa_enable = 0; +} + +/* ---------------------------------------------------------------------- */ + +void PairLJCutCoulWolfOMP::compute(int eflag, int vflag) +{ + if (eflag || vflag) { + ev_setup(eflag,vflag); + } else evflag = vflag_fdotr = 0; + + const int nall = atom->nlocal + atom->nghost; + const int nthreads = comm->nthreads; + const int inum = list->inum; + +#if defined(_OPENMP) +#pragma omp parallel default(none) shared(eflag,vflag) +#endif + { + int ifrom, ito, tid; + + loop_setup_thr(ifrom, ito, tid, inum, nthreads); + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::START); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, thr); + + if (evflag) { + if (eflag) { + if (force->newton_pair) eval<1,1,1>(ifrom, ito, thr); + else eval<1,1,0>(ifrom, ito, thr); + } else { + if (force->newton_pair) eval<1,0,1>(ifrom, ito, thr); + else eval<1,0,0>(ifrom, ito, thr); + } + } else { + if (force->newton_pair) eval<0,0,1>(ifrom, ito, thr); + else eval<0,0,0>(ifrom, ito, thr); + } + + thr->timer(Timer::PAIR); + reduce_thr(this, eflag, vflag, thr); + } // end of omp parallel region +} + +/* ---------------------------------------------------------------------- */ + +template +void PairLJCutCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) +{ + int i,j,ii,jj,jnum,itype,jtype; + double qitmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; + double r,rsq,r2inv,r6inv,forcecoul,forcelj,factor_coul,factor_lj; + double prefactor,erfcc,erfcd,v_sh,dvdrr,e_self,qisq; + int *ilist,*jlist,*numneigh,**firstneigh; + + evdwl = ecoul = 0.0; + + const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const double * _noalias const q = atom->q; + const int * _noalias const type = atom->type; + const int nlocal = atom->nlocal; + const double * _noalias const special_coul = force->special_coul; + const double * _noalias const special_lj = force->special_lj; + const double qqrd2e = force->qqrd2e; + double fxtmp,fytmp,fztmp; + + // self and shifted Coulombic energy + + e_self = v_sh = 0.0; + const double e_shift = erfc(alf*cut_coul)/cut_coul; + const double f_shift = -(e_shift+ 2.0*alf/MY_PIS + * exp(-alf*alf*cut_coul*cut_coul)) / cut_coul; + + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = iifrom; ii < iito; ++ii) { + + i = ilist[ii]; + qitmp = q[i]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + fxtmp=fytmp=fztmp=0.0; + + if (EFLAG) { + e_self = -(e_shift/2.0 + alf/MY_PIS) * qitmp*qitmp*qqrd2e; + ev_tally_thr(this,i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0,thr); + } + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r2inv = 1.0/rsq; + + if (rsq < cut_coulsq) { + r = sqrt(rsq); + prefactor = qqrd2e*qitmp*q[j]/r; + erfcc = erfc(alf*r); + erfcd = exp(-alf*alf*r*r); + v_sh = (erfcc - e_shift*r) * prefactor; + dvdrr = (erfcc/rsq + 2.0*alf/MY_PIS * erfcd/r) + f_shift; + forcecoul = dvdrr*rsq*prefactor; + if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + } else forcecoul = 0.0; + + if (rsq < cut_ljsq[itype][jtype]) { + r6inv = r2inv*r2inv*r2inv; + forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); + } else forcelj = 0.0; + + fpair = (forcecoul + factor_lj*forcelj) * r2inv; + + fxtmp += delx*fpair; + fytmp += dely*fpair; + fztmp += delz*fpair; + if (NEWTON_PAIR || j < nlocal) { + f[j].x -= delx*fpair; + f[j].y -= dely*fpair; + f[j].z -= delz*fpair; + } + + if (EFLAG) { + if (rsq < cut_ljsq[itype][jtype]) { + evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - + offset[itype][jtype]; + evdwl *= factor_lj; + } else evdwl = 0.0; + + if (rsq < cut_coulsq) { + ecoul = v_sh; + if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; + } else ecoul = 0.0; + } + + if (EVFLAG) ev_tally_thr(this, i,j,nlocal,NEWTON_PAIR, + evdwl,ecoul,fpair,delx,dely,delz,thr); + } + } + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + } +} + +/* ---------------------------------------------------------------------- */ + +double PairLJCutCoulWolfOMP::memory_usage() +{ + double bytes = memory_usage_thr(); + bytes += PairLJCutCoulWolf::memory_usage(); + + return bytes; +} diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.h b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.h new file mode 100644 index 0000000000..4e56808c7b --- /dev/null +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.h @@ -0,0 +1,48 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Axel Kohlmeyer (Temple U) +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(lj/cut/coul/wolf/omp,PairLJCutCoulWolfOMP) + +#else + +#ifndef LMP_PAIR_LJ_CUT_COUL_WOLF_OMP_H +#define LMP_PAIR_LJ_CUT_COUL_WOLF_OMP_H + +#include "pair_lj_cut_coul_wolf.h" +#include "thr_omp.h" + +namespace LAMMPS_NS { + +class PairLJCutCoulWolfOMP : public PairLJCutCoulWolf, public ThrOMP { + + public: + PairLJCutCoulWolfOMP(class LAMMPS *); + + virtual void compute(int, int); + virtual double memory_usage(); + + private: + template + void eval(int ifrom, int ito, ThrData * const thr); +}; + +} + +#endif +#endif diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index c6490b0824..60445d2d86 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -1700,6 +1700,7 @@ void PairLJLongTIP4PLongOMP::eval_outer(int iifrom, int iito, ThrData * const th jnum = numneigh[i]; offseti = offset[itype]; lj1i = lj1[itype]; lj2i = lj2[itype]; lj3i = lj3[itype]; lj4i = lj4[itype]; + fxtmp = fytmp = fztmp = 0.0; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/USER-OMP/respa_omp.cpp b/src/USER-OMP/respa_omp.cpp index aa4aa65a4f..e596caab81 100644 --- a/src/USER-OMP/respa_omp.cpp +++ b/src/USER-OMP/respa_omp.cpp @@ -67,24 +67,26 @@ void RespaOMP::init() setup before run ------------------------------------------------------------------------- */ -void RespaOMP::setup() +void RespaOMP::setup(int flag) { if (comm->me == 0 && screen) { fprintf(screen,"Setting up r-RESPA/omp run ...\n"); - fprintf(screen," Unit style : %s\n", update->unit_style); - fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep); - fprintf(screen," Time steps :"); - for (int ilevel=0; ilevel < nlevels; ++ilevel) - fprintf(screen," %d:%g",ilevel+1, step[ilevel]); - fprintf(screen,"\n r-RESPA fixes :"); - for (int l=0; l < modify->n_post_force_respa; ++l) { - Fix *f = modify->fix[modify->list_post_force_respa[l]]; - if (f->respa_level >= 0) - fprintf(screen," %d:%s[%s]", - MIN(f->respa_level+1,nlevels),f->style,f->id); + if (flag) { + fprintf(screen," Unit style : %s\n", update->unit_style); + fprintf(screen," Current step : " BIGINT_FORMAT "\n", update->ntimestep); + fprintf(screen," Time steps :"); + for (int ilevel=0; ilevel < nlevels; ++ilevel) + fprintf(screen," %d:%g",ilevel+1, step[ilevel]); + fprintf(screen,"\n r-RESPA fixes :"); + for (int l=0; l < modify->n_post_force_respa; ++l) { + Fix *f = modify->fix[modify->list_post_force_respa[l]]; + if (f->respa_level >= 0) + fprintf(screen," %d:%s[%s]", + MIN(f->respa_level+1,nlevels),f->style,f->id); + } + fprintf(screen,"\n"); + timer->print_timeout(screen); } - fprintf(screen,"\n"); - timer->print_timeout(screen); } update->setupflag = 1; @@ -107,7 +109,7 @@ void RespaOMP::setup() domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; @@ -200,7 +202,7 @@ void RespaOMP::setup_minimal(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; } @@ -311,7 +313,7 @@ void RespaOMP::recurse(int ilevel) modify->pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); if (modify->n_post_neighbor) { modify->post_neighbor(); diff --git a/src/USER-OMP/respa_omp.h b/src/USER-OMP/respa_omp.h index 89ddbe78af..dc01e3dc5b 100644 --- a/src/USER-OMP/respa_omp.h +++ b/src/USER-OMP/respa_omp.h @@ -30,7 +30,7 @@ class RespaOMP : public Respa, public ThrOMP { RespaOMP(class LAMMPS *, int, char **); virtual ~RespaOMP() {} virtual void init(); - virtual void setup(); + virtual void setup(int); virtual void setup_minimal(int); protected: diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index d6ddc9c72d..8dac846017 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -775,9 +775,9 @@ void PairTlsph::AssembleStress() { // compute a characteristic time over which to average the plastic strain double tav = 1000 * radius[i] / (Lookup[SIGNAL_VELOCITY][itype]); - eff_plastic_strain_rate[i] -= eff_plastic_strain_rate[i] / tav; - eff_plastic_strain_rate[i] += (plastic_strain_increment / dt) / tav; - eff_plastic_strain_rate[i] = MAX(0.0, eff_plastic_strain_rate[i]); + eff_plastic_strain_rate[i] -= eff_plastic_strain_rate[i] * dt / tav; + eff_plastic_strain_rate[i] += plastic_strain_increment / tav; + eff_plastic_strain_rate[i] = MAX(0.0, eff_plastic_strain_rate[i]); /* * assemble total stress from pressure and deviatoric stress diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index dd639c34db..36494b0d49 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -734,7 +734,7 @@ void FixNHUef::end_of_step() comm->borders(); domain->lamda2x(atom->nlocal+atom->nghost); timer->stamp(Timer::COMM); - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); } } @@ -754,7 +754,7 @@ void FixNHUef::post_run() comm->borders(); domain->lamda2x(atom->nlocal+atom->nghost); timer->stamp(Timer::COMM); - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); } diff --git a/src/atom.cpp b/src/atom.cpp index 3fa470efd5..fa86046d23 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -822,8 +822,8 @@ void Atom::deallocate_topology() call style-specific routine to parse line ------------------------------------------------------------------------- */ -void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, - int shiftflag, double *shift) +void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, + int type_offset, int shiftflag, double *shift) { int m,xptr,iptr; imageint imagedata; @@ -948,6 +948,7 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, int type_offset, coord[2] >= sublo[2] && coord[2] < subhi[2]) { avec->data_atom(xdata,imagedata,values); if (id_offset) tag[nlocal-1] += id_offset; + if (mol_offset) molecule[nlocal-1] += mol_offset; if (type_offset) { type[nlocal-1] += type_offset; if (type[nlocal-1] > ntypes) diff --git a/src/atom.h b/src/atom.h index 007142a1c0..62c2d64ca7 100644 --- a/src/atom.h +++ b/src/atom.h @@ -229,7 +229,7 @@ class Atom : protected Pointers { void deallocate_topology(); - void data_atoms(int, char *, tagint, int, int, double *); + void data_atoms(int, char *, tagint, tagint, int, int, double *); void data_vels(int, char *, tagint); void data_bonds(int, char *, int *, tagint, int); void data_angles(int, char *, int *, tagint, int); diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 9d257d99de..4b1be77a06 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -57,7 +57,7 @@ void Atom::map_init(int check) map_nused = 0; map_free = 0; for (int i = 0; i < map_nhash; i++) map_hash[i].next = i+1; - map_hash[map_nhash-1].next = -1; + if (map_nhash > 0) map_hash[map_nhash-1].next = -1; } // recreating: delete old map and create new one for array or hash diff --git a/src/comm.cpp b/src/comm.cpp index 88edf98ca6..d997c2914f 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -696,10 +696,15 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag, if (maxbytes == 0) return; + // sanity check + + if ((nbytes > 0) && inbuf == NULL) + error->one(FLERR,"Cannot put data on ring from NULL pointer"); + char *buf,*bufcopy; memory->create(buf,maxbytes,"comm:buf"); memory->create(bufcopy,maxbytes,"comm:bufcopy"); - memcpy(buf,inbuf,nbytes); + if (nbytes && inbuf) memcpy(buf,inbuf,nbytes); int next = me + 1; int prev = me - 1; @@ -712,12 +717,12 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag, MPI_Send(buf,nbytes,MPI_CHAR,next,messtag,world); MPI_Wait(&request,&status); MPI_Get_count(&status,MPI_CHAR,&nbytes); - memcpy(buf,bufcopy,nbytes); + if (nbytes) memcpy(buf,bufcopy,nbytes); } if (self || loop < nprocs-1) callback(nbytes/nper,buf,ptr); } - if (outbuf) memcpy(outbuf,buf,nbytes); + if (nbytes && outbuf) memcpy(outbuf,buf,nbytes); memory->destroy(buf); memory->destroy(bufcopy); diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 1e91327e54..d61fd06397 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -52,6 +52,7 @@ ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; comm_forward = 1; + comm_reverse = 1; nmax = 0; } @@ -120,8 +121,10 @@ void ComputeAggregateAtom::compute_peratom() } // invoke full neighbor list (will copy or build if necessary) + // on the first step of a run, set preflag to one in neighbor->build_one(...) - neighbor->build_one(list); + if (update->firststep == update->ntimestep) neighbor->build_one(list,1); + else neighbor->build_one(list); // if group is dynamic, insure ghost atom masks are current @@ -164,6 +167,11 @@ void ComputeAggregateAtom::compute_peratom() while (1) { comm->forward_comm_compute(this); + // reverse communication when bonds are not stored on every processor + + if (force->newton_bond) + comm->reverse_comm_compute(this); + change = 0; while (1) { done = 1; @@ -253,13 +261,50 @@ void ComputeAggregateAtom::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (commflag) - for (i = first; i < last; i++) aggregateID[i] = buf[m++]; + for (i = first; i < last; i++) { + double x = buf[m++]; + + // only overwrite ghost IDs with values lower than current ones + + aggregateID[i] = MIN(x,aggregateID[i]); + } else { int *mask = atom->mask; for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i; } } +/* ---------------------------------------------------------------------- */ + +int ComputeAggregateAtom::pack_reverse_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = aggregateID[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeAggregateAtom::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + double x = buf[m++]; + + // only overwrite local IDs with values lower than current ones + + aggregateID[j] = MIN(x,aggregateID[j]); + } +} + /* ---------------------------------------------------------------------- memory usage of local atom-based array ------------------------------------------------------------------------- */ diff --git a/src/compute_aggregate_atom.h b/src/compute_aggregate_atom.h index 8170aabc7f..dc2e1d7b40 100644 --- a/src/compute_aggregate_atom.h +++ b/src/compute_aggregate_atom.h @@ -33,6 +33,8 @@ class ComputeAggregateAtom : public Compute { void compute_peratom(); int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *); + void unpack_reverse_comm(int, int *, double *); double memory_usage(); private: diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index dcfd2ff131..d08f462907 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -712,13 +712,14 @@ void ComputeChunkAtom::compute_ichunk() return; } - invoked_ichunk = update->ntimestep; - // assign chunk IDs to atoms // will exclude atoms not in group or in optional region // already invoked if this is same timestep as last setup_chunks() + // however, when between runs or using rerun, we need it again. - if (update->ntimestep > invoked_setup) assign_chunk_ids(); + if ((update->ntimestep > invoked_setup) || (invoked_ichunk < 0)) assign_chunk_ids(); + + invoked_ichunk = update->ntimestep; // compress chunk IDs via hash of the original uncompressed IDs // also apply discard rule except for binning styles which already did @@ -1808,13 +1809,13 @@ void ComputeChunkAtom::atom2binsphere() } yremap = x[i][1]; if (periodicity[1]) { - if (xremap < boxlo[1]) yremap += prd[1]; - if (xremap >= boxhi[1]) yremap -= prd[1]; + if (yremap < boxlo[1]) yremap += prd[1]; + if (yremap >= boxhi[1]) yremap -= prd[1]; } zremap = x[i][2]; if (periodicity[2]) { - if (xremap < boxlo[2]) zremap += prd[2]; - if (xremap >= boxhi[2]) zremap -= prd[2]; + if (zremap < boxlo[2]) zremap += prd[2]; + if (zremap >= boxhi[2]) zremap -= prd[2]; } dx = xremap - sorigin[0]; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 5ee6368504..9a7df03e49 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -112,8 +112,10 @@ void ComputeClusterAtom::compute_peratom() } // invoke full neighbor list (will copy or build if necessary) + // on the first step of a run, set preflag to one in neighbor->build_one(...) - neighbor->build_one(list); + if (update->firststep == update->ntimestep) neighbor->build_one(list,1); + else neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 2dfb20a570..8606f54933 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -44,6 +44,7 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; comm_forward = 1; + comm_reverse = 1; nmax = 0; } @@ -122,6 +123,11 @@ void ComputeFragmentAtom::compute_peratom() while (1) { comm->forward_comm_compute(this); + // reverse communication when bonds are not stored on every processor + + if (force->newton_bond) + comm->reverse_comm_compute(this); + change = 0; while (1) { done = 1; @@ -183,13 +189,50 @@ void ComputeFragmentAtom::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (commflag) - for (i = first; i < last; i++) fragmentID[i] = buf[m++]; + for (i = first; i < last; i++) { + double x = buf[m++]; + + // only overwrite ghost IDs with values lower than current ones + + fragmentID[i] = MIN(x,fragmentID[i]); + } else { int *mask = atom->mask; for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i; } } +/* ---------------------------------------------------------------------- */ + +int ComputeFragmentAtom::pack_reverse_comm(int n, int first, double *buf) +{ + int i,m,last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) { + buf[m++] = fragmentID[i]; + } + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeFragmentAtom::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i,j,m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + double x = buf[m++]; + + // only overwrite local IDs with values lower than current ones + + fragmentID[j] = MIN(x,fragmentID[j]); + } +} + /* ---------------------------------------------------------------------- memory usage of local atom-based array ------------------------------------------------------------------------- */ diff --git a/src/compute_fragment_atom.h b/src/compute_fragment_atom.h index a56239dbda..2365b6028b 100644 --- a/src/compute_fragment_atom.h +++ b/src/compute_fragment_atom.h @@ -32,6 +32,8 @@ class ComputeFragmentAtom : public Compute { void compute_peratom(); int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); + int pack_reverse_comm(int, int, double *); + void unpack_reverse_comm(int, int *, double *); double memory_usage(); private: diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index 013036f364..85324651c1 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -154,8 +154,10 @@ void ComputeHexOrderAtom::compute_peratom() } // invoke full neighbor list (will copy or build if necessary) + // on the first step of a run, set preflag to one in neighbor->build_one(...) - neighbor->build_one(list); + if (update->firststep == update->ntimestep) neighbor->build_one(list,1); + else neighbor->build_one(list); inum = list->inum; ilist = list->ilist; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 4752002ac9..48f12406b6 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -209,7 +209,7 @@ void CreateBonds::many() comm->exchange(); comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); - neighbor->build(); + neighbor->build(1); // build neighbor list this command needs based on earlier request diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 489c5bf5d5..a5b15f5f52 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -311,7 +311,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) comm->exchange(); comm->borders(); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); - neighbor->build(); + neighbor->build(1); // build neighbor list this command needs based on earlier request diff --git a/src/fix.cpp b/src/fix.cpp index 80fa00f4b3..297d184967 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -350,7 +350,6 @@ void Fix::v_tally(int n, int *list, double total, double *v) void Fix::v_tally(int i, double *v) { - if (vflag_global) { virial[0] += v[0]; virial[1] += v[1]; @@ -384,7 +383,6 @@ void Fix::v_tally(int i, double *v) void Fix::v_tally(int n, int i, double vn) { - if (vflag_global) virial[n] += vn; diff --git a/src/fix_group.cpp b/src/fix_group.cpp index fe2495d6c0..51abebdf29 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -33,7 +33,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), idvar(NULL) +idregion(NULL), idvar(NULL), idprop(NULL) { // dgroupbit = bitmask of dynamic group // group ID is last part of fix ID @@ -49,6 +49,7 @@ idregion(NULL), idvar(NULL) regionflag = 0; varflag = 0; + propflag = 0; nevery = 1; int iarg = 3; @@ -73,7 +74,17 @@ idregion(NULL), idvar(NULL) idvar = new char[n]; strcpy(idvar,arg[iarg+1]); iarg += 2; - } else if (strcmp(arg[iarg],"every") == 0) { + } else if (strcmp(arg[iarg],"property") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); + if (atom->find_custom(arg[iarg+1],typeflag) < 0) + error->all(FLERR,"Per atom property for group dynamic does not exist"); + propflag = 1; + delete [] idprop; + int n = strlen(arg[iarg+1]) + 1; + idprop = new char[n]; + strcpy(idprop,arg[iarg+1]); + iarg += 2; + } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); nevery = force->inumeric(FLERR,arg[iarg+1]); if (nevery <= 0) error->all(FLERR,"Illegal group command"); @@ -88,6 +99,7 @@ FixGroup::~FixGroup() { delete [] idregion; delete [] idvar; + delete [] idprop; } /* ---------------------------------------------------------------------- */ @@ -130,6 +142,12 @@ void FixGroup::init() error->all(FLERR,"Variable for group dynamic is invalid style"); } + if (propflag) { + iprop = atom->find_custom(idprop,typeflag); + if (iprop < 0) + error->all(FLERR,"Per-atom property for group dynamic does not exist"); + } + // warn if any FixGroup is not at tail end of all post_integrate fixes Fix **fix = modify->fix; @@ -188,6 +206,9 @@ void FixGroup::set_group() // invoke atom-style variable if defined double *var = NULL; + int *ivector = NULL; + double *dvector = NULL; + if (varflag) { modify->clearstep_compute(); @@ -196,6 +217,12 @@ void FixGroup::set_group() modify->addstep_compute(update->ntimestep + nevery); } + // invoke per-atom property if defined + + if (propflag && !typeflag) ivector = atom->ivector[iprop]; //check nlocal > 0? + + if (propflag && typeflag) dvector = atom->dvector[iprop]; //check nlocal > 0? + // update region in case it has a variable dependence or is dynamic if (regionflag) region->prematch(); @@ -214,6 +241,8 @@ void FixGroup::set_group() inflag = 1; if (regionflag && !region->match(x[i][0],x[i][1],x[i][2])) inflag = 0; if (varflag && var[i] == 0.0) inflag = 0; + if (propflag && !typeflag && ivector[i] == 0) inflag = 0; + if (propflag && typeflag && dvector[i] == 0) inflag = 0; } else inflag = 0; if (inflag) mask[i] |= gbit; diff --git a/src/fix_group.h b/src/fix_group.h index 6ed842578d..662325492b 100644 --- a/src/fix_group.h +++ b/src/fix_group.h @@ -36,9 +36,9 @@ class FixGroup : public Fix { private: int gbit,gbitinverse; - int regionflag,varflag; - int iregion,ivar; - char *idregion,*idvar; + int regionflag,varflag,propflag,typeflag; + int iregion,ivar,iprop; + char *idregion,*idvar,*idprop; class Region *region; int nlevels_respa; diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 966fcfbb09..6f85d107f1 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -38,6 +38,7 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; global_freq = 1; extscalar = 1; + dynamic_group_allow = 1; xlimit = force->numeric(FLERR,arg[3]); diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index fe52a31788..52e2da7b3d 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -48,6 +48,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; global_freq = nevery; extscalar = 1; + dynamic_group_allow = 1; tstr = NULL; if (strstr(arg[4],"v_") == arg[4]) { diff --git a/src/fix_wall_harmonic.cpp b/src/fix_wall_harmonic.cpp index f91295d469..20d5dbebd4 100644 --- a/src/fix_wall_harmonic.cpp +++ b/src/fix_wall_harmonic.cpp @@ -22,7 +22,10 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixWallHarmonic::FixWallHarmonic(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) {} + FixWall(lmp, narg, arg) +{ + dynamic_group_allow = 1; +} /* ---------------------------------------------------------------------- interaction of all particles in group with a wall diff --git a/src/fix_wall_lj1043.cpp b/src/fix_wall_lj1043.cpp index e8e706ed5e..064a5a8d60 100644 --- a/src/fix_wall_lj1043.cpp +++ b/src/fix_wall_lj1043.cpp @@ -26,7 +26,10 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixWallLJ1043::FixWallLJ1043(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) {} + FixWall(lmp, narg, arg) +{ + dynamic_group_allow = 1; +} /* ---------------------------------------------------------------------- */ diff --git a/src/fix_wall_lj126.cpp b/src/fix_wall_lj126.cpp index 22199fed5b..f556952ab3 100644 --- a/src/fix_wall_lj126.cpp +++ b/src/fix_wall_lj126.cpp @@ -22,7 +22,10 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixWallLJ126::FixWallLJ126(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) {} + FixWall(lmp, narg, arg) +{ + dynamic_group_allow = 1; +} /* ---------------------------------------------------------------------- */ diff --git a/src/fix_wall_lj93.cpp b/src/fix_wall_lj93.cpp index 281a1fafc4..f5d6a7e147 100644 --- a/src/fix_wall_lj93.cpp +++ b/src/fix_wall_lj93.cpp @@ -22,7 +22,10 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixWallLJ93::FixWallLJ93(LAMMPS *lmp, int narg, char **arg) : - FixWall(lmp, narg, arg) {} + FixWall(lmp, narg, arg) +{ + dynamic_group_allow = 1; +} /* ---------------------------------------------------------------------- */ diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index dba7cf7036..86607dbe8e 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -39,6 +39,8 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : { if (narg < 4) error->all(FLERR,"Illegal fix wall/reflect command"); + dynamic_group_allow = 1; + // parse args nwall = 0; diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index 1d22e6141b..67b0bcd713 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -67,6 +67,8 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[4],"harmonic") == 0) style = HARMONIC; else error->all(FLERR,"Illegal fix wall/region command"); + if (style != COLLOID) dynamic_group_allow = 1; + epsilon = force->numeric(FLERR,arg[5]); sigma = force->numeric(FLERR,arg[6]); cutoff = force->numeric(FLERR,arg[7]); diff --git a/src/group.cpp b/src/group.cpp index 76275f301d..93c9c12bcf 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -188,6 +188,12 @@ void Group::assign(int narg, char **arg) if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) mask[i] |= bit; + // create an empty group + + } else if (strcmp(arg[1],"empty") == 0) { + + ; // nothing to do here + // style = type, molecule, id // add to group if atom matches type/molecule/id or condition diff --git a/src/integrate.h b/src/integrate.h index 4ca3a788fa..9a50fad1f7 100644 --- a/src/integrate.h +++ b/src/integrate.h @@ -23,7 +23,7 @@ class Integrate : protected Pointers { Integrate(class LAMMPS *, int, char **); virtual ~Integrate(); virtual void init(); - virtual void setup(int flag=1) = 0; + virtual void setup(int flag) = 0; virtual void setup_minimal(int) = 0; virtual void run(int) = 0; virtual void cleanup() {} diff --git a/src/kspace.cpp b/src/kspace.cpp index c2113cdf76..07e117e162 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -315,10 +315,10 @@ double KSpace::estimate_table_accuracy(double q2_over_sqrt, double spr) if (comm->me == 0) { char str[128]; if (nctb) - sprintf(str,"Using %d-bit tables for long-range coulomb",nctb); + sprintf(str," using %d-bit tables for long-range coulomb",nctb); else - sprintf(str,"Using polynomial approximation for long-range coulomb"); - error->warning(FLERR,str); + sprintf(str," using polynomial approximation for long-range coulomb"); + error->message(FLERR,str); } if (nctb) { diff --git a/src/library.cpp b/src/library.cpp index 8f87d6fab2..233bb3122c 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -203,7 +203,10 @@ void lammps_file(void *ptr, char *str) BEGIN_CAPTURE { - lmp->input->file(str); + if (lmp->update->whichflag != 0) + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + else + lmp->input->file(str); } END_CAPTURE } @@ -221,7 +224,10 @@ char *lammps_command(void *ptr, char *str) BEGIN_CAPTURE { - result = lmp->input->one(str); + if (lmp->update->whichflag != 0) + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + else + result = lmp->input->one(str); } END_CAPTURE @@ -278,6 +284,10 @@ void lammps_commands_string(void *ptr, char *str) BEGIN_CAPTURE { + if (lmp->update->whichflag != 0) { + lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + } + char *ptr = copy; for (int i=0; i < n-1; ++i) { diff --git a/src/min.cpp b/src/min.cpp index 653cac71e6..0caa9a9acf 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -245,7 +245,7 @@ void Min::setup(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; @@ -345,7 +345,7 @@ void Min::setup_minimal(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; } @@ -508,7 +508,7 @@ double Min::energy_force(int resetflag) modify->min_pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); if (modify->n_min_post_neighbor) { modify->min_post_neighbor(); diff --git a/src/molecule.cpp b/src/molecule.cpp index b93cf24e7e..78dc4b82b3 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -144,17 +144,17 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : if (me == 0) { if (screen) fprintf(screen,"Read molecule %s:\n" - " %d atoms with %d types\n %d bonds with %d types\n" - " %d angles with %d types\n %d dihedrals with %d types\n" - " %d impropers with %d types\n", + " %d atoms with max type %d\n %d bonds with max type %d\n" + " %d angles with max type %d\n %d dihedrals with max type %d\n" + " %d impropers with max type %d\n", id,natoms,ntypes, nbonds,nbondtypes,nangles,nangletypes, ndihedrals,ndihedraltypes,nimpropers,nimpropertypes); if (logfile) fprintf(logfile,"Read molecule %s:\n" - " %d atoms with %d types\n %d bonds with %d types\n" - " %d angles with %d types\n %d dihedrals with %d types\n" - " %d impropers with %d types\n", + " %d atoms with max type %d\n %d bonds with max type %d\n" + " %d angles with max type %d\n %d dihedrals with max type %d\n" + " %d impropers with max type %d\n", id,natoms,ntypes, nbonds,nbondtypes,nangles,nangletypes, ndihedrals,ndihedraltypes,nimpropers,nimpropertypes); diff --git a/src/neighbor.h b/src/neighbor.h index 9244bc575d..c054cddb2b 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -111,7 +111,7 @@ class Neighbor : protected Pointers { int decide(); // decide whether to build or not virtual int check_distance(); // check max distance moved since last build void setup_bins(); // setup bins based on box and cutoff - virtual void build(int topoflag=1); // build all perpetual neighbor lists + virtual void build(int); // build all perpetual neighbor lists virtual void build_topology(); // pairwise topology neighbor lists void build_one(class NeighList *list, int preflag=0); // create a one-time pairwise neigh list diff --git a/src/npair_half_size_bin_newtoff.cpp b/src/npair_half_size_bin_newtoff.cpp index cf608b5d59..d575f3eb1f 100644 --- a/src/npair_half_size_bin_newtoff.cpp +++ b/src/npair_half_size_bin_newtoff.cpp @@ -36,14 +36,13 @@ NPairHalfSizeBinNewtoff::NPairHalfSizeBinNewtoff(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeBinNewtoff::build(NeighList *list) { - int i,j,k,m,n,nn,ibin; + int i,j,k,n,ibin; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/npair_half_size_bin_newton.cpp b/src/npair_half_size_bin_newton.cpp index 662bf91d6e..da29cb2029 100644 --- a/src/npair_half_size_bin_newton.cpp +++ b/src/npair_half_size_bin_newton.cpp @@ -35,14 +35,13 @@ NPairHalfSizeBinNewton::NPairHalfSizeBinNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeBinNewton::build(NeighList *list) { - int i,j,k,m,n,nn,ibin; + int i,j,k,n,ibin; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/npair_half_size_bin_newton_tri.cpp b/src/npair_half_size_bin_newton_tri.cpp index e70c072280..044847ba8c 100644 --- a/src/npair_half_size_bin_newton_tri.cpp +++ b/src/npair_half_size_bin_newton_tri.cpp @@ -36,14 +36,13 @@ NPairHalfSizeBinNewtonTri::NPairHalfSizeBinNewtonTri(LAMMPS *lmp) : void NPairHalfSizeBinNewtonTri::build(NeighList *list) { - int i,j,k,m,n,nn,ibin; + int i,j,k,n,ibin; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/npair_half_size_nsq_newtoff.cpp b/src/npair_half_size_nsq_newtoff.cpp index e6f5cba657..50a32c87ba 100644 --- a/src/npair_half_size_nsq_newtoff.cpp +++ b/src/npair_half_size_nsq_newtoff.cpp @@ -36,14 +36,13 @@ NPairHalfSizeNsqNewtoff::NPairHalfSizeNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewtoff::build(NeighList *list) { - int i,j,m,n,nn,bitmask; + int i,j,n,bitmask; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; double **x = atom->x; double *radius = atom->radius; - tagint *tag = atom->tag; int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; diff --git a/src/npair_half_size_nsq_newton.cpp b/src/npair_half_size_nsq_newton.cpp index 78811170cb..343172fb98 100644 --- a/src/npair_half_size_nsq_newton.cpp +++ b/src/npair_half_size_nsq_newton.cpp @@ -37,7 +37,7 @@ NPairHalfSizeNsqNewton::NPairHalfSizeNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewton::build(NeighList *list) { - int i,j,m,n,nn,itag,jtag,bitmask; + int i,j,n,itag,jtag,bitmask; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; diff --git a/src/npair_skip_size.cpp b/src/npair_skip_size.cpp index 075387f5b0..b75856dde4 100644 --- a/src/npair_skip_size.cpp +++ b/src/npair_skip_size.cpp @@ -33,14 +33,10 @@ NPairSkipSize::NPairSkipSize(LAMMPS *lmp) : NPair(lmp) {} void NPairSkipSize::build(NeighList *list) { - int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,dnum,dnumbytes; - tagint jtag; + int i,j,ii,jj,n,itype,jnum,joriginal; int *neighptr,*jlist; - tagint *tag = atom->tag; int *type = atom->type; - int nlocal = atom->nlocal; - int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; diff --git a/src/npair_skip_size_off2on.cpp b/src/npair_skip_size_off2on.cpp index 92eae285d0..8d728a3c0a 100644 --- a/src/npair_skip_size_off2on.cpp +++ b/src/npair_skip_size_off2on.cpp @@ -34,7 +34,7 @@ NPairSkipSizeOff2on::NPairSkipSizeOff2on(LAMMPS *lmp) : NPair(lmp) {} void NPairSkipSizeOff2on::build(NeighList *list) { - int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,dnum,dnumbytes; + int i,j,ii,jj,n,itype,jnum,joriginal; tagint itag,jtag; int *neighptr,*jlist; diff --git a/src/npair_skip_size_off2on_oneside.cpp b/src/npair_skip_size_off2on_oneside.cpp index f2fca7b128..a04fc7782c 100644 --- a/src/npair_skip_size_off2on_oneside.cpp +++ b/src/npair_skip_size_off2on_oneside.cpp @@ -37,11 +37,9 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) : void NPairSkipSizeOff2onOneside::build(NeighList *list) { - int i,j,ii,jj,m,n,nn,itype,jnum,joriginal,flip,dnum,dnumbytes,tmp; - tagint jtag; + int i,j,ii,jj,n,itype,jnum,joriginal,flip,tmp; int *surf,*jlist; - tagint *tag = atom->tag; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp new file mode 100644 index 0000000000..1527180eac --- /dev/null +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -0,0 +1,447 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Vishal Boddu (FAU) +------------------------------------------------------------------------- */ + +#include +#include +#include +#include +#include "pair_lj_cut_coul_wolf.h" +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "neighbor.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "update.h" +#include "integrate.h" +#include "math_const.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace MathConst; + +/* ---------------------------------------------------------------------- */ + +PairLJCutCoulWolf::PairLJCutCoulWolf(LAMMPS *lmp) : Pair(lmp) +{ + single_enable = 0; + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairLJCutCoulWolf::~PairLJCutCoulWolf() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(cut_lj); + memory->destroy(cut_ljsq); + memory->destroy(epsilon); + memory->destroy(sigma); + memory->destroy(lj1); + memory->destroy(lj2); + memory->destroy(lj3); + memory->destroy(lj4); + memory->destroy(offset); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::compute(int eflag, int vflag) +{ + int i,j,ii,jj,inum,jnum,itype,jtype; + double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; + double rsq,r2inv,r6inv,forcelj,factor_lj,forcecoul,factor_coul; + double prefactor; + double r; + int *ilist,*jlist,*numneigh,**firstneigh; + double erfcc,erfcd,v_sh,dvdrr,e_self,e_shift,f_shift,qisq; + + evdwl = 0.0; + ecoul = 0.0; + if (eflag || vflag) ev_setup(eflag,vflag); + else evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **f = atom->f; + double *q = atom->q; + int *type = atom->type; + int nlocal = atom->nlocal; + double *special_lj = force->special_lj; + double *special_coul = force->special_coul; + int newton_pair = force->newton_pair; + double qqrd2e = force->qqrd2e; + + // self and shifted Coulombic energy + + e_self = v_sh = 0.0; + e_shift = erfc(alf*cut_coul)/cut_coul; + f_shift = -(e_shift+ 2.0*alf/MY_PIS + * exp(-alf*alf*cut_coul*cut_coul)) / cut_coul; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + qtmp = q[i]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + qisq = qtmp*qtmp; + e_self = -(e_shift/2.0 + alf/MY_PIS) * qisq*qqrd2e; + if (eflag) ev_tally(i,i,nlocal,0,0.0,e_self,0.0,0.0,0.0,0.0); + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r2inv = 1.0/rsq; + + if (rsq < cut_coulsq) { + r = sqrt(rsq); + prefactor = qqrd2e*qtmp*q[j]/r; + erfcc = erfc(alf*r); + erfcd = exp(-alf*alf*r*r); + v_sh = (erfcc - e_shift*r) * prefactor; + dvdrr = (erfcc/rsq + 2.0*alf/MY_PIS * erfcd/r) + f_shift; + forcecoul = dvdrr*rsq*prefactor; + if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; + } else forcecoul = 0.0; + + if (rsq < cut_ljsq[itype][jtype]) { + r6inv = r2inv*r2inv*r2inv; + forcelj = r6inv * (lj1[itype][jtype]*r6inv - lj2[itype][jtype]); + } else forcelj = 0.0; + + fpair = (forcecoul + factor_lj*forcelj) * r2inv; + + f[i][0] += delx*fpair; + f[i][1] += dely*fpair; + f[i][2] += delz*fpair; + if (newton_pair || j < nlocal) { + f[j][0] -= delx*fpair; + f[j][1] -= dely*fpair; + f[j][2] -= delz*fpair; + } + + if (eflag) { + if (rsq < cut_ljsq[itype][jtype]) { + evdwl = r6inv*(lj3[itype][jtype]*r6inv-lj4[itype][jtype]) - + offset[itype][jtype]; + evdwl *= factor_lj; + } else evdwl = 0.0; + + if (rsq < cut_coulsq) { + ecoul = v_sh; + if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; + } else ecoul = 0.0; + } + + if (evflag) ev_tally(i,j,nlocal,newton_pair, + evdwl,ecoul,fpair,delx,dely,delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::allocate() +{ + allocated = 1; + int n = atom->ntypes; + + memory->create(setflag,n+1,n+1,"pair:setflag"); + for (int i = 1; i <= n; i++) + for (int j = i; j <= n; j++) + setflag[i][j] = 0; + + memory->create(cutsq,n+1,n+1,"pair:cutsq"); + memory->create(cut_lj,n+1,n+1,"pair:cut"); + memory->create(cut_ljsq,n+1,n+1,"pair:cut_ljsq"); + memory->create(epsilon,n+1,n+1,"pair:epsilon"); + memory->create(sigma,n+1,n+1,"pair:sigma"); + memory->create(lj1,n+1,n+1,"pair:lj1"); + memory->create(lj2,n+1,n+1,"pair:lj2"); + memory->create(lj3,n+1,n+1,"pair:lj3"); + memory->create(lj4,n+1,n+1,"pair:lj4"); + memory->create(offset,n+1,n+1,"pair:offset"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::settings(int narg, char **arg) +{ + if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); + + alf = force->numeric(FLERR,arg[0]); + cut_lj_global = force->numeric(FLERR,arg[1]); + if (narg == 2) cut_coul = cut_lj_global; + + if (allocated) { + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) + if (setflag[i][j]) cut_lj[i][j] = cut_lj_global; + } +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::coeff(int narg, char **arg) +{ + if (narg < 4 || narg > 5) + error->all(FLERR,"Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo,ihi,jlo,jhi; + force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + + double epsilon_one = force->numeric(FLERR,arg[2]); + double sigma_one = force->numeric(FLERR,arg[3]); + + double cut_lj_one = cut_lj_global; + if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo,i); j <= jhi; j++) { + epsilon[i][j] = epsilon_one; + sigma[i][j] = sigma_one; + cut_lj[i][j] = cut_lj_one; + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::init_style() +{ + if (!atom->q_flag) + error->all(FLERR,"Pair style lj/cut/coul/wolf requires atom attribute q"); + + cut_coulsq = cut_coul * cut_coul; + + // request regular or rRESPA neighbor list + + int irequest; + irequest = neighbor->request(this,instance_me); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairLJCutCoulWolf::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + epsilon[i][j] = mix_energy(epsilon[i][i],epsilon[j][j], + sigma[i][i],sigma[j][j]); + sigma[i][j] = mix_distance(sigma[i][i],sigma[j][j]); + cut_lj[i][j] = mix_distance(cut_lj[i][i],cut_lj[j][j]); + } + + double cut = MAX(cut_lj[i][j],cut_coul); + cut_ljsq[i][j] = cut_lj[i][j] * cut_lj[i][j]; + + lj1[i][j] = 48.0 * epsilon[i][j] * pow(sigma[i][j],12.0); + lj2[i][j] = 24.0 * epsilon[i][j] * pow(sigma[i][j],6.0); + lj3[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],12.0); + lj4[i][j] = 4.0 * epsilon[i][j] * pow(sigma[i][j],6.0); + + if (offset_flag && (cut_lj[i][j] > 0.0)) { + double ratio = sigma[i][j] / cut_lj[i][j]; + offset[i][j] = 4.0 * epsilon[i][j] * (pow(ratio,12.0) - pow(ratio,6.0)); + } else offset[i][j] = 0.0; + + lj1[j][i] = lj1[i][j]; + lj2[j][i] = lj2[i][j]; + lj3[j][i] = lj3[i][j]; + lj4[j][i] = lj4[i][j]; + offset[j][i] = offset[i][j]; + + // compute I,J contribution to long-range tail correction + // count total # of atoms of type I and J via Allreduce + + if (tail_flag) { + int *type = atom->type; + int nlocal = atom->nlocal; + + double count[2],all[2]; + count[0] = count[1] = 0.0; + for (int k = 0; k < nlocal; k++) { + if (type[k] == i) count[0] += 1.0; + if (type[k] == j) count[1] += 1.0; + } + MPI_Allreduce(count,all,2,MPI_DOUBLE,MPI_SUM,world); + + double sig2 = sigma[i][j]*sigma[i][j]; + double sig6 = sig2*sig2*sig2; + double rc3 = cut_lj[i][j]*cut_lj[i][j]*cut_lj[i][j]; + double rc6 = rc3*rc3; + double rc9 = rc3*rc6; + etail_ij = 8.0*MY_PI*all[0]*all[1]*epsilon[i][j] * + sig6 * (sig6 - 3.0*rc6) / (9.0*rc9); + ptail_ij = 16.0*MY_PI*all[0]*all[1]*epsilon[i][j] * + sig6 * (2.0*sig6 - 3.0*rc6) / (9.0*rc9); + } + + return cut; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i,j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j],sizeof(int),1,fp); + if (setflag[i][j]) { + fwrite(&epsilon[i][j],sizeof(double),1,fp); + fwrite(&sigma[i][j],sizeof(double),1,fp); + fwrite(&cut_lj[i][j],sizeof(double),1,fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i,j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); + if (setflag[i][j]) { + if (me == 0) { + fread(&epsilon[i][j],sizeof(double),1,fp); + fread(&sigma[i][j],sizeof(double),1,fp); + fread(&cut_lj[i][j],sizeof(double),1,fp); + } + MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_lj[i][j],1,MPI_DOUBLE,0,world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::write_restart_settings(FILE *fp) +{ + fwrite(&alf,sizeof(double),1,fp); + fwrite(&cut_lj_global,sizeof(double),1,fp); + fwrite(&cut_coul,sizeof(double),1,fp); + fwrite(&offset_flag,sizeof(int),1,fp); + fwrite(&mix_flag,sizeof(int),1,fp); + fwrite(&tail_flag,sizeof(int),1,fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::read_restart_settings(FILE *fp) +{ + int me = comm->me; + if (me == 0) { + fread(&alf,sizeof(double),1,fp); + fread(&cut_lj_global,sizeof(double),1,fp); + fread(&cut_coul,sizeof(double),1,fp); + fread(&offset_flag,sizeof(int),1,fp); + fread(&mix_flag,sizeof(int),1,fp); + fread(&tail_flag,sizeof(int),1,fp); + } + MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); + MPI_Bcast(&offset_flag,1,MPI_INT,0,world); + MPI_Bcast(&mix_flag,1,MPI_INT,0,world); + MPI_Bcast(&tail_flag,1,MPI_INT,0,world); +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp,"%d %g %g\n",i,epsilon[i][i],sigma[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairLJCutCoulWolf::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp,"%d %d %g %g %g\n",i,j,epsilon[i][j],sigma[i][j],cut_lj[i][j]); +} diff --git a/src/pair_lj_cut_coul_wolf.h b/src/pair_lj_cut_coul_wolf.h new file mode 100644 index 0000000000..aa4e08f9b7 --- /dev/null +++ b/src/pair_lj_cut_coul_wolf.h @@ -0,0 +1,70 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef PAIR_CLASS + +PairStyle(lj/cut/coul/wolf,PairLJCutCoulWolf) + +#else + +#ifndef LMP_PAIR_LJ_CUT_COUL_WOLF_H +#define LMP_PAIR_LJ_CUT_COUL_WOLF_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairLJCutCoulWolf : public Pair { + public: + PairLJCutCoulWolf(class LAMMPS *); + virtual ~PairLJCutCoulWolf(); + virtual void compute(int, int); + void settings(int, char **); + void coeff(int, char **); + void init_style(); + double init_one(int, int); + void write_restart(FILE *); + void read_restart(FILE *); + void write_restart_settings(FILE *); + void read_restart_settings(FILE *); + void write_data(FILE *); + void write_data_all(FILE *); + + protected: + double cut_lj_global; + double **cut_lj,**cut_ljsq; + double **epsilon,**sigma; + double **lj1,**lj2,**lj3,**lj4,**offset; + double cut_coul,cut_coulsq,alf; + + virtual void allocate(); +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Incorrect args for pair coefficients + +Self-explanatory. Check the input script or data file. + +*/ diff --git a/src/read_data.cpp b/src/read_data.cpp index b1a42608c0..3b93098a6e 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -124,7 +124,7 @@ void ReadData::command(int narg, char **arg) addflag = NONE; coeffflag = 1; - id_offset = 0; + id_offset = mol_offset = 0; offsetflag = shiftflag = 0; toffset = boffset = aoffset = doffset = ioffset = 0; shift[0] = shift[1] = shift[2] = 0.0; @@ -145,11 +145,21 @@ void ReadData::command(int narg, char **arg) if (strcmp(arg[iarg+1],"append") == 0) addflag = APPEND; else if (strcmp(arg[iarg+1],"merge") == 0) addflag = MERGE; else { + if (atom->molecule_flag && (iarg+3 > narg)) + error->all(FLERR,"Illegal read_data command"); addflag = VALUE; bigint offset = force->bnumeric(FLERR,arg[iarg+1]); if (offset > MAXTAGINT) - error->all(FLERR,"Read data add offset is too big"); + error->all(FLERR,"Read data add atomID offset is too big"); id_offset = offset; + + if (atom->molecule_flag) { + offset = force->bnumeric(FLERR,arg[iarg+2]); + if (offset > MAXTAGINT) + error->all(FLERR,"Read data add molID offset is too big"); + mol_offset = offset; + iarg++; + } } iarg += 2; } else if (strcmp(arg[iarg],"offset") == 0) { @@ -310,14 +320,18 @@ void ReadData::command(int narg, char **arg) update->ntimestep = 0; } - // compute atomID offset for addflag = MERGE + // compute atomID and optionally moleculeID offset for addflag = APPEND if (addflag == APPEND) { tagint *tag = atom->tag; + tagint *molecule = atom->molecule; int nlocal = atom->nlocal; - tagint max = 0; - for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); - MPI_Allreduce(&max,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world); + tagint maxid = 0, maxmol = 0; + for (int i = 0; i < nlocal; i++) maxid = MAX(maxid,tag[i]); + if (atom->molecule_flag) + for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); + MPI_Allreduce(&maxid,&id_offset,1,MPI_LMP_TAGINT,MPI_MAX,world); + MPI_Allreduce(&maxmol,&mol_offset,1,MPI_LMP_TAGINT,MPI_MAX,world); } // set up pointer to hold original styles while we replace them with "zero" @@ -1137,7 +1151,7 @@ void ReadData::atoms() nchunk = MIN(natoms-nread,CHUNK); eof = comm->read_lines_from_file(fp,nchunk,MAXLINE,buffer); if (eof) error->all(FLERR,"Unexpected end of data file"); - atom->data_atoms(nchunk,buffer,id_offset,toffset,shiftflag,shift); + atom->data_atoms(nchunk,buffer,id_offset,mol_offset,toffset,shiftflag,shift); nread += nchunk; } diff --git a/src/read_data.h b/src/read_data.h index 730229c722..b85ed67dcd 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -39,7 +39,7 @@ class ReadData : protected Pointers { int narg,maxarg; char argoffset1[8],argoffset2[8]; - bigint id_offset; + bigint id_offset, mol_offset; int nlocal_previous; bigint natoms; diff --git a/src/respa.cpp b/src/respa.cpp index 23cd941834..18630c06d6 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -441,7 +441,7 @@ void Respa::setup(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; @@ -517,7 +517,7 @@ void Respa::setup_minimal(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; } @@ -668,7 +668,7 @@ void Respa::recurse(int ilevel) modify->pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); if (modify->n_post_neighbor) { modify->post_neighbor(); diff --git a/src/respa.h b/src/respa.h index 0b08b12bd7..f910f0c666 100644 --- a/src/respa.h +++ b/src/respa.h @@ -48,7 +48,7 @@ class Respa : public Integrate { Respa(class LAMMPS *, int, char **); virtual ~Respa(); virtual void init(); - virtual void setup(int flag=1); + virtual void setup(int); virtual void setup_minimal(int); virtual void run(int); virtual void cleanup(); diff --git a/src/run.cpp b/src/run.cpp index 3317545342..37af977e34 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -175,7 +175,7 @@ void Run::command(int narg, char **arg) if (preflag || update->first_update == 0) { lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); } else output->setup(0); timer->init(); @@ -216,7 +216,7 @@ void Run::command(int narg, char **arg) if (preflag || iter == 0) { lmp->init(); - update->integrate->setup(); + update->integrate->setup(1); } else output->setup(0); timer->init(); diff --git a/src/verlet.cpp b/src/verlet.cpp index d74906556b..019f3f2f05 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -120,7 +120,7 @@ void Verlet::setup(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; @@ -182,7 +182,7 @@ void Verlet::setup_minimal(int flag) domain->image_check(); domain->box_too_small_check(); modify->setup_pre_neighbor(); - neighbor->build(); + neighbor->build(1); modify->setup_post_neighbor(); neighbor->ncalls = 0; } @@ -284,7 +284,7 @@ void Verlet::run(int n) modify->pre_neighbor(); timer->stamp(Timer::MODIFY); } - neighbor->build(); + neighbor->build(1); timer->stamp(Timer::NEIGH); if (n_post_neighbor) { modify->post_neighbor(); diff --git a/src/verlet.h b/src/verlet.h index 29bd3f16b3..e71932a861 100644 --- a/src/verlet.h +++ b/src/verlet.h @@ -29,7 +29,7 @@ class Verlet : public Integrate { Verlet(class LAMMPS *, int, char **); virtual ~Verlet() {} virtual void init(); - virtual void setup(int flag=1); + virtual void setup(int flag); virtual void setup_minimal(int); virtual void run(int); void cleanup(); diff --git a/src/version.h b/src/version.h index f544f0203c..8342aa8ef1 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "17 Jan 2018" +#define LAMMPS_VERSION "22 Feb 2018" diff --git a/src/write_data.cpp b/src/write_data.cpp index bf00249e51..7c8838628e 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -243,11 +243,11 @@ void WriteData::header() fprintf(fp,"%d angle types\n",atom->nangletypes); } if (atom->ndihedrals || atom->ndihedraltypes) { - fprintf(fp,BIGINT_FORMAT " dihedrals\n",atom->ndihedrals); + fprintf(fp,BIGINT_FORMAT " dihedrals\n",ndihedrals); fprintf(fp,"%d dihedral types\n",atom->ndihedraltypes); } if (atom->nimpropers || atom->nimpropertypes) { - fprintf(fp,BIGINT_FORMAT " impropers\n",atom->nimpropers); + fprintf(fp,BIGINT_FORMAT " impropers\n",nimpropers); fprintf(fp,"%d improper types\n",atom->nimpropertypes); } } diff --git a/tools/msi2lmp/src/ReadCarFile.c b/tools/msi2lmp/src/ReadCarFile.c index 73209bc994..c6db96cf92 100644 --- a/tools/msi2lmp/src/ReadCarFile.c +++ b/tools/msi2lmp/src/ReadCarFile.c @@ -73,7 +73,6 @@ void ReadCarFile(void) int skip; /* lines to skip at beginning of file */ double lowest, highest; /* temp coordinate finding variables */ double total_q; - double sq_c; double cos_alpha; /* Added by SLTM Sept 13, 2010 */ double cos_gamma; double sin_gamma; @@ -261,7 +260,7 @@ void ReadCarFile(void) box[2][k] = 0.0; } } else { - sq_c = pbc[2]*pbc[2]; + double ly,lz; cos_alpha = cos(pbc[3]*PI_180); cos_gamma = cos(pbc[5]*PI_180); sin_gamma = sin(pbc[5]*PI_180); @@ -275,16 +274,23 @@ void ReadCarFile(void) B = pbc[1]; C = pbc[2]; + /* compute xy, xz, and yz */ + box[2][0] = B * cos_gamma; + box[2][1] = C * cos_beta; + if (fabs(sin_gamma) > 0.0001) + box[2][2] = C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma; + else box[2][2] = 0.0; box[0][0] = -0.5*A + center[0] + shift[0]; box[1][0] = 0.5*A + center[0] + shift[0]; - box[0][1] = -0.5*B*sin_gamma + center[1] + shift[1]; - box[1][1] = 0.5*B*sin_gamma + center[1] + shift[1]; - box[0][2] = -0.5*sqrt(sq_c * sin_beta*sin_beta - C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma) + center[2] + shift[2]; - box[1][2] = 0.5*sqrt(sq_c * sin_beta*sin_beta - C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma) + center[2] + shift[2]; - box[2][0] = B * cos_gamma; /* This is xy SLTM */ - box[2][1] = C * cos_beta; /* This is xz SLTM */ - box[2][2] = C*(cos_alpha-cos_gamma*cos_beta)/sin_gamma; /* This is yz SLTM */ + + /* compute adjusted box length for y and z and apply */ + ly = sqrt(B*B - box[2][0]*box[2][0]); + lz = sqrt(C*C - box[2][1]*box[2][1] - box[2][2]*box[2][2]); + box[0][1] = -0.5*ly + center[1] + shift[1]; + box[1][1] = 0.5*ly + center[1] + shift[1]; + box[0][2] = -0.5*lz + center[2] + shift[2]; + box[1][2] = 0.5*lz + center[2] + shift[2]; } } diff --git a/tools/msi2lmp/src/msi2lmp.c b/tools/msi2lmp/src/msi2lmp.c index 15cfddd258..b0bc7815ba 100644 --- a/tools/msi2lmp/src/msi2lmp.c +++ b/tools/msi2lmp/src/msi2lmp.c @@ -273,7 +273,7 @@ int main (int argc, char *argv[]) shift[2] = atof(argv[++n]); } else if (strncmp(argv[n],"-i",2) == 0 ) { iflag = 1; - } else if (strncmp(argv[n],"-n",4) == 0 ) { + } else if (strncmp(argv[n],"-n",2) == 0 ) { centerflag = 0; } else if (strncmp(argv[n],"-o",2) == 0 ) { hintflag = 0; diff --git a/tools/pymol_asphere/src/error.cpp b/tools/pymol_asphere/src/error.cpp index 0bbd090566..9491ca04a4 100644 --- a/tools/pymol_asphere/src/error.cpp +++ b/tools/pymol_asphere/src/error.cpp @@ -13,7 +13,8 @@ #include "error.h" #include - +#include + Notice::Notice() { nullout=new ostream(NULL); noteout=&cout;