Code Monkey home page Code Monkey logo

lammps-user-conp2's Introduction

LAMMPS-USER-CONP2

The updated constant potential plugin for LAMMPS

Summary

The USER-CONP2 package allows users to perform LAMMPS MD simulations with constant potential electrodes. It updates the original LAMMPS-CONP (https://github.com/zhenxingwang/lammps-conp) with the following improvements and optimizations:

  1. Overall electroneutrality enforced via projection matrix precomputation
  2. New PPPM KSpace styles and CONP interfaces, including with the Intel package
  3. Smart neighborlisting and newton on compatibility
  4. Extensive vectorization speedups in the old Ewald KSpace code

This is version 1.1 of the code. Upgrade priorities for version 1.2 are listed throughout this document in boldface; I welcome all feature suggestions!

If you are reading this, you probably know that you need a custom compiled LAMMPS to use this plugin -- see below for instructions.

Citing this plugin

If you have used this plugin, please use one or both of the following citations as suitable:

  1. https://doi.org/10.48610/6b1122a The University of Queensland eSpace digital repository DOI for this source code
  2. https://aip.scitation.org/doi/10.1063/5.0086986 Our just accepted manuscript describing electroneutrality and fully periodic techniques (ffield / noslab zneutr)

Known issues

Fix conp used to crash without an error message if electrolyte particle IDs were non-contiguous (e.g. after a delete_atoms command). I believe this has been fixed but have not personally verified this. For now, any such crashes may be remedied by a suitable reset_atom_ids command.

The PPPM flag causes weird things to happen in Poiseuille-flow-type simulations. Omitting that flag works fine (albeit with much lower performance). Repairing this is a priority issue.

Usage instructions

The fix command is considerably simpler than in the previous version:

fix [ID] [group1] conp [Nevery] [group2] [η] [DV] [Log] [optional keyword1] [optional value1] ...
fix [ID] [group1] conq [Nevery] [group2] [η] [QR] [Log] [optional keyword1] [optional value1] ...

ID = ID of FIX command

group1 = Group for 'left' electrode

Nevery = Update charge every this many steps

group2 = Group for 'right' electrode

η = Gaussian width parameter in angstrom-1. Usually this is 1.979 in earlier literature. Validating this is an active project.

DV: fix conp will set the charges such that group2 has a potential DV volts above group1.

QR: fix conq will set the charges such that group2 has total charge QR, group1 has total charge -QR, and energy is minimized. See [5] for more details. fully added in v1.1

Log = Name of log file recording time usage of different parts

The optional keywords and values allowed are as follows:

pppm [no values]

Does what it says on the box!

To use pppm, the pppm/conp KSpace style must be used. This style is interchangeable with the LAMMPS pppm style in every other way but can interface with fix conp to enable PPPM calculations of the electrode-electrolyte interactions in KSpace. (Note that there is a pppm/conp/intel KSpace implementation, which works with package intel and will automatically be used when suffix intel is specified).

Fix conp will crash LAMMPS with an error message if the pppm flag is specified but fix conp cannot find the pppm/conp (or /intel) KSpace style. The eventual design goal is for the pppm flag to be removed and for fix conp to silently interface with pppm/conp when detected.

Note: Weird things happen with PPPM mode (with and without USER-INTEL) in NEMD simulations. Proceed with caution.

etypes [Ntypes] [type1] [type2] ... [typeN]

This tells fix conp that the electrode only contains the specified particle types, and the electrolyte does not contain the specified particle types. For example, "etypes 2 5 3" is a promise to fix conp that the electrode only contains types 3 and 5. This allows fix conp to request specialized neighbor lists from LAMMPS: in the construction of the electrode "A" matrix the neighbor list will contain only electrode-electrode interactions, and in the calculation of the electrolyte "b" vector the neighbor list will contain only electrode-electrolyte interactions. This will speed up your calculation by 10-20% if correctly specified, and will silently return incorrect results if the electrode and electrolyte particle types overlap in any way.

ffield [no values]

This tells fix conp to run in finite-field mode as per Dufils (2019) [1], where (1) slab corrections are disabled and (2) the electrode preset charge vector is calculated using the electrodes' z coordinates. Configurations can be switched seamlessly between slab and finite-field mode, as long as the usual changes to the script are made ("boundary p p p" instead of "boundary p p f" and no "kspace_modify slab").

However, you must add in the electric field separately: if fix conp is run in ffield mode, you must include lines like these in your script:

variable zfield equal -v_v/lz
fix efield all efield 0.0 0.0 v_zfield

where v_v is the potential difference supplied to fix conp. Note that using "v_"-style variables is required for matching up a dynamically-varying potential difference to a dynamically-varying electric field.

Note that fix efield already takes its argument in the correct units for units real (V/angstroms) so no unit conversion should usually be needed. Fix conp in ffield mode will silently return incorrect results without the electric field; upgrading this is an urgent feature addition priority.

*Note: In [1], electrode atoms are mentioned as being "set at 0V", but the effect of this is already automatically done inside the conp ffield code. You do not specify electrode voltages in any different way whatsoever in the input script when using ffield.

new in v1.1:

You can also run fix conq in finite-field mode by coupling a fix efield to its output (which is the potential difference required to achieve the prescribed charge):

fix charges elec1 conq 1 elec2 ...
variable v_zfield equal -f_charges/lz
fix efield all efield 0.0 0.0 v_zfield

noslab [no values]

This tells fix conp to run in no-slab-corrections mode, without further modifications. Run this with zneutr (see below) unless you know what you are doing.

zneutr [no values]

This tells fix conp to enforce an additional electroneutrality constraint: the total sum of electrode charges in the right half of the box (z > 0) will be zero. Thus, noslab zneutr enables fix conp to run a "doubled cell" simulation, in which two cells are positioned back-to-back with reversed polarities to create a zero dipole supercell -- see Raiteri (2020) [2] for a version of this simulation geometry, but with fixed charges.

matout [no values]

Causes fix conp to print out the A-matrix and the inverse A-matrix (if inv is used) to amatrix and inv_a_matrix respectively. The inverse matrix will already be projected into the space of electroneutral charge vectors (see [4], eq (21) for the expression, which they label as "S"). Note that the former conp would print out this matrix by default -- I have decided to make this capability opt-in because the A matrix reading code still has bugs lurking in it and the alternative of just computing the A matrix afresh is now very fast with the latest optimizations in v1.0.

inv [inv_matrix_file]

org [org_matrix_file]

This allows fix conp to read in a pre-existing electrode matrix for its calculations, either the A matrix ("org") or its inverse ("inv"). Option "org" will result in an electroneutral final matrix (since fix conp calculates the electroneutrality projection when inverting the A matrix), while option "inv" has no such guarantee. Use of these options are maintained for compatibility but is discouraged: there are still plenty of possible bugs lurking, and the code here does not use LAMMPS's latest file-reading functions, and optimization (notably calculating only half the A-matrix and then mirroring by symmetry) means that the A-matrix calculation is very short for all but the largest electrode configurations.

Dependencies

This package is only guaranteed to work for the 27May2021 patch of LAMMPS. Although it may work with other versions, they are not officially supported by the USER-CONP2 developers and may require extra work on the part of the user to compile.

The fix requires BLAS and LAPACK compatible linear algebra libraries, although it's not fussy about which ones to use. CMake will automatically attempt to find compatible libraries during the configuration stage and will build its own if it can't find any, although this will be slower than using libraries optimised for the target machine. CMake is usually accurate when finding libraries, but it may be necessary to modify the CMAKE_CXX_FLAGS variable to explicitly specify the desired library location and link flags.

Git is required by the install_cmake.sh installation script.

Installation instructions

Installation is managed via the install_cmake.sh script in the root directory. This script copies the necessary files into a dedicated USER-CONP2 folder in the LAMMPS src directory and integrates with LAMMPS' CMake build process. The installation steps are as follows:

  1. Set the LAMMPS_PREFIX environment variable to the location of the base LAMMPS directory (note: this must be the root directory containing the README file, not the src directory). In bash, run the command export LAMMPS_PREFIX=/path/to/lammps.
  2. In the root directory of this repository, run the install script via bash ./install_cmake.sh
  3. Compile LAMMPS using the usual CMake procedure, setting -D PKG_USER-CONP2=yes. This package can be installed alongside the USER-INTEL accelerator package by also setting -D PKG_USER-INTEL=yes, in which case you should use the Intel C++ compiler and link against Intel MKL for the best performance.
  4. Alternatively, compile LAMMPS using the legacy Make procedure, including make yes-user-conp2 to set up this package for inclusion.

It is also possible to use the legacy make-based build system by copying all relevant .cpp and .h files into the LAMMPS src directory and manually specifying the BLAS/LAPACK compile and link options.

Development: Other features included

There is a compute potential/atom which can be used to compute the electric potential at atoms' positions as a per-atom variable. This is still in development but almost ready for public use.

The dev-historical branch contains versions frozen in various stages of optimization -- including the original conp/v0, with only semantic changes to bring it in line with the latest LAMMPS code -- to prove correctness of optimizations.

Citations

[1] Dufils et al, PRL 123 (19): 195501 (2019) https://doi.org/10.1103/PhysRevLett.123.195501

[2] Raiteri et al, J Chem Phys 153: 164714 (2020) https://doi.org/10.1063/5.0027876

[3] Zhang et al, J Phys Energy 2: 032005 (2020) https://doi.org/10.1088/2515-7655/ab9d8c

[4] Scalfi et al, Phys Chem Chem Phys 22: 10480-10489 (2020) https://doi.org/10.1039/C9CP06285H

[5] Dufils et al, JPC Lett 12 (18): 4357-4361 (2021) https://doi.org/10.1021/acs.jpclett.1c01131

lammps-user-conp2's People

Contributors

emilyviolet avatar srtee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lammps-user-conp2's Issues

error while testing

Hello,

Thanks for implementing this package. I actually linked BLAS/LAPACK and corrected -lmkl_intel_ilp64 to -lmkl_intel_lp64 in intel files and finally compiled lammps (27MAY2021) with "make". However, while testing the existing test sets, I got the same error as below:

LAMMPS (27 May 2021)
ERROR: Invalid Boolean syntax in if command (../variable.cpp:4939)
Last command: <= 1

May I ask the possible reasons for this?

Thanks
marze

Compiling problems

Hi Shern,

Thanks for your reply. So now I open a new issue for my compiling problems.

I am building this code on a cluster based on the linux system, and I use the latest Lammps version (8 Apr 2021).

Some packages are installed:
#########################
(xhyang)[xhyang@mgt02 src]$ make ps | grep "YES"
Installed YES: package CLASS2
Installed YES: package CORESHELL
Installed YES: package KSPACE
Installed YES: package MANYBODY
Installed YES: package MOLECULE
Installed YES: package REPLICA
Installed YES: package RIGID
Installed YES: package USER-INTEL
Installed YES: package USER-MISC
Installed YES: package USER-MOLFILE
Installed YES: package USER-OMP
#########################

and the main part of the make file is:
#########################
CC = mpiicpc -std=c++11
OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits
-qopt-zmm-usage=hig -DBUILD_OMP=noh
CCFLAGS = -qopenmp -qno-offload -ansi-alias -restrict
-DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG $(OPTFLAGS)
-I$(MKLROOT)/include
SHFLAGS = -fPIC
DEPFLAGS = -M

LINK = mpiicpc -std=c++11
LINKFLAGS = -qopenmp $(OPTFLAGS) -L$(MKLROOT)/lib/intel64/
LIB = -ltbbmalloc -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core
SIZE = size

ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared
#########################

As you can see, I use intel compiler and intel mpi. I cannot fix this problem by adding the "-D BUILD_OMP=no" flag, and the only choice is to remove two pppm_conp_intel.* files. However, the program failed when calculating the matrix, then end up with many core.* files.

Could you please give me some suggestions?

Please let me know if you need more details.

Cheers,
Xiaohui

Does ffield is suitable for my system?

Hello dear,

I am using your implemented code for my research. One of my systems is similar to the attached image which has electrolyte in the backside of the electrodes as well. I wanted to use ffiled, but I was wondering whether it would be correct or not, since we impose an efiled in the direction of lets say from -z toward +z (if left electrode is charged negatively), and what would be the direction of electric field in electrolyte solution behind of the electrodes according to the image. I do appreciate your help

Capture

Fix can crash when atom IDs are non-contiguous

This fix can crash during initialization if atom IDs are non-contiguous.

Specifically, suppose a simulation box originally has N particles, with the electrodes listed as the last particles ID-wise (largest IDs). Now suppose a delete_atoms command removes some particles so that the simulation box now only has M (<N) particles, but some electrode particles still have IDs larger than M.

Then, tag2eleall will often be assigned as a list of ints of length M (fix_conp.cpp: 417), but fix_conp will attempt to write past that bound during initialization (fix_conp.cpp: 507, tag2eleall[eleall2tag[i]] = i).

In the interim, scripts can avoid this bug simply by using reset_atom_ids as necessary. In the long run, clearly the "electrode-tag" should be reimplemented as a per-atom array using LAMMPS's atom class callbacks.

LAMMPS_NS::GridComm" has no member "reverse_comm_kspace

I have a error, I want to know,your gcc version 、intel version、and lammps version。
../pppm_conp.cpp(114): error: class "LAMMPS_NS::GridComm" has no member "reverse_comm_kspace"
gc->reverse_comm_kspace(dynamic_cast<KSpace*>(this),1,sizeof(FFT_SCALAR),REVERSE_RHO,
^

../pppm_conp.cpp(122): error: class "LAMMPS_NS::GridComm" has no member "forward_comm_kspace"
gc->forward_comm_kspace(dynamic_cast<KSpace*>(this),1,sizeof(FFT_SCALAR),FORWARD_AD,

Segmentation Error

I'm having segmentation error while running conp simulation for 8M steps. But no error occurs when running for only a few thousand steps. Is this normal? I'm using total 200GB memory and 5GB memory per CPU. The stack trace shows the following -

[a247:1007389:0:1007389] Caught signal 11 (Segmentation fault: address not mapped to object at address 0xd1)
==== backtrace (tid:1007389) ====
 0 0x0000000000012b30 .annobin_sigaction.c()  sigaction.c:0
 1 0x00000000009a8b87 LAMMPS_NS::FixConp::alist_coul_cal()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/USER-CONP2/fix_conp.cpp:1250
 2 0x00000000009a8202 LAMMPS_NS::FixConp::a_cal()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/USER-CONP2/fix_conp.cpp:814
 3 0x00000000009a7a12 LAMMPS_NS::FixConp::linalg_setup()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/USER-CONP2/fix_conp.cpp:440
 4 0x00000000009a7a12 LAMMPS_NS::FixConp::setup_pre_force()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/USER-CONP2/fix_conp.cpp:389
 5 0x00000000004d2aec LAMMPS_NS::Modify::setup_pre_force()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/modify.cpp:369
 6 0x00000000005e98b8 LAMMPS_NS::Verlet::setup()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/verlet.cpp:134
 7 0x0000000000571806 LAMMPS_NS::Run::command()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/run.cpp:175
 8 0x000000000044b050 LAMMPS_NS::Input::execute_command()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/input.cpp:795
 9 0x0000000000448b0c LAMMPS_NS::Input::file()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/input.cpp:273
10 0x000000000041a2dd main()  /anvil/projects/xxx/lammps4/lammps-patch_27May2021/src/main.cpp:93
11 0x00000000000234a3 __libc_start_main()  ???:0
12 0x000000000041a1ae _start()  ???:0
=================================
srun: error: a247: task 24: Segmentation fault (core dumped)
srun: Job step aborted: Waiting up to 32 seconds for job step to finish.
slurmstepd: error: *** STEP 629321.0 ON a247 CANCELLED AT 2022-10-11T02:14:24 ***
slurmstepd: error: *** JOB 629321 ON a247 CANCELLED AT 2022-10-11T02:14:24 ***
=================================
srun: error: a247: task 24: Segmentation fault (core dumped)
srun: Job step aborted: Waiting up to 32 seconds for job step to finish.
slurmstepd: error: *** STEP 629321.0 ON a247 CANCELLED AT 2022-10-11T02:14:24 ***
slurmstepd: error: *** JOB 629321 ON a247 CANCELLED AT 2022-10-11T02:14:24 ***

Compiling error in Cluster

Hi Shern,

I am having compiling error like this.

/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp: In member function 'void LAMMPS_NS::PPPMCONPIntel::elyte_make_rho(LAMMPS_NS::IntelBuffers<flt_t, acc_t>*)':
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:309:18:error: 'nlocal' has not been declared
     shared(nthr, nlocal, global_elyte_density) if(!_use_lrt)
                  ^~~~~~
In file included from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_buffers.h:27:0,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/fix_intel.h:28,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/pppm_intel.h:31,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.h:28,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:19:
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:415:51:error: 'thr' was not declared in this scope
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
                                                   ^
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_preprocess.h:167:23: note: in definition of macro 'IP_PRE_omp_range'
     int idelta = inum/nthreads;                                 \
                       ^~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:415:7: note: in expansion of macro 'IP_PRE_omp_range_id'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
       ^~~~~~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:415:51:note: suggested alternative: 'nthr'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
                                                   ^
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_preprocess.h:167:23: note: in definition of macro 'IP_PRE_omp_range'
     int idelta = inum/nthreads;                                 \
                       ^~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:415:7: note: in expansion of macro 'IP_PRE_omp_range_id'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
       ^~~~~~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp: In member function 'void LAMMPS_NS::PPPMCONPIntel::ele_make_rho(LAMMPS_NS::IntelBuffers<flt_t, acc_t>*)':
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:499:18:error: 'nlocal' has not been declared
     shared(nthr, nlocal, global_ele_density) if(!_use_lrt)
                  ^~~~~~
In file included from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_buffers.h:27:0,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/fix_intel.h:28,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/pppm_intel.h:31,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.h:28,
                 from /global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:19:
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:567:51:error: 'thr' was not declared in this scope
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
                                                   ^
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_preprocess.h:167:23: note: in definition of macro 'IP_PRE_omp_range'
     int idelta = inum/nthreads;                                 \
                       ^~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:567:7: note: in expansion of macro 'IP_PRE_omp_range_id'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
       ^~~~~~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:567:51:note: suggested alternative: 'nthr'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
                                                   ^
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/USER-INTEL/intel_preprocess.h:167:23: note: in definition of macro 'IP_PRE_omp_range'
     int idelta = inum/nthreads;                                 \
                       ^~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:567:7: note: in expansion of macro 'IP_PRE_omp_range_id'
       IP_PRE_omp_range_id(ifrom, ito, tid, ngrid, thr);
       ^~~~~~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp: In member function 'void LAMMPS_NS::PPPMCONPIntel::ele_make_rho(LAMMPS_NS::IntelBuffers<flt_t, acc_t>*) [with flt_t = float; acc_t = double]':
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:524:24:error: 'ele2tag' not specified in enclosing 'parallel'
       int i = atom->map(ele2tag[iele]);
               ~~~~~~~~~^~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:498:11:error: enclosing 'parallel'
   #pragma omp parallel LMP_DEFAULT_NONE \
           ^~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp: In member function 'void LAMMPS_NS::PPPMCONPIntel::ele_make_rho(LAMMPS_NS::IntelBuffers<flt_t, acc_t>*) [with flt_t = double; acc_t = double]':
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:524:24:error: 'ele2tag' not specified in enclosing 'parallel'
       int i = atom->map(ele2tag[iele]);
               ~~~~~~~~~^~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:498:11:error: enclosing 'parallel'
   #pragma omp parallel LMP_DEFAULT_NONE \
           ^~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp: In member function 'void LAMMPS_NS::PPPMCONPIntel::ele_make_rho(LAMMPS_NS::IntelBuffers<flt_t, acc_t>*) [with flt_t = float; acc_t = float]':
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:524:24:error: 'ele2tag' not specified in enclosing 'parallel'
       int i = atom->map(ele2tag[iele]);
               ~~~~~~~~~^~~~~~~~~~~~~~~
/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp:498:11:error: enclosing 'parallel'
   #pragma omp parallel LMP_DEFAULT_NONE \
           ^~~
gmake[2]: *** [CMakeFiles/lammps.dir/build.make:8751: CMakeFiles/lammps.dir/global/project/projectdirs/m1046/Xiaobo/installed_software/lammps/src/pppm_conp_intel.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1003: CMakeFiles/lammps.dir/all] Error 2
gmake: *** [Makefile:130: all] Error 2

Any suggests for this? looks like something error in parallel. (I installed USER_INTEL as you said)

Best,

Xiaobo

BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES

Hi Shern,

I can run the test "dilute" successfully in Linux Cloud with 2 core and 2048 MB RAM. I can also run my system with any compute and fixes such as (compute chunk/atom" and "fix ave/chunk") only if I try to get only at most 1 interested parameter and also only if I use fix ave/time or fix ave/histo with (Nevery=1, Nrepeat=1, and Nfreq=1)

I mean if I try to use multiple of (compute chunk/atom" and "fix ave/chunk") for various atoms or various parameters or if I use fix ave/time or fix ave/histo with for example (Nevery=1, Nrepeat=10, and Nfreq=100), I get the error as below:

*Is it possible to figure out the reason?
*Is this related to the 2048 MB RAM? How many core and RAM is required at least for a system with 15k atoms and multiple interested parameters such as atom density, RDF, ...

I do appreciate your help

Best regards,

============================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 8040 RUNNING AT vm9532652820.bitcommand.com
= EXIT CODE: 139
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES

YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

installing the code

Dear all,

I am compiling the code, but at the end I receive an error and it doesn't make lammps correctly.
The error is
~/conp/lammps-27May2021/src/Obj_mpi/../fix_conq.cpp:63: undefined reference to `ddot_'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:89: ../lmp_mpi] Error 1

Please let me know where I am going wrong.

Thank you in advance!

Best regards,
Hossein

Fix did not correctly charge ghost atoms

Prior to the commits on 14 June 2022, this fix did not correctly charge particles that were multiply-owned on one processor. It only updated the charge on the first owned copy of the particle, whereas it should have updated the charges on all copies.

In LAMMPS, each processor retains information about particles outside its domain -- but within the neighborlist cutoff -- as "ghosts"; if a processor's ghost regions overlap its main region, then it will own both "local" and ghost copies -- possibly more than one "ghost" -- of affected particles. Thus, simulations of small systems on small numbers of processors are most likely to have multiply-owned particles and thus be affected by this bug.

In practice, any simulation where (1) x- and y- dimensions of the system are more than twice the neighborlist cutoff (2) processor partitioning has at least 2 procs each in the x- and y- directions should not have multiply-owned processor atoms. Furthermore, dynamics will only be affected if any electrolyte particle interacts with both an electrode particle and its periodic image -- and since only further-away periodic images will have been incorrectly charged, any effect on dynamics will be minimal. Simulations run with the incorrect code have still produced physically correct results, with the potential profile across the simulation cell correctly corresponding to the imposed potential difference between electrodes.

Nonetheless, anyone who has run simulations using this code prior to the new commits should re-run one or two simulations to confirm that dynamics are not affected. If identical results have been obtained on simulations using different numbers of processors, the results are very unlikely to have errors. Alternatively, one can run the newly-coded nghosts compute to confirm if there are multiply-owned electrode atoms. The nghosts compute outputs a per-atom vector stating how many ghost copies of an atom are owned by its owning processor (0 means a processor only owns a local particle; 1 means the processor which owns that particle owns one ghost copy of it, and so on). A code snippet like

compute nghosts all nghosts
compute ave_ghosts_in_electrode electrode reduce ave c_nghosts

will calculate the average of number of ghost copies of electrode atoms were owned by their owning processors.

Why the electrodes were stretched toward each other?

Hello Dear,

I am applying conp2 for a system as I attached its image to this post, but according to image the electrodes were stretched toward each other after some steps, even though I assigned a zero setforce on them. I used ffield with as below. Could you please let me know whether is this because of my selected options in conp fix ?

variable v equal 1.2
timestep 1

fix fxnve ele nve
fix fxnvt sol nvt temp 295 295 100
fix e eleleft conp 1 eleright 1.979 1.2 iter etypes 2 5 6 pppm ffield
fix efield all efield 0.0 0.0 $(-v_v/lz)

Bests,

Help for new fix command

Dear Dr. Shern,

I noticed that the fix conp has been modified to:

fix [ID] [group1] conp [Nevery] [group2] [η] [DV]
fix [ID] [group1] conq [Nevery] [group2] [η] [QR]

Could you please let me how the newscript would be for:
fix e all conp 1 1.979 ${molleft} ${molright} -0.6 0.6 inv

Also how do we define the total charge QR in conq? for example what is an optimum or lets say typical value for an aqueous electrolyte and electrodes with -0.6V and 0. 6 V?

Can we skip the fix conq and not to set the QR as I don't know what is the typical value for my system?

Bests regards,

How "etypes [Ntypes] [type1] [type2]" Recognize different types of atoms?

I have N-doped graphene electrode and wondering how the charge is updated based on electronegativity and hardness of C and N? OR How can I specify the hardness and electronegativity in LAMMPS input file? The total electronic energy is written in terms of the atomic electronegativities χi and hardnesses Hi as χiqi +1/2Hiq 2 i +Jcoul, where Jcoul is the total electrostatic interaction energy between atoms.

Compiling problems using cmake

Hi Shern,

I am trying to compile the lammps with your added function, but the program produced error like this.

Undefined symbols for architecture x86_64:
  "_ddot_", referenced from:
      LAMMPS_NS::FixConp::get_setq() in liblammps.a(fix_conp.cpp.o)
      LAMMPS_NS::FixConp::update_charge() in liblammps.a(fix_conp.cpp.o)
  "_dgetrf_", referenced from:
      LAMMPS_NS::FixConp::inv() in liblammps.a(fix_conp.cpp.o)
  "_dgetri_", referenced from:
      LAMMPS_NS::FixConp::inv() in liblammps.a(fix_conp.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lmp] Error 1
make[1]: *** [CMakeFiles/lmp.dir/all] Error 2
make: *** [all] Error 2

Any suggestions for solving this problem?

The command line I used is this:

cd lammps
mkdir build
cd build
cmake ../cmake           # configuration reading CMake scripts from ../cmake
cmake --build .          # compilation (or type "make")

New feature: Update the A matrix at some interval/frequency

Hello

If I understand correctly, the A matrix is computed at the start and then not updated afterwards. This means that the electrode particles cannot move during the simulation.
Is it possible to change the code so the A matrix can optionally be updated at some interval/frequency?
This could be interesting to enable simulation of a changing electrode/moveable electrode atoms.

Kind regards,
Øystein Gullbrekken

USER-DRUDE package compatability

Hi thanks for developing this code. I compiled it without the Intel related cpp and h files, and it works fine on some example inputs and a few other lammps calculations I had. However, when using this fix in conjunction with the USER-DRUDE package on lammps it starts to output segmentation faults. (The lammps calculation that throws segmentation faults when fix conp is used runs fine when the fix conp command is not used.) Is the fix conp command currently incompatible with the USER-DRUDE package?

How to solve the potential distribution after updating the movable electrode using the cg method?

Dear Professor,

I used the cg method in the electrode package of lammps-22Dec2022 to simulate the movable electrodes, now I want to ask if I get a Z-directional potential distribution in the case of moving electrodes? I remember you have a command to calculate the single atom potential, I wonder if he can be used for me? Or is there any easier (introductory means) to get the system potential distribution here.

Thanks!
Best regards!

Error in fix conp command while running the test code

Hello,

I have built 27May2021 patch of LAMMPS . While running the input script from dilute (from tests folder), I faced the error:

ERROR: Fix conp group ID does not exist (src/USER-CONP2/fix_conp.cpp:107)
Last command: fix e all conp 1 1.979 ${molleft} ${molright} -0.5 0.5 inv iter etypes 1 3

But the molleft and molright variable is already defined in the input script. I am not understanding where the problem is then. Could anyone please help me about this?

Thank you.

N.B: I have set n value as 1 and processor value as 1 in the input script.

Need help for installing CONP2

Hi Dear Shern,

First of all, I appreciate you for the contribution for conp2. I confront an error when compiling in ubuntu 18 cloud. Since I'm newbie, I couldn't find out the reason. I list briefly my steps. I do appreciate your help and the time you spend for it.

1. Get the last stable release lammps tarball
2. Install LAPACK and BLAS from: "https://github.com/eddelbuettel/mkl4deb/blob/master/script.sh"
3. Link LAPCK and BLAS: "LIB = -lblas -llapack"
4. Copy cpp/h files from conp2 into src
5. In buid directory: "cmake -D PKG_MOLECULE=yes -D PKG_RIGID=yes -D PKG_KSPACE=yes -D PKG_MANYBODY=yes -D INTEL_ARCH=cpu -D INTEL_LRT_MODE=threads -D PKG_USER-OMP=yes ../cmake"
"

Output:

-- Running check for auto-generated files from make-based build system
-- Checking for module 'fftw3'
-- No package 'fftw3' found
-- Generating style headers...
-- Generating package headers...
-- Generating lmpinstalledpkgs.h...
-- The following tools and libraries have been found and configured:

  • Git
  • OpenMP
  • PkgConfig

-- <<< Build configuration >>>
Operating System: Linux
Build type: RelWithDebInfo
Install path: /root/.local
Generator: Unix Makefiles using /usr/bin/make
-- Enabled packages: KSPACE;MANYBODY;MOLECULE;RIGID;USER-OMP
-- <<< Compilers and Flags: >>>
-- C++ Compiler: /usr/bin/c++
Type: GNU
Version: 7.5.0
C++ Flags: -O2 -g -DNDEBUG
Defines: LAMMPS_SMALLBIG;LAMMPS_MEMALIGN=64;LAMMPS_OMP_COMPAT=3;LAMMPS_GZIP;FFT_KISS;LMP_USER_OMP
-- C compiler: /usr/bin/cc
Type: GNU
Version: 7.5.0
C Flags: -O2 -g -DNDEBUG
-- <<< Linker flags: >>>
-- Executable name: lmp
-- Static library flags:
-- <<< FFT settings >>>
-- Primary FFT lib: KISS
-- Using double precision FFTs
-- Using non-threaded FFTs
-- Configuring done
-- Generating done
-- Build files have been written to: /lammps-29Oct20/build

6. Compile: "cmake --build ."

Warnings and Errors:

/lammps-29Oct20/src/fix_conp_dyn.cpp: In member function ‘virtual void LAMMPS_NS::FixConpDyn::post_integrate()’:
/lammps-29Oct20/src/fix_conp_dyn.cpp:116:117: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
if (me == 0) fprintf(outf,"At step %d, couldn't increase or decrease check interval\n",update->ntimestep);
~~~~~~~~~~~~~~~~~^
/lammps-29Oct20/src/fix_conp_dyn.cpp:120:138: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
if (me == 0) fprintf(outf,"At step %d, increasing explicit check interval to every %d steps\n",update->ntimestep,dyn_interval);
~~~~~~~~~~~~~~~~~ ^
/lammps-29Oct20/src/fix_conp_dyn.cpp:124:138: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
if (me == 0) fprintf(outf,"At step %d, decreasing explicit check interval to every %d steps\n",update->ntimestep,dyn_interval);
~~~~~~~~~~~~~~~~~ ^
/lammps-29Oct20/src/fix_conp_dyn.cpp:127:121: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
if (me == 0) fprintf(outf,"At step %d, initializing dynamic update, stage %d\n",update->ntimestep,dyn_status);
~~~~~~~~~~~~~~~~~ ^
[ 25%] Building CXX object CMakeFiles/lammps.dir/lammps-29Oct20/src/fix_conp_dyn2.cpp.o
/lammps-29Oct20/src/fix_conp_dyn2.cpp: In member function ‘virtual void LAMMPS_NS::FixConpDyn2::b_cal()’:
/lammps-29Oct20/src/fix_conp_dyn2.cpp:137:113: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
fprintf(outf,"%d\tbk\t%d\t%d\t%g\t%g\n",update->ntimestep,bk_interval,bk_interval_new,bk_err,bk_runerr);
~~~~~~~~~~~~~~~~~ ^
/lammps-29Oct20/src/fix_conp_dyn2.cpp:179:113: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘LAMMPS_NS::bigint {aka long int}’ [-Wformat=]
fprintf(outf,"%d\tbp\t%d\t%d\t%g\t%g\n",update->ntimestep,bp_interval,bp_interval_new,bp_err,bp_runerr);

....

[ 6%] Built target compute.h
Consolidate compiler generated dependencies of target lammps
[ 6%] Building CXX object CMakeFiles/lammps.dir/lammps-29Oct20/src/force.cpp.o
In file included from /lammps-29Oct20/build/styles/style_kspace.h:15:0,
from /lammps-29Oct20/src/force.cpp:19:
/lammps-29Oct20/src/pppm_conp_intel.h:28:10: fatal error: pppm_intel.h: No such file or directory
#include "pppm_intel.h"
^~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/lammps.dir/build.make:2861: recipe for target 'CMakeFiles/lammps.dir/lammps-29Oct20/src/force.cpp.o' failed
make[2]: *** [CMakeFiles/lammps.dir/lammps-29Oct20/src/force.cpp.o] Error 1
CMakeFiles/Makefile2:681: recipe for target 'CMakeFiles/lammps.dir/all' failed
make[1]: *** [CMakeFiles/lammps.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

Using CPM in EMD or NEMD

Dear Professor,

I noticed that there may be a problem with this cpm method for NEMD? Does this problem require whether the electrodes are fixed or not?
Is there also a problem with using it for EMD?
Or could I use this cpm code without fixed the electrodes?

I want to use this code for heat-related simulations and I sincerely ask for your help!

Thanks a lot!

Script for reverse potential of electrodes

Hi Shern

I want to reverse the electrodes' potentials. If left electrode has -2 V and right electrode 2 V according to script below, what would be if I want to reverse it as left electrode to be 2 V and right electrode to be -2 V,

variable v equal 4.0
fix e eleleft conp 1 eleright 1.979 4 iter etypes 1 5 pppm ffield
fix efiled sol efield 0 0 $(-v_v/lz)

Also, since in ffiled we use p p p boundary, how much gap distance is required to put in the end of simulation box in z direction, right behind the electrodes, in order to halt the interactions of ions and electrodes with image atoms from the z direction in the next periodic simulation box?

Bests,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.