Multiple sources with mcxlabcl

52 views
Skip to first unread message

Naim Slim

unread,
Feb 26, 2025, 10:17:16 AM2/26/25
to mcx-users
Dear Dr. Fang,

Hi, I'm Naim.  First and foremost, thank you for this incredible work which has proven to be very useful for the work I've been doing.

I wanted to ask a question about multiple sources in mcxlabcl.  I can see that cfg.srcpos can accomodate multiple sources by means of a multi-row array in mcxlab, but this does not appear to be the case for mcxlabcl? 

The reason for this question is that I use MATLAB on my no-GPU Macbook Pro M3 Max (which funnily enough I thought would be powerful enough when I bought it!) to write, test and debug my code, before deploying it on a high performance computing cluster with GPUs.  I have a six 'disk' light source configuration as follows:

% Source positions in circular configuration at z=100 plane
cfg.srcpos = [
60, 50, 100;
10*cos(pi()/3)+50, 10*sin(pi()/3)+50, 100;
-10*cos(pi()/3)+50, 10*sin(pi()/3)+50, 100;
40, 50, 100;
-10*cos(pi()/3)+50, -10*sin(pi()/3)+50, 100;
10*cos(pi()/3)+50, -10*sin(pi()/3)+50, 100];
% Unit vectors for downward (i.e. top down) trajectory from sources
cfg.srcdir = [
0 0 -1;
0 0 -1;
0 0 -1;
0 0 -1;
0 0 -1;
0 0 -1;
];
% Each source has a 5*60um radius
cfg.srcparam1 = [
5 0 0 0;
5 0 0 0;
5 0 0 0;
5 0 0 0;
5 0 0 0;
5 0 0 0;
];

MCXLAB with a GPU recognises six light sources and runs the simulation correctly, but MCXLABCL recognises only one light source and produces an error regarding cfg.srcdir in that it can only be a single row array (i.e. [0, 0, -1]).

The "workaround" for the MCXLABCL version is that I would iteratively run six instances of MCXLABCL in a for loop, each with the corresponding row of cfg.srcpos, and then average out flux.data for the entire volume.  Inefficient code on an inefficient machine!

I was just wondering if this is a bug on my end or if this is a feature difference between mcxlab and mcxlabcl?

Thanks in advance!
Best wishes,
Naim

Qianqian Fang

unread,
Feb 26, 2025, 10:26:50 AM2/26/25
to mcx-...@googlegroups.com, Naim Slim

hi Naim,

unfortunately multi-src support is only available in mcxlab at this moment, and has not been ported to mcxlabcl. The loop approach should still work with a small overhead.

Qianqian

On 2/26/25 05:23, Naim Slim wrote:

You don't often get email from naim...@gmail.com. Learn why this is important

--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/dcd9bc07-19c7-425c-82fa-b15ddb0a7300n%40googlegroups.com.

Naim Slim

unread,
Feb 27, 2025, 6:46:49 AM2/27/25
to mcx-users
Thanks for the prompt response!
BW
Naim
Reply all
Reply to author
Forward
0 new messages