3535#include "stream.h"
3636#include "util.h"
3737
38+ static void
39+ add_screen2_params (struct frag * frag ) {
40+ double * scr ;
41+ scr = (double * )malloc (frag -> n_multipole_pts * sizeof (double ));
42+ // if (scr == NULL)
43+ // return EFP_RESULT_NO_MEMORY;
44+ for (int i = 0 ; i < frag -> n_multipole_pts ; i ++ ){
45+ scr [i ] = 10.0 ; // assign large value - no effective screening
46+ }
47+
48+ if (frag -> screen_params )
49+ free (frag -> screen_params );
50+ frag -> screen_params = scr ;
51+ }
52+
3853static void
3954update_fragment (struct frag * frag )
4055{
@@ -310,7 +325,7 @@ check_opts(const struct efp_opts *opts)
310325}
311326
312327static enum efp_result
313- check_frag_params (const struct efp_opts * opts , const struct frag * frag )
328+ check_frag_params (const struct efp_opts * opts , struct frag * frag )
314329{
315330 if ((opts -> terms & EFP_TERM_ELEC ) || (opts -> terms & EFP_TERM_AI_ELEC )) {
316331 if (!frag -> multipole_pts ) {
@@ -319,8 +334,9 @@ check_frag_params(const struct efp_opts *opts, const struct frag *frag)
319334 }
320335 if (opts -> elec_damp == EFP_ELEC_DAMP_SCREEN &&
321336 frag -> screen_params == NULL ) {
322- efp_log ("screening parameters are missing" );
323- return EFP_RESULT_FATAL ;
337+ efp_log ("electrostatic screening parameters are missing; continue" );
338+ add_screen2_params (frag );
339+ //return EFP_RESULT_FATAL;
324340 }
325341 }
326342 if ((opts -> terms & EFP_TERM_POL ) || (opts -> terms & EFP_TERM_AI_POL )) {
@@ -359,8 +375,10 @@ check_params(struct efp *efp)
359375 enum efp_result res ;
360376
361377 for (size_t i = 0 ; i < efp -> n_frag ; i ++ )
362- if ((res = check_frag_params (& efp -> opts , efp -> frags + i )))
363- return res ;
378+ if ((res = check_frag_params (& efp -> opts , efp -> frags + i ))) {
379+ efp_log ("check_params() failure" );
380+ return res ;
381+ }
364382
365383 return EFP_RESULT_SUCCESS ;
366384}
@@ -870,8 +888,10 @@ efp_set_coordinates(struct efp *efp, enum efp_coord_type coord_type,
870888 }
871889
872890 for (size_t i = 0 ; i < efp -> n_frag ; i ++ , coord += stride )
873- if ((res = efp_set_frag_coordinates (efp , i , coord_type , coord )))
874- return res ;
891+ if ((res = efp_set_frag_coordinates (efp , i , coord_type , coord ))) {
892+ efp_log ("efp_set_coordinates() failure" );
893+ return res ;
894+ }
875895
876896 return EFP_RESULT_SUCCESS ;
877897}
@@ -896,6 +916,7 @@ efp_set_frag_coordinates(struct efp *efp, size_t frag_idx,
896916 case EFP_COORD_TYPE_ROTMAT :
897917 return set_coord_rotmat (frag , coord );
898918 }
919+ efp_log ("efp_set_frag_coordinates() failure" );
899920 assert (0 );
900921}
901922
@@ -1134,8 +1155,10 @@ efp_compute(struct efp *efp, int do_gradient)
11341155
11351156 efp -> do_gradient = do_gradient ;
11361157
1137- if ((res = check_params (efp )))
1138- return res ;
1158+ if ((res = check_params (efp ))) {
1159+ efp_log ("check_params() failure" );
1160+ return res ;
1161+ }
11391162
11401163 memset (& efp -> energy , 0 , sizeof (efp -> energy ));
11411164 memset (& efp -> stress , 0 , sizeof (efp -> stress ));
@@ -1147,16 +1170,24 @@ efp_compute(struct efp *efp, int do_gradient)
11471170 efp_balance_work (efp , compute_two_body_range , NULL );
11481171 }
11491172 else { // high-symmetry crystals
1150- if (res = compute_two_body_crystal (efp ))
1151- return res ;
1173+ if (res = compute_two_body_crystal (efp )){
1174+ efp_log ("compute_two_body_crystal() failure" );
1175+ return res ;
1176+ }
11521177 }
11531178
1154- if (res = efp_compute_pol (efp ))
1155- return res ;
1156- if (res = efp_compute_ai_elec (efp ))
1157- return res ;
1158- if (res = efp_compute_ai_disp (efp ))
1159- return res ;
1179+ if (res = efp_compute_pol (efp )) {
1180+ efp_log ("efp_compute_pol() failure" );
1181+ return res ;
1182+ }
1183+ if (res = efp_compute_ai_elec (efp )){
1184+ efp_log ("efp_compute_ai_elec() failure" );
1185+ return res ;
1186+ }
1187+ if (res = efp_compute_ai_disp (efp )){
1188+ efp_log ("efp_compute_ai_disp() failure" );
1189+ return res ;
1190+ }
11601191
11611192#ifdef EFP_USE_MPI
11621193 efp_allreduce (& efp -> energy .electrostatic , 1 );
@@ -1475,8 +1506,10 @@ efp_set_opts(struct efp *efp, const struct efp_opts *opts)
14751506 assert (efp );
14761507 assert (opts );
14771508
1478- if ((res = check_opts (opts )))
1479- return res ;
1509+ if ((res = check_opts (opts ))) {
1510+ efp_log ("check_opts() failure" );
1511+ return res ;
1512+ }
14801513
14811514 efp -> opts = * opts ;
14821515 return EFP_RESULT_SUCCESS ;
@@ -1534,8 +1567,10 @@ efp_add_fragment(struct efp *efp, const char *name)
15341567 enum efp_result res ;
15351568 struct frag * frag = efp -> frags + efp -> n_frag - 1 ;
15361569
1537- if ((res = copy_frag (frag , lib )))
1538- return res ;
1570+ if ((res = copy_frag (frag , lib ))) {
1571+ efp_log ("copy_frag() failure" );
1572+ return res ;
1573+ }
15391574
15401575 for (size_t a = 0 ; a < 3 ; a ++ ) {
15411576 size_t size = frag -> xr_wf_size * frag -> n_lmo ;
@@ -1909,3 +1944,4 @@ n_symm_frag(struct efp *efp, size_t *symm_frag) {
19091944 // printf("\n symm_frag %d = %d", i, symm_frag[i]);
19101945 }
19111946}
1947+
0 commit comments