Skip to content

Fix copying of TMolecule - #1292

Merged
thfroitzheim merged 5 commits into
grimme-lab:mainfrom
foxtran:fix/copy
Sep 11, 2026
Merged

thfroitzheim merged 5 commits into
grimme-lab:mainfrom
foxtran:fix/copy

Conversation

@foxtran

@foxtran foxtran commented May 21, 2025

Copy link
Copy Markdown
Contributor

By some reason, GCC 12.2 does not copy some data between TMolecule objects and, therefore, there is some trash in output like (it is xtbopt.xyz):
image

This patch fixes it. Not sure that I found all places, but at least GFN2 geometry optimizations work well.

Comment thread src/type/molecule.f90
Call init(self, mol0%at, mol0%sym, mol0%xyz, mol0%chrg, mol0%uhf, &
& mol0%lattice, mol0%pbc)
self%ftype = mol0%ftype
end subroutine copyMolecule

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should merge the TMolecule copy part here with the = assignment and add a deep copy of everything. Then one could still just use the assignment with =

Signed-off-by: Igor S. Gerasimov <foxtranigor@gmail.com>
Signed-off-by: Igor S. Gerasimov <foxtranigor@gmail.com>
Signed-off-by: Igor S. Gerasimov <foxtranigor@gmail.com>
@thfroitzheim

Copy link
Copy Markdown
Member

@foxtran does this still fix a problem? If yes, I would merge it

@foxtran

foxtran commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

I would prefer to implement check in LLVM flang firstly to find all problematic places.

@lmseidler

lmseidler commented Feb 18, 2026

Copy link
Copy Markdown
Member

#1380 is not fixed by this although it seems related

edit: def related to gnu-12, gnu-15 works fine

Comment thread src/optimizer.f90 Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this one also needs to be updated to call mol%copy(molopt) or else the gfortran issues persist, as reported in #1391 and #1380

Comment thread src/optimizer.f90 Outdated

@thfroitzheim thfroitzheim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use this fix even before merging everything the = assignment

@thfroitzheim
thfroitzheim merged commit 45680bc into grimme-lab:main Sep 11, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants