1 #ifndef CUDAGLOBALMASTERCLIENT_H 2 #define CUDAGLOBALMASTERCLIENT_H 22 :
public std::enable_shared_from_this<CudaGlobalMasterClient> {
23 #if defined(NAMD_CUDA) && defined(NODEGROUP_FORCE_REGISTER) 40 virtual void initialize(
41 const std::vector<std::string>& arguments,
42 int deviceID, cudaStream_t stream);
47 virtual void setStep(int64_t step) { m_step = step; }
52 void setMaster(std::shared_ptr<CudaGlobalMasterServer> master) {
59 void subscribe(std::shared_ptr<CudaGlobalMasterServer> master);
67 std::string name() {
return m_name; }
71 virtual void calculate() {}
78 virtual bool requestedAtomsChanged() = 0;
85 virtual bool requestedTotalForcesAtomsChanged() = 0;
92 virtual bool requestedForcedAtomsChanged() = 0;
100 virtual bool requestUpdateAtomPositions() = 0;
108 virtual bool requestUpdateAtomTotalForces() = 0;
116 virtual bool requestUpdateForcedAtoms() = 0;
125 virtual bool requestUpdateMasses() = 0;
135 virtual bool requestUpdateCharges() = 0;
140 virtual bool requestUpdateLattice() = 0;
150 virtual bool requestUpdateTransforms() {
return false; }
159 virtual bool requestUpdateVelocities() {
return false; }
175 virtual double *getAppliedForces()
const = 0;
191 virtual double *getPositions() = 0;
207 virtual float *getMasses() = 0;
223 virtual float *getCharges() = 0;
239 virtual double *getTotalForces() = 0;
254 virtual double *getLattice() = 0;
272 virtual char *getTransforms() {
return nullptr; }
288 virtual double *getVelocities() {
return nullptr; }
294 virtual std::string updateFromTCLCommand(
const std::vector<std::string>& arguments);
306 void finishReductions(
bool doEnergy,
bool doVirial,
NodeReduction *reduction);
311 virtual const std::vector<AtomID> &getRequestedAtoms()
const = 0;
315 virtual const std::vector<AtomID> &getRequestedTotalForcesAtoms()
const = 0;
320 virtual const std::vector<AtomID> &getRequestedForcedAtoms()
const = 0;
326 virtual cudaStream_t getStream() = 0;
330 virtual bool hasEnergy()
const {
return true; }
335 virtual double getEnergy()
const {
return 0; }
339 virtual bool hasVirial()
const {
return false; }
352 virtual bool hasExtForce()
const {
return false; }
357 virtual Vector getExtForce()
const {
return Vector{0}; };
363 virtual bool useDefaultExtForceAndVirial()
const {
return true; };
378 bool replica_enabled()
const;
379 int replica_index()
const;
380 int num_replicas()
const;
381 void replica_comm_barrier();
382 int replica_comm_recv(
char* msg_data,
int buf_len,
int src_rep);
383 int replica_comm_send(
char* msg_data,
int msg_len,
int dest_rep);
386 std::weak_ptr<CudaGlobalMasterServer> m_master;
395 #endif // defined(NAMD_CUDA) && defined(NODEGROUP_FORCE_REGISTER) 398 #endif // CUDAGLOBALMASTERCLIENT_H
A class for performing calculations on specific atoms selected by atom serial numbers.
Molecule stores the structural information for the system.
CudaGlobalMasterClient(std::string name, int deviceID)
A class for copying atom information from SequencerCUDA to CudaGlobalMasterClient.