Newer
Older
Kurt A. O'Hearn
committed
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
* vel_y: y-coordinate of atom velocities, in Angstroms / ps (allocated by caller)
* vel_z: z-coordinate of atom velocities, in Angstroms / ps (allocated by caller)
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
*/
int get_atom_velocities( const void * const handle, double * const vel_x,
double * const vel_y, double * const vel_z )
{
int i, ret;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
for ( i = 0; i < spmd_handle->system->N; ++i )
{
vel_x[i] = spmd_handle->system->atoms[i].v[0];
vel_y[i] = spmd_handle->system->atoms[i].v[1];
vel_z[i] = spmd_handle->system->atoms[i].v[2];
}
ret = SPUREMD_SUCCESS;
}
return ret;
}
/* Getter for atom forces
*
* handle: pointer to wrapper struct with top-level data structures
* f_x: x-coordinate of atom forces, in Angstroms * Daltons / ps^2 (allocated by caller)
* f_y: y-coordinate of atom forces, in Angstroms * Daltons / ps^2 (allocated by caller)
* f_z: z-coordinate of atom forces, in Angstroms * Daltons / ps^2 (allocated by caller)
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
*/
int get_atom_forces( const void * const handle, double * const f_x,
double * const f_y, double * const f_z )
{
int i, ret;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
for ( i = 0; i < spmd_handle->system->N; ++i )
{
f_x[i] = spmd_handle->system->atoms[i].f[0];
f_y[i] = spmd_handle->system->atoms[i].f[1];
f_z[i] = spmd_handle->system->atoms[i].f[2];
}
ret = SPUREMD_SUCCESS;
}
return ret;
}
/* Getter for atom charges
*
* handle: pointer to wrapper struct with top-level data structures
Kurt A. O'Hearn
committed
* q: atom charges, in Coulombs (allocated by caller)
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
*/
int get_atom_charges( const void * const handle, double * const q )
{
int i, ret;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
for ( i = 0; i < spmd_handle->system->N; ++i )
{
q[i] = spmd_handle->system->atoms[i].q;
}
ret = SPUREMD_SUCCESS;
}
return ret;
Kurt A. O'Hearn
committed
}
Kurt A. O'Hearn
committed
Kurt A. O'Hearn
committed
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
/* Getter for system energies
*
* handle: pointer to wrapper struct with top-level data structures
* e_pot: system potential energy, in kcal / mol (reference from caller)
* e_kin: system kinetic energy, in kcal / mol (reference from caller)
* e_tot: system total energy, in kcal / mol (reference from caller)
* t_scalar: temperature scalar, in K (reference from caller)
* vol: volume of the simulation box, in Angstroms^3 (reference from caller)
* pres: average pressure, in K (reference from caller)
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
*/
int get_system_info( const void * const handle, double * const e_pot,
double * const e_kin, double * const e_tot, double * const temp,
double * const vol, double * const pres )
{
int ret;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
*e_pot = spmd_handle->data->E_Pot;
*e_kin = spmd_handle->data->E_Kin;
*e_tot = spmd_handle->data->E_Tot;
*temp = spmd_handle->data->therm.T;
*vol = spmd_handle->system->box.volume;
*pres = (spmd_handle->control->P[0] + spmd_handle->control->P[1]
+ spmd_handle->control->P[2]) / 3.0;
ret = SPUREMD_SUCCESS;
}
return ret;
}
Kurt A. O'Hearn
committed
/* Setter for writing output to files
*
* handle: pointer to wrapper struct with top-level data structures
* enabled: TRUE enables writing output to files, FALSE otherwise
Kurt A. O'Hearn
committed
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
Kurt A. O'Hearn
committed
*/
Kurt A. O'Hearn
committed
int set_output_enabled( const void * const handle, const int enabled )
{
int ret;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
spmd_handle->output_enabled = enabled;
ret = SPUREMD_SUCCESS;
}
return ret;
}
Kurt A. O'Hearn
committed
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
/* Setter for simulation parameter values as defined in the input control file
*
* handle: pointer to wrapper struct with top-level data structures
* control_keyword: keyword from the control file to set the value for
* control_value: value to set
*
* returns: SPUREMD_SUCCESS upon success, SPUREMD_FAILURE otherwise
*/
int set_control_parameter( const void * const handle, const char * const keyword,
const char ** const values )
{
int ret, ret_;
spuremd_handle *spmd_handle;
ret = SPUREMD_FAILURE;
if ( handle != NULL )
{
spmd_handle = (spuremd_handle*) handle;
ret_ = Set_Control_Parameter( keyword, values, spmd_handle->control,
spmd_handle->out_control );
if ( ret_ == SUCCESS )
{
ret = SPUREMD_SUCCESS;
}
}
return ret;
}