Skip to content

Commit 5b5b06a

Browse files
committed
feat!: mark the total forces invalid for startup steps
1 parent f363f25 commit 5b5b06a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.C

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,13 @@ void colvarproxy_impl::calculate() {
765765
cudaCheck(cudaSetDevice(m_device_id));
766766
// The following memcpy operations are supposed to be overlapped with the NB kernel
767767
if (numAtoms > 0) {
768+
if (mClient->requestUpdateAtomTotalForces()) {
769+
if (mClient->isStartupStep()) {
770+
set_total_forces_invalid();
771+
} else {
772+
set_total_forces_valid();
773+
}
774+
}
768775
if (!has_gpu_support()) {
769776
// Transform the arrays for Colvars
770777
auto &colvars_pos = *(modify_atom_positions());
@@ -1078,8 +1085,8 @@ bool CudaGlobalMasterColvars::requestUpdateCharges() {
10781085
return mImpl->atomsChanged();
10791086
}
10801087

1081-
void CudaGlobalMasterColvars::setStep(int64_t step) {
1082-
CudaGlobalMasterClient::setStep(step);
1088+
void CudaGlobalMasterColvars::setStep(int64_t step, int startup, int doMigration) {
1089+
CudaGlobalMasterClient::setStep(step, startup, doMigration);
10831090
if (mImpl->atomsChanged()) {
10841091
mImpl->reallocate();
10851092
}

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CudaGlobalMasterColvars: public CudaGlobalMasterClient {
3434
int updateFromTCLCommand(const std::vector<std::string>& arguments) override;
3535
void onBuffersUpdated() override;
3636
void calculate() override;
37-
void setStep(int64_t step) override;
37+
void setStep(int64_t step, int startup, int doMigration) override;
3838
cudaStream_t getStream() override;
3939
bool requestedAtomsChanged() override;
4040
bool requestedForcedAtomsChanged() override { return requestedAtomsChanged(); }
@@ -76,6 +76,7 @@ class CudaGlobalMasterColvars: public CudaGlobalMasterClient {
7676
return CudaGlobalMasterClient::replica_comm_send(msg_data, msg_len, dest_rep);
7777
}
7878
int64_t getStep() const {return m_step;}
79+
int isStartupStep() const {return m_is_startup_step;}
7980
std::string getTCLUpdateResult() override {return mTCLResult;}
8081
private:
8182
std::unique_ptr<colvarproxy_impl> mImpl;

0 commit comments

Comments
 (0)