Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adding Ewald+SPME longrange force solvers #24

Draft
wants to merge 181 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
5edffaf
very preliminary setup of ewald force framework
sfogerty Nov 26, 2019
b4c7d3b
progress on ewald force calcs
sfogerty Nov 26, 2019
51f7f7f
separate folder for longrange_force_types
sfogerty Dec 4, 2019
8810854
remove ExaMiniMD licence from added files
sfogerty Dec 4, 2019
f3493a3
progress and notes on ewald implementation
sfogerty Dec 4, 2019
73ade1b
cleaned up kspace computation and removed reduction
sfogerty Dec 5, 2019
8b3a8d7
fix build for longrange force header
sfogerty Dec 5, 2019
fa82e96
fixing build issues
sfogerty Dec 5, 2019
5da91bf
fix build issues
sfogerty Dec 5, 2019
52d04fd
Make longrange optional with CMake flag
streeve Dec 5, 2019
7c7d9b1
add real-space calcs to ewald solve
sfogerty Dec 9, 2019
e996a68
fix compile errors
sfogerty Dec 9, 2019
55fc62d
add function names to par_for loops
sfogerty Dec 11, 2019
e127707
throw error for not half_neigh
sfogerty Dec 11, 2019
a0b7b47
Add optional Cajita dependency
streeve Dec 12, 2019
bde1c69
Add optional FFTW dependency / cuFFT usage for longrange
streeve Dec 12, 2019
3446356
removing comm from force calcs
sfogerty Dec 12, 2019
6a78fb3
add comm to Ewald force
sfogerty Dec 12, 2019
e4cf912
Merge branch 'longrange' of https://github.com/sfogerty/CabanaMD into…
streeve Dec 12, 2019
cd5f2a7
start of adding SPME
sfogerty Dec 12, 2019
8f1ec63
Add input parsing for longrange and charges, make charge (q) useable
streeve Dec 12, 2019
50dcece
Merge branch 'longrange' of https://github.com/sfogerty/CabanaMD into…
streeve Dec 12, 2019
7f48242
added FindFFTW3
sfogerty Dec 12, 2019
06110c1
start of ading Cajita mesh
sfogerty Dec 13, 2019
c9fc026
add SPME c file and clean up functions
sfogerty Dec 13, 2019
245a9d6
more cleanup SPME
sfogerty Dec 13, 2019
7a60b32
cleanup and ready to add Cajita meshes
sfogerty Dec 13, 2019
1d497a8
fix GlobalMesh type
sfogerty Dec 13, 2019
cd1d2a7
merge master with new travis file
sfogerty Dec 13, 2019
c947c97
add Cajita pointSet
sfogerty Dec 17, 2019
ef5d583
Merge branch 'master' into longrange
streeve Dec 17, 2019
b679979
Add longrange to travis
streeve Dec 17, 2019
2765e89
Add canary build; fix travis
streeve Dec 17, 2019
64a7b28
Fix file list
streeve Dec 17, 2019
a5bf8cb
Move constants
streeve Dec 17, 2019
3c43694
Adding Cajita mesh to SPME
sfogerty Dec 17, 2019
61d8cca
Consistent initialization for longrange; always tune for now
streeve Dec 17, 2019
0f47ebf
Cleanup Ewald, split force and energy calc
streeve Dec 17, 2019
5477708
Fix travis
streeve Dec 17, 2019
36d97be
Merge branch 'longrange' of https://github.com/sfogerty/CabanaMD into…
streeve Dec 17, 2019
de24316
Add HEFFTE dependency in place of FFTW/cuFFT
streeve Dec 18, 2019
0ccaab9
Clean up initialization
streeve Dec 19, 2019
9a3a5d4
Add full module names
streeve Dec 19, 2019
73ac40d
Fix inputs; define actual NaCl settings
streeve Dec 19, 2019
9f28fc1
moved BC array to init
sfogerty Dec 19, 2019
17514f9
moved meshq and q_halo to create_mesh
sfogerty Dec 19, 2019
bf34fc0
Fixing Ewald inputs and init
streeve Dec 20, 2019
b666f7d
adding Cajita FFTs
sfogerty Dec 20, 2019
abacb42
Fix longrange/charge inputs for GPU
streeve Jan 4, 2020
255bdfe
Only print nnp info on one MPI rank
streeve Jan 4, 2020
4c87155
Use N_local, not N_global
streeve Jan 4, 2020
7909aea
One init function
streeve Jan 6, 2020
a9e9374
Create neighbors and zero energy for longrange
streeve Jan 6, 2020
53fd2a5
Enable multiple lattices (e.g. B1 for NaCl)
streeve Jan 9, 2020
64a7ede
Remove repeated code (moved to PE)
streeve Jan 9, 2020
d22b1d7
fixes for charge spreading/gathering using Cajita
sfogerty Jan 10, 2020
96d6f00
Merge branch 'longrange' of https://github.com/sfogerty/CabanaMD into…
streeve Jan 11, 2020
2ea387b
Report total PE
streeve Jan 11, 2020
539ed96
fix travis for HEFFTE build
streeve Jan 11, 2020
eaa2dcc
Run make format
streeve Jan 14, 2020
ef7861c
Merge branch 'master' into longrange
streeve Jan 14, 2020
691324d
fix travis for longrange
streeve Jan 14, 2020
da59871
Don't reset per-type arrays (in case of multiple lattices)
streeve Jan 15, 2020
b2ed613
Only add longrange PE if using longrange
streeve Jan 16, 2020
fd2569d
Remove longrange bool and use LRforce_type
streeve Jan 16, 2020
6650853
Merge branch 'master' into longrange
streeve Jan 17, 2020
7aa83ef
Optional longrange exit
streeve Jan 17, 2020
bf0affe
link heffte lib
sfogerty Jan 27, 2020
24c3b07
add compute_energy and create_neigh_list
sfogerty Jan 27, 2020
3af30c3
cmake: find and link FFTW for longrange
sfogerty Jan 27, 2020
d9ecb8e
clang format
sfogerty Jan 28, 2020
aa4baa6
Fix Ewald->SPME mistakes
streeve Jan 29, 2020
d68aa90
Clean up SPME; split force and energy
streeve Feb 10, 2020
55f2b2f
fixing energy units in Ewald
sfogerty Feb 19, 2020
a48118d
fixed units of Ewald energies
sfogerty Feb 19, 2020
41d3222
Energy units updated for SPME
sfogerty Feb 20, 2020
0ca8ab1
cleanup formatting typo
sfogerty Feb 20, 2020
873ba97
tweak tuning for Ewald
sfogerty Feb 26, 2020
eec5a53
merge small changes
sfogerty Feb 26, 2020
5e5893d
force unit conversion
sfogerty Feb 27, 2020
fb44c46
Merge branch 'master' into longrange
streeve Feb 28, 2020
44b227a
Merge branch 'master' into longrange
streeve Apr 24, 2020
d660a2a
Clean warnings
streeve Apr 24, 2020
25478ca
Run make format
streeve Apr 24, 2020
230a53f
Fix build
streeve Apr 24, 2020
eee8533
Fix merge issues
streeve Apr 24, 2020
4c5367b
Remove per-atom loop where it seems unnecessary
streeve Apr 24, 2020
9f3fa55
Fix more merge issues
streeve Apr 25, 2020
801a89a
Add longrange to printing
streeve Apr 25, 2020
0eea718
cmake: remove extra find_package
sfogerty May 4, 2020
3f6c551
Remove cmake findFFTW
streeve May 4, 2020
c488611
Separate init and init_longrange; simplify cutoff calculation
streeve May 4, 2020
6009212
Clean up smpe
streeve Jun 2, 2020
a1d9521
Merge branch 'master' into longrange and update LR for multiple devices
streeve Jun 5, 2020
a68caac
make format
streeve Jun 5, 2020
32fc3a0
remove Cajita from Travis
sfogerty Jun 11, 2020
a7eeb0c
remove Cajita from CMakeLists
sfogerty Jun 11, 2020
925cbe2
remove Cajita and heffte from src/CMakeLists
sfogerty Jun 11, 2020
1912e49
fix typos
sfogerty Jun 11, 2020
11973ae
fix travis logic
sfogerty Jun 11, 2020
4b03d47
logic test
sfogerty Jun 11, 2020
addb740
fix possible parse issue travis
sfogerty Jun 11, 2020
3fdbb53
parsing fix again
sfogerty Jun 11, 2020
8eb4733
try different travis logic
sfogerty Jun 11, 2020
132cf2b
Use CABANA_OPTS to get longrange flags
sfogerty Jun 11, 2020
45639b0
typo
sfogerty Jun 11, 2020
7033206
fix syntax travis
sfogerty Jun 11, 2020
fa328ae
try again
sfogerty Jun 11, 2020
6b3682a
finalize
sfogerty Jun 11, 2020
b4bdfd2
switch to get my test Cabana
sfogerty Jun 11, 2020
6e4d190
switch to my fixed tree of Cabana
sfogerty Jun 11, 2020
83fec3e
fix git branch getting
sfogerty Jun 11, 2020
1568b7e
fix git checkout
sfogerty Jun 11, 2020
937a602
branch fix
sfogerty Jun 11, 2020
e59e6cb
test remove cajita include
sfogerty Jun 11, 2020
dc214ca
remove cajita include
sfogerty Jun 11, 2020
0f18a75
restore including Cajita
sfogerty Jun 11, 2020
5856413
wrong file to include Cajita...
sfogerty Jun 11, 2020
199fe6b
include Cajita in correct file
sfogerty Jun 11, 2020
ff6c50e
format
sfogerty Jun 11, 2020
1b89c89
link Cajita
sfogerty Jun 12, 2020
70e6d46
link Cabana::Cajita
sfogerty Jun 12, 2020
c5e4810
include Cajita
sfogerty Jun 12, 2020
590482f
dont need kokkos in CMAKE_PREFIX_PATH for CabanaMD
sfogerty Jun 12, 2020
3c3b874
try REQUIRE_CAJITA
sfogerty Jun 12, 2020
2890f78
Update .travis.yml
sfogerty Jun 12, 2020
f76a6c4
switch REQUIRE and ENABLE
sfogerty Jun 12, 2020
3fbcfef
remove REQUIRE_CAJITA
sfogerty Jun 12, 2020
447ad48
pull ECP-copa Cabana after recent fix
sfogerty Jun 15, 2020
5da700f
clone Cabana master branch
sfogerty Jun 15, 2020
7962017
Merge pull request #1 from sfogerty/longrange_testing
sfogerty Jun 15, 2020
957ecd9
Use Cabana heffte flag
streeve Jun 15, 2020
dc5a6f6
remove travis testing of old branch
sfogerty Jun 15, 2020
51b01dc
add travis testing of longrange branch (for now)
sfogerty Jun 15, 2020
4b1d45a
Merge branch 'master' into longrange
streeve Jun 15, 2020
d4a41f5
Merge branch 'longrange' of https://github.com/sfogerty/CabanaMD into…
streeve Jun 15, 2020
9c3260c
Remove space changes
streeve Jun 15, 2020
ac045ae
Remove space changes
streeve Jun 15, 2020
ea6499b
test travis
sfogerty Jul 16, 2020
1bcb0c7
build heffte tagged v1.0-rc1
sfogerty Jul 16, 2020
a42a215
Merge branch 'master' into longrange
streeve Jul 23, 2020
a9b13f8
make format
streeve Jul 23, 2020
a95213a
Fix new coeff parsing
streeve Aug 12, 2020
a289037
Merge branch 'master' into sfogerty-longrange
streeve Aug 14, 2020
2515ac2
Include Cajita for heffte enable var
streeve Aug 14, 2020
af45596
link Cajita for longrange
sfogerty Aug 18, 2020
8824652
Include Cajita for heffte enable var
streeve Aug 19, 2020
f0d6f3f
Fix longrange input error
streeve Aug 19, 2020
c6b71af
Use new Halo interface
streeve Aug 19, 2020
1f81222
Merge branch 'master' of https://github.com/ECP-copa/CabanaMD
sfogerty Oct 29, 2020
5d12043
merge in recent changes from master
sfogerty Nov 3, 2020
af6535a
update FFT to use new Cabana-heFFTe API
sfogerty Nov 3, 2020
66a2628
Merge branch 'master' of https://github.com/ECP-copa/CabanaMD
sfogerty Nov 3, 2020
0091e74
Merge branch 'master' into longrange
sfogerty Nov 3, 2020
86f549a
lr forces using new system domain vars
sfogerty Nov 3, 2020
4d9c12e
Fix merge error
streeve Nov 23, 2020
7a9378b
Fix multiple lattice creation
streeve Nov 23, 2020
da26571
Simplify long range mesh
streeve Nov 23, 2020
af75b38
Use input file naming convention
streeve Nov 23, 2020
03a130c
make format
streeve Nov 23, 2020
d0d2e21
Read input once; create multiple lattices; create velocities once
streeve Dec 4, 2020
77a4cf5
Merge branch 'master' into longrange
streeve Dec 4, 2020
9856ffa
Fix merge mistake
streeve Dec 4, 2020
05ed494
Cajita required
streeve Dec 4, 2020
4aea783
Resize before velocities
streeve Dec 9, 2020
e7b2f64
Merge branch 'master' into longrange
streeve Dec 10, 2020
0c7a51b
Fix format
streeve Dec 10, 2020
933f4cd
Enable variable vector length per aosoa; only compile one layout
streeve Nov 11, 2020
010d060
Enable variable vector length per NNP aosoa
streeve Jan 7, 2021
7f9e717
Test different layouts
streeve Jan 12, 2021
2967192
Merge branch 'master' into longrange
sfogerty Feb 3, 2021
391fd35
update layout type in create_velocities
sfogerty Feb 3, 2021
66a784c
update to new Cabana-heFFTe interface
sfogerty Feb 3, 2021
42b2f3c
use heFFTe 2.0
sfogerty Feb 3, 2021
76b6c05
update travis with REQUIRES for Cabana
sfogerty Feb 3, 2021
299bf73
change spme input to spme
sfogerty Mar 30, 2021
3ec936a
remove setting host charges to zero
sfogerty Mar 30, 2021
b08a0ce
shift BC indices to avoid ghost cells
sfogerty Mar 30, 2021
0d94ebd
fix typo in setting complex charge view
sfogerty Mar 30, 2021
59a1545
Merge branch 'master' into longrange
streeve Jun 14, 2021
a6b5e7c
initialize charge if not in input file
streeve Jun 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions input/in.spme
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 3d NaCl melt

units metal
atom_style charge

newton off
lattice fcc 5.64
region box block 0 10 0 10 0 10
create_box 2 box
create_atoms 1 box

lattice fcc 5.64 origin 0.5 0.0 0.0
region box block 0 10 0 10 0 10
create_atoms 2 box

mass 1 22.990
mass 2 35.453
set type 1 charge 1
set type 2 charge -1

velocity all create 300 87287 loop geom

kspace_style spme 1.0e-6
pair_style lj/cut/coul/long 8.0
pair_coeff 1 1 0.00150286 2.52 8.0
pair_coeff 2 2 0.01658406 3.85 8.0
pair_coeff 1 2 0.00499235 3.185 8.0

neighbor 0.3 bin
neigh_modify every 20
fix 1 all nve
thermo 10

run 100
12 changes: 11 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ configure_file(CabanaMD_config.hpp.cmakein CabanaMD_config.hpp @ONLY)
#------------------------------------------------------------

file(GLOB HEADERS_PUBLIC
GLOB *.h force_types/*.h neighbor_types/*.h system_types/*.h
GLOB *.h force_types/*.h longrange_force_types/*.h neighbor_types/*.h system_types/*.h
)

file(GLOB SOURCES
Expand All @@ -75,6 +75,11 @@ endif()

list(APPEND SOURCES ${FORCE_TYPES} ${SYSTEM_TYPES} ${SYSNNP_TYPES})

if( Cabana_ENABLE_HEFFTE )
file(GLOB LR_FORCE_TYPES longrange_force_types/*.cpp)
list(APPEND SOURCES ${LR_FORCE_TYPES})
endif()

install(FILES ${HEADERS_PUBLIC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CabanaMD_config.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

Expand All @@ -85,6 +90,7 @@ add_library(CabanaMD ${SOURCES})
# Sources linking against CabanaMD will implicitly include these directories:
target_include_directories(CabanaMD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/force_types
${CMAKE_CURRENT_SOURCE_DIR}/longrange_force_types
${CMAKE_CURRENT_SOURCE_DIR}/neighbor_types
${CMAKE_CURRENT_SOURCE_DIR}/system_types
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
Expand All @@ -100,4 +106,8 @@ if(CabanaMD_ENABLE_NNP AND N2P2_DIR)
target_link_libraries(CabanaMD ${N2P2_LIB})
endif()

if(Cabana_ENABLE_HEFFTE)
target_link_libraries(CabanaMD Cabana::Cajita)
endif()

install(TARGETS CabanaMD DESTINATION lib)
1 change: 1 addition & 0 deletions src/cabanamd.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class CbnMD : public CabanaMD
t_System *system;
t_Neighbor *neighbor;
Force<t_System, t_Neighbor> *force;
Force<t_System, t_Neighbor> *lrforce;
Integrator<t_System> *integrator;
Comm<t_System> *comm;
Binning<t_System> *binning;
Expand Down
150 changes: 112 additions & 38 deletions src/cabanamd_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <CabanaMD_config.hpp>

#include <Cabana_Core.hpp>
#include <Cajita.hpp>
#include <Kokkos_Core.hpp>

#include <output.h>
Expand All @@ -72,23 +73,35 @@ void CbnMD<t_System, t_Neighbor>::init( InputCL commandline )

// Create the Input class: Command line and LAMMPS input file
input = new InputFile<t_System>( commandline, system );

// Create output/error streams and overwrite previous runs
std::ofstream out( input->output_file, std::ofstream::out );
std::ofstream err( input->error_file, std::ofstream::out );

// Read input file
input->read_file();
input->read_file( out, err );
nsteps = input->nsteps;
std::ofstream out( input->output_file, std::ofstream::app );
std::ofstream err( input->error_file, std::ofstream::app );
log( out, "Read input file." );

using exe_space = typename t_System::execution_space;
if ( print_rank() )
{
exe_space::print_configuration( out );
}

// Check that the requested pair_style/kspace_style was compiled
#ifndef CabanaMD_ENABLE_NNP
// Check that the requested pair_style was compiled
if ( input->force_type == FORCE_NNP )
{
log_err( err, "NNP requested, but not compiled!" );
}
#endif
#ifndef Cabana_ENABLE_HEFFTE
if ( input->lrforce_type != FORCE_NONE )
{
log_err( err, "LongRange requested, but heFFTe and/or Cajita was not "
"compiled with Cabana!" );
}
#endif
auto neigh_cutoff = input->force_cutoff + input->neighbor_skin;
bool half_neigh = input->force_iteration_type == FORCE_ITER_NEIGH_HALF;
Expand Down Expand Up @@ -174,27 +187,60 @@ void CbnMD<t_System, t_Neighbor>::init( InputCL commandline )
}
force->init_coeff( input->force_coeff_lines );

log( out, "Using: SystemVectorLength: ", CabanaMD_VECTORLENGTH, " ",
system->name() );
#ifdef CabanaMD_ENABLE_NNP
if ( input->force_type == FORCE_NNP )
log( out, "Using: SystemNNPVectorLength: ", CabanaMD_VECTORLENGTH_NNP,
" ", force->system_name() );
#endif
log( out, "Using: ", force->name(), " ", neighbor->name(), " ",
comm->name(), " ", binning->name(), " ", integrator->name() );

// Create atoms - from LAMMPS data file or create FCC/SC lattice
if ( system->N == 0 && input->read_data_flag == true )
{
read_lammps_data_file<t_System>( input, system, comm );
read_lammps_data_file<t_System>( input, system, comm, out, err );
}
else if ( system->N == 0 )
{
input->create_lattice( comm );
input->create_lattices( comm, out );
}
log( out, "Created atoms." );
if ( input->create_velocity_flag )
{
input->create_velocities( comm, out );
}

// Create long range Force class: options in longrangeforce_types/ folder
// Delay because tuning (within init) uses atom count, domain size
#ifdef Cabana_ENABLE_HEFFTE
if ( input->lrforce_type != FORCE_NONE )
{
bool half_neigh =
input->lrforce_iteration_type == FORCE_ITER_NEIGH_HALF;
if ( !half_neigh )
log( err, "Full neighbor list not implemented "
"for the SPME longrange solver." );

if ( input->lrforce_type == FORCE_EWALD )
lrforce = new ForceEwald<t_System, t_Neighbor>( system );
else if ( input->lrforce_type == FORCE_SPME )
lrforce = new ForceSPME<t_System, t_Neighbor>( system );
else
log( err, "Invalid LongRangeForceType" );

lrforce->init_coeff( input->lrforce_coeff_lines );
lrforce->init_longrange( system, neigh_cutoff );
}
#endif

log( out, "Using: SystemVectorLength: ", CabanaMD_VECTORLENGTH, " ",
system->name() );
#ifdef CabanaMD_ENABLE_NNP
if ( input->force_type == FORCE_NNP )
log( out, "Using: SystemNNPVectorLength: ", CabanaMD_VECTORLENGTH_NNP,
" ", force->system_name() );
#endif
if ( input->lrforce_type != FORCE_NONE )
log( out, "Using: ", force->name(), " ", lrforce->name(), " ",
neighbor->name(), " ", comm->name(), " ", binning->name(), " ",
integrator->name() );
else
log( out, "Using: ", force->name(), " ", neighbor->name(), " ",
comm->name(), " ", binning->name(), " ", integrator->name() );

// Run step 0
// Set MPI rank neighbors
comm->create_domain_decomposition();

Expand All @@ -210,12 +256,15 @@ void CbnMD<t_System, t_Neighbor>::init( InputCL commandline )

// Compute atom neighbors
neighbor->create( system );
// TODO: option for separate long range neighbors

// Compute initial forces
system->slice_f();
auto f = system->f;
Cabana::deep_copy( f, 0.0 );
force->compute( system, neighbor );
if ( input->lrforce_type != FORCE_NONE )
lrforce->compute( system, neighbor );

// Scatter ghost atom forces back to original MPI rank
// (update force for pair_style nnp even if full neighbor list)
Expand All @@ -233,6 +282,8 @@ void CbnMD<t_System, t_Neighbor>::init( InputCL commandline )
KinE<t_System> kine( comm );
auto T = temp.compute( system );
auto PE = pote.compute( system, force, neighbor ) / system->N;
if ( input->lrforce_type != FORCE_NONE )
PE += pote.compute( system, lrforce, neighbor ) / system->N;
auto KE = kine.compute( system ) / system->N;
if ( !_print_lammps )
{
Expand Down Expand Up @@ -273,16 +324,17 @@ void CbnMD<t_System, t_Neighbor>::run()
KinE<t_System> kine( comm );

double force_time = 0;
double lrforce_time = 0;
double comm_time = 0;
double neigh_time = 0;
double integrate_time = 0;
double other_time = 0;

double last_time = 0;
Kokkos::Timer timer, force_timer, comm_timer, neigh_timer, integrate_timer,
other_timer;
Kokkos::Timer timer, force_timer, lrforce_timer, comm_timer, neigh_timer,
integrate_timer, other_timer;

// Main timestep loop
// Timestep Loop
for ( int step = 1; step <= nsteps; step++ )
{
// Integrate atom positions - velocity Verlet first half
Expand Down Expand Up @@ -331,7 +383,15 @@ void CbnMD<t_System, t_Neighbor>::run()
force->compute( system, neighbor );
force_time += force_timer.seconds();

// This is where Bonds, Angles, and KSpace should go eventually
// Compute long range force
if ( input->lrforce_type != FORCE_NONE )
{
lrforce_timer.reset();
lrforce->compute( system, neighbor );
lrforce_time += lrforce_timer.seconds();
}

// This is where Bonds, Angles, etc. should go eventually

// Scatter ghost atom forces back to original MPI rank
// (update force for pair_style nnp even if full neighbor list)
Expand All @@ -348,12 +408,13 @@ void CbnMD<t_System, t_Neighbor>::run()
integrate_time += integrate_timer.seconds();

other_timer.reset();

// Print output
if ( step % input->thermo_rate == 0 )
{
auto T = temp.compute( system );
auto PE = pote.compute( system, force, neighbor ) / system->N;
if ( input->lrforce_type != FORCE_NONE )
PE += pote.compute( system, lrforce, neighbor ) / system->N;
auto KE = kine.compute( system ) / system->N;

if ( !_print_lammps )
Expand Down Expand Up @@ -391,16 +452,36 @@ void CbnMD<t_System, t_Neighbor>::run()
{
double steps_per_sec = 1.0 * nsteps / time;
double atom_steps_per_sec = system->N * steps_per_sec;
log( out, std::fixed, std::setprecision( 2 ),
"\n#Procs Atoms | Time T_Force T_Neigh T_Comm T_Int ",
"T_Other |\n", comm->num_processes(), " ", system->N, " | ", time,
" ", force_time, " ", neigh_time, " ", comm_time, " ",
integrate_time, " ", other_time, " | PERFORMANCE\n", std::fixed,
comm->num_processes(), " ", system->N, " | ", 1.0, " ",
force_time / time, " ", neigh_time / time, " ", comm_time / time,
" ", integrate_time / time, " ", other_time / time,
" | FRACTION\n\n", "#Steps/s Atomsteps/s Atomsteps/(proc*s)\n",
std::scientific, steps_per_sec, " ", atom_steps_per_sec, " ",

if ( input->lrforce_type == FORCE_NONE )
{
log( out, std::fixed, std::setprecision( 2 ),
"\n#Procs Atoms | Time T_Force T_Neigh T_Comm T_Int ",
"T_Other |" );
log( out, comm->num_processes(), " ", system->N, " | ", time, " ",
force_time, " ", neigh_time, " ", comm_time, " ",
integrate_time, " ", other_time, " | PERFORMANCE" );
log( out, std::fixed, comm->num_processes(), " ", system->N, " | ",
1.0, " ", force_time / time, " ", neigh_time / time, " ",
comm_time / time, " ", integrate_time / time, " ",
other_time / time, " | FRACTION\n" );
}
else
{
log( out, std::fixed, std::setprecision( 2 ),
"\n#Procs Atoms | Time T_Force T_ForceLong T_Neigh T_Comm "
"T_Int T_Other |" );
log( out, comm->num_processes(), " ", system->N, " | ", time, " ",
force_time, " ", lrforce_time, " ", neigh_time, " ", comm_time,
" ", integrate_time, " ", other_time, " | PERFORMANCE" );
log( out, std::fixed, comm->num_processes(), " ", system->N, " | ",
1.0, " ", force_time / time, " ", lrforce_time / time, " ",
neigh_time / time, " ", comm_time / time, " ",
integrate_time / time, " ", other_time / time,
" | FRACTION\n" );
}
log( out, "#Steps/s Atomsteps/s Atomsteps/(proc*s)\n", std::scientific,
steps_per_sec, " ", atom_steps_per_sec, " ",
atom_steps_per_sec / comm->num_processes() );
}
else
Expand Down Expand Up @@ -457,13 +538,6 @@ void CbnMD<t_System, t_Neighbor>::dump_binary( int step )
err.close();
}

// TODO: 1. Add path to Reference [DONE]
// 2. Add MPI Rank file ids in Reference [DONE]
// 3. Move to separate class
// 4. Add pressure to thermo output
// 5. basis_offset [DONE]
// 6. correctness output to file [DONE]

template <class t_System, class t_Neighbor>
void CbnMD<t_System, t_Neighbor>::check_correctness( int step )
{
Expand Down
1 change: 1 addition & 0 deletions src/force.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Force
virtual ~Force() {}

virtual void init_coeff( std::vector<std::vector<std::string>> args ) = 0;
virtual void init_longrange( t_System *, T_X_FLOAT ){};

virtual void compute( t_System *system, t_Neighbor *neighbor ) = 0;
virtual T_F_FLOAT compute_energy( t_System *, t_Neighbor * )
Expand Down
Loading